]>
Commit | Line | Data |
---|---|---|
e628c711 | 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 | /* $Id$ */ | |
17 | ||
18 | ||
19 | ////////////////////////////////////////////////////////////////////// | |
20 | // | |
21 | // ITS SPD Trigger Detector Class | |
22 | // | |
23 | // Several Fast-OR Algoritm are implemented | |
24 | // | |
25 | // Ref: ALICE-INT-2005-025 | |
26 | // (J. Conrad, J. G. Contreras and C. E. Jorgensen) | |
27 | // | |
28 | ////////////////////////////////////////////////////////////////////// | |
29 | ||
30 | ||
31 | #include "AliLog.h" | |
32 | #include "AliRun.h" | |
33 | #include "AliRunLoader.h" | |
e628c711 | 34 | |
e628c711 | 35 | #include "AliITSTrigger.h" |
36 | ||
37 | //______________________________________________________________________ | |
38 | ClassImp(AliITSTrigger) | |
39 | ||
40 | //______________________________________________________________________ | |
41 | AliITSTrigger::AliITSTrigger() | |
42 | : AliTriggerDetector() | |
43 | { | |
44 | SetName("ITS"); | |
45 | CreateInputs(); | |
8e50d897 | 46 | |
47 | // FIX: should this be hardcoded? | |
48 | fFODigistThreshold = 1; | |
49 | fHighMultFODigistThreshold = 100; | |
e628c711 | 50 | } |
51 | ||
52 | //______________________________________________________________________ | |
53 | void AliITSTrigger::CreateInputs() | |
54 | { | |
55 | // inputs | |
56 | ||
57 | // Do not create inputs again!! | |
58 | if( fInputs.GetEntriesFast() > 0 ) return; | |
59 | ||
60 | fInputs.AddLast( new AliTriggerInput( "ITS_SPD_GFO_L0", "Global, Fast OR all detectors", 0x01 ) ); | |
8e50d897 | 61 | fInputs.AddLast( new AliTriggerInput( "ITS_SPD_HMULT_L0", "High Multiplicity", 0x600 ) ); |
e628c711 | 62 | |
63 | } | |
64 | ||
65 | //______________________________________________________________________ | |
66 | void AliITSTrigger::Trigger() | |
67 | { | |
68 | ||
8e50d897 | 69 | // ********** Get run loader for the current event ********** |
70 | AliRunLoader* runLoader = gAlice->GetRunLoader(); | |
71 | ||
72 | AliITSLoader* loader = (AliITSLoader* )runLoader->GetLoader( "ITSLoader" ); | |
73 | AliITSgeom* geom = loader->GetITSgeom(); | |
74 | loader->LoadDigits("READ"); | |
75 | TTree *treeD = loader->TreeD(); | |
76 | ||
77 | TObjArray *digDet = 0; | |
78 | digDet = new TObjArray(3); | |
79 | ||
80 | ||
81 | // Cut on Signal In the Pixel Detector | |
82 | TBranch* br = treeD->GetBranch( "ITSDigitsSPD" ); | |
83 | br->SetAddress( &((*digDet)[0]) ); | |
84 | ((TClonesArray*)(digDet->At(0)))->Clear(); | |
85 | ||
86 | MultiplicityTriggers(digDet, treeD, geom); | |
87 | // GeometryTriggers(digDet, treeD, geom); | |
88 | ||
89 | // Debug : FIX change to AliLog | |
90 | cout << "=================================================" << endl; | |
91 | cout << " Pixel Trigger Mask ( " << hex << "0x" << GetMask() << " )" << endl << endl; | |
92 | cout << " Global Fast OR " << "0x" << GetInput( "ITS_SPD_GFO_L0" )->GetValue() << endl; | |
93 | cout << "=================================================" << endl << endl; | |
e628c711 | 94 | |
95 | } | |
96 | ||
8e50d897 | 97 | //______________________________________________________________________ |
98 | void AliITSTrigger::MultiplicityTriggers(TObjArray* digDet, TTree* treeD, AliITSgeom* geom) | |
99 | { | |
100 | // simple FO triggers that only cares about the multiplicity | |
101 | ||
102 | // first and last module? | |
103 | Int_t startSPD = geom->GetStartSPD(); | |
104 | Int_t lastSPD = geom->GetLastSPD(); | |
105 | ||
106 | Int_t totalNumberOfDigits = 0; | |
e628c711 | 107 | |
8e50d897 | 108 | // loop over modules |
109 | for (Int_t moduleIndex=startSPD; moduleIndex<lastSPD; moduleIndex++) { | |
110 | treeD->GetEvent(moduleIndex); | |
111 | TClonesArray* digits = (TClonesArray*) (digDet->At(0)); // SPD only. | |
112 | ||
113 | // get number of digits in this module | |
114 | Int_t numberOfDigitsInModule = digits->GetEntriesFast(); | |
115 | ||
116 | // sum of digits in all modules | |
117 | totalNumberOfDigits = totalNumberOfDigits + numberOfDigitsInModule; | |
118 | ||
119 | } | |
120 | ||
121 | if (totalNumberOfDigits>=fFODigistThreshold) | |
122 | SetInput( "ITS_SPD_GFO_L0" ); | |
123 | ||
124 | if (totalNumberOfDigits>=fHighMultFODigistThreshold) | |
125 | SetInput( "ITS_SPD_HMULT_L0" ); | |
126 | ||
127 | return; | |
128 | ||
129 | } | |
e628c711 | 130 | |
131 | //______________________________________________________________________ | |
8e50d897 | 132 | void AliITSTrigger::GeometryTriggers(TObjArray* digDet, TTree* treeD, AliITSgeom* geom) |
e628c711 | 133 | { |
8e50d897 | 134 | |
135 | ||
136 | ||
137 | // // const Int_t nlay = 2; // not used | |
138 | // // const Int_t nlad = 240; // not used | |
139 | // // const Int_t nstave = 40; // not used | |
140 | // // const Int_t ndet = 4; // not used | |
141 | // // const Int_t nchip = 5; // not used | |
142 | // // const Int_t ntotal = 1200; | |
143 | ||
144 | // Int_t ndigA[5]; | |
145 | // Int_t iFOperlayer[2]; | |
146 | // Int_t iFOperladder[240]; | |
147 | // Int_t iFOperstave[40][2]; | |
148 | // // Int_t iFOperchip[ntotal]; // not used | |
149 | // Int_t iFOperChipinStave[20][40][2]; | |
150 | ||
151 | // for (Int_t m=startSPD;m<lastSPD;m++) { | |
152 | // iFOperladder[m] = 0; | |
153 | // } | |
154 | ||
155 | // for (Int_t k = 0;k<2;k++){ | |
156 | // iFOperlayer[k] = 0; | |
157 | // for (Int_t o=0; o<40; o++) { | |
158 | // iFOperstave[o][k] = 0; | |
159 | // for (Int_t ich=0; ich<20; ich++) { | |
160 | // iFOperChipinStave[ich][o][k] = 0; | |
161 | // } | |
162 | // } | |
163 | // } | |
164 | ||
165 | // // nFO = 0.0; | |
166 | // Int_t mInStaveCounter = 0; | |
167 | // Int_t checkStave = 0; | |
168 | ||
169 | // // loop over modules | |
170 | // for (Int_t moduleIndex=startSPD; moduleIndex<lastSPD; moduleIndex++) { | |
171 | // treeD->GetEvent(moduleIndex); | |
172 | // TClonesArray* digits = (TClonesArray*) (digDet->At(0)); // SPD only. | |
173 | ||
174 | // Int_t lay, stav, det; | |
175 | // geom->GetModuleId(moduleIndex,lay,stav,det); | |
176 | ||
177 | // ndig = digits->GetEntriesFast(); | |
178 | ||
179 | // for( Int_t l=0; l<5; l++ ) { | |
180 | // ndigA[l] = 0 ; | |
181 | // } | |
182 | // for( Int_t dig=0; dig<ndig; dig++) { | |
183 | // AliITSdigitSPD* dp = (AliITSdigitSPD*) digits->At(dig); | |
184 | // Int_t column = dp->GetCoord1(); | |
185 | // // Int_t row = dp->GetCoord2(); | |
186 | // Int_t chip = Int_t(column/32.); | |
187 | // ndigA[chip]++; | |
188 | // } | |
189 | ||
190 | // if (checkStave != stav) { | |
191 | // mInStaveCounter = 0; | |
192 | // } else { | |
193 | // mInStaveCounter += 1; | |
194 | // } | |
195 | ||
196 | // // m 0,.., 239 | |
197 | // // stav 1,..,40 | |
198 | // // mInStave 0,..,3 | |
199 | // // chipInStave 0,..,19 | |
200 | ||
201 | // //cout << "m " << m << " stav " << stav << " mInStave " << mInStaveCounter << " " <<lay << endl; | |
202 | ||
203 | // for (Int_t ichip=0; ichip<5; ichip++) { | |
204 | // //Int_t seq = (m*5+ichip); | |
205 | // Int_t chipInStave = (mInStaveCounter *5) + ichip; | |
206 | ||
207 | // if (ndigA[ichip] >= 1) { | |
208 | // iFOperladder[moduleIndex]++; | |
209 | // iFOperlayer[lay-1]++; | |
210 | // iFOperstave[stav-1][lay-1]++; | |
211 | // //iFOperHstave[hstav-1][lay-1]++; | |
212 | // iFOperChipinStave[chipInStave][stav-1][lay-1]++; | |
213 | // // nFO++; | |
214 | // } | |
215 | // } | |
216 | // // SIMPLE FO ---> ANY HIT TRIGGERS | |
217 | // ndigfo += ndig; | |
218 | // checkStave = stav; | |
219 | // } // endl loop over SPD's | |
220 | ||
221 | ||
222 | ||
223 | // if ( ndigfo >= singhitthreshold ) { | |
224 | // // Set input GLOBAL FO | |
225 | // SetInput( "ITS_SPD_GFO_L0" ); | |
226 | // // or SetInput( "0x01" ); | |
227 | // // or ((AliTriggerInput*)fInputs.At(0))->Set(); | |
228 | // // bit1 |= (1 << 1); | |
229 | // } | |
230 | ||
231 | // return bit1; | |
e628c711 | 232 | } |
233 | ||
234 | ||
8e50d897 | 235 | |
236 |