]>
Commit | Line | Data |
---|---|---|
1 | /* $Id: AliTriggerAnalysis.cxx 35782 2009-10-22 11:54:31Z jgrosseo $ */ | |
2 | ||
3 | /************************************************************************** | |
4 | * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. * | |
5 | * * | |
6 | * Author: The ALICE Off-line Project. * | |
7 | * Contributors are mentioned in the code where appropriate. * | |
8 | * * | |
9 | * Permission to use, copy, modify and distribute this software and its * | |
10 | * documentation strictly for non-commercial purposes is hereby granted * | |
11 | * without fee, provided that the above copyright notice appears in all * | |
12 | * copies and that both the copyright notice and this permission notice * | |
13 | * appear in the supporting documentation. The authors make no claims * | |
14 | * about the suitability of this software for any purpose. It is * | |
15 | * provided "as is" without express or implied warranty. * | |
16 | **************************************************************************/ | |
17 | ||
18 | //------------------------------------------------------------------------- | |
19 | // Implementation of Class AliTriggerAnalysis | |
20 | // This class provides function to check if events have been triggered based on the data in the ESD | |
21 | // The trigger bits, trigger class inputs and only the data (offline trigger) can be used | |
22 | // Origin: Jan Fiete Grosse-Oetringhaus, CERN | |
23 | //------------------------------------------------------------------------- | |
24 | ||
25 | #include <Riostream.h> | |
26 | #include <TH1F.h> | |
27 | #include <TH2F.h> | |
28 | #include <TList.h> | |
29 | #include <TIterator.h> | |
30 | #include "TParameter.h" | |
31 | #include <TMap.h> | |
32 | #include <TRandom.h> | |
33 | ||
34 | #include <AliTriggerAnalysis.h> | |
35 | ||
36 | #include <AliLog.h> | |
37 | #include <AliAnalysisManager.h> | |
38 | ||
39 | #include <AliESDEvent.h> | |
40 | ||
41 | #include <AliMultiplicity.h> | |
42 | #include <AliESDVZERO.h> | |
43 | #include <AliESDZDC.h> | |
44 | #include <AliESDFMD.h> | |
45 | #include <AliESDVertex.h> | |
46 | #include <AliESDtrackCuts.h> | |
47 | ||
48 | ClassImp(AliTriggerAnalysis) | |
49 | ||
50 | AliTriggerAnalysis::AliTriggerAnalysis() : | |
51 | fSPDGFOThreshold(2), | |
52 | fSPDGFOEfficiency(0), | |
53 | fV0TimeOffset(0), | |
54 | fV0AdcThr(0), | |
55 | fV0HwAdcThr(2.5), | |
56 | fV0HwWinLow(61.5), | |
57 | fV0HwWinHigh(86.5), | |
58 | fZDCCutRefSum(-568.5), | |
59 | fZDCCutRefDelta(-2.1), | |
60 | fZDCCutSigmaSum(3.25), | |
61 | fZDCCutSigmaDelta(2.25), | |
62 | fZDCCutRefSumCorr(-65.5), | |
63 | fZDCCutRefDeltaCorr(-2.1), | |
64 | fZDCCutSigmaSumCorr(6.0), | |
65 | fZDCCutSigmaDeltaCorr(1.2), | |
66 | fASPDCvsTCut(65), | |
67 | fBSPDCvsTCut(4), | |
68 | fDoFMD(kTRUE), | |
69 | fFMDLowCut(0.2), | |
70 | fFMDHitCut(0.5), | |
71 | fHistBitsSPD(0), | |
72 | fHistFiredBitsSPD(0), | |
73 | fHistSPDClsVsTrk(0), | |
74 | fHistV0A(0), | |
75 | fHistV0C(0), | |
76 | fHistZDC(0), | |
77 | fHistTDCZDC(0), | |
78 | fHistTimeZDC(0), | |
79 | fHistTimeCorrZDC(0), | |
80 | fHistFMDA(0), | |
81 | fHistFMDC(0), | |
82 | fHistFMDSingle(0), | |
83 | fHistFMDSum(0), | |
84 | fHistT0(0), | |
85 | fTriggerClasses(0), | |
86 | fMC(kFALSE), | |
87 | fEsdTrackCuts(0), | |
88 | fTPCOnly(kFALSE) | |
89 | { | |
90 | // constructor | |
91 | } | |
92 | ||
93 | AliTriggerAnalysis::~AliTriggerAnalysis() | |
94 | { | |
95 | // destructor | |
96 | ||
97 | if (fHistBitsSPD) | |
98 | { | |
99 | delete fHistBitsSPD; | |
100 | fHistBitsSPD = 0; | |
101 | } | |
102 | ||
103 | if (fHistFiredBitsSPD) | |
104 | { | |
105 | delete fHistFiredBitsSPD; | |
106 | fHistFiredBitsSPD = 0; | |
107 | } | |
108 | ||
109 | if (fHistSPDClsVsTrk) | |
110 | { | |
111 | delete fHistSPDClsVsTrk; | |
112 | fHistSPDClsVsTrk = 0; | |
113 | } | |
114 | ||
115 | if (fHistV0A) | |
116 | { | |
117 | delete fHistV0A; | |
118 | fHistV0A = 0; | |
119 | } | |
120 | ||
121 | if (fHistV0C) | |
122 | { | |
123 | delete fHistV0C; | |
124 | fHistV0C = 0; | |
125 | } | |
126 | ||
127 | if (fHistZDC) | |
128 | { | |
129 | delete fHistZDC; | |
130 | fHistZDC = 0; | |
131 | } | |
132 | if (fHistTDCZDC) | |
133 | { | |
134 | delete fHistTDCZDC; | |
135 | fHistTDCZDC = 0; | |
136 | } | |
137 | if (fHistTimeZDC) | |
138 | { | |
139 | delete fHistTimeZDC; | |
140 | fHistTimeZDC = 0; | |
141 | } | |
142 | if (fHistTimeCorrZDC) | |
143 | { | |
144 | delete fHistTimeCorrZDC; | |
145 | fHistTimeCorrZDC = 0; | |
146 | } | |
147 | ||
148 | if (fHistFMDA) | |
149 | { | |
150 | delete fHistFMDA; | |
151 | fHistFMDA = 0; | |
152 | } | |
153 | ||
154 | if (fHistFMDC) | |
155 | { | |
156 | delete fHistFMDC; | |
157 | fHistFMDC = 0; | |
158 | } | |
159 | ||
160 | if (fHistFMDSingle) | |
161 | { | |
162 | delete fHistFMDSingle; | |
163 | fHistFMDSingle = 0; | |
164 | } | |
165 | ||
166 | if (fHistFMDSum) | |
167 | { | |
168 | delete fHistFMDSum; | |
169 | fHistFMDSum = 0; | |
170 | } | |
171 | ||
172 | if (fHistT0) | |
173 | { | |
174 | delete fHistT0; | |
175 | fHistT0 = 0; | |
176 | } | |
177 | ||
178 | if (fTriggerClasses) | |
179 | { | |
180 | fTriggerClasses->DeleteAll(); | |
181 | delete fTriggerClasses; | |
182 | fTriggerClasses = 0; | |
183 | } | |
184 | ||
185 | if (fEsdTrackCuts){ | |
186 | delete fEsdTrackCuts; | |
187 | fEsdTrackCuts =0; | |
188 | } | |
189 | } | |
190 | ||
191 | void AliTriggerAnalysis::EnableHistograms() | |
192 | { | |
193 | // creates the monitoring histograms | |
194 | ||
195 | // do not add this hists to the directory | |
196 | Bool_t oldStatus = TH1::AddDirectoryStatus(); | |
197 | TH1::AddDirectory(kFALSE); | |
198 | ||
199 | fHistBitsSPD = new TH2F("fHistBitsSPD", "SPD GFO;number of fired chips (offline);number of fired chips (hardware)", 1202, -1.5, 1200.5, 1202, -1.5, 1200.5); | |
200 | fHistFiredBitsSPD = new TH1F("fHistFiredBitsSPD", "SPD GFO Hardware;chip number;events", 1200, -0.5, 1199.5); | |
201 | fHistSPDClsVsTrk = new TH2F("fHistSPDClsVsTrk", "SPD Clusters vs Tracklets", 300, -0.5, 2999.5, 1000, -0.5, 9999.5); | |
202 | fHistV0A = new TH1F("fHistV0A", "V0A;leading time (ns);events", 400, -100, 100); | |
203 | fHistV0C = new TH1F("fHistV0C", "V0C;leading time (ns);events", 400, -100, 100); | |
204 | fHistZDC = new TH1F("fHistZDC", "ZDC;trigger bits;events", 8, -1.5, 6.5); | |
205 | fHistTDCZDC = new TH1F("fHistTDCZDC", "ZDC;TDC bits;events", 32, -0.5, 32-0.5); | |
206 | fHistTimeZDC = new TH2F("fHistTimeZDC", "ZDC;TDC timing A+C vs C-A; events", 120,-30,30,120,-600,-540); | |
207 | fHistTimeCorrZDC = new TH2F("fHistTimeCorrZDC", "ZDC;Corrected TDC timing A+C vs C-A; events", 120,-30,30,260,-100,30); | |
208 | ||
209 | // TODO check limits | |
210 | fHistFMDA = new TH1F("fHistFMDA", "FMDA;combinations above threshold;events", 102, -1.5, 100.5); | |
211 | fHistFMDC = new TH1F("fHistFMDC", "FMDC;combinations above threshold;events", 102, -1.5, 100.5); | |
212 | fHistFMDSingle = new TH1F("fHistFMDSingle", "FMD single;multiplicity value;counts", 1000, 0, 10); | |
213 | fHistFMDSum = new TH1F("fHistFMDSum", "FMD sum;multiplicity value;counts", 1000, 0, 10); | |
214 | fHistT0 = new TH1F("fHistT0", "T0;time (ns);events", 100, -25, 25); | |
215 | ||
216 | fTriggerClasses = new TMap; | |
217 | fTriggerClasses->SetOwner(); | |
218 | ||
219 | TH1::AddDirectory(oldStatus); | |
220 | } | |
221 | ||
222 | //____________________________________________________________________ | |
223 | const char* AliTriggerAnalysis::GetTriggerName(Trigger trigger) | |
224 | { | |
225 | // returns the name of the requested trigger | |
226 | // the returned string will only be valid until the next call to this function [not thread-safe] | |
227 | ||
228 | static TString str; | |
229 | ||
230 | UInt_t triggerNoFlags = (UInt_t) trigger % (UInt_t) kStartOfFlags; | |
231 | ||
232 | switch (triggerNoFlags) | |
233 | { | |
234 | case kAcceptAll : str = "ACCEPT ALL (bypass!)"; break; | |
235 | case kMB1 : str = "MB1"; break; | |
236 | case kMB2 : str = "MB2"; break; | |
237 | case kMB3 : str = "MB3"; break; | |
238 | case kSPDGFO : str = "SPD GFO"; break; | |
239 | case kSPDGFOBits : str = "SPD GFO Bits"; break; | |
240 | case kSPDGFOL0 : str = "SPD GFO L0 (first layer)"; break; | |
241 | case kSPDGFOL1 : str = "SPD GFO L1 (second layer)"; break; | |
242 | case kSPDClsVsTrkBG : str = "Cluster vs Tracklets"; break; | |
243 | case kV0A : str = "V0 A BB"; break; | |
244 | case kV0C : str = "V0 C BB"; break; | |
245 | case kV0OR : str = "V0 OR BB"; break; | |
246 | case kV0AND : str = "V0 AND BB"; break; | |
247 | case kV0ABG : str = "V0 A BG"; break; | |
248 | case kV0CBG : str = "V0 C BG"; break; | |
249 | case kZDC : str = "ZDC"; break; | |
250 | case kZDCA : str = "ZDC A"; break; | |
251 | case kZDCC : str = "ZDC C"; break; | |
252 | case kZNA : str = "ZN A"; break; | |
253 | case kZNC : str = "ZN C"; break; | |
254 | case kZNABG : str = "ZN A BG"; break; | |
255 | case kZNCBG : str = "ZN C BG"; break; | |
256 | case kFMDA : str = "FMD A"; break; | |
257 | case kFMDC : str = "FMD C"; break; | |
258 | case kFPANY : str = "SPD GFO | V0 | ZDC | FMD"; break; | |
259 | case kNSD1 : str = "NSD1"; break; | |
260 | case kMB1Prime: str = "MB1prime"; break; | |
261 | case kZDCTDCA : str = "ZDC TDC A"; break; | |
262 | case kZDCTDCC : str = "ZDC TDC C"; break; | |
263 | case kZDCTime : str = "ZDC Time Cut"; break; | |
264 | case kCentral : str = "V0 Central"; break; | |
265 | case kSemiCentral : str = "V0 Semi-central"; break; | |
266 | case kEMCAL : str = "EMCAL"; break; | |
267 | default: str = ""; break; | |
268 | } | |
269 | ||
270 | if (trigger & kOfflineFlag) | |
271 | str += " OFFLINE"; | |
272 | ||
273 | if (trigger & kOneParticle) | |
274 | str += " OneParticle"; | |
275 | ||
276 | if (trigger & kOneTrack) | |
277 | str += " OneTrack"; | |
278 | ||
279 | return str; | |
280 | } | |
281 | ||
282 | Bool_t AliTriggerAnalysis::IsTriggerFired(const AliESDEvent* aEsd, Trigger trigger) | |
283 | { | |
284 | // checks if an event has been triggered | |
285 | ||
286 | if (trigger & kOfflineFlag) | |
287 | return IsOfflineTriggerFired(aEsd, trigger); | |
288 | ||
289 | return IsTriggerBitFired(aEsd, trigger); | |
290 | } | |
291 | ||
292 | Bool_t AliTriggerAnalysis::IsTriggerBitFired(const AliESDEvent* aEsd, Trigger trigger) const | |
293 | { | |
294 | // checks if an event is fired using the trigger bits | |
295 | ||
296 | return IsTriggerBitFired(aEsd->GetTriggerMask(), trigger); | |
297 | } | |
298 | ||
299 | Bool_t AliTriggerAnalysis::IsTriggerBitFired(ULong64_t triggerMask, Trigger trigger) const | |
300 | { | |
301 | // checks if an event is fired using the trigger bits | |
302 | // | |
303 | // this function needs the branch TriggerMask in the ESD | |
304 | ||
305 | // definitions from p-p.cfg | |
306 | ULong64_t spdFO = (1 << 14); | |
307 | ULong64_t v0left = (1 << 10); | |
308 | ULong64_t v0right = (1 << 11); | |
309 | ||
310 | switch (trigger) | |
311 | { | |
312 | case kAcceptAll: | |
313 | { | |
314 | return kTRUE; | |
315 | break; | |
316 | } | |
317 | case kMB1: | |
318 | { | |
319 | if (triggerMask & spdFO || ((triggerMask & v0left) || (triggerMask & v0right))) | |
320 | return kTRUE; | |
321 | break; | |
322 | } | |
323 | case kMB2: | |
324 | { | |
325 | if (triggerMask & spdFO && ((triggerMask & v0left) || (triggerMask & v0right))) | |
326 | return kTRUE; | |
327 | break; | |
328 | } | |
329 | case kMB3: | |
330 | { | |
331 | if (triggerMask & spdFO && (triggerMask & v0left) && (triggerMask & v0right)) | |
332 | return kTRUE; | |
333 | break; | |
334 | } | |
335 | case kSPDGFO: | |
336 | { | |
337 | if (triggerMask & spdFO) | |
338 | return kTRUE; | |
339 | break; | |
340 | } | |
341 | default: | |
342 | Printf("IsEventTriggered: ERROR: Trigger type %d not implemented in this method", (Int_t) trigger); | |
343 | break; | |
344 | } | |
345 | ||
346 | return kFALSE; | |
347 | } | |
348 | ||
349 | Bool_t AliTriggerAnalysis::IsTriggerBitFired(const AliESDEvent* aEsd, ULong64_t tclass) const | |
350 | { | |
351 | // Checks if corresponding bit in mask is on | |
352 | ||
353 | ULong64_t trigmask = aEsd->GetTriggerMask(); | |
354 | return (trigmask & (1ull << (tclass-1))); | |
355 | } | |
356 | ||
357 | Int_t AliTriggerAnalysis::EvaluateTrigger(const AliESDEvent* aEsd, Trigger trigger) | |
358 | { | |
359 | // evaluates a given trigger "offline" | |
360 | // trigger combinations are not supported, for that see IsOfflineTriggerFired | |
361 | ||
362 | UInt_t triggerNoFlags = (UInt_t) trigger % (UInt_t) kStartOfFlags; | |
363 | Bool_t offline = kFALSE; | |
364 | if (trigger & kOfflineFlag) | |
365 | offline = kTRUE; | |
366 | ||
367 | Int_t decision = 0; | |
368 | switch (triggerNoFlags) | |
369 | { | |
370 | case kSPDGFO: | |
371 | { | |
372 | decision = SPDFiredChips(aEsd, (offline) ? 0 : 1); | |
373 | break; | |
374 | } | |
375 | case kSPDGFOL0: | |
376 | { | |
377 | decision = SPDFiredChips(aEsd, (offline) ? 0 : 1, kFALSE, 1); | |
378 | break; | |
379 | } | |
380 | case kSPDGFOL1: | |
381 | { | |
382 | decision = SPDFiredChips(aEsd, (offline) ? 0 : 1, kFALSE, 2); | |
383 | break; | |
384 | } | |
385 | case kSPDClsVsTrkBG: | |
386 | { | |
387 | if(!offline) | |
388 | AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags)); | |
389 | decision = IsSPDClusterVsTrackletBG(aEsd); | |
390 | break; | |
391 | } | |
392 | case kV0A: | |
393 | { | |
394 | if (V0Trigger(aEsd, kASide, !offline) == kV0BB) | |
395 | decision = 1; | |
396 | break; | |
397 | } | |
398 | case kV0C: | |
399 | { | |
400 | if (V0Trigger(aEsd, kCSide, !offline) == kV0BB) | |
401 | decision = 1; | |
402 | break; | |
403 | } | |
404 | case kV0ABG: | |
405 | { | |
406 | if (V0Trigger(aEsd, kASide, !offline) == kV0BG) | |
407 | decision = 1; | |
408 | break; | |
409 | } | |
410 | case kV0CBG: | |
411 | { | |
412 | if (V0Trigger(aEsd, kCSide, !offline) == kV0BG) | |
413 | decision = 1; | |
414 | break; | |
415 | } | |
416 | case kT0: | |
417 | { | |
418 | if (T0Trigger(aEsd, !offline) == kT0BB) | |
419 | decision = 1; | |
420 | break; | |
421 | } | |
422 | case kT0BG: | |
423 | { | |
424 | if (!offline) | |
425 | AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags)); | |
426 | if (T0Trigger(aEsd, !offline) == kT0DecBG) | |
427 | decision = 1; | |
428 | break; | |
429 | } | |
430 | case kT0Pileup: | |
431 | { | |
432 | if (!offline) | |
433 | AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags)); | |
434 | if (T0Trigger(aEsd, !offline) == kT0DecPileup) | |
435 | decision = 1; | |
436 | break; | |
437 | } | |
438 | case kZDCA: | |
439 | { | |
440 | if (!offline) | |
441 | AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags)); | |
442 | if (ZDCTrigger(aEsd, kASide)) | |
443 | decision = 1; | |
444 | break; | |
445 | } | |
446 | case kZDCC: | |
447 | { | |
448 | if (!offline) | |
449 | AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags)); | |
450 | if (ZDCTrigger(aEsd, kCSide)) | |
451 | decision = 1; | |
452 | break; | |
453 | } | |
454 | case kZDCTDCA: | |
455 | { | |
456 | if (!offline) | |
457 | AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags)); | |
458 | if (ZDCTDCTrigger(aEsd, kASide)) | |
459 | decision = 1; | |
460 | break; | |
461 | } | |
462 | case kZDCTDCC: | |
463 | { | |
464 | if (!offline) | |
465 | AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags)); | |
466 | if (ZDCTDCTrigger(aEsd, kCSide)) | |
467 | decision = 1; | |
468 | break; | |
469 | } | |
470 | case kZDCTime: | |
471 | { | |
472 | if (!offline) | |
473 | AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags)); | |
474 | if (ZDCTimeTrigger(aEsd)) | |
475 | decision = 1; | |
476 | break; | |
477 | } | |
478 | case kZNA: | |
479 | { | |
480 | if (!offline) | |
481 | AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags)); | |
482 | if (ZDCTDCTrigger(aEsd,kASide,kTRUE,kFALSE,kFALSE)) | |
483 | decision = 1; | |
484 | break; | |
485 | } | |
486 | case kZNC: | |
487 | { | |
488 | if (!offline) | |
489 | AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags)); | |
490 | if (ZDCTDCTrigger(aEsd,kCSide,kTRUE,kFALSE,kFALSE)) | |
491 | decision = 1; | |
492 | break; | |
493 | } | |
494 | case kZNABG: | |
495 | { | |
496 | if (!offline) | |
497 | AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags)); | |
498 | if (ZDCTimeBGTrigger(aEsd,kASide)) | |
499 | decision = 1; | |
500 | break; | |
501 | } | |
502 | case kZNCBG: | |
503 | { | |
504 | if (!offline) | |
505 | AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags)); | |
506 | if (ZDCTimeBGTrigger(aEsd,kCSide)) | |
507 | decision = 1; | |
508 | break; | |
509 | } | |
510 | case kFMDA: | |
511 | { | |
512 | if (!offline) | |
513 | AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags)); | |
514 | if (FMDTrigger(aEsd, kASide)) | |
515 | decision = 1; | |
516 | break; | |
517 | } | |
518 | case kFMDC: | |
519 | { | |
520 | if (!offline) | |
521 | AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags)); | |
522 | if (FMDTrigger(aEsd, kCSide)) | |
523 | decision = 1; | |
524 | break; | |
525 | } | |
526 | case kCTPV0A: | |
527 | { | |
528 | if (offline) | |
529 | AliFatal(Form("Offline trigger not available for trigger %d", triggerNoFlags)); | |
530 | if (IsL0InputFired(aEsd, 2)) | |
531 | decision = 1; | |
532 | break; | |
533 | } | |
534 | case kCTPV0C: | |
535 | { | |
536 | if (offline) | |
537 | AliFatal(Form("Offline trigger not available for trigger %d", triggerNoFlags)); | |
538 | if (IsL0InputFired(aEsd, 3)) | |
539 | decision = 1; | |
540 | break; | |
541 | } | |
542 | case kTPCLaserWarmUp: | |
543 | { | |
544 | if (!offline) | |
545 | AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags)); | |
546 | return IsLaserWarmUpTPCEvent(aEsd); | |
547 | } | |
548 | case kCentral: | |
549 | { | |
550 | if (offline) | |
551 | AliFatal(Form("Offline trigger not available for trigger %d - use centrality selection", triggerNoFlags)); | |
552 | if (aEsd->GetVZEROData()) { | |
553 | if (aEsd->GetVZEROData()->TestBit(AliESDVZERO::kTriggerChargeBitsFilled)) { | |
554 | if (aEsd->GetVZEROData()->GetTriggerBits() & (1<<AliESDVZERO::kCTA2andCTC2)) | |
555 | decision = kTRUE; | |
556 | } | |
557 | else | |
558 | AliWarning("V0 centrality trigger bits were not filled!"); | |
559 | } | |
560 | break; | |
561 | } | |
562 | case kSemiCentral: | |
563 | { | |
564 | if (offline) | |
565 | AliFatal(Form("Offline trigger not available for trigger %d - use centrality selection", triggerNoFlags)); | |
566 | if (aEsd->GetVZEROData()) { | |
567 | if (aEsd->GetVZEROData()->TestBit(AliESDVZERO::kTriggerChargeBitsFilled)) { | |
568 | if (aEsd->GetVZEROData()->GetTriggerBits() & (1<<AliESDVZERO::kCTA1andCTC1)) | |
569 | decision = kTRUE; | |
570 | } | |
571 | else | |
572 | AliWarning("V0 centrality trigger bits were not filled!"); | |
573 | } | |
574 | break; | |
575 | } | |
576 | case kEMCAL: | |
577 | { | |
578 | if(!offline) | |
579 | AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags)); | |
580 | if (EMCALCellsTrigger(aEsd)) | |
581 | decision = kTRUE; | |
582 | break; | |
583 | } | |
584 | default: | |
585 | { | |
586 | AliFatal(Form("Trigger type %d not implemented", triggerNoFlags)); | |
587 | } | |
588 | } | |
589 | ||
590 | return decision; | |
591 | } | |
592 | ||
593 | Bool_t AliTriggerAnalysis::IsLaserWarmUpTPCEvent(const AliESDEvent* esd) | |
594 | { | |
595 | // | |
596 | // This function flags noisy TPC events which can happen during laser warm-up. | |
597 | // | |
598 | ||
599 | Int_t trackCounter = 0; | |
600 | for (Int_t i=0; i<esd->GetNumberOfTracks(); ++i) | |
601 | { | |
602 | AliESDtrack *track = esd->GetTrack(i); | |
603 | if (!track) | |
604 | continue; | |
605 | ||
606 | if (track->GetTPCNcls() < 30) continue; | |
607 | if (TMath::Abs(track->Eta()) > 0.005) continue; | |
608 | if (track->Pt() < 4) continue; | |
609 | if (track->GetKinkIndex(0) > 0) continue; | |
610 | ||
611 | UInt_t status = track->GetStatus(); | |
612 | if ((status&AliESDtrack::kITSrefit)==AliESDtrack::kITSrefit) continue; // explicitly ask for tracks without ITS refit | |
613 | if ((status&AliESDtrack::kTPCrefit)!=AliESDtrack::kTPCrefit) continue; | |
614 | ||
615 | if (track->GetTPCsignal() > 10) continue; // explicitly ask for tracks without dE/dx | |
616 | ||
617 | trackCounter++; | |
618 | } | |
619 | if (trackCounter > 15) | |
620 | return kTRUE; | |
621 | return kFALSE; | |
622 | } | |
623 | ||
624 | Bool_t AliTriggerAnalysis::IsOfflineTriggerFired(const AliESDEvent* aEsd, Trigger trigger) | |
625 | { | |
626 | // checks if an event has been triggered "offline" | |
627 | ||
628 | UInt_t triggerNoFlags = (UInt_t) trigger % (UInt_t) kStartOfFlags; | |
629 | ||
630 | Bool_t decision = kFALSE; | |
631 | switch (triggerNoFlags) | |
632 | { | |
633 | case kAcceptAll: | |
634 | { | |
635 | decision = kTRUE; | |
636 | break; | |
637 | } | |
638 | case kMB1: | |
639 | { | |
640 | if (SPDGFOTrigger(aEsd, 0) || V0Trigger(aEsd, kASide, kFALSE) == kV0BB || V0Trigger(aEsd, kCSide, kFALSE) == kV0BB) | |
641 | decision = kTRUE; | |
642 | break; | |
643 | } | |
644 | case kMB2: | |
645 | { | |
646 | if (SPDGFOTrigger(aEsd, 0) && (V0Trigger(aEsd, kASide, kFALSE) == kV0BB || V0Trigger(aEsd, kCSide, kFALSE) == kV0BB)) | |
647 | decision = kTRUE; | |
648 | break; | |
649 | } | |
650 | case kMB3: | |
651 | { | |
652 | if (SPDGFOTrigger(aEsd, 0) && V0Trigger(aEsd, kASide, kFALSE) == kV0BB && V0Trigger(aEsd, kCSide, kFALSE) == kV0BB) | |
653 | decision = kTRUE; | |
654 | break; | |
655 | } | |
656 | case kSPDGFO: | |
657 | { | |
658 | if (SPDGFOTrigger(aEsd, 0)) | |
659 | decision = kTRUE; | |
660 | break; | |
661 | } | |
662 | case kSPDGFOBits: | |
663 | { | |
664 | if (SPDGFOTrigger(aEsd, 1)) | |
665 | decision = kTRUE; | |
666 | break; | |
667 | } | |
668 | case kV0A: | |
669 | { | |
670 | if (V0Trigger(aEsd, kASide, kFALSE) == kV0BB) | |
671 | decision = kTRUE; | |
672 | break; | |
673 | } | |
674 | case kV0C: | |
675 | { | |
676 | if (V0Trigger(aEsd, kCSide, kFALSE) == kV0BB) | |
677 | decision = kTRUE; | |
678 | break; | |
679 | } | |
680 | case kV0OR: | |
681 | { | |
682 | if (V0Trigger(aEsd, kASide, kFALSE) == kV0BB || V0Trigger(aEsd, kCSide, kFALSE) == kV0BB) | |
683 | decision = kTRUE; | |
684 | break; | |
685 | } | |
686 | case kV0AND: | |
687 | { | |
688 | if (V0Trigger(aEsd, kASide, kFALSE) == kV0BB && V0Trigger(aEsd, kCSide, kFALSE) == kV0BB) | |
689 | decision = kTRUE; | |
690 | break; | |
691 | } | |
692 | case kV0ABG: | |
693 | { | |
694 | if (V0Trigger(aEsd, kASide, kFALSE) == kV0BG) | |
695 | decision = kTRUE; | |
696 | break; | |
697 | } | |
698 | case kV0CBG: | |
699 | { | |
700 | if (V0Trigger(aEsd, kCSide, kFALSE) == kV0BG) | |
701 | decision = kTRUE; | |
702 | break; | |
703 | } | |
704 | case kZDC: | |
705 | { | |
706 | if (ZDCTrigger(aEsd, kASide) || ZDCTrigger(aEsd, kCentralBarrel) || ZDCTrigger(aEsd, kCSide)) | |
707 | decision = kTRUE; | |
708 | break; | |
709 | } | |
710 | case kZDCA: | |
711 | { | |
712 | if (ZDCTrigger(aEsd, kASide)) | |
713 | decision = kTRUE; | |
714 | break; | |
715 | } | |
716 | case kZDCC: | |
717 | { | |
718 | if (ZDCTrigger(aEsd, kCSide)) | |
719 | decision = kTRUE; | |
720 | break; | |
721 | } | |
722 | case kZNA: | |
723 | { | |
724 | if (ZDCTDCTrigger(aEsd,kASide,kTRUE,kFALSE,kFALSE)) | |
725 | decision = kTRUE; | |
726 | break; | |
727 | } | |
728 | case kZNC: | |
729 | { | |
730 | if (ZDCTDCTrigger(aEsd,kCSide,kTRUE,kFALSE,kFALSE)) | |
731 | decision = kTRUE; | |
732 | break; | |
733 | } | |
734 | case kZNABG: | |
735 | { | |
736 | if (ZDCTimeBGTrigger(aEsd,kASide)) | |
737 | decision = kTRUE; | |
738 | break; | |
739 | } | |
740 | case kZNCBG: | |
741 | { | |
742 | if (ZDCTimeBGTrigger(aEsd,kCSide)) | |
743 | decision = kTRUE; | |
744 | break; | |
745 | } | |
746 | case kFMDA: | |
747 | { | |
748 | if (FMDTrigger(aEsd, kASide)) | |
749 | decision = kTRUE; | |
750 | break; | |
751 | } | |
752 | case kFMDC: | |
753 | { | |
754 | if (FMDTrigger(aEsd, kCSide)) | |
755 | decision = kTRUE; | |
756 | break; | |
757 | } | |
758 | case kFPANY: | |
759 | { | |
760 | if (SPDGFOTrigger(aEsd, 0) || V0Trigger(aEsd, kASide, kFALSE) == kV0BB || V0Trigger(aEsd, kCSide, kFALSE) == kV0BB || ZDCTrigger(aEsd, kASide) || ZDCTrigger(aEsd, kCentralBarrel) || ZDCTrigger(aEsd, kCSide) || FMDTrigger(aEsd, kASide) || FMDTrigger(aEsd, kCSide)) | |
761 | decision = kTRUE; | |
762 | break; | |
763 | } | |
764 | case kNSD1: | |
765 | { | |
766 | if (SPDFiredChips(aEsd, 0) >= 5 || (V0Trigger(aEsd, kASide, kFALSE) == kV0BB && V0Trigger(aEsd, kCSide, kFALSE) == kV0BB)) | |
767 | decision = kTRUE; | |
768 | break; | |
769 | } | |
770 | case kMB1Prime: | |
771 | { | |
772 | Int_t count = 0; | |
773 | if (SPDGFOTrigger(aEsd, 0)) | |
774 | count++; | |
775 | if (V0Trigger(aEsd, kASide, kFALSE) == kV0BB) | |
776 | count++; | |
777 | if (V0Trigger(aEsd, kCSide, kFALSE) == kV0BB) | |
778 | count++; | |
779 | ||
780 | if (count >= 2) | |
781 | decision = kTRUE; | |
782 | ||
783 | break; | |
784 | } | |
785 | case kEMCAL: | |
786 | { | |
787 | if (EMCALCellsTrigger(aEsd)) | |
788 | decision = kTRUE; | |
789 | break; | |
790 | } | |
791 | default: | |
792 | { | |
793 | AliFatal(Form("Trigger type %d not implemented", triggerNoFlags)); | |
794 | } | |
795 | } | |
796 | ||
797 | // hadron-level requirement | |
798 | if (decision && (trigger & kOneParticle)) | |
799 | { | |
800 | decision = kFALSE; | |
801 | ||
802 | const AliESDVertex* vertex = aEsd->GetPrimaryVertexSPD(); | |
803 | const AliMultiplicity* mult = aEsd->GetMultiplicity(); | |
804 | ||
805 | if (mult && vertex && vertex->GetNContributors() > 0 && (!vertex->IsFromVertexerZ() || vertex->GetDispersion() < 0.02) && TMath::Abs(vertex->GetZv()) < 5.5) | |
806 | { | |
807 | for (Int_t i=0; i<mult->GetNumberOfTracklets(); ++i) | |
808 | { | |
809 | if (TMath::Abs(mult->GetEta(i)) < 1) | |
810 | { | |
811 | decision = kTRUE; | |
812 | break; | |
813 | } | |
814 | } | |
815 | } | |
816 | } | |
817 | ||
818 | // hadron level definition for TPC tracks | |
819 | ||
820 | if (decision && (trigger & kOneTrack)) | |
821 | { | |
822 | decision = kFALSE; | |
823 | const AliESDVertex* vertex =0x0; | |
824 | vertex = aEsd->GetPrimaryVertexTracks(); | |
825 | if (!vertex || vertex->GetNContributors() <= 0) | |
826 | { | |
827 | vertex = aEsd->GetPrimaryVertexSPD(); | |
828 | } | |
829 | Float_t ptmin, ptmax; | |
830 | fEsdTrackCuts->GetPtRange(ptmin,ptmax); | |
831 | AliDebug(3, Form("ptmin = %f, ptmax = %f\n",ptmin, ptmax)); | |
832 | ||
833 | if (vertex && vertex->GetNContributors() > 0 && (!vertex->IsFromVertexerZ() || vertex->GetDispersion() < 0.02) && TMath::Abs(vertex->GetZv()) < 10.) { | |
834 | AliDebug(3,Form("Check on the vertex passed\n")); | |
835 | for (Int_t i=0; i<aEsd->GetNumberOfTracks(); ++i){ | |
836 | if (fTPCOnly == kFALSE){ | |
837 | if (fEsdTrackCuts->AcceptTrack(aEsd->GetTrack(i))){ | |
838 | AliDebug(2, Form("pt of track = %f --> check passed\n",aEsd->GetTrack(i)->Pt())); | |
839 | decision = kTRUE; | |
840 | break; | |
841 | } | |
842 | } | |
843 | else { | |
844 | // TPC only tracks | |
845 | AliESDtrack *tpcTrack = fEsdTrackCuts->GetTPCOnlyTrack((AliESDEvent*)aEsd, i); | |
846 | if (!tpcTrack){ | |
847 | AliDebug(3,Form("track %d is NOT a TPC track",i)); | |
848 | continue; | |
849 | } | |
850 | else{ | |
851 | AliDebug(3,Form("track %d IS a TPC track",i)); | |
852 | if (!(fEsdTrackCuts->AcceptTrack(tpcTrack))) { | |
853 | AliDebug(2, Form("TPC track %d NOT ACCEPTED, pt = %f, eta = %f",i,tpcTrack->Pt(), tpcTrack->Eta())); | |
854 | delete tpcTrack; tpcTrack = 0x0; | |
855 | continue; | |
856 | } // end if the TPC track is not accepted | |
857 | else{ | |
858 | AliDebug(2, Form("TPC track %d ACCEPTED, pt = %f, eta = %f",i,tpcTrack->Pt(), tpcTrack->Eta())); | |
859 | decision = kTRUE; | |
860 | delete tpcTrack; tpcTrack = 0x0; | |
861 | break; | |
862 | } // end if the TPC track is accepted | |
863 | } // end if it is a TPC track | |
864 | } // end if you are looking at TPC only tracks | |
865 | } // end loop on tracks | |
866 | } // end check on vertex | |
867 | else{ | |
868 | AliDebug(4,Form("Check on the vertex not passed\n")); | |
869 | for (Int_t i=0; i<aEsd->GetNumberOfTracks(); ++i){ | |
870 | if (fEsdTrackCuts->AcceptTrack(aEsd->GetTrack(i))){ | |
871 | AliDebug(4,Form("pt of track = %f --> check would be passed if the vertex was ok\n",aEsd->GetTrack(i)->Pt())); | |
872 | break; | |
873 | } | |
874 | } | |
875 | } | |
876 | if (!decision) AliDebug(3,("Check for kOneTrack NOT passed\n")); | |
877 | } | |
878 | ||
879 | return decision; | |
880 | } | |
881 | ||
882 | Bool_t AliTriggerAnalysis::IsTriggerClassFired(const AliESDEvent* aEsd, const Char_t* tclass) const | |
883 | { | |
884 | // tclass is logical function of inputs, e.g. 01 && 02 || 03 && 11 && 21 | |
885 | // = L0 inp 1 && L0 inp 2 || L0 inp 3 && L1 inp 1 && L2 inp 1 | |
886 | // NO brackets in logical function ! | |
887 | // Spaces between operators and inputs. | |
888 | // Not all logical functions are available in CTP= | |
889 | // =any function of first 4 inputs; 'AND' of other inputs, check not done | |
890 | // This method will be replaced/complemened by similar one | |
891 | // which works withh class and inputs names as in CTP cfg file | |
892 | ||
893 | TString TClass(tclass); | |
894 | TObjArray* tcltokens = TClass.Tokenize(" "); | |
895 | Char_t level=((TObjString*)tcltokens->At(0))->String()[0]; | |
896 | UInt_t input=atoi((((TObjString*)tcltokens->At(0))->String()).Remove(0)); | |
897 | Bool_t tcl = IsInputFired(aEsd,level,input); | |
898 | ||
899 | for (Int_t i=1;i<tcltokens->GetEntriesFast();i=i+2) { | |
900 | level=((TObjString*)tcltokens->At(i+1))->String()[0]; | |
901 | input=atoi((((TObjString*)tcltokens->At(i+1))->String()).Remove(0)); | |
902 | Bool_t inpnext = IsInputFired(aEsd,level,input); | |
903 | Char_t op =((TObjString*)tcltokens->At(i))->String()[0]; | |
904 | if (op == '&') tcl=tcl && inpnext; | |
905 | else if (op == '|') tcl =tcl || inpnext; | |
906 | else { | |
907 | AliError(Form("Syntax error in %s", tclass)); | |
908 | delete tcltokens; | |
909 | tcltokens = 0; | |
910 | // tcltokens->Delete(); | |
911 | return kFALSE; | |
912 | } | |
913 | } | |
914 | delete tcltokens; | |
915 | tcltokens = 0; | |
916 | // tcltokens->Delete(); | |
917 | return tcl; | |
918 | } | |
919 | ||
920 | Bool_t AliTriggerAnalysis::IsInputFired(const AliESDEvent* aEsd, Char_t level, UInt_t input) const | |
921 | { | |
922 | // Checks trigger input of any level | |
923 | ||
924 | switch (level) | |
925 | { | |
926 | case '0': return IsL0InputFired(aEsd,input); | |
927 | case '1': return IsL1InputFired(aEsd,input); | |
928 | case '2': return IsL2InputFired(aEsd,input); | |
929 | default: | |
930 | AliError(Form("Wrong level %i",level)); | |
931 | return kFALSE; | |
932 | } | |
933 | } | |
934 | ||
935 | Bool_t AliTriggerAnalysis::IsL0InputFired(const AliESDEvent* aEsd, UInt_t input) const | |
936 | { | |
937 | // Checks if corresponding bit in mask is on | |
938 | ||
939 | UInt_t inpmask = aEsd->GetHeader()->GetL0TriggerInputs(); | |
940 | return (inpmask & (1<<(input-1))); | |
941 | } | |
942 | ||
943 | Bool_t AliTriggerAnalysis::IsL1InputFired(const AliESDEvent* aEsd, UInt_t input) const | |
944 | { | |
945 | // Checks if corresponding bit in mask is on | |
946 | ||
947 | UInt_t inpmask = aEsd->GetHeader()->GetL1TriggerInputs(); | |
948 | return (inpmask & (1<<(input-1))); | |
949 | } | |
950 | ||
951 | Bool_t AliTriggerAnalysis::IsL2InputFired(const AliESDEvent* aEsd, UInt_t input) const | |
952 | { | |
953 | // Checks if corresponding bit in mask is on | |
954 | ||
955 | UInt_t inpmask = aEsd->GetHeader()->GetL2TriggerInputs(); | |
956 | return (inpmask & (1<<(input-1))); | |
957 | } | |
958 | ||
959 | void AliTriggerAnalysis::FillHistograms(const AliESDEvent* aEsd) | |
960 | { | |
961 | // fills the histograms with the info from the ESD | |
962 | ||
963 | fHistBitsSPD->Fill(SPDFiredChips(aEsd, 0), SPDFiredChips(aEsd, 1, kTRUE)); | |
964 | ||
965 | V0Trigger(aEsd, kASide, kFALSE, kTRUE); | |
966 | V0Trigger(aEsd, kCSide, kFALSE, kTRUE); | |
967 | T0Trigger(aEsd, kFALSE, kTRUE); | |
968 | ZDCTDCTrigger(aEsd,kASide,kFALSE,kFALSE,kTRUE); | |
969 | ZDCTimeTrigger(aEsd,kTRUE); | |
970 | IsSPDClusterVsTrackletBG(aEsd, kTRUE); | |
971 | ||
972 | AliESDZDC* zdcData = aEsd->GetESDZDC(); | |
973 | if (zdcData) | |
974 | { | |
975 | UInt_t quality = zdcData->GetESDQuality(); | |
976 | ||
977 | // from Nora's presentation, general first physics meeting 16.10.09 | |
978 | static UInt_t zpc = 0x20; | |
979 | static UInt_t znc = 0x10; | |
980 | static UInt_t zem1 = 0x08; | |
981 | static UInt_t zem2 = 0x04; | |
982 | static UInt_t zpa = 0x02; | |
983 | static UInt_t zna = 0x01; | |
984 | ||
985 | fHistZDC->Fill(1, (quality & zna) ? 1 : 0); | |
986 | fHistZDC->Fill(2, (quality & zpa) ? 1 : 0); | |
987 | fHistZDC->Fill(3, (quality & zem2) ? 1 : 0); | |
988 | fHistZDC->Fill(4, (quality & zem1) ? 1 : 0); | |
989 | fHistZDC->Fill(5, (quality & znc) ? 1 : 0); | |
990 | fHistZDC->Fill(6, (quality & zpc) ? 1 : 0); | |
991 | } | |
992 | else | |
993 | { | |
994 | fHistZDC->Fill(-1); | |
995 | AliError("AliESDZDC not available"); | |
996 | } | |
997 | ||
998 | if (fDoFMD) { | |
999 | fHistFMDA->Fill(FMDHitCombinations(aEsd, kASide, kTRUE)); | |
1000 | fHistFMDC->Fill(FMDHitCombinations(aEsd, kCSide, kTRUE)); | |
1001 | } | |
1002 | } | |
1003 | ||
1004 | void AliTriggerAnalysis::FillTriggerClasses(const AliESDEvent* aEsd) | |
1005 | { | |
1006 | // fills trigger classes map | |
1007 | ||
1008 | TParameter<Long64_t>* count = dynamic_cast<TParameter<Long64_t>*> (fTriggerClasses->GetValue(aEsd->GetFiredTriggerClasses().Data())); | |
1009 | if (!count) | |
1010 | { | |
1011 | count = new TParameter<Long64_t>(aEsd->GetFiredTriggerClasses(), 0); | |
1012 | fTriggerClasses->Add(new TObjString(aEsd->GetFiredTriggerClasses().Data()), count); | |
1013 | } | |
1014 | count->SetVal(count->GetVal() + 1); | |
1015 | } | |
1016 | ||
1017 | Int_t AliTriggerAnalysis::SSDClusters(const AliESDEvent* aEsd) | |
1018 | { | |
1019 | // returns the number of clusters in the SSD | |
1020 | const AliMultiplicity* mult = aEsd->GetMultiplicity(); | |
1021 | Int_t clusters = mult->GetNumberOfITSClusters(4)+mult->GetNumberOfITSClusters(5); | |
1022 | return clusters; | |
1023 | } | |
1024 | ||
1025 | ||
1026 | Int_t AliTriggerAnalysis::SPDFiredChips(const AliESDEvent* aEsd, Int_t origin, Bool_t fillHists, Int_t layer) | |
1027 | { | |
1028 | // returns the number of fired chips in the SPD | |
1029 | // | |
1030 | // origin = 0 --> aEsd->GetMultiplicity()->GetNumberOfFiredChips() (filled from clusters) | |
1031 | // origin = 1 --> aEsd->GetMultiplicity()->TestFastOrFiredChips() (from hardware bits) | |
1032 | // layer = 0 --> both layers | |
1033 | // layer = 1 --> inner | |
1034 | // layer = 2 --> outer | |
1035 | ||
1036 | const AliMultiplicity* mult = aEsd->GetMultiplicity(); | |
1037 | if (!mult) | |
1038 | { | |
1039 | AliError("AliMultiplicity not available"); | |
1040 | return -1; | |
1041 | } | |
1042 | ||
1043 | if (origin == 0){ | |
1044 | if (layer == 0) | |
1045 | return mult->GetNumberOfFiredChips(0) + mult->GetNumberOfFiredChips(1); | |
1046 | ||
1047 | return mult->GetNumberOfFiredChips(layer-1); | |
1048 | } | |
1049 | ||
1050 | if (origin == 1) | |
1051 | { | |
1052 | Int_t nChips = 0; | |
1053 | Int_t firstChip = 0; | |
1054 | Int_t lastChip = 1200; | |
1055 | if(layer == 1) | |
1056 | lastChip = 400; | |
1057 | if(layer == 2) | |
1058 | firstChip = 400; | |
1059 | ||
1060 | for (Int_t i=firstChip; i<lastChip; i++) | |
1061 | { | |
1062 | if (mult->TestFastOrFiredChips(i) == kTRUE) | |
1063 | { | |
1064 | // efficiency simulation (if enabled) | |
1065 | if (fSPDGFOEfficiency) | |
1066 | { | |
1067 | if (gRandom->Uniform() > fSPDGFOEfficiency->GetBinContent(i+1)) | |
1068 | continue; | |
1069 | } | |
1070 | ||
1071 | nChips++; | |
1072 | if (fillHists) | |
1073 | fHistFiredBitsSPD->Fill(i); | |
1074 | } | |
1075 | } | |
1076 | return nChips; | |
1077 | } | |
1078 | ||
1079 | return -1; | |
1080 | } | |
1081 | ||
1082 | Bool_t AliTriggerAnalysis::SPDGFOTrigger(const AliESDEvent* aEsd, Int_t origin) | |
1083 | { | |
1084 | // Returns if the SPD gave a global Fast OR trigger | |
1085 | ||
1086 | Int_t firedChips = SPDFiredChips(aEsd, origin); | |
1087 | ||
1088 | if (firedChips >= fSPDGFOThreshold) | |
1089 | return kTRUE; | |
1090 | return kFALSE; | |
1091 | } | |
1092 | ||
1093 | Bool_t AliTriggerAnalysis::IsSPDClusterVsTrackletBG(const AliESDEvent* aEsd, Bool_t fillHists){ | |
1094 | //rejects BG based on the cluster vs tracklet correlation | |
1095 | // returns true if the event is BG | |
1096 | const AliMultiplicity* mult = aEsd->GetMultiplicity(); | |
1097 | if (!mult){ | |
1098 | AliFatal("No multiplicity object"); // TODO: Should this be fatal? | |
1099 | } | |
1100 | Int_t ntracklet = mult->GetNumberOfTracklets(); | |
1101 | ||
1102 | Int_t spdClusters = 0; | |
1103 | for(Int_t ilayer = 0; ilayer < 2; ilayer++){ | |
1104 | spdClusters += mult->GetNumberOfITSClusters(ilayer); | |
1105 | } | |
1106 | ||
1107 | if(fillHists) { | |
1108 | fHistSPDClsVsTrk->Fill(ntracklet,spdClusters); | |
1109 | } | |
1110 | ||
1111 | Bool_t isCvsTOk = kFALSE; | |
1112 | Float_t limit = Float_t(fASPDCvsTCut) + Float_t(ntracklet) * fBSPDCvsTCut; | |
1113 | if (spdClusters > limit) isCvsTOk = kTRUE; | |
1114 | else isCvsTOk = kFALSE ; | |
1115 | ||
1116 | return isCvsTOk; | |
1117 | ||
1118 | } | |
1119 | ||
1120 | ||
1121 | AliTriggerAnalysis::V0Decision AliTriggerAnalysis::V0Trigger(const AliESDEvent* aEsd, AliceSide side, Bool_t online, Bool_t fillHists) | |
1122 | { | |
1123 | // Returns the V0 trigger decision in V0A | V0C | |
1124 | // | |
1125 | // Returns kV0Fake if the calculated average time is in a window where neither BB nor BG is expected. | |
1126 | // The rate of such triggers can be used to estimate the background. Note that the rate has to be | |
1127 | // rescaled with the size of the windows (numerical values see below in the code) | |
1128 | // | |
1129 | // argument 'online' is used as a switch between online and offline trigger algorithms | |
1130 | // | |
1131 | // Based on an algorithm by Cvetan Cheshkov | |
1132 | ||
1133 | AliESDVZERO* esdV0 = aEsd->GetVZEROData(); | |
1134 | if (!esdV0) | |
1135 | { | |
1136 | AliError("AliESDVZERO not available"); | |
1137 | return kV0Invalid; | |
1138 | } | |
1139 | AliDebug(2,Form("In V0Trigger: %f %f",esdV0->GetV0ATime(),esdV0->GetV0CTime())); | |
1140 | ||
1141 | Int_t begin = -1; | |
1142 | Int_t end = -1; | |
1143 | ||
1144 | if (side == kASide) | |
1145 | { | |
1146 | begin = 32; | |
1147 | end = 64; | |
1148 | } | |
1149 | else if (side == kCSide) | |
1150 | { | |
1151 | begin = 0; | |
1152 | end = 32; | |
1153 | } | |
1154 | else | |
1155 | return kV0Invalid; | |
1156 | ||
1157 | if (esdV0->TestBit(AliESDVZERO::kDecisionFilled)) { | |
1158 | if (online) { | |
1159 | if (esdV0->TestBit(AliESDVZERO::kOnlineBitsFilled)) { | |
1160 | for (Int_t i = begin; i < end; ++i) { | |
1161 | if (esdV0->GetBBFlag(i)) return kV0BB; | |
1162 | } | |
1163 | for (Int_t i = begin; i < end; ++i) { | |
1164 | if (esdV0->GetBGFlag(i)) return kV0BG; | |
1165 | } | |
1166 | return kV0Empty; | |
1167 | } | |
1168 | else { | |
1169 | AliWarning("V0 online trigger analysis is not yet available!"); | |
1170 | return kV0BB; | |
1171 | } | |
1172 | } | |
1173 | else { | |
1174 | ||
1175 | if (fillHists) { | |
1176 | if (side == kASide && fHistV0A) | |
1177 | fHistV0A->Fill(esdV0->GetV0ATime()); | |
1178 | if (side == kCSide && fHistV0C) | |
1179 | fHistV0C->Fill(esdV0->GetV0CTime()); | |
1180 | } | |
1181 | ||
1182 | if (side == kASide) return (V0Decision)esdV0->GetV0ADecision(); | |
1183 | else if (side == kCSide) return (V0Decision)esdV0->GetV0CDecision(); | |
1184 | else return kV0Invalid; | |
1185 | } | |
1186 | } | |
1187 | ||
1188 | Float_t time = 0; | |
1189 | Float_t weight = 0; | |
1190 | if (fMC) | |
1191 | { | |
1192 | Int_t runRange; | |
1193 | if (aEsd->GetRunNumber() <= 104803) runRange = 0; | |
1194 | else if (aEsd->GetRunNumber() <= 104876) runRange = 1; | |
1195 | else runRange = 2; | |
1196 | ||
1197 | Float_t factors[3][64] = { | |
1198 | // runs: 104792-104803 | |
1199 | {4.6,5.9,6.3,6.0,4.7,5.9,4.9,5.4,4.8,4.1,4.9,4.6,4.5,5.5,5.1,5.8,4.3,4.0,4.0,3.3,3.1,2.9,3.0,5.6,3.3,4.9,3.9,5.3,4.1,4.4,3.9,5.5,5.7,9.5,5.1,5.3,6.6,7.1,8.9,4.4,4.1,5.9,9.0,4.5,4.1,6.0,4.7,7.1,4.2,4.7,3.9,6.3,5.9,4.8,4.7,4.5,4.7,5.4,5.8,5.0,5.1,5.9,5.3,3.6}, | |
1200 | // runs: 104841-104876 | |
1201 | {4.6,4.8,4.9,4.8,4.3,4.9,4.4,4.5,4.6,5.0,4.7,4.6,4.7,4.6,4.6,5.5,4.7,4.5,4.7,5.0,6.5,7.6,5.3,4.9,5.5,4.8,4.6,4.9,4.5,4.5,4.6,4.9,5.7,9.8,4.9,5.2,7.1,7.1,8.1,4.4,4.0,6.0,8.3,4.6,4.2,5.6,4.6,6.4,4.4,4.7,4.5,6.5,6.0,4.7,4.5,4.4,4.8,5.5,5.9,5.3,5.0,5.7,5.1,3.6}, | |
1202 | // runs: 104890-92 | |
1203 | {4.7,5.2,4.8,5.0,4.4,5.0,4.4,4.6,4.6,4.5,4.4,4.6,4.5,4.6,4.8,5.5,4.8,4.5,4.4,4.3,5.4,7.7,5.6,5.0,5.4,4.3,4.5,4.8,4.5,4.5,4.6,5.3,5.7,9.6,4.9,5.4,6.1,7.2,8.6,4.4,4.0,5.4,8.8,4.4,4.2,5.8,4.7,6.7,4.3,4.7,4.0,6.1,6.0,4.9,4.8,4.6,4.7,5.2,5.7,5.0,5.0,5.8,5.3,3.6} | |
1204 | }; | |
1205 | Float_t dA = 77.4 - 11.0; | |
1206 | Float_t dC = 77.4 - 2.9; | |
1207 | // Time misalignment | |
1208 | Float_t timeShift[64] = {0.477957 , 0.0889999 , 0.757669 , 0.205439 , 0.239666 , -0.183705 , 0.442873 , -0.281366 , 0.260976 , 0.788995 , 0.974758 , 0.548532 , 0.495023 , 0.868472 , 0.661167 , 0.358307 , 0.221243 , 0.530179 , 1.26696 , 1.33082 , 1.27086 , 1.77133 , 1.10253 , 0.634806 , 2.14838 , 1.50212 , 1.59253 , 1.66122 , 1.16957 , 1.52056 , 1.47791 , 1.81905 , -1.94123 , -1.29124 , -2.16045 , -1.78939 , -3.11111 , -1.87178 , -1.57671 , -1.70311 , -1.81208 , -1.94475 , -2.53058 , -1.7042 , -2.08109 , -1.84416 , -0.61073 , -1.77145 , 0.16999 , -0.0585339 , 0.00401133 , 0.397726 , 0.851111 , 0.264187 , 0.59573 , -0.158263 , 0.584362 , 1.20835 , 0.927573 , 1.13895 , 0.64648 , 2.18747 , 1.68909 , 0.451194}; | |
1209 | Float_t dA2 = 2.8, dC2 = 3.3; | |
1210 | ||
1211 | if (online) { | |
1212 | for (Int_t i = begin; i < end; ++i) { | |
1213 | Float_t tempAdc = esdV0->GetAdc(i)/factors[runRange][i]; | |
1214 | Float_t tempTime = (i >= 32) ? esdV0->GetTime(i)+dA+timeShift[i]+dA2 : esdV0->GetTime(i)+dC+timeShift[i]+dC2; | |
1215 | if (esdV0->GetTime(i) >= 1e-6 && | |
1216 | tempTime > fV0HwWinLow && tempTime < fV0HwWinHigh && | |
1217 | tempAdc > fV0HwAdcThr) | |
1218 | return kV0BB; | |
1219 | } | |
1220 | return kV0Empty; | |
1221 | } | |
1222 | else { | |
1223 | for (Int_t i = begin; i < end; ++i) { | |
1224 | Float_t tempAdc = esdV0->GetAdc(i)/factors[runRange][i]; | |
1225 | Float_t tempTime = (i >= 32) ? esdV0->GetTime(i)+dA : esdV0->GetTime(i)+dC; | |
1226 | Float_t tempRawTime = (i >= 32) ? esdV0->GetTime(i)+dA+timeShift[i]+dA2 : esdV0->GetTime(i)+dC+timeShift[i]+dC2; | |
1227 | if (esdV0->GetTime(i) >= 1e-6 && | |
1228 | tempRawTime < 125.0 && | |
1229 | tempAdc > fV0AdcThr) { | |
1230 | weight += 1.0; | |
1231 | time += tempTime; | |
1232 | } | |
1233 | } | |
1234 | } | |
1235 | } | |
1236 | else { | |
1237 | if (online) { | |
1238 | for (Int_t i = begin; i < end; ++i) { | |
1239 | if (esdV0->GetTime(i) >= 1e-6 && | |
1240 | esdV0->GetTime(i) > fV0HwWinLow && esdV0->GetTime(i) < fV0HwWinHigh && | |
1241 | esdV0->GetAdc(i) > fV0HwAdcThr) | |
1242 | return kV0BB; | |
1243 | } | |
1244 | return kV0Empty; | |
1245 | } | |
1246 | else { | |
1247 | for (Int_t i = begin; i < end; ++i) { | |
1248 | if (esdV0->GetTime(i) > 1e-6 && esdV0->GetAdc(i) > fV0AdcThr) { | |
1249 | Float_t correctedTime = V0CorrectLeadingTime(i, esdV0->GetTime(i), esdV0->GetAdc(i),aEsd->GetRunNumber()); | |
1250 | Float_t timeWeight = V0LeadingTimeWeight(esdV0->GetAdc(i)); | |
1251 | time += correctedTime*timeWeight; | |
1252 | ||
1253 | weight += timeWeight; | |
1254 | } | |
1255 | } | |
1256 | } | |
1257 | } | |
1258 | ||
1259 | if (weight > 0) | |
1260 | time /= weight; | |
1261 | time += fV0TimeOffset; | |
1262 | ||
1263 | if (fillHists) | |
1264 | { | |
1265 | if (side == kASide && fHistV0A) | |
1266 | fHistV0A->Fill(time); | |
1267 | if (side == kCSide && fHistV0C) | |
1268 | fHistV0C->Fill(time); | |
1269 | } | |
1270 | ||
1271 | if (side == kASide) | |
1272 | { | |
1273 | if (time > 68 && time < 100) | |
1274 | return kV0BB; | |
1275 | if (time > 54 && time < 57.5) | |
1276 | return kV0BG; | |
1277 | if (time > 57.5 && time < 68) | |
1278 | return kV0Fake; | |
1279 | } | |
1280 | ||
1281 | if (side == kCSide) | |
1282 | { | |
1283 | if (time > 75.5 && time < 100) | |
1284 | return kV0BB; | |
1285 | if (time > 69.5 && time < 73) | |
1286 | return kV0BG; | |
1287 | if (time > 55 && time < 69.5) | |
1288 | return kV0Fake; | |
1289 | } | |
1290 | ||
1291 | return kV0Empty; | |
1292 | } | |
1293 | ||
1294 | Float_t AliTriggerAnalysis::V0CorrectLeadingTime(Int_t i, Float_t time, Float_t adc, Int_t runNumber) const | |
1295 | { | |
1296 | // Correct for slewing and align the channels | |
1297 | // | |
1298 | // Authors: Cvetan Cheshkov / Raphael Tieulent | |
1299 | ||
1300 | if (time == 0) return 0; | |
1301 | ||
1302 | // Time alignment | |
1303 | Float_t timeShift[64] = {0.477957 , 0.0889999 , 0.757669 , 0.205439 , 0.239666 , -0.183705 , 0.442873 , -0.281366 , 0.260976 , 0.788995 , 0.974758 , 0.548532 , 0.495023 , 0.868472 , 0.661167 , 0.358307 , 0.221243 , 0.530179 , 1.26696 , 1.33082 , 1.27086 , 1.77133 , 1.10253 , 0.634806 , 2.14838 , 1.50212 , 1.59253 , 1.66122 , 1.16957 , 1.52056 , 1.47791 , 1.81905 , -1.94123 , -1.29124 , -2.16045 , -1.78939 , -3.11111 , -1.87178 , -1.57671 , -1.70311 , -1.81208 , -1.94475 , -2.53058 , -1.7042 , -2.08109 , -1.84416 , -0.61073 , -1.77145 , 0.16999 , -0.0585339 , 0.00401133 , 0.397726 , 0.851111 , 0.264187 , 0.59573 , -0.158263 , 0.584362 , 1.20835 , 0.927573 , 1.13895 , 0.64648 , 2.18747 , 1.68909 , 0.451194}; | |
1304 | ||
1305 | if(runNumber < 106031) | |
1306 | time -= timeShift[i]; | |
1307 | ||
1308 | // Slewing correction | |
1309 | if (adc == 0) return time; | |
1310 | ||
1311 | Float_t p1 = 1.57345e1; | |
1312 | Float_t p2 =-4.25603e-1; | |
1313 | ||
1314 | if(runNumber >= 106031) adc *= (2.5/4.0); | |
1315 | return (time - p1*TMath::Power(adc,p2)); | |
1316 | } | |
1317 | ||
1318 | Float_t AliTriggerAnalysis::V0LeadingTimeWeight(Float_t adc) const | |
1319 | { | |
1320 | if (adc < 1e-6) return 0; | |
1321 | ||
1322 | Float_t p1 = 40.211; | |
1323 | Float_t p2 =-4.25603e-1; | |
1324 | Float_t p3 = 0.5646; | |
1325 | ||
1326 | return 1./(p1*p1*TMath::Power(adc,2.*(p2-1.))+p3*p3); | |
1327 | } | |
1328 | ||
1329 | ||
1330 | Bool_t AliTriggerAnalysis::ZDCTDCTrigger(const AliESDEvent* aEsd, AliceSide side, Bool_t useZN, Bool_t useZP, Bool_t fillHists) const | |
1331 | { | |
1332 | // Returns if ZDC triggered, based on TDC information | |
1333 | ||
1334 | AliESDZDC *esdZDC = aEsd->GetESDZDC(); | |
1335 | ||
1336 | Bool_t zdcNA = kFALSE; | |
1337 | Bool_t zdcNC = kFALSE; | |
1338 | Bool_t zdcPA = kFALSE; | |
1339 | Bool_t zdcPC = kFALSE; | |
1340 | ||
1341 | if (fMC) { | |
1342 | // If it's MC, we use the energy | |
1343 | Double_t minEnergy = 0; | |
1344 | Double_t zNCEnergy = esdZDC->GetZDCN1Energy(); | |
1345 | Double_t zPCEnergy = esdZDC->GetZDCP1Energy(); | |
1346 | Double_t zNAEnergy = esdZDC->GetZDCN2Energy(); | |
1347 | Double_t zPAEnergy = esdZDC->GetZDCP2Energy(); | |
1348 | zdcNA = (zNAEnergy>minEnergy); | |
1349 | zdcNC = (zNCEnergy>minEnergy); | |
1350 | zdcPA = (zPAEnergy>minEnergy); | |
1351 | zdcPC = (zPCEnergy>minEnergy); | |
1352 | ||
1353 | } | |
1354 | else { | |
1355 | ||
1356 | Bool_t tdc[32] = {kFALSE}; | |
1357 | for(Int_t itdc=0; itdc<32; itdc++){ | |
1358 | for(Int_t i=0; i<4; i++){ | |
1359 | if (esdZDC->GetZDCTDCData(itdc, i) != 0){ | |
1360 | tdc[itdc] = kTRUE; | |
1361 | } | |
1362 | } | |
1363 | if(fillHists && tdc[itdc]) { | |
1364 | fHistTDCZDC->Fill(itdc); | |
1365 | } | |
1366 | } | |
1367 | zdcNA = tdc[12]; | |
1368 | zdcNC = tdc[10]; | |
1369 | zdcPA = tdc[13]; | |
1370 | zdcPC = tdc[11]; | |
1371 | } | |
1372 | ||
1373 | if (side == kASide) return ((useZP&&zdcPA) || (useZN&&zdcNA)); | |
1374 | if (side == kCSide) return ((useZP&&zdcPC) || (useZN&&zdcNC)); | |
1375 | return kFALSE; | |
1376 | } | |
1377 | ||
1378 | Bool_t AliTriggerAnalysis::ZDCTimeTrigger(const AliESDEvent *aEsd, Bool_t fillHists) const | |
1379 | { | |
1380 | // This method implements a selection | |
1381 | // based on the timing in both sides of zdcN | |
1382 | // It can be used in order to eliminate | |
1383 | // parasitic collisions | |
1384 | Bool_t zdcAccept = kFALSE; | |
1385 | AliESDZDC *esdZDC = aEsd->GetESDZDC(); | |
1386 | ||
1387 | if(fMC) { | |
1388 | UInt_t esdFlag = esdZDC->GetESDQuality(); | |
1389 | ||
1390 | Bool_t znaFired=kFALSE, zpaFired=kFALSE; | |
1391 | Bool_t zem1Fired=kFALSE, zem2Fired=kFALSE; | |
1392 | Bool_t zncFired=kFALSE, zpcFired=kFALSE; | |
1393 | // | |
1394 | // **** Trigger patterns | |
1395 | if((esdFlag & 0x00000001) == 0x00000001) znaFired=kTRUE; | |
1396 | if((esdFlag & 0x00000002) == 0x00000002) zpaFired=kTRUE; | |
1397 | if((esdFlag & 0x00000004) == 0x00000004) zem1Fired=kTRUE; | |
1398 | if((esdFlag & 0x00000008) == 0x00000008) zem2Fired=kTRUE; | |
1399 | if((esdFlag & 0x00000010) == 0x00000010) zncFired=kTRUE; | |
1400 | if((esdFlag & 0x00000020) == 0x00000020) zpcFired=kTRUE; | |
1401 | zdcAccept = (znaFired | zncFired); | |
1402 | } | |
1403 | else { | |
1404 | for(Int_t i = 0; i < 4; ++i) { | |
1405 | if (esdZDC->GetZDCTDCData(10,i) != 0) { | |
1406 | Float_t tdcC = 0.025*(esdZDC->GetZDCTDCData(10,i)-esdZDC->GetZDCTDCData(14,i)); | |
1407 | Float_t tdcCcorr = esdZDC->GetZDCTDCCorrected(10,i); | |
1408 | for(Int_t j = 0; j < 4; ++j) { | |
1409 | if (esdZDC->GetZDCTDCData(12,j) != 0) { | |
1410 | Float_t tdcA = 0.025*(esdZDC->GetZDCTDCData(12,j)-esdZDC->GetZDCTDCData(14,j)); | |
1411 | ||
1412 | Float_t tdcAcorr = esdZDC->GetZDCTDCCorrected(12,j); | |
1413 | if(fillHists) { | |
1414 | fHistTimeZDC->Fill(tdcC-tdcA,tdcC+tdcA); | |
1415 | fHistTimeCorrZDC->Fill(tdcCcorr-tdcAcorr,tdcCcorr+tdcAcorr); | |
1416 | } | |
1417 | if (esdZDC->TestBit(AliESDZDC::kCorrectedTDCFilled)) { | |
1418 | if (((tdcCcorr-tdcAcorr-fZDCCutRefDeltaCorr)*(tdcCcorr-tdcAcorr-fZDCCutRefDeltaCorr)/(fZDCCutSigmaDeltaCorr*fZDCCutSigmaDeltaCorr) + | |
1419 | (tdcCcorr+tdcAcorr-fZDCCutRefSumCorr)*(tdcCcorr+tdcAcorr-fZDCCutRefSumCorr)/(fZDCCutSigmaSumCorr*fZDCCutSigmaSumCorr))< 1.0) | |
1420 | zdcAccept = kTRUE; | |
1421 | } | |
1422 | else { | |
1423 | if (((tdcC-tdcA-fZDCCutRefDelta)*(tdcC-tdcA-fZDCCutRefDelta)/(fZDCCutSigmaDelta*fZDCCutSigmaDelta) + | |
1424 | (tdcC+tdcA-fZDCCutRefSum)*(tdcC+tdcA-fZDCCutRefSum)/(fZDCCutSigmaSum*fZDCCutSigmaSum))< 1.0) | |
1425 | zdcAccept = kTRUE; | |
1426 | } | |
1427 | } | |
1428 | } | |
1429 | } | |
1430 | } | |
1431 | } | |
1432 | return zdcAccept; | |
1433 | } | |
1434 | ||
1435 | Bool_t AliTriggerAnalysis::ZDCTimeBGTrigger(const AliESDEvent *aEsd, AliceSide side) const | |
1436 | { | |
1437 | // This method implements a selection | |
1438 | // based on the timing in of zdcN | |
1439 | // It can be used in order to flag background | |
1440 | // ** So far only implemented for the 2012 pA run ** | |
1441 | ||
1442 | if(fMC) return kFALSE; | |
1443 | ||
1444 | AliESDZDC *zdcData = aEsd->GetESDZDC(); | |
1445 | Bool_t zna = kFALSE; | |
1446 | Bool_t znc = kFALSE; | |
1447 | ||
1448 | Float_t tdcC=999, tdcCcorr=999, tdcA=999, tdcAcorr=999; | |
1449 | for(Int_t i = 0; i < 4; ++i) { | |
1450 | if (zdcData->GetZDCTDCData(10,i) != 0) { | |
1451 | znc = kTRUE; | |
1452 | tdcC = 0.025*(zdcData->GetZDCTDCData(10,i)-zdcData->GetZDCTDCData(14,i)); | |
1453 | tdcCcorr = zdcData->GetZDCTDCCorrected(10,i); | |
1454 | } | |
1455 | } | |
1456 | for(Int_t j = 0; j < 4; ++j) { | |
1457 | if (zdcData->GetZDCTDCData(12,j) != 0) { | |
1458 | zna = kTRUE; | |
1459 | tdcA = 0.025*(zdcData->GetZDCTDCData(12,j)-zdcData->GetZDCTDCData(14,j)); | |
1460 | tdcAcorr = zdcData->GetZDCTDCCorrected(12,j); | |
1461 | } | |
1462 | } | |
1463 | ||
1464 | const Int_t runNumber = aEsd->GetRunNumber(); | |
1465 | if(runNumber<188124 || runNumber>188374){ | |
1466 | AliError(Form(" ZN BG time cut not implemented for run %d",runNumber)); | |
1467 | return kFALSE; | |
1468 | } | |
1469 | ||
1470 | Bool_t znabg = (zna && (TMath::Abs(tdcAcorr)>2.0)); | |
1471 | Bool_t zncbg = (znc && (TMath::Abs(tdcCcorr)>5.0)); | |
1472 | ||
1473 | // Printf("Checking ZN background (time) for run %d, A = %d, time=%2.2f, C = %d, time=%2.2f",runNumber,(Int_t)zna,tdcAcorr,(Int_t)znc,tdcCcorr); | |
1474 | // Printf("Checking ZN background (time) for run %d, A-BG = %d, C-BG = %d",runNumber,(Int_t)znabg,(Int_t)zncbg); | |
1475 | ||
1476 | if (side == kASide) return znabg; | |
1477 | if (side == kCSide) return zncbg; | |
1478 | return kFALSE; | |
1479 | } | |
1480 | ||
1481 | Bool_t AliTriggerAnalysis::ZDCTrigger(const AliESDEvent* aEsd, AliceSide side) const | |
1482 | { | |
1483 | // Returns if ZDC triggered | |
1484 | ||
1485 | AliESDZDC* zdcData = aEsd->GetESDZDC(); | |
1486 | if (!zdcData) | |
1487 | { | |
1488 | AliError("AliESDZDC not available"); | |
1489 | return kFALSE; | |
1490 | } | |
1491 | ||
1492 | UInt_t quality = zdcData->GetESDQuality(); | |
1493 | ||
1494 | // from Nora's presentation, general first physics meeting 16.10.09 | |
1495 | static UInt_t zpc = 0x20; | |
1496 | static UInt_t znc = 0x10; | |
1497 | static UInt_t zem1 = 0x08; | |
1498 | static UInt_t zem2 = 0x04; | |
1499 | static UInt_t zpa = 0x02; | |
1500 | static UInt_t zna = 0x01; | |
1501 | ||
1502 | if (side == kASide && ((quality & zpa) || (quality & zna))) | |
1503 | return kTRUE; | |
1504 | if (side == kCentralBarrel && ((quality & zem1) || (quality & zem2))) | |
1505 | return kTRUE; | |
1506 | if (side == kCSide && ((quality & zpc) || (quality & znc))) | |
1507 | return kTRUE; | |
1508 | ||
1509 | return kFALSE; | |
1510 | } | |
1511 | ||
1512 | Int_t AliTriggerAnalysis::FMDHitCombinations(const AliESDEvent* aEsd, AliceSide side, Bool_t fillHists) | |
1513 | { | |
1514 | // returns number of hit combinations agove threshold | |
1515 | // | |
1516 | // Authors: FMD team, Hans Dalsgaard (code merged from FMD/AliFMDOfflineTrigger) | |
1517 | ||
1518 | if (!fDoFMD) | |
1519 | return -1; | |
1520 | ||
1521 | // Workaround for AliESDEvent::GetFMDData is not const! | |
1522 | const AliESDFMD* fmdData = (const_cast<AliESDEvent*>(aEsd))->GetFMDData(); | |
1523 | if (!fmdData) | |
1524 | { | |
1525 | AliError("AliESDFMD not available"); | |
1526 | return -1; | |
1527 | } | |
1528 | ||
1529 | Int_t detFrom = (side == kASide) ? 1 : 3; | |
1530 | Int_t detTo = (side == kASide) ? 2 : 3; | |
1531 | ||
1532 | Int_t triggers = 0; | |
1533 | Float_t totalMult = 0; | |
1534 | for (UShort_t det=detFrom;det<=detTo;det++) { | |
1535 | Int_t nRings = (det == 1 ? 1 : 2); | |
1536 | for (UShort_t ir = 0; ir < nRings; ir++) { | |
1537 | Char_t ring = (ir == 0 ? 'I' : 'O'); | |
1538 | UShort_t nsec = (ir == 0 ? 20 : 40); | |
1539 | UShort_t nstr = (ir == 0 ? 512 : 256); | |
1540 | for (UShort_t sec =0; sec < nsec; sec++) { | |
1541 | for (UShort_t strip = 0; strip < nstr; strip++) { | |
1542 | Float_t mult = fmdData->Multiplicity(det,ring,sec,strip); | |
1543 | if (mult == AliESDFMD::kInvalidMult) continue; | |
1544 | ||
1545 | if (fillHists) | |
1546 | fHistFMDSingle->Fill(mult); | |
1547 | ||
1548 | if (mult > fFMDLowCut) | |
1549 | totalMult = totalMult + mult; | |
1550 | else | |
1551 | { | |
1552 | if (totalMult > fFMDHitCut) | |
1553 | triggers++; | |
1554 | ||
1555 | if (fillHists) | |
1556 | fHistFMDSum->Fill(totalMult); | |
1557 | ||
1558 | totalMult = 0; | |
1559 | } | |
1560 | } | |
1561 | } | |
1562 | } | |
1563 | } | |
1564 | ||
1565 | return triggers; | |
1566 | } | |
1567 | ||
1568 | Bool_t AliTriggerAnalysis::FMDTrigger(const AliESDEvent* aEsd, AliceSide side) | |
1569 | { | |
1570 | // Returns if the FMD triggered | |
1571 | // | |
1572 | // Authors: FMD team, Hans Dalsgaard (code merged from FMD/AliFMDOfflineTrigger) | |
1573 | ||
1574 | Int_t triggers = FMDHitCombinations(aEsd, side, kFALSE); | |
1575 | ||
1576 | if (triggers > 0) | |
1577 | return kTRUE; | |
1578 | ||
1579 | return kFALSE; | |
1580 | } | |
1581 | ||
1582 | Long64_t AliTriggerAnalysis::Merge(TCollection* list) | |
1583 | { | |
1584 | // Merge a list of AliMultiplicityCorrection objects with this (needed for | |
1585 | // PROOF). | |
1586 | // Returns the number of merged objects (including this). | |
1587 | ||
1588 | if (!list) | |
1589 | return 0; | |
1590 | ||
1591 | if (list->IsEmpty()) | |
1592 | return 1; | |
1593 | ||
1594 | TIterator* iter = list->MakeIterator(); | |
1595 | TObject* obj; | |
1596 | ||
1597 | // collections of all histograms | |
1598 | const Int_t nHists = 14; | |
1599 | TList collections[nHists]; | |
1600 | ||
1601 | Int_t count = 0; | |
1602 | while ((obj = iter->Next())) { | |
1603 | ||
1604 | AliTriggerAnalysis* entry = dynamic_cast<AliTriggerAnalysis*> (obj); | |
1605 | if (entry == 0) | |
1606 | continue; | |
1607 | ||
1608 | Int_t n = 0; | |
1609 | collections[n++].Add(entry->fHistV0A); | |
1610 | collections[n++].Add(entry->fHistV0C); | |
1611 | collections[n++].Add(entry->fHistZDC); | |
1612 | collections[n++].Add(entry->fHistTDCZDC); | |
1613 | collections[n++].Add(entry->fHistTimeZDC); | |
1614 | collections[n++].Add(entry->fHistTimeCorrZDC); | |
1615 | collections[n++].Add(entry->fHistFMDA); | |
1616 | collections[n++].Add(entry->fHistFMDC); | |
1617 | collections[n++].Add(entry->fHistFMDSingle); | |
1618 | collections[n++].Add(entry->fHistFMDSum); | |
1619 | collections[n++].Add(entry->fHistBitsSPD); | |
1620 | collections[n++].Add(entry->fHistFiredBitsSPD); | |
1621 | collections[n++].Add(entry->fHistSPDClsVsTrk); | |
1622 | collections[n++].Add(entry->fHistT0); | |
1623 | ||
1624 | // merge fTriggerClasses | |
1625 | TIterator* iter2 = entry->fTriggerClasses->MakeIterator(); | |
1626 | TObjString* obj2 = 0; | |
1627 | while ((obj2 = dynamic_cast<TObjString*> (iter2->Next()))) | |
1628 | { | |
1629 | TParameter<Long64_t>* param2 = static_cast<TParameter<Long64_t>*> (entry->fTriggerClasses->GetValue(obj2)); | |
1630 | ||
1631 | TParameter<Long64_t>* param1 = dynamic_cast<TParameter<Long64_t>*> (fTriggerClasses->GetValue(obj2)); | |
1632 | if (param1) | |
1633 | { | |
1634 | param1->SetVal(param1->GetVal() + param2->GetVal()); | |
1635 | } | |
1636 | else | |
1637 | { | |
1638 | param1 = dynamic_cast<TParameter<Long64_t>*> (param2->Clone()); | |
1639 | fTriggerClasses->Add(new TObjString(obj2->String()), param1); | |
1640 | } | |
1641 | } | |
1642 | ||
1643 | delete iter2; | |
1644 | ||
1645 | count++; | |
1646 | } | |
1647 | ||
1648 | Int_t n = 0; | |
1649 | fHistV0A->Merge(&collections[n++]); | |
1650 | fHistV0C->Merge(&collections[n++]); | |
1651 | fHistZDC->Merge(&collections[n++]); | |
1652 | fHistTDCZDC->Merge(&collections[n++]); | |
1653 | if (fHistTimeZDC) | |
1654 | fHistTimeZDC->Merge(&collections[n++]); | |
1655 | else | |
1656 | n++; | |
1657 | if (fHistTimeCorrZDC) | |
1658 | fHistTimeCorrZDC->Merge(&collections[n++]); | |
1659 | else | |
1660 | n++; | |
1661 | fHistFMDA->Merge(&collections[n++]); | |
1662 | fHistFMDC->Merge(&collections[n++]); | |
1663 | fHistFMDSingle->Merge(&collections[n++]); | |
1664 | fHistFMDSum->Merge(&collections[n++]); | |
1665 | fHistBitsSPD->Merge(&collections[n++]); | |
1666 | fHistFiredBitsSPD->Merge(&collections[n++]); | |
1667 | fHistSPDClsVsTrk->Merge(&collections[n++]); | |
1668 | fHistT0->Merge(&collections[n++]); | |
1669 | delete iter; | |
1670 | ||
1671 | return count+1; | |
1672 | } | |
1673 | ||
1674 | void AliTriggerAnalysis::SaveHistograms() const | |
1675 | { | |
1676 | // write histograms to current directory | |
1677 | ||
1678 | if (!fHistBitsSPD) | |
1679 | return; | |
1680 | ||
1681 | if (fHistBitsSPD) { | |
1682 | fHistBitsSPD->Write(); | |
1683 | fHistBitsSPD->ProjectionX(); | |
1684 | fHistBitsSPD->ProjectionY(); | |
1685 | } | |
1686 | else Printf("Cannot save fHistBitsSPD"); | |
1687 | if (fHistFiredBitsSPD) fHistFiredBitsSPD->Write(); | |
1688 | else Printf("Cannot save fHistFiredBitsSPD"); | |
1689 | if (fHistV0A) fHistV0A->Write(); | |
1690 | else Printf("Cannot save fHistV0A"); | |
1691 | if (fHistV0C) fHistV0C->Write(); | |
1692 | else Printf("Cannot save fHistV0C"); | |
1693 | if (fHistZDC) fHistZDC->Write(); | |
1694 | else Printf("Cannot save fHistZDC"); | |
1695 | if (fHistTDCZDC) fHistTDCZDC->Write(); | |
1696 | else Printf("Cannot save fHistTDCZDC"); | |
1697 | if (fHistTimeZDC) fHistTimeZDC->Write(); | |
1698 | else Printf("Cannot save fHistTimeZDC"); | |
1699 | if (fHistTimeCorrZDC) fHistTimeCorrZDC->Write(); | |
1700 | else Printf("Cannot save fHistTimeCorrZDC"); | |
1701 | if (fHistFMDA) fHistFMDA->Write(); | |
1702 | else Printf("Cannot save fHistFMDA"); | |
1703 | if (fHistFMDC) fHistFMDC->Write(); | |
1704 | else Printf("Cannot save fHistFMDC"); | |
1705 | if (fHistFMDSingle) fHistFMDSingle->Write(); | |
1706 | else Printf("Cannot save fHistFMDSingle"); | |
1707 | if (fHistFMDSum) fHistFMDSum->Write(); | |
1708 | else Printf("Cannot save fHistFMDSum"); | |
1709 | if (fSPDGFOEfficiency) fSPDGFOEfficiency->Write("fSPDGFOEfficiency"); | |
1710 | if (fHistSPDClsVsTrk) fHistSPDClsVsTrk->Write("fHistSPDClsVsTrk"); | |
1711 | if (fHistT0) fHistT0->Write("fHistT0"); | |
1712 | ||
1713 | // else Printf("Cannot save fSPDGFOEfficiency"); | |
1714 | ||
1715 | fTriggerClasses->Write("fTriggerClasses", TObject::kSingleKey); | |
1716 | } | |
1717 | ||
1718 | void AliTriggerAnalysis::PrintTriggerClasses() const | |
1719 | { | |
1720 | // print trigger classes | |
1721 | ||
1722 | Printf("Trigger Classes:"); | |
1723 | ||
1724 | Printf("Event count for trigger combinations:"); | |
1725 | ||
1726 | TMap singleTrigger; | |
1727 | singleTrigger.SetOwner(); | |
1728 | ||
1729 | TIterator* iter = fTriggerClasses->MakeIterator(); | |
1730 | TObjString* obj = 0; | |
1731 | while ((obj = dynamic_cast<TObjString*> (iter->Next()))) | |
1732 | { | |
1733 | TParameter<Long64_t>* param = static_cast<TParameter<Long64_t>*> (fTriggerClasses->GetValue(obj)); | |
1734 | ||
1735 | Printf(" %s: %ld triggers", obj->String().Data(), (Long_t)param->GetVal()); | |
1736 | ||
1737 | TObjArray* tokens = obj->String().Tokenize(" "); | |
1738 | for (Int_t i=0; i<tokens->GetEntries(); i++) | |
1739 | { | |
1740 | TParameter<Long64_t>* count = dynamic_cast<TParameter<Long64_t>*> (singleTrigger.GetValue(((TObjString*) tokens->At(i))->String().Data())); | |
1741 | if (!count) | |
1742 | { | |
1743 | count = new TParameter<Long64_t>(((TObjString*) tokens->At(i))->String().Data(), 0); | |
1744 | singleTrigger.Add(new TObjString(((TObjString*) tokens->At(i))->String().Data()), count); | |
1745 | } | |
1746 | count->SetVal(count->GetVal() + param->GetVal()); | |
1747 | } | |
1748 | ||
1749 | delete tokens; | |
1750 | } | |
1751 | delete iter; | |
1752 | ||
1753 | Printf("Event count for single trigger:"); | |
1754 | ||
1755 | iter = singleTrigger.MakeIterator(); | |
1756 | while ((obj = dynamic_cast<TObjString*> (iter->Next()))) | |
1757 | { | |
1758 | TParameter<Long64_t>* param = static_cast<TParameter<Long64_t>*> (singleTrigger.GetValue(obj)); | |
1759 | ||
1760 | Printf(" %s: %ld triggers", obj->String().Data(), (Long_t)param->GetVal()); | |
1761 | } | |
1762 | delete iter; | |
1763 | ||
1764 | singleTrigger.DeleteAll(); | |
1765 | } | |
1766 | ||
1767 | ||
1768 | //---------------------------------------------------------------------------------------------------- | |
1769 | AliTriggerAnalysis::T0Decision AliTriggerAnalysis::T0Trigger(const AliESDEvent* aEsd, Bool_t online, Bool_t fillHists) | |
1770 | { | |
1771 | // Returns the T0 TVDC trigger decision | |
1772 | // | |
1773 | // argument 'online' is used as a switch between online and offline trigger algorithms | |
1774 | // in online mode return 0TVX | |
1775 | // in offline mode in addition check pile-up and background : | |
1776 | // pile-up readed from ESD: check if TVDC (0TVX module name) has more 1 hit; | |
1777 | // backgroud flag readed from ESD : check in given time interval OrA and OrC were correct but TVDC not | |
1778 | // | |
1779 | // Based on an algorithm by Alla Maevskaya | |
1780 | ||
1781 | const AliESDTZERO* esdT0 = aEsd->GetESDTZERO(); | |
1782 | if (!esdT0) | |
1783 | { | |
1784 | AliError("AliESDTZERO not available"); | |
1785 | return kT0Invalid; | |
1786 | } | |
1787 | //???? AliDebug(2,Form("In T0Trigger: %f %f",esdV0->GetV0ATime(),esdV0->GetV0CTime())); | |
1788 | Float_t tvdc[5] ; | |
1789 | for (Int_t ii=0; ii<5; ii++) | |
1790 | tvdc[ii] = esdT0->GetTVDC(ii); | |
1791 | Int_t trig=esdT0->GetT0Trig(); | |
1792 | // cout<<" T0 trig "<<trig<<endl; | |
1793 | ||
1794 | if(fillHists) fHistT0->Fill(tvdc[0]); | |
1795 | ||
1796 | if (online) { | |
1797 | if(aEsd->GetHeader()->GetFiredTriggerInputs().Contains("0TVX") ) return kT0BB; | |
1798 | } | |
1799 | else { | |
1800 | ||
1801 | if (esdT0->GetPileupFlag()) return kT0DecPileup; | |
1802 | if (esdT0->GetBackgroundFlag()) return kT0DecBG; | |
1803 | if (tvdc[0]>-5 && tvdc[0]<5 && tvdc[0] != 0) return kT0BB; | |
1804 | } | |
1805 | ||
1806 | if (fMC) | |
1807 | if( esdT0->GetT0zVertex()>-12.3 && esdT0->GetT0zVertex() < 10.3) return kT0BB; | |
1808 | ||
1809 | return kT0Empty; | |
1810 | } | |
1811 | ||
1812 | //---------------------------------------------------------------------------------------------------- | |
1813 | Bool_t AliTriggerAnalysis::EMCALCellsTrigger(const AliESDEvent *aEsd) | |
1814 | { | |
1815 | // | |
1816 | // Returns the EMCAL trigger decision | |
1817 | // so far only implemented for LHC11a data | |
1818 | // see http://alisoft.cern.ch/viewvc/trunk/PWGGA/EMCALTasks/AliEmcalPhysicsSelection.cxx?view=markup&root=AliRoot Revision 56136 | |
1819 | // | |
1820 | ||
1821 | Bool_t isFired = kTRUE; | |
1822 | const Int_t runNumber = aEsd->GetRunNumber(); | |
1823 | ||
1824 | /* | |
1825 | // Load EMCAL branches from the manager | |
1826 | AliAnalysisManager *am = AliAnalysisManager::GetAnalysisManager(); | |
1827 | am->LoadBranch("EMCALCells."); | |
1828 | am->LoadBranch("CaloClusters"); | |
1829 | */ | |
1830 | ||
1831 | // Get EMCAL cells | |
1832 | AliVCaloCells *cells = aEsd->GetEMCALCells(); | |
1833 | const Short_t nCells = cells->GetNumberOfCells(); | |
1834 | ||
1835 | // count cells above threshold per sm | |
1836 | Int_t nCellCount[10] = {0,0,0,0,0,0,0,0,0,0}; | |
1837 | for(Int_t iCell=0; iCell<nCells; ++iCell) { | |
1838 | Short_t cellId = cells->GetCellNumber(iCell); | |
1839 | Double_t cellE = cells->GetCellAmplitude(cellId); | |
1840 | Int_t sm = cellId / (24*48); | |
1841 | if (cellE>0.1) | |
1842 | ++nCellCount[sm]; | |
1843 | } | |
1844 | ||
1845 | // Trigger decision for LHC11a | |
1846 | Bool_t isLedEvent = kFALSE; | |
1847 | if ((runNumber>=144871) && (runNumber<=146860)) { | |
1848 | if (nCellCount[4] > 100) | |
1849 | isLedEvent = kTRUE; | |
1850 | else { | |
1851 | if ((runNumber>=146858) && (runNumber<=146860)) { | |
1852 | if (nCellCount[3]>=35) | |
1853 | isLedEvent = kTRUE; | |
1854 | } | |
1855 | } | |
1856 | } | |
1857 | ||
1858 | if (isLedEvent) { | |
1859 | isFired = kFALSE; | |
1860 | } | |
1861 | ||
1862 | return isFired; | |
1863 | } |