]>
Commit | Line | Data |
---|---|---|
cd82ed2f | 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 | ///////////////////////////////////////////////////////////////////// | |
ee51d470 | 19 | // |
cd82ed2f | 20 | // Class performing TOF Trigger |
21 | // Cosmic_Multi_muon: Cosmic Multi-Muonic Event Trigger (L0) | |
22 | // ppMB: p-p Minimum Bias Event Trigger (L0) | |
23 | // UltraPer_Coll: Ultra-Peripheral Collision Event Trigger (L0) | |
24 | // High_Mult: High Multiplicity Event Trigger (L0) | |
25 | // Jet: Events with Jet Topology Trigger (L1) | |
26 | // | |
ee51d470 | 27 | // A.Silenzi: added CTTM map, |
28 | // method to fill LTM matrix from raw data, | |
29 | // method to retrieve the TOF pre-trigger for TRD detector | |
30 | // | |
31 | // | |
cd82ed2f | 32 | ///////////////////////////////////////////////////////////////////// |
33 | ||
7ca4655f | 34 | #include <TClonesArray.h> |
35 | ||
cd82ed2f | 36 | #include "AliLoader.h" |
0e46b9ae | 37 | #include "AliLog.h" |
cd82ed2f | 38 | #include "AliRunLoader.h" |
0e46b9ae | 39 | #include "AliRun.h" |
cd82ed2f | 40 | #include "AliTriggerInput.h" |
ee51d470 | 41 | #include "AliRawReader.h" |
0e46b9ae | 42 | |
ee51d470 | 43 | #include "AliTOFRawStream.h" |
44 | #include "AliTOFrawData.h" | |
cd82ed2f | 45 | #include "AliTOFdigit.h" |
ee51d470 | 46 | #include "AliTOFGeometry.h" |
0e46b9ae | 47 | #include "AliTOFTrigger.h" |
c06f660b | 48 | #include "AliTOFTriggerMask.h" |
cd82ed2f | 49 | |
c11d3763 | 50 | #include "AliCDBManager.h" |
51 | #include "AliCDBEntry.h" | |
52 | ||
53 | ||
0e46b9ae | 54 | extern AliRun* gAlice; |
cd82ed2f | 55 | |
56 | //------------------------------------------------------------------------- | |
57 | ClassImp(AliTOFTrigger) | |
58 | ||
59 | //---------------------------------------------------------------------- | |
ee51d470 | 60 | AliTOFTrigger::AliTOFTrigger() : |
61 | AliTriggerDetector(), | |
cd82ed2f | 62 | fHighMultTh(1000), |
c06f660b | 63 | fppMBTh(4),//4::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
64 | fMultiMuonTh(4), | |
cd82ed2f | 65 | fUPTh(2), |
c06f660b | 66 | fdeltaminpsi(150), //150 |
67 | fdeltamaxpsi(170), //170 | |
cd82ed2f | 68 | fdeltaminro(70), |
69 | fdeltamaxro(110), | |
c06f660b | 70 | fstripWindow(2), |
71 | fSel1(0), | |
72 | fSel2(0), | |
73 | fSel3(0), | |
74 | fSel4(0), | |
75 | fNCrateOn(0), | |
76 | fNMaxipadOn(0), | |
77 | fNMaxipadOnAll(0), | |
78 | fTOFTrigMask(0) | |
cd82ed2f | 79 | { |
80 | //main ctor | |
8104fec9 | 81 | for (Int_t i=0;i<kNCTTM;i++) fLTMarray[i] = kFALSE; |
82 | ||
cd82ed2f | 83 | for (Int_t i=0;i<kNLTM;i++){ |
8104fec9 | 84 | |
cd82ed2f | 85 | for (Int_t j=0;j<kNLTMchannels;j++){ |
86 | fLTMmatrix[i][j]=kFALSE; | |
87 | } | |
88 | if (i<kNCTTM){ | |
89 | for (Int_t j=0;j<kNCTTMchannels;j++){ | |
90 | fCTTMmatrixFront[i][j]=kFALSE; | |
91 | fCTTMmatrixBack[i][j]=kFALSE; | |
92 | } | |
93 | } | |
94 | } | |
c06f660b | 95 | |
96 | fPowerMask[0] = 1; | |
97 | for(Int_t i=1;i <= kNCTTMchannels;i++){ | |
98 | fPowerMask[i] = fPowerMask[i-1]*2; | |
99 | } | |
100 | ||
cd82ed2f | 101 | SetName("TOF"); |
102 | CreateInputs(); | |
c06f660b | 103 | |
cd82ed2f | 104 | } |
ee51d470 | 105 | |
cd82ed2f | 106 | //---------------------------------------------------------------------- |
ee51d470 | 107 | |
108 | AliTOFTrigger::AliTOFTrigger(Int_t HighMultTh, Int_t ppMBTh, Int_t MultiMuonTh, Int_t UPTh, Float_t deltaminpsi, Float_t deltamaxpsi, Float_t deltaminro, Float_t deltamaxro, Int_t stripWindow) : | |
109 | AliTriggerDetector(), | |
655e379f | 110 | fHighMultTh(HighMultTh), |
111 | fppMBTh(ppMBTh), | |
112 | fMultiMuonTh(MultiMuonTh), | |
113 | fUPTh(UPTh), | |
114 | fdeltaminpsi(deltaminpsi), | |
115 | fdeltamaxpsi(deltamaxpsi), | |
116 | fdeltaminro(deltaminro), | |
117 | fdeltamaxro(deltamaxro), | |
c06f660b | 118 | fstripWindow(stripWindow), |
119 | fSel1(0), | |
120 | fSel2(0), | |
121 | fSel3(0), | |
122 | fSel4(0), | |
123 | fNCrateOn(0), | |
124 | fNMaxipadOn(0), | |
125 | fNMaxipadOnAll(0), | |
126 | fTOFTrigMask(0) | |
cd82ed2f | 127 | { |
128 | //ctor with thresholds for triggers | |
8104fec9 | 129 | for (Int_t i=0;i<kNCTTM;i++) fLTMarray[i] = kFALSE; |
cd82ed2f | 130 | for (Int_t i=0;i<kNLTM;i++){ |
131 | for (Int_t j=0;j<kNLTMchannels;j++){ | |
132 | fLTMmatrix[i][j]=kFALSE; | |
133 | } | |
134 | if (i<kNCTTM){ | |
135 | for (Int_t j=0;j<kNCTTMchannels;j++){ | |
136 | fCTTMmatrixFront[i][j]=kFALSE; | |
137 | fCTTMmatrixBack[i][j]=kFALSE; | |
138 | } | |
139 | } | |
140 | } | |
c06f660b | 141 | |
142 | fPowerMask[0] = 1; | |
143 | for(Int_t i=1;i <= kNCTTMchannels;i++){ | |
144 | fPowerMask[i] = fPowerMask[i-1]*2; | |
145 | } | |
146 | ||
cd82ed2f | 147 | SetName("TOF"); |
148 | CreateInputs(); | |
149 | } | |
150 | ||
9a838fb7 | 151 | |
152 | #if 0 /*** COPY CONSTRUCTOR SUPPRESSED **/ | |
ee51d470 | 153 | //____________________________________________________________________________ |
cd82ed2f | 154 | |
655e379f | 155 | AliTOFTrigger::AliTOFTrigger(const AliTOFTrigger & tr): |
8a190ba2 | 156 | AliTriggerDetector(tr), |
157 | fHighMultTh(tr.fHighMultTh), | |
158 | fppMBTh(tr.fppMBTh), | |
159 | fMultiMuonTh(tr.fMultiMuonTh), | |
160 | fUPTh(tr.fUPTh), | |
161 | fdeltaminpsi(tr.fdeltaminpsi), | |
162 | fdeltamaxpsi(tr.fdeltamaxpsi), | |
163 | fdeltaminro(tr.fdeltaminro), | |
164 | fdeltamaxro(tr.fdeltamaxro), | |
c06f660b | 165 | fstripWindow(tr.fstripWindow), |
166 | fSel1(tr.fSel1), | |
167 | fSel2(tr.fSel2), | |
168 | fSel3(tr.fSel3), | |
169 | fSel4(tr.fSel4), | |
170 | fNCrateOn(tr.fNCrateOn), | |
171 | fNMaxipadOn(tr.fNMaxipadOn), | |
172 | fNMaxipadOnAll(tr.fNMaxipadOnAll), | |
173 | fTOFTrigMask(0) | |
cd82ed2f | 174 | { |
175 | //copy ctor | |
8104fec9 | 176 | for (Int_t i=0;i<kNCTTM;i++) fLTMarray[i] = kFALSE; |
cd82ed2f | 177 | for (Int_t i=0;i<kNLTM;i++){ |
178 | for (Int_t j=0;j<kNLTMchannels;j++){ | |
179 | fLTMmatrix[i][j]=tr.fLTMmatrix[i][j]; | |
180 | } | |
181 | if (i<kNCTTM){ | |
182 | for (Int_t j=0;j<kNCTTMchannels;j++){ | |
ee51d470 | 183 | fCTTMmatrixFront[i][j]=tr.fCTTMmatrixFront[i][j]; |
184 | fCTTMmatrixBack[i][j]=tr.fCTTMmatrixBack[i][j]; | |
cd82ed2f | 185 | } |
186 | } | |
187 | } | |
c06f660b | 188 | |
189 | fPowerMask[0] = 1; | |
190 | for(Int_t i=1;i <= kNCTTMchannels;i++){ | |
191 | fPowerMask[i] = fPowerMask[i-1]*2; | |
192 | } | |
193 | ||
194 | if(tr.fTOFTrigMask){ | |
195 | fTOFTrigMask = new AliTOFTriggerMask(); | |
196 | fTOFTrigMask->SetTriggerMaskArray(tr.fTOFTrigMask->GetTriggerMaskArray()); | |
197 | } | |
198 | ||
cd82ed2f | 199 | SetName(tr.GetName()); |
ee51d470 | 200 | //fInputs=&(tr.GetInputs()); |
c06f660b | 201 | CreateInputs(); |
202 | ||
cd82ed2f | 203 | } |
9a838fb7 | 204 | #endif /*** COPY CONTRUCTOR SUPPRESSED ***/ |
cd82ed2f | 205 | |
206 | //---------------------------------------------------------------------- | |
207 | ||
208 | void AliTOFTrigger::CreateInputs() | |
209 | { | |
ee51d470 | 210 | // creating inputs |
cd82ed2f | 211 | // Do not create inputs again!! |
ee51d470 | 212 | if( fInputs.GetEntriesFast() > 0 ) return; |
213 | ||
c06f660b | 214 | LoadActiveMask(); |
215 | ||
ee51d470 | 216 | fInputs.AddLast(new AliTriggerInput("TOF_Cosmic_MultiMuon_L0","TOF",0)); |
217 | fInputs.AddLast(new AliTriggerInput("0OIN","TOF",0)); // was "TOF_pp_MB_L0" | |
c06f660b | 218 | fInputs.AddLast(new AliTriggerInput("0OM2","TOF",0)); // was "TOF_PbPb_MB2_L0" |
219 | fInputs.AddLast(new AliTriggerInput("0OM3","TOF",0)); // was "TOF_PbPb_MB3_L0" | |
220 | fInputs.AddLast(new AliTriggerInput("0OUP","TOF",0)); // was "TOF_UltraPer_Coll_L0" | |
ee51d470 | 221 | |
222 | fInputs.AddLast(new AliTriggerInput("0OHM","TOF",0)); // was "TOF_High_Mult_L0" | |
223 | fInputs.AddLast(new AliTriggerInput("TOF_Jet_L1","TOF",0)); | |
224 | ||
cd82ed2f | 225 | } |
226 | ||
227 | //---------------------------------------------------------------------- | |
ee51d470 | 228 | void AliTOFTrigger::Trigger() { |
cd82ed2f | 229 | //triggering method |
c06f660b | 230 | fSel1=0; |
231 | fSel2=0; | |
232 | fSel3=0; | |
233 | fSel4=0; | |
c6eeb5c9 | 234 | |
cd82ed2f | 235 | CreateLTMMatrix(); |
236 | Int_t nchonFront = 0; | |
237 | Int_t nchonBack = 0; | |
238 | Int_t nchonTot = 0; | |
c06f660b | 239 | Int_t nSectOn = 0; // °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° |
240 | Int_t DeSlots = -1;// °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° | |
241 | Int_t AntiDeSlots = -1;// °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° | |
cd82ed2f | 242 | Int_t nchonFrontBack = 0; |
243 | Int_t nchonFront1 = 0; | |
244 | Int_t nchonBack1 = 0; | |
245 | Int_t nchonFrontBack1 = 0; | |
246 | Int_t mindeltapsi = (Int_t)fdeltaminpsi/10; | |
247 | Int_t maxdeltapsi = (Int_t)fdeltamaxpsi/10; | |
248 | Int_t mindeltaro = (Int_t)fdeltaminro/10; | |
249 | Int_t maxdeltaro = (Int_t)fdeltamaxro/10; | |
ee51d470 | 250 | |
cd82ed2f | 251 | for (Int_t i=0;i<kNCTTM;i++){ |
252 | for (Int_t j=0;j<kNCTTMchannels;j++){ | |
ee51d470 | 253 | if (fCTTMmatrixFront[i][j]) nchonFront++; |
cd82ed2f | 254 | } |
255 | } | |
256 | ||
257 | for (Int_t i=kNCTTM;i<(kNCTTM*2);i++){ | |
258 | for (Int_t j=0;j<kNCTTMchannels;j++){ | |
ee51d470 | 259 | if (fCTTMmatrixBack[i-kNCTTM][j]) nchonBack++; |
cd82ed2f | 260 | } |
261 | } | |
262 | ||
263 | nchonTot = nchonFront + nchonBack; | |
c06f660b | 264 | // fNMaxipadOn = nchonTot; |
265 | for(Int_t i=0;i<kNCTTM;i++) { if(fLTMarray[i]) nSectOn++; } | |
cd82ed2f | 266 | |
267 | //pp Minimum Bias Trigger | |
268 | if (nchonTot >= fppMBTh) { | |
c6eeb5c9 | 269 | SetInput("0OIN"); |
c06f660b | 270 | fSel1=1; |
271 | //printf("0OIN - MB\n"); | |
272 | } | |
273 | ||
274 | // PbPb MB | |
275 | if (nchonTot >= 2) { | |
276 | SetInput("0OM2"); | |
277 | fSel2=1; | |
278 | } | |
279 | if (nchonTot >= 3) { | |
280 | SetInput("0OM3"); | |
281 | fSel3=1; | |
cd82ed2f | 282 | } |
283 | ||
284 | //High Multiplicity Trigger | |
285 | if (nchonTot >= fHighMultTh) { | |
c6eeb5c9 | 286 | SetInput("0OHM"); |
c06f660b | 287 | //printf("0OHM - High Mult\n"); |
cd82ed2f | 288 | } |
289 | ||
ee51d470 | 290 | |
cd82ed2f | 291 | //MultiMuon Trigger |
292 | nchonFront = 0; | |
293 | nchonBack = 0; | |
294 | nchonFrontBack = 0; | |
295 | ||
296 | Bool_t boolCTTMor = kFALSE; | |
297 | ||
298 | for (Int_t i=0;i<(kNCTTM/2);i++){ | |
299 | Int_t iopp = i+kNCTTM/2; | |
300 | for (Int_t j=0;j<kNCTTMchannels;j++){ | |
301 | if (fCTTMmatrixFront[i][j]){ | |
302 | Int_t minj = j-fstripWindow; | |
303 | Int_t maxj = j+fstripWindow; | |
304 | if (minj<0) minj =0; | |
305 | if (maxj>=kNCTTMchannels) maxj = kNCTTMchannels-1; | |
306 | boolCTTMor = kFALSE; | |
307 | for (Int_t k = minj;k<=maxj;k++){ | |
308 | boolCTTMor |= fCTTMmatrixFront[iopp][k]; | |
ee51d470 | 309 | } |
cd82ed2f | 310 | if (boolCTTMor) { |
311 | nchonFront++; | |
312 | } | |
313 | } | |
ee51d470 | 314 | |
cd82ed2f | 315 | if (fCTTMmatrixBack[i][j]){ |
316 | Int_t minj = j-fstripWindow; | |
317 | Int_t maxj = j+fstripWindow; | |
318 | if (minj<0) minj =0; | |
319 | if (maxj>=kNCTTMchannels) maxj =kNCTTMchannels-1; | |
320 | boolCTTMor = kFALSE; | |
321 | for (Int_t k = minj;k<=maxj;k++){ | |
322 | boolCTTMor |= fCTTMmatrixBack[iopp][k]; | |
323 | } | |
324 | if (boolCTTMor) { | |
325 | nchonBack++; | |
326 | } | |
327 | } | |
328 | } | |
329 | } | |
330 | ||
331 | nchonFrontBack = nchonFront+nchonBack; | |
332 | ||
333 | nchonFront1 = 0; | |
334 | nchonBack1 = 0; | |
335 | nchonFrontBack1 = 0; | |
336 | ||
337 | boolCTTMor = kFALSE; | |
338 | for (Int_t i=0;i<(kNCTTM/2);i++){ | |
339 | Int_t i2max = (kNCTTM-1)-i+1; | |
340 | Int_t i2min = (kNCTTM-1)-i-1; | |
341 | if (i2max >=kNCTTM) i2max = kNCTTM-1; | |
342 | if (i2min==i) i2min = kNCTTM-1-i; | |
343 | for (Int_t j=0;j<kNCTTMchannels;j++){ | |
344 | Int_t j2min = j-fstripWindow; | |
345 | Int_t j2max = j+fstripWindow; | |
346 | if (j2min<0) j2min =0; | |
347 | if (j2max>=kNCTTMchannels) j2max =kNCTTMchannels-1; | |
348 | if (fCTTMmatrixFront[i][j]){ | |
349 | boolCTTMor = kFALSE; | |
350 | for (Int_t i2=i2min;i2<=i2max;i2++){ | |
351 | for (Int_t j2 = j2min;j2<=j2max;j2++){ | |
352 | boolCTTMor |= fCTTMmatrixFront[i2][j2]; | |
ee51d470 | 353 | } |
cd82ed2f | 354 | if (boolCTTMor) { |
355 | nchonFront++; | |
356 | } | |
357 | } | |
358 | } | |
359 | if (fCTTMmatrixBack[i][j]){ | |
c06f660b | 360 | boolCTTMor = kFALSE; |
361 | for (Int_t i2=i2min;i2<=i2max;i2++){ | |
362 | for (Int_t j2 = j2min;j2<=j2max;j2++){ | |
363 | boolCTTMor |= fCTTMmatrixBack[i2][j2]; | |
364 | } | |
365 | } | |
366 | if (boolCTTMor) { | |
367 | nchonBack++; | |
cd82ed2f | 368 | } |
cd82ed2f | 369 | } |
370 | } | |
371 | } | |
c06f660b | 372 | |
cd82ed2f | 373 | nchonFrontBack1 = nchonFront1+nchonBack1; |
c06f660b | 374 | |
cd82ed2f | 375 | if (nchonFrontBack >= fMultiMuonTh || nchonFrontBack1 >= fMultiMuonTh) { |
c06f660b | 376 | SetInput("TOF_Cosmic_MultiMuon_L0"); |
cd82ed2f | 377 | } |
c06f660b | 378 | |
cd82ed2f | 379 | //Ultra-Peripheral collision Trigger |
c06f660b | 380 | |
381 | // °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° | |
382 | // DeSlots = (k+1)_Array Element - k_Array Element | |
383 | // AntiDeSlots = kNCTTM - DeSlots | |
384 | ||
385 | if((!fSel1))// && nchonFront < 4 && nchonBack < 4) | |
386 | { | |
387 | // printf("nHitMaxipad CLASSE: %i \n",fNMaxipadOn); | |
388 | // printf("Total Number per event of Switched-On sectors : %i \n", nSectOn); | |
389 | // printf("mindeltapsi %i \n", mindeltapsi); | |
390 | //printf("maxdeltapsi %i \n", maxdeltapsi); | |
391 | for(Int_t i = 0; i < kNCTTM; i++){ | |
392 | if(fLTMarray[i]){ | |
393 | // printf(" i-sect On: %i\n",i); | |
394 | for(Int_t j = i+1; j < kNCTTM; j++){ | |
395 | if(fLTMarray[j]) { | |
396 | // printf(" j-sect On: %i\n",j); | |
397 | DeSlots = j-i; | |
398 | AntiDeSlots = kNCTTM - DeSlots; | |
399 | //printf("DeSlots = %i \n",DeSlots); | |
400 | //printf("AntiDeSlots = %i \n",AntiDeSlots); | |
401 | if(DeSlots >= mindeltapsi && DeSlots <= maxdeltapsi){ | |
402 | fSel4=1; | |
403 | SetInput("0OUP"); | |
404 | //printf("trigger On with DeSlot \n"); | |
405 | } | |
406 | if(AntiDeSlots >= mindeltapsi && AntiDeSlots <= maxdeltapsi){ | |
407 | fSel4=1; | |
408 | SetInput("0OUP"); | |
409 | //printf("trigger On with AntiDeSlot \n"); | |
410 | } | |
411 | ||
412 | ||
413 | if(DeSlots >= mindeltaro && DeSlots <= maxdeltaro){ | |
414 | fSel4=1; | |
415 | SetInput("0OUP"); | |
416 | //printf("trigger On with DeSlot \n"); | |
417 | } | |
418 | if(AntiDeSlots >= mindeltaro && AntiDeSlots <= maxdeltaro){ | |
419 | fSel4=1; | |
420 | SetInput("0OUP"); | |
421 | //printf("trigger On with AntiDeSlot \n"); | |
422 | } | |
423 | ||
424 | } | |
425 | ||
426 | } | |
cd82ed2f | 427 | } |
cd82ed2f | 428 | } |
c06f660b | 429 | } |
cd82ed2f | 430 | } |
ee51d470 | 431 | |
cd82ed2f | 432 | //----------------------------------------------------------------------------- |
ee51d470 | 433 | void AliTOFTrigger::CreateLTMMatrix() { |
cd82ed2f | 434 | //creating LTMMatrix |
ee51d470 | 435 | //initialization |
436 | CreateLTMMatrixFromDigits(); | |
437 | } | |
438 | ||
439 | //------------------------------------------------------------------------- | |
440 | ||
441 | void AliTOFTrigger::CreateLTMMatrixFromDigits() { | |
442 | // | |
443 | // Create LTM matrix by TOF digits | |
444 | // | |
445 | ||
cd82ed2f | 446 | //initialization |
8104fec9 | 447 | for (Int_t i=0;i<kNCTTM;i++) fLTMarray[i]= kFALSE; |
cd82ed2f | 448 | for (Int_t i=0;i<kNLTM;i++){ |
449 | for (Int_t j=0;j<kNLTMchannels;j++){ | |
450 | fLTMmatrix[i][j]=kFALSE; | |
451 | } | |
452 | } | |
5cd96e39 | 453 | for (Int_t i=0;i<kNCTTM;i++){ |
454 | for (Int_t j=0;j<kNCTTMchannels;j++){ | |
455 | fCTTMmatrixFront[i][j]=kFALSE; | |
456 | fCTTMmatrixBack[i][j]=kFALSE; | |
457 | } | |
458 | } | |
459 | ||
460 | ||
cd82ed2f | 461 | AliRunLoader *rl; |
33c3c91a | 462 | rl = AliRunLoader::Instance(); |
ee51d470 | 463 | |
cd82ed2f | 464 | Int_t ncurrevent = rl->GetEventNumber(); |
465 | rl->GetEvent(ncurrevent); | |
ee51d470 | 466 | |
cd82ed2f | 467 | AliLoader * tofLoader = rl->GetLoader("TOFLoader"); |
ee51d470 | 468 | |
cd82ed2f | 469 | tofLoader->LoadDigits("read"); |
470 | TTree *treeD = tofLoader->TreeD(); | |
8104fec9 | 471 | if (treeD == 0x0) { |
472 | AliFatal("AliTOFTrigger: Can not get TreeD"); | |
473 | return; | |
474 | } | |
ee51d470 | 475 | |
cd82ed2f | 476 | TBranch *branch = treeD->GetBranch("TOF"); |
ee51d470 | 477 | if (!branch) { |
cd82ed2f | 478 | AliError("can't get the branch with the TOF digits !"); |
479 | return; | |
480 | } | |
481 | TClonesArray *tofDigits =new TClonesArray("AliTOFdigit", 1000); | |
482 | branch->SetAddress(&tofDigits); | |
483 | treeD->GetEvent(0); | |
484 | Int_t ndigits = tofDigits->GetEntriesFast(); | |
485 | Int_t detind[5]; //detector indexes: 0 -> sector | |
c06f660b | 486 | // 1 -> plate(modulo) |
cd82ed2f | 487 | // 2 -> strip |
488 | // 3 -> padz | |
489 | // 4 -> padx | |
ee51d470 | 490 | |
cd82ed2f | 491 | for (Int_t i=0;i<ndigits;i++){ |
492 | AliTOFdigit * digit = (AliTOFdigit*)tofDigits->UncheckedAt(i); | |
493 | detind[0] = digit->GetSector(); | |
494 | detind[1] = digit->GetPlate(); | |
495 | detind[2] = digit->GetStrip(); | |
496 | detind[3] = digit->GetPadz(); | |
497 | detind[4] = digit->GetPadx(); | |
ee51d470 | 498 | |
cd82ed2f | 499 | Int_t indexLTM[2] = {-1,-1}; |
500 | GetLTMIndex(detind,indexLTM); | |
501 | ||
502 | fLTMmatrix[indexLTM[0]][indexLTM[1]] = kTRUE; | |
c11d3763 | 503 | // fLTMarray[indexLTM[0]%36] = kTRUE; //dimensione MAX array 36 = kNCTTM |
c06f660b | 504 | } |
c06f660b | 505 | |
cd82ed2f | 506 | |
28751b82 | 507 | tofLoader->UnloadDigits(); |
ee51d470 | 508 | // rl->UnloadgAlice(); |
509 | CreateCTTMMatrix(); | |
510 | ||
cd82ed2f | 511 | } |
ee51d470 | 512 | |
cd82ed2f | 513 | //----------------------------------------------------------------------------- |
ee51d470 | 514 | |
515 | void AliTOFTrigger::CreateLTMMatrixFromRaw(AliRawReader *fRawReader) { | |
516 | // | |
517 | // Create LTM matrix by TOF raw data | |
518 | // | |
519 | ||
520 | //initialization | |
521 | for (Int_t i=0;i<kNLTM;i++){ | |
522 | for (Int_t j=0;j<kNLTMchannels;j++){ | |
523 | fLTMmatrix[i][j]=kFALSE; | |
524 | } | |
525 | } | |
5cd96e39 | 526 | for (Int_t i=0;i<kNCTTM;i++){ |
527 | for (Int_t j=0;j<kNCTTMchannels;j++){ | |
528 | fCTTMmatrixFront[i][j]=kFALSE; | |
529 | fCTTMmatrixBack[i][j]=kFALSE; | |
530 | } | |
531 | } | |
ee51d470 | 532 | |
533 | if(fRawReader){ | |
534 | AliTOFRawStream * tofRawStream = new AliTOFRawStream(); | |
535 | ||
536 | Int_t inholes = 0; | |
537 | ||
538 | //if(!GetLoader()->TreeS()) {MakeTree("S"); MakeBranch("S");} | |
539 | ||
540 | Clear(); | |
541 | tofRawStream->SetRawReader(fRawReader); | |
542 | ||
543 | //ofstream ftxt; | |
544 | //if (fVerbose==2) ftxt.open("TOFsdigitsRead.txt",ios::app); | |
545 | ||
546 | TClonesArray staticRawData("AliTOFrawData",10000); | |
547 | staticRawData.Clear(); | |
548 | TClonesArray * clonesRawData = &staticRawData; | |
549 | ||
550 | Int_t dummy = -1; | |
551 | Int_t detectorIndex[5] = {-1, -1, -1, -1, -1}; | |
552 | Int_t digit[2]; | |
553 | //Int_t track = -1; | |
554 | //Int_t last = -1; | |
555 | ||
556 | Int_t indexDDL = 0; | |
557 | Int_t iRawData = 0; | |
558 | AliTOFrawData *tofRawDatum = 0; | |
559 | for (indexDDL=0; indexDDL<AliDAQ::NumberOfDdls("TOF"); indexDDL++) { | |
560 | ||
561 | fRawReader->Reset(); | |
5cd96e39 | 562 | tofRawStream->LoadRawDataBuffersV2(indexDDL); |
ee51d470 | 563 | |
564 | clonesRawData = tofRawStream->GetRawData(); | |
565 | if (clonesRawData->GetEntriesFast()!=0) AliInfo(Form(" TOF raw data number = %3d", clonesRawData->GetEntriesFast())); | |
566 | for (iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) { | |
567 | ||
568 | tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData); | |
569 | ||
570 | //if (tofRawDatum->GetTOT()==-1 || tofRawDatum->GetTOF()==-1) continue; | |
571 | if (tofRawDatum->GetTOF()==-1) continue; | |
572 | ||
573 | SetBit(indexDDL, tofRawDatum->GetTRM(), tofRawDatum->GetTRMchain(), | |
574 | tofRawDatum->GetTDC(), tofRawDatum->GetTDCchannel()); | |
575 | ||
576 | dummy = detectorIndex[3]; | |
577 | detectorIndex[3] = detectorIndex[4];//padz | |
578 | detectorIndex[4] = dummy;//padx | |
579 | ||
580 | digit[0] = tofRawDatum->GetTOF(); | |
581 | digit[1] = tofRawDatum->GetTOT(); | |
582 | ||
583 | dummy = detectorIndex[3]; | |
584 | detectorIndex[3] = detectorIndex[4];//padx | |
585 | detectorIndex[4] = dummy;//padz | |
586 | ||
587 | // Do not reconstruct anything in the holes | |
588 | if (detectorIndex[0]==13 || detectorIndex[0]==14 || detectorIndex[0]==15 ) { // sectors with holes | |
589 | if (detectorIndex[1]==2) { // plate with holes | |
590 | inholes++; | |
591 | continue; | |
592 | } | |
593 | } | |
594 | ||
595 | tofRawDatum = 0; | |
596 | } // while loop | |
597 | ||
598 | clonesRawData->Clear(); | |
599 | ||
600 | } // DDL Loop | |
601 | ||
602 | //if (fVerbose==2) ftxt.close(); | |
603 | ||
604 | if (inholes) AliWarning(Form("Clusters in the TOF holes: %d",inholes)); | |
6ec122c0 | 605 | delete tofRawStream; |
606 | tofRawStream = NULL; | |
ee51d470 | 607 | |
608 | } | |
609 | ||
610 | } | |
611 | ||
612 | //----------------------------------------------------------------------------- | |
42e171ac | 613 | void AliTOFTrigger::GetLTMIndex(const Int_t * const detind, Int_t *indexLTM) { |
ee51d470 | 614 | // |
615 | // getting LTMmatrix indexes for current digit | |
616 | // | |
617 | ||
cd82ed2f | 618 | if (detind[1]==0 || detind[1]==1 || (detind[1]==2 && detind[2]<=7)) { |
619 | if (detind[4]<24){ | |
620 | indexLTM[0] = detind[0]*2; | |
621 | } | |
622 | else { | |
623 | indexLTM[0] = detind[0]*2+1; | |
624 | } | |
625 | } | |
626 | else { | |
627 | if (detind[4]<24){ | |
628 | indexLTM[0] = detind[0]*2+36; | |
629 | } | |
630 | else { | |
631 | indexLTM[0] = (detind[0]*2+1)+36; | |
632 | } | |
633 | } | |
634 | ||
ee51d470 | 635 | if (indexLTM[0]<36) { |
cd82ed2f | 636 | if (detind[1] ==0){ |
637 | indexLTM[1] = detind[2]; | |
638 | } | |
639 | else if (detind[1] ==1){ | |
640 | indexLTM[1] = detind[2]+19; | |
641 | } | |
642 | else if (detind[1] ==2){ | |
2901911a | 643 | indexLTM[1] = detind[2]+19*2; |
cd82ed2f | 644 | } |
645 | else{ | |
646 | AliError("Smth Wrong!!!"); | |
647 | } | |
648 | } | |
649 | else { | |
650 | if (detind[1] ==2){ | |
651 | indexLTM[1] = detind[2]-8; | |
652 | } | |
653 | else if (detind[1] ==3){ | |
654 | indexLTM[1] = detind[2]+7; | |
655 | } | |
656 | else if (detind[1] ==4){ | |
657 | indexLTM[1] = detind[2]+26; | |
658 | } | |
659 | else{ | |
660 | AliError("Smth Wrong!!!"); | |
661 | } | |
662 | } | |
ee51d470 | 663 | |
664 | } | |
665 | //------------------------------------------------------------------------- | |
666 | /* | |
667 | // to be checked because of warning problems | |
668 | void AliTOFTrigger::PrintMap() | |
669 | { | |
670 | // | |
671 | // | |
672 | // | |
673 | ||
674 | for(Int_t i = 0; i<kNLTM;i++) { | |
675 | if(i<36) { | |
676 | printf("| %d | %d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |\n", | |
677 | (fCTTMmatrixFront[i][0])?1:0,(fCTTMmatrixFront[i][1])?1:0,(fCTTMmatrixFront[i][2])?1:0, \ | |
678 | (fCTTMmatrixFront[i][3])?1:0,(fCTTMmatrixFront[i][4])?1:0,(fCTTMmatrixFront[i][5])?1:0, \ | |
679 | (fCTTMmatrixFront[i][6])?1:0,(fCTTMmatrixFront[i][7])?1:0,(fCTTMmatrixFront[i][8])?1:0, \ | |
680 | (fCTTMmatrixFront[i][9])?1:0,(fCTTMmatrixFront[i][10])?1:0,(fCTTMmatrixFront[i][11])?1:0, \ | |
681 | (fCTTMmatrixFront[i][12])?1:0,(fCTTMmatrixFront[i][13])?1:0,(fCTTMmatrixFront[i][14])?1:0, \ | |
682 | (fCTTMmatrixFront[i][15])?1:0,(fCTTMmatrixFront[i][16])?1:0,(fCTTMmatrixFront[i][17])?1:0, \ | |
683 | (fCTTMmatrixFront[i][18])?1:0,(fCTTMmatrixFront[i][19])?1:0,(fCTTMmatrixFront[i][20])?1:0, \ | |
684 | (fCTTMmatrixFront[i][21])?1:0,(fCTTMmatrixFront[i][22])?1:0,(fCTTMmatrixFront[i][23])?1:0); | |
685 | } else { | |
686 | printf("| %d | %d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |\n", | |
687 | (fCTTMmatrixBack[i][0])?1:0,(fCTTMmatrixBack[i][1])?1:0,(fCTTMmatrixBack[i][2])?1:0, \ | |
688 | (fCTTMmatrixBack[i][3])?1:0,(fCTTMmatrixBack[i][4])?1:0,(fCTTMmatrixBack[i][5])?1:0, \ | |
689 | (fCTTMmatrixBack[i][6])?1:0,(fCTTMmatrixBack[i][7])?1:0,(fCTTMmatrixBack[i][8])?1:0, \ | |
690 | (fCTTMmatrixBack[i][9])?1:0,(fCTTMmatrixBack[i][10])?1:0,(fCTTMmatrixBack[i][11])?1:0, \ | |
691 | (fCTTMmatrixBack[i][12])?1:0,(fCTTMmatrixBack[i][13])?1:0,(fCTTMmatrixBack[i][14])?1:0, \ | |
692 | (fCTTMmatrixBack[i][15])?1:0,(fCTTMmatrixBack[i][16])?1:0,(fCTTMmatrixBack[i][17])?1:0, \ | |
693 | (fCTTMmatrixBack[i][18])?1:0,(fCTTMmatrixBack[i][19])?1:0,(fCTTMmatrixBack[i][20])?1:0, \ | |
694 | (fCTTMmatrixBack[i][21])?1:0,(fCTTMmatrixBack[i][22])?1:0,(fCTTMmatrixBack[i][23])?1:0); | |
695 | } | |
696 | } | |
697 | ||
698 | } | |
699 | */ | |
700 | //------------------------------------------------------------------------- | |
701 | ||
5cd96e39 | 702 | void AliTOFTrigger::GetMapMatrix(Bool_t map[][24]) const |
703 | { | |
704 | // | |
705 | // Returns CTTM map | |
706 | // | |
707 | ||
708 | for(Int_t i = 0; i<kNLTM;i++) | |
709 | for(Int_t j = 0; j<kNCTTMchannels;j++) | |
710 | map[i][j]=(i<36)?fCTTMmatrixFront[i][j]:fCTTMmatrixBack[i-36][j]; | |
711 | ||
712 | } | |
713 | //------------------------------------------------------------------------- | |
714 | ||
42e171ac | 715 | void AliTOFTrigger::GetMap(Bool_t **map) const |
ee51d470 | 716 | { |
717 | // | |
42e171ac | 718 | // Returns CTTM map |
ee51d470 | 719 | // |
720 | ||
721 | for(Int_t i = 0; i<kNLTM;i++) | |
722 | for(Int_t j = 0; j<kNCTTMchannels;j++) | |
5cd96e39 | 723 | map[i][j]=(i<36)?fCTTMmatrixFront[i][j]:fCTTMmatrixBack[i-36][j]; |
ee51d470 | 724 | |
725 | } | |
726 | ||
5cd96e39 | 727 | |
ee51d470 | 728 | //------------------------------------------------------------------------- |
42e171ac | 729 | void AliTOFTrigger::GetTRDmap(Bool_t **map) const |
ee51d470 | 730 | { |
731 | // | |
732 | // Retriev the bit map sent to the TRD detector | |
733 | // | |
5cd96e39 | 734 | |
735 | for(int i = 0; i<kNLTM;i++) | |
736 | for(int j = 0; j<kNLTMtoTRDchannels;j++){ | |
737 | map[i][j]=kFALSE; | |
738 | } | |
ee51d470 | 739 | |
5cd96e39 | 740 | for(int i = 0; i<kNLTM/2;i++) |
ee51d470 | 741 | for(int j = 0; j<AliTOFTrigger::kNCTTMchannels;j++){ |
5cd96e39 | 742 | UInt_t uTRDbit=j/3; |
743 | if(fCTTMmatrixFront[i][j]) map[i][uTRDbit]=kTRUE; | |
ee51d470 | 744 | } |
745 | for(int i = kNLTM/2; i<kNLTM;i++) | |
5cd96e39 | 746 | for(int j = 0; j<AliTOFTrigger::kNCTTMchannels;j++){ |
747 | UInt_t uTRDbit=j/3; | |
748 | if(fCTTMmatrixBack[i-kNLTM/2][j]) map[i][uTRDbit]=kTRUE; | |
749 | } | |
750 | ||
751 | } | |
752 | //------------------------------------------------------------------------- | |
753 | void AliTOFTrigger::GetTRDmapMatrix(Bool_t map[][8]) const | |
754 | { | |
755 | // | |
756 | // Retriev the bit map sent to the TRD detector | |
757 | // | |
758 | ||
759 | for(int i = 0; i<kNLTM;i++) | |
760 | for(int j = 0; j<kNLTMtoTRDchannels;j++){ | |
761 | map[i][j]=kFALSE; | |
762 | } | |
763 | ||
764 | for(int i = 0; i<kNLTM/2;i++) | |
ee51d470 | 765 | for(int j = 0; j<AliTOFTrigger::kNCTTMchannels;j++){ |
5cd96e39 | 766 | UInt_t uTRDbit=j/3; |
767 | if(fCTTMmatrixFront[i][j]) map[i][uTRDbit]=kTRUE; | |
768 | } | |
769 | for(int i = kNLTM/2; i<kNLTM;i++) | |
770 | for(int j = 0; j<AliTOFTrigger::kNCTTMchannels;j++){ | |
771 | UInt_t uTRDbit=j/3; | |
772 | if(fCTTMmatrixBack[i-kNLTM/2][j]) map[i][uTRDbit]=kTRUE; | |
ee51d470 | 773 | } |
5cd96e39 | 774 | |
ee51d470 | 775 | } |
776 | ||
777 | //------------------------------------------------------------------------- | |
778 | void AliTOFTrigger::SetBit(Int_t *detind) | |
779 | { | |
780 | // | |
42e171ac | 781 | // Sets CTTM map element corresponding to detector element 'detind' |
ee51d470 | 782 | // |
783 | ||
784 | Int_t index[2]; | |
785 | GetCTTMIndex(detind,index); | |
786 | if(index[0]<36) | |
787 | fCTTMmatrixFront[index[0]][index[1]]=kTRUE; | |
788 | else | |
5cd96e39 | 789 | fCTTMmatrixBack[index[0]-36][index[1]]=kTRUE; |
ee51d470 | 790 | |
791 | } | |
792 | ||
793 | //------------------------------------------------------------------------- | |
794 | void AliTOFTrigger::SetBit(Int_t nDDL, Int_t nTRM, Int_t iChain, | |
795 | Int_t iTDC, Int_t iCH) | |
796 | { | |
797 | // | |
42e171ac | 798 | // Sets CTTM map element corresponding to equipment ID |
799 | // labelled by number nDDL, nTRM, iChain, iTDC, iCH | |
ee51d470 | 800 | // |
801 | ||
5cd96e39 | 802 | if(nTRM==3 && iTDC>=12 && iTDC<=14 && nDDL%2==1){ // DDL number to LTM number mapping |
803 | // getchar(); | |
ee51d470 | 804 | Int_t iLTMindex=-1; |
805 | Int_t iChannelIndex=-1; | |
806 | switch(nDDL%AliTOFGeometry::NDDL()){ | |
807 | case 1: | |
808 | iLTMindex=1; | |
809 | break; | |
810 | case 3: | |
811 | iLTMindex=36; | |
812 | break; | |
813 | default: | |
814 | AliError("Call this function only if(nTRM==3 && iTDC>12 && iTDC<14 && nDDL%2==1) "); | |
815 | break; | |
816 | } | |
817 | iLTMindex+=2*(Int_t)(nDDL/AliTOFGeometry::NDDL()); | |
818 | if(iChain==0 && nDDL<36) | |
819 | iLTMindex--; | |
820 | if(iChain==0 && nDDL>=36) | |
821 | iLTMindex++; | |
822 | iChannelIndex=iCH+iTDC*AliTOFGeometry::NCh()-12*AliTOFGeometry::NCh(); | |
823 | Int_t index[2]={iLTMindex,iChannelIndex}; | |
5cd96e39 | 824 | if (index[0]<36){ |
ee51d470 | 825 | fCTTMmatrixFront[index[0]][index[1]]=kTRUE; |
5cd96e39 | 826 | fLTMmatrix[index[0]][index[1]*2]=kTRUE; |
827 | } | |
828 | else{ | |
829 | fCTTMmatrixBack[index[0]-36][index[1]]=kTRUE; | |
830 | fLTMmatrix[index[0]][index[1]*2]=kTRUE; | |
831 | } | |
832 | } | |
ee51d470 | 833 | |
834 | } | |
835 | //------------------------------------------------------------------------- | |
836 | ||
837 | void AliTOFTrigger::ResetBit(Int_t *detind) | |
838 | { | |
839 | // | |
42e171ac | 840 | // Sets CTTM map element corresponding to detector element 'detind' |
ee51d470 | 841 | // |
842 | ||
843 | Int_t index[2]; | |
844 | GetCTTMIndex(detind,index); | |
845 | if(index[0]<36) | |
846 | fCTTMmatrixFront[index[0]][index[1]]=kFALSE; | |
847 | else | |
5cd96e39 | 848 | fCTTMmatrixBack[index[0]-36][index[1]]=kFALSE; |
ee51d470 | 849 | |
850 | } | |
851 | ||
852 | //------------------------------------------------------------------------- | |
853 | void AliTOFTrigger::ResetBit(Int_t nDDL, Int_t nTRM, Int_t iChain, | |
854 | Int_t iTDC, Int_t iCH) | |
855 | { | |
856 | // | |
42e171ac | 857 | // Sets CTTM map element corresponding to equipment ID |
858 | // labelled by number nDDL, nTRM, iChain, iTDC, iCH | |
ee51d470 | 859 | // |
860 | ||
861 | if(nTRM==3 && iTDC>12 && iTDC<14 && nDDL%2==1){ // DDL number to LTM number mapping | |
862 | Int_t iLTMindex=-1; | |
863 | Int_t iChannelIndex=-1; | |
864 | switch(nDDL%AliTOFGeometry::NDDL()){ | |
865 | case 1: | |
866 | iLTMindex=1; | |
867 | break; | |
868 | case 3: | |
869 | iLTMindex=36; | |
870 | break; | |
871 | default: | |
872 | AliError("Call this function only if(nTRM==3 && iTDC>12 && iTDC<14 && nDDL%2==1) "); | |
873 | break; | |
874 | } | |
875 | iLTMindex+=2*(Int_t)(nDDL/AliTOFGeometry::NDDL()); | |
876 | if(iChain==0 && nDDL<36) | |
877 | iLTMindex--; | |
878 | if(iChain==0 && nDDL>=36) | |
879 | iLTMindex++; | |
880 | iChannelIndex=iCH+iTDC*AliTOFGeometry::NCh()-12*AliTOFGeometry::NCh(); | |
881 | Int_t index[2]={iLTMindex,iChannelIndex}; | |
5cd96e39 | 882 | if (index[0]<36){ |
ee51d470 | 883 | fCTTMmatrixFront[index[0]][index[1]]=kFALSE; |
5cd96e39 | 884 | } |
885 | else{ | |
886 | fCTTMmatrixBack[index[0]-36][index[1]]=kFALSE; | |
887 | } | |
ee51d470 | 888 | } |
889 | else | |
890 | AliError("Call this function only if(nTRM==3 && iTDC>12 && iTDC<14 && nDDL%2==1) "); | |
891 | ||
892 | } | |
893 | //------------------------------------------------------------------------- | |
894 | ||
895 | Bool_t AliTOFTrigger::GetBit(Int_t *detind) | |
896 | { | |
897 | // | |
42e171ac | 898 | // Returns CTTM map element corresponding to detector element 'detind' |
ee51d470 | 899 | // |
900 | ||
901 | Int_t index[2]; | |
902 | GetCTTMIndex(detind,index); | |
5cd96e39 | 903 | return (index[0]<36)?fCTTMmatrixFront[index[0]][index[1]]:fCTTMmatrixBack[index[0]-36][index[1]]; |
ee51d470 | 904 | |
905 | } | |
906 | ||
907 | //------------------------------------------------------------------------- | |
908 | Bool_t AliTOFTrigger::GetBit(Int_t nDDL, Int_t nTRM, Int_t iChain, | |
909 | Int_t iTDC, Int_t iCH) | |
910 | { | |
911 | // | |
42e171ac | 912 | // Returns CTTM map element corresponding to equipment ID |
913 | // labelled by number nDDL, nTRM, iChain, iTDC, iCH | |
ee51d470 | 914 | // |
915 | ||
916 | if ( !(nTRM==3 && iTDC>12 && iTDC<14 && nDDL%2==1) ) { | |
917 | AliWarning("Call this function only if(nTRM==3 && iTDC>12 && iTDC<14) "); | |
918 | return kFALSE; | |
919 | } | |
920 | //if (nTRM==3 && iTDC>12 && iTDC<14 && nDDL%2==1) { // DDL number to LTM number mapping | |
921 | ||
922 | UInt_t iLTMindex=0; | |
923 | UInt_t iChannelindex=0; | |
924 | switch(nDDL%AliTOFGeometry::NDDL()) { | |
925 | case 1: | |
926 | iLTMindex=1; | |
927 | break; | |
928 | case 3: | |
929 | iLTMindex=36; | |
930 | break; | |
931 | default: | |
932 | AliError("something wrong"); | |
933 | break; | |
934 | } | |
935 | iLTMindex+=2*(Int_t)(nDDL/AliTOFGeometry::NDDL()); | |
936 | ||
937 | if (iChain==1) return kFALSE; // AdC | |
938 | ||
939 | if (nDDL<36) | |
940 | iLTMindex--; | |
941 | if (nDDL>=36) | |
942 | iLTMindex++; | |
943 | iChannelindex=iCH+iTDC*AliTOFGeometry::NCh()-12*AliTOFGeometry::NCh(); | |
944 | Int_t index[2]={iLTMindex,iChannelindex}; | |
5cd96e39 | 945 | return (index[0]<36)?fCTTMmatrixFront[index[0]][index[1]]:fCTTMmatrixBack[index[0]-36][index[1]]; |
ee51d470 | 946 | |
947 | } | |
948 | ||
949 | //------------------------------------------------------------------------- | |
950 | ||
951 | void AliTOFTrigger::CreateCTTMMatrix() { | |
952 | // | |
953 | // Create CTTM bit map | |
954 | // | |
a6ec5bf6 | 955 | Int_t fromTriggertoDCS[72] = {0,1,4,5,8,9,12,13,16,17,20,21,24,25,28,29,32,33,36,37,40,41,44,45,48,49,52,53,56,57,60,61,64,65,68,69,3, |
956 | 2,7,6,11,10,15,14,19,18,23,22,27,26,31,30,35,34,39,38,43,42,47,46,51,50,55,54,59,58,63,62,67,66,71,70}; | |
957 | ||
958 | ||
c06f660b | 959 | fNMaxipadOnAll=0; |
960 | fNMaxipadOn=0; | |
961 | ||
962 | for(Int_t i = 0; i<kNLTM;i++){ | |
963 | UInt_t currentMask = fPowerMask[kNCTTMchannels]-1; | |
a6ec5bf6 | 964 | if(fTOFTrigMask) currentMask=fTOFTrigMask->GetTriggerMask(fromTriggertoDCS[i]); |
c06f660b | 965 | if(i<kNCTTM){ |
966 | for(Int_t j = 0; j<kNCTTMchannels;j++){ | |
967 | fCTTMmatrixFront[i][j]=fLTMmatrix[i][2*j]||fLTMmatrix[i][2*j+1]; | |
968 | if(fCTTMmatrixFront[i][j]) fNMaxipadOnAll++; | |
969 | if(!(currentMask & fPowerMask[j])) fCTTMmatrixFront[i][j]=0; | |
c11d3763 | 970 | if(fCTTMmatrixFront[i][j]){ |
971 | fNMaxipadOn++; | |
972 | fLTMarray[i] = kTRUE; | |
973 | } | |
c06f660b | 974 | } |
975 | } | |
976 | else{ | |
977 | for(Int_t j = 0; j<kNCTTMchannels;j++){ | |
978 | fCTTMmatrixBack[i-kNCTTM][j]=fLTMmatrix[i][2*j]||fLTMmatrix[i][2*j+1];; | |
979 | if(fCTTMmatrixBack[i-kNCTTM][j]) fNMaxipadOnAll++; | |
980 | if(!(currentMask & fPowerMask[j])) fCTTMmatrixBack[i-kNCTTM][j]=0; | |
c11d3763 | 981 | if(fCTTMmatrixBack[i-kNCTTM][j]){ |
982 | fNMaxipadOn++; | |
983 | fLTMarray[i-kNCTTM] = kTRUE; | |
984 | } | |
c06f660b | 985 | } |
986 | } | |
ee51d470 | 987 | } |
c11d3763 | 988 | |
989 | fNCrateOn = 0; | |
990 | for(Int_t j=0; j < kNCTTM; j++) {if(fLTMarray[j]) fNCrateOn++;} | |
991 | ||
ee51d470 | 992 | } |
993 | //----------------------------------------------------------------------------- | |
994 | ||
995 | void AliTOFTrigger::GetCTTMIndex(Int_t *detind, Int_t *indexCTTM) { | |
996 | // | |
42e171ac | 997 | // Returns CTTM index corresponding to the detector element detind |
ee51d470 | 998 | // |
999 | ||
1000 | GetLTMIndex(detind,indexCTTM); | |
1001 | indexCTTM[1]/=2; | |
1002 | ||
cd82ed2f | 1003 | } |
c06f660b | 1004 | //----------------------------------------------------------------------------- |
1005 | void AliTOFTrigger::LoadActiveMask(){ | |
1006 | // | |
1007 | // Load OCDB current mask | |
1008 | // | |
c11d3763 | 1009 | |
1010 | AliCDBManager *cdb = AliCDBManager::Instance(); | |
1011 | if(cdb->GetRun() < 0 || !(cdb->GetDefaultStorage())){ | |
1012 | if(!(cdb->GetDefaultStorage())){ | |
1013 | cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); | |
1014 | printf("AliTOFTrigger (WARNING): probably CDB first instance - Default Sorage set to \"local://$ALICE_ROOT/OCDB\"\n"); | |
1015 | } | |
1016 | if(cdb->GetRun() < 0){ | |
1017 | cdb->SetRun(0); | |
1018 | printf("AliTOFTrigger (WARNING): probably CDB first instance - number of run set to 0\n"); | |
1019 | } | |
1020 | } | |
de40f9c1 | 1021 | |
c11d3763 | 1022 | AliCDBEntry *cdbe = cdb->Get("TRIGGER/TOF/TriggerMask"); |
de40f9c1 | 1023 | if(!cdbe) return; |
c11d3763 | 1024 | fTOFTrigMask= (AliTOFTriggerMask *)cdbe->GetObject(); |
c06f660b | 1025 | |
c11d3763 | 1026 | // UInt_t maskArray[kNLTM]; |
1027 | // if(fTOFTrigMask == NULL) fTOFTrigMask = new AliTOFTriggerMask(); | |
1028 | // for (Int_t k = 0; k < kNLTM ; k++) maskArray[k] = fPowerMask[kNCTTMchannels]-1; | |
1029 | // //for (Int_t k = 0; k < kNLTM ; k+=2) maskArray[k] = 0; | |
1030 | ||
1031 | // fTOFTrigMask->SetTriggerMaskArray(maskArray); | |
c06f660b | 1032 | } |
1033 | ||
1034 | ||
1035 | //----------------------------------------------------------------------------- | |
1036 | AliTOFTrigger::~AliTOFTrigger() | |
1037 | { | |
1038 | // dtor | |
1039 | ||
c06f660b | 1040 | } |
1041 | ||
1042 | //----------------------------------------------------------------------------- | |
1043 | AliTOFTrigger& AliTOFTrigger::operator=(const AliTOFTrigger &/*source*/) | |
1044 | { | |
1045 | // ass. op. | |
1046 | return *this; | |
1047 | ||
1048 | } | |
c11d3763 | 1049 |