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