]>
Commit | Line | Data |
---|---|---|
1 | /************************************************************************** | |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | ||
17 | /* $Id$ */ | |
18 | ||
19 | //////////////////////////////////////////////////////////////////////// | |
20 | // // | |
21 | // Simulates generation of Fast-OR signals from SPD (if needed). // | |
22 | // Processes the Fast-OR signals generated in AliITSsimulationSPD. // | |
23 | // Provides inputs for AliCentralTrigger. // | |
24 | // // | |
25 | // Version 2, Henrik Tydesjo, Feb 2009 // | |
26 | // Version 1, D. Elia, C. Jorgensen, Mar 2006 // | |
27 | // Version 0, J. Conrad, E. Lopez Torres, Oct 2005 // | |
28 | // // | |
29 | //////////////////////////////////////////////////////////////////////// | |
30 | ||
31 | #include <TTree.h> | |
32 | #include "AliITSTrigger.h" | |
33 | #include "AliLog.h" | |
34 | #include "AliRun.h" | |
35 | #include "AliRunLoader.h" | |
36 | #include "AliITSLoader.h" | |
37 | #include "AliTriggerInput.h" | |
38 | ||
39 | ClassImp(AliITSTrigger) | |
40 | ||
41 | //______________________________________________________________________ | |
42 | AliITSTrigger::AliITSTrigger() : | |
43 | AliTriggerDetector(), | |
44 | fPITprocessor() | |
45 | { | |
46 | //standard constructor | |
47 | SetName("ITS"); | |
48 | } | |
49 | //______________________________________________________________________ | |
50 | AliITSTrigger::AliITSTrigger(AliITSTriggerConditions* cond) : | |
51 | AliTriggerDetector(), | |
52 | fPITprocessor(cond) | |
53 | { | |
54 | // optional constructor | |
55 | SetName("ITS"); | |
56 | } | |
57 | //______________________________________________________________________ | |
58 | void AliITSTrigger::SetTriggerConditions(AliITSTriggerConditions* cond) { | |
59 | // Sets the trigger conditions, normally coming from OCDB | |
60 | fPITprocessor.SetTriggerConditions(cond); | |
61 | } | |
62 | //______________________________________________________________________ | |
63 | void AliITSTrigger::CreateInputs() { | |
64 | // Create inputs, based on OCDB Pixel Trigger Conditions | |
65 | if( fInputs.GetEntriesFast() > 0 ) return; // Inputs already created, no need to proceed | |
66 | ||
67 | // Load trigger conditions from OCDB if needed | |
68 | if (! fPITprocessor.TriggerConditionsSet() ) { | |
69 | AliError("Trigger conditions not set. No inputs created."); | |
70 | return; | |
71 | } | |
72 | ||
73 | UInt_t numInputs = fPITprocessor.GetNumOutputs(); | |
74 | AliInfo(Form("Number of trigger inputs: %d",numInputs)); | |
75 | for (UInt_t inp=0; inp<numInputs; inp++) { | |
76 | fInputs.AddLast( new AliTriggerInput(fPITprocessor.GetOutputLabel(inp), "SPD", 0) ); | |
77 | } | |
78 | } | |
79 | //______________________________________________________________________ | |
80 | void AliITSTrigger::Trigger() { | |
81 | // Performs Pixel Trigger processing of the simulated fast-or signals | |
82 | ||
83 | // Get the FO signals for this event | |
84 | AliITSFOSignalsSPD* foSignals = NULL; | |
85 | AliRunLoader* runLoader = AliRunLoader::Instance(); | |
86 | AliITSLoader* itsLoader = (AliITSLoader*) runLoader->GetLoader("ITSLoader"); | |
87 | if (!itsLoader) { | |
88 | AliError("ITS loader is NULL."); | |
89 | } | |
90 | ||
91 | else { | |
92 | itsLoader->LoadDigits(); | |
93 | TTree *tree = itsLoader->TreeD(); | |
94 | if(!tree) { | |
95 | AliError("TreeD not available"); | |
96 | itsLoader->UnloadDigits(); | |
97 | return; | |
98 | } | |
99 | foSignals = (AliITSFOSignalsSPD*)tree->GetUserInfo()->FindObject("AliITSFOSignalsSPD"); | |
100 | if(!foSignals) AliError("FO signals not retrieved"); | |
101 | } | |
102 | ||
103 | // Process the FO signals | |
104 | if (foSignals) { | |
105 | fPITprocessor.PreprocessFOSignals(foSignals); | |
106 | UInt_t numInputs = fPITprocessor.GetNumOutputs(); | |
107 | for (UInt_t inp=0; inp<numInputs; inp++) { | |
108 | if (fPITprocessor.ProcessFOSignalsIndex(inp, foSignals)) { | |
109 | SetInput(fPITprocessor.GetOutputLabel(inp)); | |
110 | } | |
111 | } | |
112 | } | |
113 | else { | |
114 | AliError("Fast-OR signals not available. No trigger processing done."); | |
115 | } | |
116 | if (itsLoader) itsLoader->UnloadDigits(); | |
117 | } |