]>
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 | ///////////////////////////////////////////////////////////////////// | |
19 | // | |
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 | // | |
27 | ///////////////////////////////////////////////////////////////////// | |
28 | ||
7ca4655f | 29 | #include <TClonesArray.h> |
30 | ||
cd82ed2f | 31 | #include "AliLoader.h" |
0e46b9ae | 32 | #include "AliLog.h" |
cd82ed2f | 33 | #include "AliRunLoader.h" |
0e46b9ae | 34 | #include "AliRun.h" |
cd82ed2f | 35 | #include "AliTriggerInput.h" |
0e46b9ae | 36 | |
cd82ed2f | 37 | #include "AliTOFdigit.h" |
0e46b9ae | 38 | #include "AliTOFTrigger.h" |
cd82ed2f | 39 | |
0e46b9ae | 40 | extern AliRun* gAlice; |
cd82ed2f | 41 | |
42 | //------------------------------------------------------------------------- | |
43 | ClassImp(AliTOFTrigger) | |
44 | ||
45 | //---------------------------------------------------------------------- | |
46 | AliTOFTrigger::AliTOFTrigger() : | |
47 | AliTriggerDetector(), | |
48 | fHighMultTh(1000), | |
49 | fppMBTh(4), | |
50 | fMultiMuonTh(2), | |
51 | fUPTh(2), | |
52 | fdeltaminpsi(150), | |
53 | fdeltamaxpsi(170), | |
54 | fdeltaminro(70), | |
55 | fdeltamaxro(110), | |
56 | fstripWindow(2) | |
57 | { | |
58 | //main ctor | |
59 | for (Int_t i=0;i<kNLTM;i++){ | |
60 | for (Int_t j=0;j<kNLTMchannels;j++){ | |
61 | fLTMmatrix[i][j]=kFALSE; | |
62 | } | |
63 | if (i<kNCTTM){ | |
64 | for (Int_t j=0;j<kNCTTMchannels;j++){ | |
65 | fCTTMmatrixFront[i][j]=kFALSE; | |
66 | fCTTMmatrixBack[i][j]=kFALSE; | |
67 | } | |
68 | } | |
69 | } | |
70 | SetName("TOF"); | |
71 | CreateInputs(); | |
72 | } | |
73 | //---------------------------------------------------------------------- | |
655e379f | 74 | 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) : |
75 | AliTriggerDetector(), | |
76 | fHighMultTh(HighMultTh), | |
77 | fppMBTh(ppMBTh), | |
78 | fMultiMuonTh(MultiMuonTh), | |
79 | fUPTh(UPTh), | |
80 | fdeltaminpsi(deltaminpsi), | |
81 | fdeltamaxpsi(deltamaxpsi), | |
82 | fdeltaminro(deltaminro), | |
83 | fdeltamaxro(deltamaxro), | |
84 | fstripWindow(stripWindow) | |
85 | ||
cd82ed2f | 86 | { |
87 | //ctor with thresholds for triggers | |
cd82ed2f | 88 | for (Int_t i=0;i<kNLTM;i++){ |
89 | for (Int_t j=0;j<kNLTMchannels;j++){ | |
90 | fLTMmatrix[i][j]=kFALSE; | |
91 | } | |
92 | if (i<kNCTTM){ | |
93 | for (Int_t j=0;j<kNCTTMchannels;j++){ | |
94 | fCTTMmatrixFront[i][j]=kFALSE; | |
95 | fCTTMmatrixBack[i][j]=kFALSE; | |
96 | } | |
97 | } | |
98 | } | |
99 | SetName("TOF"); | |
100 | CreateInputs(); | |
101 | } | |
102 | ||
103 | //____________________________________________________________________________ | |
104 | ||
655e379f | 105 | AliTOFTrigger::AliTOFTrigger(const AliTOFTrigger & tr): |
8a190ba2 | 106 | AliTriggerDetector(tr), |
107 | fHighMultTh(tr.fHighMultTh), | |
108 | fppMBTh(tr.fppMBTh), | |
109 | fMultiMuonTh(tr.fMultiMuonTh), | |
110 | fUPTh(tr.fUPTh), | |
111 | fdeltaminpsi(tr.fdeltaminpsi), | |
112 | fdeltamaxpsi(tr.fdeltamaxpsi), | |
113 | fdeltaminro(tr.fdeltaminro), | |
114 | fdeltamaxro(tr.fdeltamaxro), | |
115 | fstripWindow(tr.fstripWindow) | |
cd82ed2f | 116 | { |
117 | //copy ctor | |
cd82ed2f | 118 | for (Int_t i=0;i<kNLTM;i++){ |
119 | for (Int_t j=0;j<kNLTMchannels;j++){ | |
120 | fLTMmatrix[i][j]=tr.fLTMmatrix[i][j]; | |
121 | } | |
122 | if (i<kNCTTM){ | |
123 | for (Int_t j=0;j<kNCTTMchannels;j++){ | |
124 | fCTTMmatrixFront[i][j]=tr.fCTTMmatrixFront[i][j]; | |
125 | fCTTMmatrixBack[i][j]=tr.fCTTMmatrixBack[i][j]; | |
126 | } | |
127 | } | |
128 | } | |
129 | SetName(tr.GetName()); | |
130 | CreateInputs(); | |
131 | //fInputs=&(tr.GetInputs()); | |
132 | } | |
133 | ||
134 | //---------------------------------------------------------------------- | |
135 | ||
136 | void AliTOFTrigger::CreateInputs() | |
137 | { | |
138 | // creating inputs | |
139 | // Do not create inputs again!! | |
140 | if( fInputs.GetEntriesFast() > 0 ) return; | |
141 | ||
572b6f20 | 142 | fInputs.AddLast(new AliTriggerInput("TOF_Cosmic_MultiMuon_L0","TOF",0)); |
143 | fInputs.AddLast(new AliTriggerInput("TOF_pp_MB_L0","TOF",0)); | |
144 | fInputs.AddLast(new AliTriggerInput("TOF_UltraPer_Coll_L0","TOF",0)); | |
cd82ed2f | 145 | |
572b6f20 | 146 | fInputs.AddLast(new AliTriggerInput("TOF_High_Mult_L0","TOF",0)); |
147 | fInputs.AddLast(new AliTriggerInput("TOF_Jet_L1","TOF",0)); | |
cd82ed2f | 148 | } |
149 | ||
150 | //---------------------------------------------------------------------- | |
151 | void AliTOFTrigger::Trigger(){ | |
152 | //triggering method | |
153 | CreateLTMMatrix(); | |
154 | Int_t nchonFront = 0; | |
155 | Int_t nchonBack = 0; | |
156 | Int_t nchonTot = 0; | |
157 | Int_t nchonFrontBack = 0; | |
158 | Int_t nchonFront1 = 0; | |
159 | Int_t nchonBack1 = 0; | |
160 | Int_t nchonFrontBack1 = 0; | |
161 | Int_t mindeltapsi = (Int_t)fdeltaminpsi/10; | |
162 | Int_t maxdeltapsi = (Int_t)fdeltamaxpsi/10; | |
163 | Int_t mindeltaro = (Int_t)fdeltaminro/10; | |
164 | Int_t maxdeltaro = (Int_t)fdeltamaxro/10; | |
165 | for (Int_t i=0;i<kNCTTM;i++){ | |
166 | for (Int_t j=0;j<kNCTTMchannels;j++){ | |
167 | fCTTMmatrixFront[i][j]=kFALSE; | |
168 | fCTTMmatrixBack[i][j]=kFALSE; | |
169 | } | |
170 | } | |
171 | for (Int_t i=0;i<kNCTTM;i++){ | |
172 | for (Int_t j=0;j<kNCTTMchannels;j++){ | |
173 | fCTTMmatrixFront[i][j] = (fLTMmatrix[i][j*2] || fLTMmatrix[i][j*2+1]); | |
174 | if (fCTTMmatrixFront[i][j]) nchonFront++; | |
175 | } | |
176 | } | |
177 | ||
178 | for (Int_t i=kNCTTM;i<(kNCTTM*2);i++){ | |
179 | for (Int_t j=0;j<kNCTTMchannels;j++){ | |
180 | fCTTMmatrixBack[i-kNCTTM][j] = (fLTMmatrix[i][j*2] || fLTMmatrix[i][j*2+1]); | |
181 | if (fCTTMmatrixBack[i-kNCTTM][j]) nchonBack++; | |
182 | } | |
183 | } | |
184 | ||
185 | nchonTot = nchonFront + nchonBack; | |
186 | ||
187 | //pp Minimum Bias Trigger | |
188 | if (nchonTot >= fppMBTh) { | |
189 | SetInput("TOF_pp_MB_L0"); | |
190 | } | |
191 | ||
192 | //High Multiplicity Trigger | |
193 | if (nchonTot >= fHighMultTh) { | |
194 | SetInput("TOF_High_Mult_L0"); | |
195 | } | |
196 | ||
197 | ||
198 | //MultiMuon Trigger | |
199 | nchonFront = 0; | |
200 | nchonBack = 0; | |
201 | nchonFrontBack = 0; | |
202 | ||
203 | Bool_t boolCTTMor = kFALSE; | |
204 | ||
205 | for (Int_t i=0;i<(kNCTTM/2);i++){ | |
206 | Int_t iopp = i+kNCTTM/2; | |
207 | for (Int_t j=0;j<kNCTTMchannels;j++){ | |
208 | if (fCTTMmatrixFront[i][j]){ | |
209 | Int_t minj = j-fstripWindow; | |
210 | Int_t maxj = j+fstripWindow; | |
211 | if (minj<0) minj =0; | |
212 | if (maxj>=kNCTTMchannels) maxj = kNCTTMchannels-1; | |
213 | boolCTTMor = kFALSE; | |
214 | for (Int_t k = minj;k<=maxj;k++){ | |
215 | boolCTTMor |= fCTTMmatrixFront[iopp][k]; | |
216 | } | |
217 | if (boolCTTMor) { | |
218 | nchonFront++; | |
219 | } | |
220 | } | |
221 | ||
222 | if (fCTTMmatrixBack[i][j]){ | |
223 | Int_t minj = j-fstripWindow; | |
224 | Int_t maxj = j+fstripWindow; | |
225 | if (minj<0) minj =0; | |
226 | if (maxj>=kNCTTMchannels) maxj =kNCTTMchannels-1; | |
227 | boolCTTMor = kFALSE; | |
228 | for (Int_t k = minj;k<=maxj;k++){ | |
229 | boolCTTMor |= fCTTMmatrixBack[iopp][k]; | |
230 | } | |
231 | if (boolCTTMor) { | |
232 | nchonBack++; | |
233 | } | |
234 | } | |
235 | } | |
236 | } | |
237 | ||
238 | nchonFrontBack = nchonFront+nchonBack; | |
239 | ||
240 | nchonFront1 = 0; | |
241 | nchonBack1 = 0; | |
242 | nchonFrontBack1 = 0; | |
243 | ||
244 | boolCTTMor = kFALSE; | |
245 | for (Int_t i=0;i<(kNCTTM/2);i++){ | |
246 | Int_t i2max = (kNCTTM-1)-i+1; | |
247 | Int_t i2min = (kNCTTM-1)-i-1; | |
248 | if (i2max >=kNCTTM) i2max = kNCTTM-1; | |
249 | if (i2min==i) i2min = kNCTTM-1-i; | |
250 | for (Int_t j=0;j<kNCTTMchannels;j++){ | |
251 | Int_t j2min = j-fstripWindow; | |
252 | Int_t j2max = j+fstripWindow; | |
253 | if (j2min<0) j2min =0; | |
254 | if (j2max>=kNCTTMchannels) j2max =kNCTTMchannels-1; | |
255 | if (fCTTMmatrixFront[i][j]){ | |
256 | boolCTTMor = kFALSE; | |
257 | for (Int_t i2=i2min;i2<=i2max;i2++){ | |
258 | for (Int_t j2 = j2min;j2<=j2max;j2++){ | |
259 | boolCTTMor |= fCTTMmatrixFront[i2][j2]; | |
260 | } | |
261 | if (boolCTTMor) { | |
262 | nchonFront++; | |
263 | } | |
264 | } | |
265 | } | |
266 | if (fCTTMmatrixBack[i][j]){ | |
267 | boolCTTMor = kFALSE; | |
268 | for (Int_t i2=i2min;i2<=i2max;i2++){ | |
269 | for (Int_t j2 = j2min;j2<=j2max;j2++){ | |
270 | boolCTTMor |= fCTTMmatrixBack[i2][j2]; | |
271 | } | |
272 | } | |
273 | if (boolCTTMor) { | |
274 | nchonBack++; | |
275 | } | |
276 | } | |
277 | } | |
278 | } | |
279 | ||
280 | nchonFrontBack1 = nchonFront1+nchonBack1; | |
281 | ||
282 | if (nchonFrontBack >= fMultiMuonTh || nchonFrontBack1 >= fMultiMuonTh) { | |
283 | SetInput("TOF_Cosmic_MultiMuon_L0"); | |
284 | } | |
285 | ||
286 | //Ultra-Peripheral collision Trigger | |
287 | Bool_t boolpsi = kFALSE; | |
288 | Bool_t boolro = kFALSE; | |
289 | if (nchonTot == fUPTh){ | |
290 | for (Int_t i=0;i<kNCTTM;i++){ | |
291 | for (Int_t j=0;j<kNCTTMchannels;j++){ | |
292 | Int_t minipsi = i+mindeltapsi; | |
293 | Int_t maxipsi = i+maxdeltapsi; | |
294 | if (minipsi>=kNCTTM) minipsi = mindeltapsi-((kNCTTM-1)-i)-1; | |
295 | if (maxipsi>=kNCTTM) maxipsi = maxdeltapsi-((kNCTTM-1)-i)-1; | |
296 | Int_t miniro = i+mindeltaro; | |
297 | Int_t maxiro = i+maxdeltaro; | |
298 | if (miniro>=kNCTTM) miniro = mindeltaro-((kNCTTM-1)-i)-1; | |
299 | if (maxiro>=kNCTTM) maxiro = maxdeltaro-((kNCTTM-1)-i)-1; | |
300 | Int_t j2min = j-fstripWindow; | |
301 | Int_t j2max = j+fstripWindow; | |
302 | if (j2min<0) j2min =0; | |
303 | if (j2max>=kNCTTMchannels) j2max =kNCTTMchannels-1; | |
304 | if (fCTTMmatrixFront[i][j]){ | |
305 | for (Int_t i2=minipsi;i2<=maxipsi;i2++){ | |
306 | for (Int_t j2 = j2min;j2<=j2max;j2++){ | |
307 | if (fCTTMmatrixFront[i2][j2]) { | |
308 | SetInput("TOF_UltraPer_Coll_L0"); | |
309 | boolpsi = kTRUE; | |
310 | //exiting loops | |
311 | j2 = j2max+1; | |
312 | i2 = maxipsi+1; | |
313 | j=kNCTTMchannels; | |
314 | i=kNCTTM; | |
315 | } | |
316 | } | |
317 | } | |
318 | if (!boolpsi){ | |
319 | for (Int_t i2=miniro;i2<=maxiro;i2++){ | |
320 | for (Int_t j2 = j2min;j2<=j2max;j2++){ | |
321 | if (fCTTMmatrixFront[i2][j2]) { | |
322 | SetInput("TOF_UltraPer_Coll_L0"); | |
323 | boolro = kTRUE; | |
324 | //exiting loops | |
325 | j2 = j2max+1; | |
326 | i2 = maxiro+1; | |
327 | j=kNCTTMchannels; | |
328 | i=kNCTTM; | |
329 | } | |
330 | } | |
331 | } | |
332 | } | |
333 | } | |
334 | ||
335 | else if (fCTTMmatrixBack[i][j]){ | |
336 | for (Int_t i2=minipsi;i2<=maxipsi;i2++){ | |
337 | for (Int_t j2 = j2min;j2<=j2max;j2++){ | |
338 | if (fCTTMmatrixBack[i2][j2]) { | |
339 | SetInput("TOF_UltraPer_Coll_L0"); | |
340 | boolpsi = kTRUE; | |
341 | //exiting loops | |
342 | j2 = j2max+1; | |
343 | i2 = maxipsi+1; | |
344 | j=kNCTTMchannels; | |
345 | i=kNCTTM; | |
346 | } | |
347 | } | |
348 | } | |
349 | if (!boolpsi){ | |
350 | for (Int_t i2=miniro;i2<=maxiro;i2++){ | |
351 | for (Int_t j2 = j2min;j2<=j2max;j2++){ | |
352 | if (fCTTMmatrixBack[i2][j2]) { | |
353 | SetInput("TOF_UltraPer_Coll_L0"); | |
354 | boolro = kTRUE; | |
355 | //exiting loops | |
356 | j2 = j2max+1; | |
357 | i2 = maxiro+1; | |
358 | j=kNCTTMchannels; | |
359 | i=kNCTTM; | |
360 | } | |
361 | } | |
362 | } | |
363 | } | |
364 | } | |
365 | } | |
366 | } | |
367 | } | |
368 | } | |
369 | //----------------------------------------------------------------------------- | |
370 | void AliTOFTrigger::CreateLTMMatrix(){ | |
371 | //creating LTMMatrix | |
372 | //initialization | |
373 | for (Int_t i=0;i<kNLTM;i++){ | |
374 | for (Int_t j=0;j<kNLTMchannels;j++){ | |
375 | fLTMmatrix[i][j]=kFALSE; | |
376 | } | |
377 | } | |
378 | AliRunLoader *rl; | |
33c3c91a | 379 | rl = AliRunLoader::Instance(); |
cd82ed2f | 380 | |
381 | Int_t ncurrevent = rl->GetEventNumber(); | |
382 | rl->GetEvent(ncurrevent); | |
383 | ||
384 | AliLoader * tofLoader = rl->GetLoader("TOFLoader"); | |
385 | ||
386 | tofLoader->LoadDigits("read"); | |
387 | TTree *treeD = tofLoader->TreeD(); | |
388 | if (treeD == 0x0) | |
389 | { | |
390 | AliFatal("AliTOFTrigger: Can not get TreeD"); | |
391 | } | |
392 | ||
393 | TBranch *branch = treeD->GetBranch("TOF"); | |
394 | if (!branch) { | |
395 | AliError("can't get the branch with the TOF digits !"); | |
396 | return; | |
397 | } | |
398 | TClonesArray *tofDigits =new TClonesArray("AliTOFdigit", 1000); | |
399 | branch->SetAddress(&tofDigits); | |
400 | treeD->GetEvent(0); | |
401 | Int_t ndigits = tofDigits->GetEntriesFast(); | |
402 | Int_t detind[5]; //detector indexes: 0 -> sector | |
403 | // 1 -> plate | |
404 | // 2 -> strip | |
405 | // 3 -> padz | |
406 | // 4 -> padx | |
407 | ||
408 | for (Int_t i=0;i<ndigits;i++){ | |
409 | AliTOFdigit * digit = (AliTOFdigit*)tofDigits->UncheckedAt(i); | |
410 | detind[0] = digit->GetSector(); | |
411 | detind[1] = digit->GetPlate(); | |
412 | detind[2] = digit->GetStrip(); | |
413 | detind[3] = digit->GetPadz(); | |
414 | detind[4] = digit->GetPadx(); | |
415 | ||
416 | Int_t indexLTM[2] = {-1,-1}; | |
417 | GetLTMIndex(detind,indexLTM); | |
418 | ||
419 | fLTMmatrix[indexLTM[0]][indexLTM[1]] = kTRUE; | |
420 | } | |
421 | ||
28751b82 | 422 | tofLoader->UnloadDigits(); |
169674cd | 423 | // rl->UnloadgAlice(); |
cd82ed2f | 424 | } |
425 | //----------------------------------------------------------------------------- | |
426 | void AliTOFTrigger::GetLTMIndex(Int_t *detind, Int_t *indexLTM){ | |
427 | //getting LTMmatrix indexes for current digit | |
428 | if (detind[1]==0 || detind[1]==1 || (detind[1]==2 && detind[2]<=7)) { | |
429 | if (detind[4]<24){ | |
430 | indexLTM[0] = detind[0]*2; | |
431 | } | |
432 | else { | |
433 | indexLTM[0] = detind[0]*2+1; | |
434 | } | |
435 | } | |
436 | else { | |
437 | if (detind[4]<24){ | |
438 | indexLTM[0] = detind[0]*2+36; | |
439 | } | |
440 | else { | |
441 | indexLTM[0] = (detind[0]*2+1)+36; | |
442 | } | |
443 | } | |
444 | ||
445 | if (indexLTM[0]<36){ | |
446 | if (detind[1] ==0){ | |
447 | indexLTM[1] = detind[2]; | |
448 | } | |
449 | else if (detind[1] ==1){ | |
450 | indexLTM[1] = detind[2]+19; | |
451 | } | |
452 | else if (detind[1] ==2){ | |
2901911a | 453 | indexLTM[1] = detind[2]+19*2; |
cd82ed2f | 454 | } |
455 | else{ | |
456 | AliError("Smth Wrong!!!"); | |
457 | } | |
458 | } | |
459 | else { | |
460 | if (detind[1] ==2){ | |
461 | indexLTM[1] = detind[2]-8; | |
462 | } | |
463 | else if (detind[1] ==3){ | |
464 | indexLTM[1] = detind[2]+7; | |
465 | } | |
466 | else if (detind[1] ==4){ | |
467 | indexLTM[1] = detind[2]+26; | |
468 | } | |
469 | else{ | |
470 | AliError("Smth Wrong!!!"); | |
471 | } | |
472 | } | |
473 | } | |
474 |