AliPhysics  b43479f (b43479f)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliEMCALTriggerOfflineQAPP.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2016, 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 #include <cstring>
17 #include <fstream>
18 
19 #include <THashList.h>
20 #include <TH1D.h>
21 #include <TH2D.h>
22 #include <TH3D.h>
23 #include <TProfile.h>
24 #include <TObjString.h>
25 #include <TObjArray.h>
26 
27 #include <AliEMCALTriggerPatchInfo.h>
28 #include <AliEMCALTriggerFastOR.h>
29 #include <AliLog.h>
30 #include <AliEMCALGeometry.h>
31 #include <AliVCaloCells.h>
32 #include <AliEMCALTriggerConstants.h>
33 
35 
39 
42  AliEMCALTriggerQA(),
43  fOfflineBadChannels(),
44  fBadChannels(),
45  fFastORPedestal(),
46  fDCalPlots(kTRUE),
47  fL0MinTime(7),
48  fL0MaxTime(10),
49  fMinCellAmp(0.),
50  fMinL0FastORAmp(0),
51  fMinL1FastORAmp(0),
52  fHistManager(),
53  fSumOfflineEMCal(0),
54  fSumL0EMCal(0),
55  fSumL1EMCal(0),
56  fSumOfflineDCal(0),
57  fSumL0DCal(0),
58  fSumL1DCal(0),
59  fNCellEMCal(0),
60  fNL0EMCal(0),
61  fNL1EMCal(0),
62  fNCellDCal(0),
63  fNL0DCal(0),
64  fNL1DCal(0),
65  fNTotTRU(0),
66  fMaxFORabsId(0)
67 {
68  for (Int_t i = 0; i < 3; i++) {
69  fEnabledPatchTypes[i] = kTRUE;
70 
71  for (Int_t itype = 0; itype < 6; itype++) {
72  fMaxPatchEMCal[itype][i] = 0;
73  fMaxPatchDCal[itype][i] = 0;
74  }
75  }
76 
77  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalBkg] = kFALSE;
78  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalLevel0] = kTRUE;
79  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalGammaL] = kFALSE;
80  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalJetL] = kFALSE;
81  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalGammaH] = kTRUE;
82  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalJetH] = kTRUE;
83 }
84 
89  AliEMCALTriggerQA(name),
90  fOfflineBadChannels(),
91  fBadChannels(),
92  fFastORPedestal(5000),
93  fDCalPlots(kTRUE),
94  fL0MinTime(7),
95  fL0MaxTime(10),
96  fMinCellAmp(0.),
97  fMinL0FastORAmp(0),
98  fMinL1FastORAmp(0),
99  fHistManager(name),
100  fSumOfflineEMCal(0),
101  fSumL0EMCal(0),
102  fSumL1EMCal(0),
103  fSumOfflineDCal(0),
104  fSumL0DCal(0),
105  fSumL1DCal(0),
106  fNCellEMCal(0),
107  fNL0EMCal(0),
108  fNL1EMCal(0),
109  fNCellDCal(0),
110  fNL0DCal(0),
111  fNL1DCal(0),
112  fNTotTRU(0),
113  fMaxFORabsId(0)
114 {
115  for (Int_t i = 0; i < 3; i++) {
116  fEnabledPatchTypes[i] = kTRUE;
117 
118  for (Int_t itype = 0; itype < 6; itype++) {
119  fMaxPatchEMCal[itype][i] = 0;
120  fMaxPatchDCal[itype][i] = 0;
121  }
122  }
123 
124  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalBkg] = kFALSE;
125  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalLevel0] = kTRUE;
126  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalGammaL] = kFALSE;
127  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalJetL] = kFALSE;
128  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalGammaH] = kTRUE;
129  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalJetH] = kTRUE;
130 }
131 
136  AliEMCALTriggerQA(triggerQA),
137  fOfflineBadChannels(triggerQA.fOfflineBadChannels),
138  fBadChannels(),
139  fFastORPedestal(triggerQA.fFastORPedestal),
140  fDCalPlots(kTRUE),
141  fL0MinTime(triggerQA.fL0MinTime),
142  fL0MaxTime(triggerQA.fL0MaxTime),
143  fMinCellAmp(triggerQA.fMinCellAmp),
144  fMinL0FastORAmp(triggerQA.fMinL0FastORAmp),
145  fMinL1FastORAmp(triggerQA.fMinL1FastORAmp),
146  fHistManager(triggerQA.GetName()),
147  fSumOfflineEMCal(0),
148  fSumL0EMCal(0),
149  fSumL1EMCal(0),
150  fSumOfflineDCal(0),
151  fSumL0DCal(0),
152  fSumL1DCal(0),
153  fNCellEMCal(0),
154  fNL0EMCal(0),
155  fNL1EMCal(0),
156  fNCellDCal(0),
157  fNL0DCal(0),
158  fNL1DCal(0),
159  fNTotTRU(0),
160  fMaxFORabsId(0)
161 {
162  for (Int_t i = 0; i < 3; i++) {
163  fEnabledPatchTypes[i] = kTRUE;
164 
165  for (Int_t itype = 0; itype < 6; itype++) {
166  fMaxPatchEMCal[itype][i] = 0;
167  fMaxPatchDCal[itype][i] = 0;
168  }
169  }
170 }
171 
174 {
175 }
176 
181 {
182  Short_t absId = 0;
183 
184  while (stream.good()) {
185  stream >> absId;
186  AddOfflineBadChannel(absId);
187  }
188 }
189 
194 {
195  std::ifstream file(fname);
197 }
198 
203 {
204  Short_t absId = -1;
205 
206  while (stream.good()) {
207  stream >> absId;
208  AddFastORBadChannel(absId);
209  }
210 }
211 
216 {
217  std::ifstream file(fname);
219 }
220 
225 void AliEMCALTriggerOfflineQAPP::SetFastORPedestal(Short_t absId, Float_t ped)
226 {
227  if (absId < 0 || absId >= fFastORPedestal.GetSize()) {
228  AliWarning(Form("Abs. ID %d out of range (0,5000)", absId));
229  return;
230  }
231  fFastORPedestal[absId] = ped;
232 }
233 
234 
239 {
240  Short_t absId = 0;
241  Float_t ped = 0;
242  while (stream.good()) {
243  stream >> ped;
244  SetFastORPedestal(absId, ped);
245  absId++;
246  }
247 }
248 
253 {
254  std::ifstream file(fname);
256 }
257 
260 {
261  TString hname;
262  TString htitle;
263 
264  // Geometry object not available at this stage, so need to hardcode some numbers
265  fNTotTRU = 32; // there are 32 TRU in the EMCal (10 full SM * 3 TRU + 2 small SM * 1 TRU)
266  Int_t ndet = 1;
267  if (fDCalPlots) {
268  fNTotTRU += 20; // there are additional 14 TRU in DCal, some skip in between (see below)
269  ndet += 1;
270  }
271  fMaxFORabsId = fNTotTRU * 96; // there are 96 channels in each TRU
272 
273  if (fTimeStampBinWidth > 0) fHistManager.CreateHistoGroup("ByTimeStamp");
274 
275  hname = Form("EMCTRQA_histFastORL0");
276  htitle = Form("EMCTRQA_histFastORL0;FastOR abs. ID;entries above 0");
277  fHistManager.CreateTH1(hname, htitle, fMaxFORabsId, 0, fMaxFORabsId);
278 
279  hname = Form("EMCTRQA_histLargeAmpFastORL0");
280  htitle = Form("EMCTRQA_histLargeAmpFastORL0 (>%d);FastOR abs. ID;entries above %d", fFastorL0Th, fFastorL0Th);
281  fHistManager.CreateTH1(hname, htitle, fMaxFORabsId, 0, fMaxFORabsId);
282 
283  hname = Form("EMCTRQA_histFastORL0Amp");
284  htitle = Form("EMCTRQA_histFastORL0Amp;FastOR abs. ID;ADC counts");
285  fHistManager.CreateTH2(hname, htitle, fMaxFORabsId, 0, fMaxFORabsId, 1024, 0, 4096);
286 
287  hname = Form("EMCTRQA_histFastORL0Time");
288  htitle = Form("EMCTRQA_histFastORL0Time;FastOR abs. ID;time");
289  fHistManager.CreateTH2(hname, htitle, fMaxFORabsId, 0, fMaxFORabsId, 21, -1, 20);
290 
291  hname = Form("EMCTRQA_histFastORL0AmpVsTime");
292  htitle = Form("EMCTRQA_histFastORL0AmpVsTime;time;amplitude");
293  fHistManager.CreateTH2(hname, htitle, 21, -1, 20, 1024, 0, 4096);
294 
295  hname = Form("EMCTRQA_histFastORL0TimeOk");
296  htitle = Form("EMCTRQA_histFastORL0TimeOk;FastOR abs. ID;entries (%d < time < %d)", fL0MinTime, fL0MaxTime);
297  fHistManager.CreateTH1(hname, htitle, fMaxFORabsId, 0, fMaxFORabsId);
298 
299  hname = Form("EMCTRQA_histFastORL0AmpTimeOk");
300  htitle = Form("EMCTRQA_histFastORL0AmpTimeOk;FastOR abs. ID;ADC counts (%d < time < %d)", fL0MinTime, fL0MaxTime);
301  fHistManager.CreateTH2(hname, htitle, fMaxFORabsId, 0, fMaxFORabsId, 1024, 0, 4096);
302 
303  hname = Form("EMCTRQA_histFastORL1");
304  htitle = Form("EMCTRQA_histFastORL1;FastOR abs. ID;entries above 0");
305  fHistManager.CreateTH1(hname, htitle, fMaxFORabsId, 0, fMaxFORabsId);
306 
307  hname = Form("EMCTRQA_histLargeAmpFastORL1");
308  htitle = Form("EMCTRQA_histLargeAmpFastORL1 (>%d);FastOR abs. ID;entries above %d", fFastorL1Th, fFastorL1Th);
309  fHistManager.CreateTH1(hname, htitle, fMaxFORabsId, 0, fMaxFORabsId);
310 
311  hname = Form("EMCTRQA_histFastORL1Amp");
312  htitle = Form("EMCTRQA_histFastORL1Amp;FastOR abs. ID;L1 time sum");
313  fHistManager.CreateTH2(hname, htitle, fMaxFORabsId, 0, fMaxFORabsId, 1024, 0, 4096);
314 
315  hname = Form("EMCTRQA_histFastORL1AmpVsL0Amp");
316  htitle = Form("EMCTRQA_histFastORL1AmpVsL0Amp;L0 amplitude;L1 time sum;entries");
317  fHistManager.CreateTH2(hname, htitle, 256, 0, 1024, 256, 0, 1024);
318 
319  hname = Form("EMCTRQA_histCellAmp");
320  htitle = Form("EMCTRQA_histCellAmp;cell abs. ID;energy (GeV)");
321  fHistManager.CreateTH2(hname, htitle, fMaxFORabsId*4, 0, fMaxFORabsId*4, 400, 0, 200);
322 
323  hname = Form("EMCTRQA_histCell");
324  htitle = Form("EMCTRQA_histCell;cell abs. ID;entries above 0 GeV");
325  fHistManager.CreateTH1(hname, htitle, fMaxFORabsId*4, 0, fMaxFORabsId*4);
326 
327  hname = Form("EMCTRQA_histLargeAmpCell");
328  htitle = Form("EMCTRQA_histLargeAmpCell (>%.1f);cell abs. ID;entries above %.1f GeV", fFastorL1Th * EMCALTrigger::kEMCL1ADCtoGeV, fFastorL1Th * EMCALTrigger::kEMCL1ADCtoGeV);
329  fHistManager.CreateTH1(hname, htitle, fMaxFORabsId*4, 0, fMaxFORabsId*4);
330 
331  hname = Form("EMCTRQA_histCellAmpVsFastORL0Amp");
332  htitle = Form("EMCTRQA_histCellAmpVsFastORL0Amp;FastOR L0 amplitude;2x2 cell sum energy (GeV)");
333  fHistManager.CreateTH2(hname, htitle, 1024, 0, 4096, 400, 0, 200);
334 
335  hname = Form("EMCTRQA_histCellAmpVsFastORL0AmpTriggered");
336  htitle = Form("EMCTRQA_histCellAmpVsFastORL0AmpTriggered;FastOR L0 amplitude;2x2 cell sum energy (GeV)");
337  fHistManager.CreateTH2(hname, htitle, 1024, 0, 4096, 400, 0, 200);
338 
339  hname = Form("EMCTRQA_histCellAmpVsFastORL1Amp");
340  htitle = Form("EMCTRQA_histCellAmpVsFastORL1Amp;FastOR L1 amplitude;2x2 cell sum energy (GeV)");
341  fHistManager.CreateTH2(hname, htitle, 1024, 0, 4096, 400, 0, 200);
342 
343  for (Int_t nTRU = 0; nTRU < fNTotTRU; nTRU++) {
344  if (nTRU == 34 || nTRU == 35 ||
345  nTRU == 40 || nTRU == 41 ||
346  nTRU == 46 || nTRU == 47) continue;
347  hname = Form("EMCTRQA_histCellAmpVsFastORL0AmpTRU%d", nTRU);
348  htitle = Form("EMCTRQA_histCellAmpVsFastORL0Amp%d;FastOR L0 amplitude;2x2 cell sum energy (GeV)", nTRU);
349  fHistManager.CreateTH2(hname, htitle, 1024, 0, 4096, 400, 0, 200);
350 
351  hname = Form("EMCTRQA_histCellAmpVsFastORL0AmpTriggeredTRU%d", nTRU);
352  htitle = Form("EMCTRQA_histCellAmpVsFastORL0AmpTriggeredTRU%d;FastOR L0 amplitude;2x2 cell sum energy (GeV)", nTRU);
353  fHistManager.CreateTH2(hname, htitle, 1024, 0, 4096, 400, 0, 200);
354  }
355 
356  hname = Form("EMCTRQA_histFastORNoOffline");
357  htitle = Form("EMCTRQA_histFastORNoOffline;FastOR abs. ID;entries with no offline energy");
358  fHistManager.CreateTH1(hname, htitle, fMaxFORabsId, 0, fMaxFORabsId);
359 
360  const char* det[2] = { "EMCal", "DCal" };
361 
362  for (Int_t itrig = 0; itrig < 6; itrig++) {
363  if (EMCALTrigger::kEMCalTriggerNames[itrig].IsNull() || fEnabledTriggerTypes[itrig] == kFALSE) continue;
364 
365  for (Int_t idet = 0; idet < ndet; idet++) {
366  hname = Form("EMCTRQA_hist%s%sMaxOfflineVsRecalc", det[idet], EMCALTrigger::kEMCalTriggerNames[itrig].Data());
367  htitle = Form("EMCTRQA_hist%s%sMaxOfflineVsRecalc;Recalc;Offline;entries", det[idet], EMCALTrigger::kEMCalTriggerNames[itrig].Data());
368  fHistManager.CreateTH2(hname, htitle, fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig], fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig]);
369 
370  hname = Form("EMCTRQA_hist%s%sOfflineVsRecalc", det[idet], EMCALTrigger::kEMCalTriggerNames[itrig].Data());
371  htitle = Form("EMCTRQA_hist%s%sOfflineVsRecalc;Recalc;Offline;entries", det[idet], EMCALTrigger::kEMCalTriggerNames[itrig].Data());
372  fHistManager.CreateTH2(hname, htitle, fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig], fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig]);
373  }
374 
375  for (Int_t itype = 0; itype < 3; itype++) {
376  if (!fEnabledPatchTypes[itype]) continue;
377  for (Int_t idet = 0; idet < ndet; idet++) {
378  hname = Form("EMCTRQA_hist%sPatchAmp%s%s", det[idet], EMCALTrigger::kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
379  htitle = Form("EMCTRQA_hist%sPatchAmp%s%s;amplitude;entries", det[idet], EMCALTrigger::kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
380  fHistManager.CreateTH1(hname, htitle, fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig]);
381 
382  hname = Form("EMCTRQA_hist%sMaxPatchAmp%s%s", det[idet], EMCALTrigger::kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
383  htitle = Form("EMCTRQA_hist%sMaxPatchAmp%s%s;amplitude;entries", det[idet], EMCALTrigger::kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
384  fHistManager.CreateTH1(hname, htitle, fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig]);
385 
386  for (Int_t itrig2 = itrig+1; itrig2 < 6; itrig2++) {
387  if (EMCALTrigger::kEMCalTriggerNames[itrig2].IsNull() || fEnabledTriggerTypes[itrig2] == kFALSE) continue;
388  hname = Form("EMCTRQA_hist%s%sMaxVs%sMax%s", det[idet], EMCALTrigger::kEMCalTriggerNames[itrig].Data(), EMCALTrigger::kEMCalTriggerNames[itrig2].Data(), fgkPatchTypes[itype].Data());
389  htitle = Form("EMCTRQA_hist%s%sMaxVs%sMax%s;%s max;%s max;entries", det[idet], EMCALTrigger::kEMCalTriggerNames[itrig].Data(), EMCALTrigger::kEMCalTriggerNames[itrig2].Data(), fgkPatchTypes[itype].Data(), EMCALTrigger::kEMCalTriggerNames[itrig2].Data(), EMCALTrigger::kEMCalTriggerNames[itrig].Data());
390  fHistManager.CreateTH2(hname, htitle, fgkMaxPatchAmp[itrig2]/fADCperBin, 0, fgkMaxPatchAmp[itrig2], fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig]);
391  }
392  }
393 
394  hname = Form("EMCTRQA_histMaxEdgePos%s%s", EMCALTrigger::kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
395  htitle = Form("EMCTRQA_histMaxEdgePos%s%s;col;row;entries", EMCALTrigger::kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
396  fHistManager.CreateTH2(hname, htitle, 48, 0, 48, 105, 0, 105);
397 
398  if (fDCalPlots) {
399  hname = Form("EMCTRQA_histEMCalMaxVsDCalMax%s%s", EMCALTrigger::kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
400  htitle = Form("EMCTRQA_histEMCalMaxVsDCalMax%s%s;EMCal max;DCal max;entries", EMCALTrigger::kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
401  fHistManager.CreateTH2(hname, htitle, fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig], fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig]);
402  }
403  }
404  }
405 
406  for (Int_t idet = 0; idet < ndet; idet++) {
407  hname = Form("EMCTRQA_hist%sOfflineSumVsL0Sum", det[idet]);
408  htitle = hname + ";Sum of L0 amplitudes;Sum of cell energies (GeV)";
409  fHistManager.CreateTH2(hname, htitle, 250, 0, 5000, 400, 0, 200);
410 
411  hname = Form("EMCTRQA_hist%sOfflineSumVsL1Sum", det[idet]);
412  htitle = hname + ";Sum of L1 amplitudes;Sum of cell energies (GeV)";
413  fHistManager.CreateTH2(hname, htitle, 250, 0, 5000, 400, 0, 200);
414 
415  hname = Form("EMCTRQA_hist%sL1SumVsL0Sum", det[idet]);
416  htitle = hname + ";Sum of L0 amplitudes;Sum of L1 amplitudes";
417  fHistManager.CreateTH2(hname, htitle, 250, 0, 5000, 250, 0, 5000);
418 
419  hname = Form("EMCTRQA_hist%sNCellVsNL0", det[idet]);
420  htitle = hname + ";Number of L0 FastORs;Number of cells";
421  fHistManager.CreateTH2(hname, htitle, 250, 0, 500, 250, 0, 2000);
422 
423  hname = Form("EMCTRQA_hist%sNCellVsNL1", det[idet]);
424  htitle = hname + ";Number of L1 FastORs;Number of cells";
425  fHistManager.CreateTH2(hname, htitle, 250, 0, 500, 250, 0, 2000);
426 
427  hname = Form("EMCTRQA_hist%sNL1VsNL0", det[idet]);
428  htitle = hname + ";Number of L0 FastORs;Number of L1 FastORs";
429  fHistManager.CreateTH2(hname, htitle, 250, 0, 500, 250, 0, 500);
430  }
431 }
432 
437 void AliEMCALTriggerOfflineQAPP::ProcessPatch(const AliEMCALTriggerPatchInfo* patch)
438 {
439  TString hname;
440 
441  Bool_t (AliEMCALTriggerPatchInfo::* triggerCheck[3][6])(void) const = {
442  { &AliEMCALTriggerPatchInfo::IsLevel0,
443  &AliEMCALTriggerPatchInfo::IsGammaLow,
444  &AliEMCALTriggerPatchInfo::IsGammaHigh,
445  &AliEMCALTriggerPatchInfo::IsJetLow,
446  &AliEMCALTriggerPatchInfo::IsJetHigh,
447  &AliEMCALTriggerPatchInfo::IsBkg
448  },
449  { &AliEMCALTriggerPatchInfo::IsLevel0Recalc,
450  &AliEMCALTriggerPatchInfo::IsGammaLowRecalc,
451  &AliEMCALTriggerPatchInfo::IsGammaHighRecalc,
452  &AliEMCALTriggerPatchInfo::IsJetLowRecalc,
453  &AliEMCALTriggerPatchInfo::IsJetHighRecalc,
454  &AliEMCALTriggerPatchInfo::IsBkgRecalc
455  },
456  { &AliEMCALTriggerPatchInfo::IsLevel0Simple,
457  &AliEMCALTriggerPatchInfo::IsGammaLowSimple,
458  &AliEMCALTriggerPatchInfo::IsGammaHighSimple,
459  &AliEMCALTriggerPatchInfo::IsJetLowSimple,
460  &AliEMCALTriggerPatchInfo::IsJetHighSimple,
461  &AliEMCALTriggerPatchInfo::IsBkgSimple
462  }
463  };
464 
465  for (Int_t itrig = 0; itrig < 6; itrig++) {
466  if (EMCALTrigger::kEMCalTriggerNames[itrig].IsNull() || fEnabledTriggerTypes[itrig] == kFALSE) continue;
467 
468  for (Int_t itype = 0; itype < 3; itype++) {
469  if (!fEnabledPatchTypes[itype]) continue;
470  if (!(patch->*(triggerCheck[itype][itrig]))()) continue;
471 
472  TString det;
473 
474  if (patch->IsEMCal()) {
475  det = "EMCal";
476  if (GetAmplitude(fMaxPatchEMCal[itrig][itype], itype) < GetAmplitude(patch, itype)) fMaxPatchEMCal[itrig][itype] = patch;
477  }
478  else if (patch->IsDCalPHOS()) {
479  if (!fDCalPlots) return;
480  det = "DCal";
481  if (GetAmplitude(fMaxPatchDCal[itrig][itype], itype) < GetAmplitude(patch, itype)) fMaxPatchDCal[itrig][itype] = patch;
482  }
483  else {
484  AliWarning(Form("Patch is not EMCal nor DCal/PHOS (pos: %d, %d)", patch->GetRowStart(), patch->GetColStart()));
485  }
486 
487  hname = Form("EMCTRQA_hist%s%sOfflineVsRecalc", det.Data(), EMCALTrigger::kEMCalTriggerNames[itrig].Data());
488  fHistManager.FillTH2(hname, GetAmplitude(patch, 1) , GetAmplitude(patch, 2));
489 
490  hname = Form("EMCTRQA_hist%sPatchAmp%s%s", det.Data(), EMCALTrigger::kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
491  fHistManager.FillTH1(hname, GetAmplitude(patch, itype));
492  }
493 
494  if (fDebugLevel >= 2) {
495  Printf("Type = %s; global pos = (%d, %d); Amp (online) = %d; Amp (offline) = %d; Patch energy = %.3f\n"
496  "Position (CM): Eta=%.3f, Phi=%.3f\n"
497  "Position (Geo): Eta=%.3f, Phi=%.3f\n",
498  EMCALTrigger::kEMCalTriggerNames[itrig].Data(), patch->GetRowStart(), patch->GetColStart(), patch->GetADCAmp(), patch->GetADCOfflineAmp(), patch->GetPatchE(),
499  patch->GetEtaCM(), patch->GetPhiCM(),
500  patch->GetEtaGeo(), patch->GetPhiGeo());
501  }
502  }
503 }
504 
509 void AliEMCALTriggerOfflineQAPP::ProcessCell(const AliEMCALCellInfo& cell)
510 {
511  TString hname;
512 
513  if (fGeom) {
514  Double_t pos[3] = {0};
515  fGeom->GetGlobal(cell.fAbsId, pos);
516  if (fGeom->IsInDCAL(pos[0], pos[1], pos[2])) {
517  if (!fDCalPlots) return;
518  fSumOfflineDCal += cell.fEnergy;
519  fNCellDCal++;
520  }
521  else if (fGeom->IsInEMCAL(pos[0], pos[1], pos[2])) {
522  fSumOfflineEMCal += cell.fEnergy;
523  fNCellEMCal++;
524  }
525  else {
526  AliWarning(Form("Cell with absolute ID %hd was not identified as neither DCal or EMCal!!", cell.fAbsId));
527  }
528  }
529 
530  if (fOfflineBadChannels.find(cell.fAbsId) != fOfflineBadChannels.end()) return;
531 
532  if (cell.fEnergy < fMinCellAmp) return;
533 
534  hname = Form("EMCTRQA_histCell");
535  fHistManager.FillTH1(hname, cell.fAbsId);
536 
537  hname = Form("EMCTRQA_histCellAmp");
538  fHistManager.FillTH2(hname, cell.fAbsId, cell.fEnergy);
539 
540  if (cell.fEnergy > fFastorL1Th * EMCALTrigger::kEMCL1ADCtoGeV) {
541  hname = Form("EMCTRQA_histLargeAmpCell");
542  fHistManager.FillTH1(hname, cell.fAbsId);
543  }
544 }
545 
550 void AliEMCALTriggerOfflineQAPP::ProcessFastor(const AliEMCALTriggerFastOR* fastor, AliVCaloCells* cells)
551 {
552  TString hname;
553 
554  if (fBadChannels.find(fastor->GetAbsId()) != fBadChannels.end()) return;
555 
556  Int_t L0amp = fastor->GetL0Amp() - fFastORPedestal[fastor->GetAbsId()];
557  Bool_t isDCal = kFALSE;
558 
559  Double_t offlineAmp = 0;
560  Int_t nTRU = -1;
561  Int_t nADC = -1;
562 
563  if (fGeom) {
564  Int_t idx[4] = {-1};
565  fGeom->GetCellIndexFromFastORIndex(fastor->GetAbsId(), idx);
566  fGeom->GetTRUFromAbsFastORIndex(fastor->GetAbsId(), nTRU, nADC);
567  Double_t pos[3] = {0};
568  if (idx[0] >= 0) {
569  fGeom->GetGlobal(idx[0], pos);
570  isDCal = fGeom->IsInDCAL(pos[0], pos[1], pos[2]);
571  if (isDCal && !fDCalPlots) return;
572 
573  if (L0amp > fMinL0FastORAmp) {
574  if (cells) {
575  for (Int_t i = 0; i < 4; i++) {
576  offlineAmp += cells->GetCellAmplitude(idx[i]);
577  }
578  }
579  }
580  }
581  }
582 
583  if (L0amp > fMinL0FastORAmp) {
584  if (fTimeStampBinWidth > 0) {
585  hname = TString::Format("ByTimeStamp/EMCTRQA_histFastORL0_%u_%u", fEventTimeStampBin, fEventTimeStampBin+fTimeStampBinWidth);
586  fHistManager.FillTH1(hname, fastor->GetAbsId());
587  }
588 
589  hname = Form("EMCTRQA_histFastORL0");
590  fHistManager.FillTH1(hname, fastor->GetAbsId());
591 
592  hname = Form("EMCTRQA_histFastORL0Amp");
593  fHistManager.FillTH2(hname, fastor->GetAbsId(), L0amp);
594 
595  hname = Form("EMCTRQA_histFastORL0Time");
596  fHistManager.FillTH2(hname, fastor->GetAbsId(), fastor->GetL0Time());
597 
598  hname = Form("EMCTRQA_histFastORL0AmpVsTime");
599  fHistManager.FillTH2(hname, fastor->GetL0Time(), L0amp);
600 
601  if (fastor->GetL0Time() > fL0MinTime && fastor->GetL0Time() < fL0MaxTime) {
602  hname = Form("EMCTRQA_histFastORL0TimeOk");
603  fHistManager.FillTH1(hname, fastor->GetAbsId());
604 
605  hname = Form("EMCTRQA_histFastORL0AmpTimeOk");
606  fHistManager.FillTH2(hname, fastor->GetAbsId(), L0amp);
607 
608  hname = Form("EMCTRQA_histCellAmpVsFastORL0AmpTriggered");
609  fHistManager.FillTH2(hname, L0amp, offlineAmp);
610 
611  hname = Form("EMCTRQA_histCellAmpVsFastORL0AmpTriggeredTRU%d",nTRU);
612  fHistManager.FillTH2(hname, L0amp, offlineAmp);
613  }
614 
615  hname = Form("EMCTRQA_histCellAmpVsFastORL0Amp");
616  fHistManager.FillTH2(hname, L0amp, offlineAmp);
617 
618  hname = Form("EMCTRQA_histCellAmpVsFastORL0AmpTRU%d",nTRU);
619  fHistManager.FillTH2(hname, L0amp, offlineAmp);
620 
621  if (offlineAmp == 0) {
622  hname = Form("EMCTRQA_histFastORNoOffline");
623  fHistManager.FillTH1(hname, fastor->GetAbsId());
624  }
625 
626  if (isDCal) {
627  fSumL0DCal += L0amp;
628  fNL0DCal++;
629  }
630  else {
631  fSumL0EMCal += L0amp;
632  fNL0EMCal++;
633  }
634  }
635 
636  if (L0amp > fFastorL0Th) {
637  if (fTimeStampBinWidth > 0) {
638  hname = TString::Format("ByTimeStamp/EMCTRQA_histLargeAmpFastORL0_%u_%u", fEventTimeStampBin, fEventTimeStampBin+fTimeStampBinWidth);
639  fHistManager.FillTH1(hname, fastor->GetAbsId());
640  }
641 
642  hname = Form("EMCTRQA_histLargeAmpFastORL0");
643  fHistManager.FillTH1(hname, fastor->GetAbsId());
644  }
645 
646  if (fastor->GetL1Amp() > fMinL1FastORAmp) {
647  hname = Form("EMCTRQA_histFastORL1");
648  fHistManager.FillTH1(hname, fastor->GetAbsId());
649 
650  hname = Form("EMCTRQA_histFastORL1Amp");
651  fHistManager.FillTH2(hname, fastor->GetAbsId(), fastor->GetL1Amp());
652 
653  if (isDCal) {
654  fSumL1DCal += fastor->GetL1Amp();
655  fNL1DCal++;
656  }
657  else {
658  fSumL1EMCal += fastor->GetL1Amp();
659  fNL1EMCal++;
660  }
661 
662  hname = Form("EMCTRQA_histCellAmpVsFastORL1Amp");
663  fHistManager.FillTH2(hname, fastor->GetL1Amp(), offlineAmp);
664  }
665 
666  if (fastor->GetL1Amp() > fFastorL1Th) {
667  hname = Form("EMCTRQA_histLargeAmpFastORL1");
668  fHistManager.FillTH1(hname, fastor->GetAbsId());
669  }
670 
671  if (fastor->GetL1Amp() > fMinL1FastORAmp || L0amp > fMinL0FastORAmp) {
672  hname = Form("EMCTRQA_histFastORL1AmpVsL0Amp");
673  fHistManager.FillTH2(hname, L0amp, fastor->GetL1Amp());
674  }
675 }
676 
677 
682 {
683  AliDebug(2, Form("Entering AliEmcalTriggerQAAP::EventCompleted"));
684 
685  TString hname;
686 
687  for (Int_t itrig = 0; itrig < 6; itrig++) {
688  if (EMCALTrigger::kEMCalTriggerNames[itrig].IsNull() || fEnabledTriggerTypes[itrig] == kFALSE) continue;
689  AliDebug(2, Form("Trigger type: %s", EMCALTrigger::kEMCalTriggerNames[itrig].Data()));
690 
691  hname = Form("EMCTRQA_histEMCal%sMaxOfflineVsRecalc", EMCALTrigger::kEMCalTriggerNames[itrig].Data());
692  fHistManager.FillTH2(hname, GetAmplitude(fMaxPatchEMCal[itrig][1], 1), GetAmplitude(fMaxPatchEMCal[itrig][2], 2));
693 
694  if (fDCalPlots) {
695  hname = Form("EMCTRQA_histDCal%sMaxOfflineVsRecalc", EMCALTrigger::kEMCalTriggerNames[itrig].Data());
696  fHistManager.FillTH2(hname, GetAmplitude(fMaxPatchDCal[itrig][1], 1), GetAmplitude(fMaxPatchDCal[itrig][2], 2));
697  }
698 
699  for (Int_t itype = 0; itype < 3; itype++) {
700  if (!fEnabledPatchTypes[itype]) continue;
701  AliDebug(2, Form("Patch type %s", fgkPatchTypes[itype].Data()));
702 
703  if (fMaxPatchEMCal[itrig][itype]) {
704  hname = Form("EMCTRQA_histMaxEdgePos%s%s", EMCALTrigger::kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
705  fHistManager.FillTH2(hname, fMaxPatchEMCal[itrig][itype]->GetColStart(), fMaxPatchEMCal[itrig][itype]->GetRowStart());
706  }
707 
708  hname = Form("EMCTRQA_histEMCalMaxPatchAmp%s%s", EMCALTrigger::kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
709  fHistManager.FillTH1(hname, GetAmplitude(fMaxPatchEMCal[itrig][itype], itype));
710 
711  if (fDCalPlots) {
712  if (fMaxPatchDCal[itrig][itype]) {
713  hname = Form("EMCTRQA_histMaxEdgePos%s%s", EMCALTrigger::kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
714  fHistManager.FillTH2(hname, fMaxPatchDCal[itrig][itype]->GetColStart(), fMaxPatchDCal[itrig][itype]->GetRowStart());
715  }
716 
717  hname = Form("EMCTRQA_histDCalMaxPatchAmp%s%s", EMCALTrigger::kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
718  fHistManager.FillTH1(hname, GetAmplitude(fMaxPatchDCal[itrig][itype], itype));
719 
720  hname = Form("EMCTRQA_histEMCalMaxVsDCalMax%s%s", EMCALTrigger::kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
721  fHistManager.FillTH2(hname, GetAmplitude(fMaxPatchEMCal[itrig][itype], itype), GetAmplitude(fMaxPatchDCal[itrig][itype], itype));
722  }
723 
724  for (Int_t itrig2 = itrig+1; itrig2 < 6; itrig2++) {
725  if (EMCALTrigger::kEMCalTriggerNames[itrig2].IsNull() || fEnabledTriggerTypes[itrig2] == kFALSE) continue;
726 
727  hname = Form("EMCTRQA_histEMCal%sMaxVs%sMax%s", EMCALTrigger::kEMCalTriggerNames[itrig].Data(), EMCALTrigger::kEMCalTriggerNames[itrig2].Data(), fgkPatchTypes[itype].Data());
728  fHistManager.FillTH2(hname, GetAmplitude(fMaxPatchEMCal[itrig2][itype], itype), GetAmplitude(fMaxPatchEMCal[itrig][itype], itype));
729 
730  if (fDCalPlots) {
731  hname = Form("EMCTRQA_histDCal%sMaxVs%sMax%s", EMCALTrigger::kEMCalTriggerNames[itrig].Data(), EMCALTrigger::kEMCalTriggerNames[itrig2].Data(), fgkPatchTypes[itype].Data());
732  fHistManager.FillTH2(hname, GetAmplitude(fMaxPatchDCal[itrig2][itype], itype), GetAmplitude(fMaxPatchDCal[itrig][itype], itype));
733  }
734  }
735 
736  fMaxPatchEMCal[itrig][itype] = 0;
737  fMaxPatchDCal[itrig][itype] = 0;
738  }
739  }
740 
741 
742  fHistManager.FillTH2("EMCTRQA_histEMCalOfflineSumVsL0Sum", fSumL0EMCal, fSumOfflineEMCal);
743  fHistManager.FillTH2("EMCTRQA_histEMCalOfflineSumVsL1Sum", fSumL1EMCal, fSumOfflineEMCal);
744  fHistManager.FillTH2("EMCTRQA_histEMCalL1SumVsL0Sum", fSumL0EMCal, fSumL1EMCal);
745  fHistManager.FillTH2("EMCTRQA_histEMCalNCellVsNL0", fNL0EMCal, fNCellEMCal);
746  fHistManager.FillTH2("EMCTRQA_histEMCalNCellVsNL1", fNL1EMCal, fNCellEMCal);
747  fHistManager.FillTH2("EMCTRQA_histEMCalNL1VsNL0", fNL0EMCal, fNL1EMCal);
748 
749  if (fDCalPlots) {
750  fHistManager.FillTH2("EMCTRQA_histDCalOfflineSumVsL0Sum", fSumL0DCal, fSumOfflineDCal);
751  fHistManager.FillTH2("EMCTRQA_histDCalOfflineSumVsL1Sum", fSumL1DCal, fSumOfflineDCal);
752  fHistManager.FillTH2("EMCTRQA_histDCalL1SumVsL0Sum", fSumL0DCal, fSumL1DCal);
753  fHistManager.FillTH2("EMCTRQA_histDCalNCellVsNL0", fNL0DCal, fNCellDCal);
754  fHistManager.FillTH2("EMCTRQA_histDCalNCellVsNL1", fNL1DCal, fNCellDCal);
755  fHistManager.FillTH2("EMCTRQA_histDCalNL1VsNL0", fNL0DCal, fNL1DCal);
756  }
757 
758  fSumOfflineEMCal = 0;
759  fSumL0EMCal = 0;
760  fSumL1EMCal = 0;
761  fSumOfflineDCal = 0;
762  fSumL0DCal = 0;
763  fSumL1DCal = 0;
764 
765  fNCellEMCal = 0;
766  fNL0EMCal = 0;
767  fNL1EMCal = 0;
768  fNCellDCal = 0;
769  fNL0DCal = 0;
770  fNL1DCal = 0;
771 }
772 
780 {
781  AliEMCALTriggerQA::EventTimeStamp(timeStamp);
782 
783  if (fTimeStampBinWidth > 0) {
784  TString hname = TString::Format("ByTimeStamp/EMCTRQA_histEvents_%u_%u", fEventTimeStampBin, fEventTimeStampBin+fTimeStampBinWidth);
785  if (!fHistManager.FindObject(hname)) {
786  TString htitle;
787 
788  hname = TString::Format("ByTimeStamp/EMCTRQA_histEvents_%u_%u", fEventTimeStampBin, fEventTimeStampBin+fTimeStampBinWidth);
789  htitle = TString::Format("EMCTRQA_histEvents;;events");
790  TH1* hevents = fHistManager.CreateTH1(hname, htitle, 1, 0, 1);
791  hevents->GetXaxis()->SetBinLabel(1, TString::Format("%u <= time stamp < %u", fEventTimeStampBin, fEventTimeStampBin+fTimeStampBinWidth));
792 
793  hname = TString::Format("ByTimeStamp/EMCTRQA_histFastORL0_%u_%u", fEventTimeStampBin, fEventTimeStampBin+fTimeStampBinWidth);
794  htitle = TString::Format("EMCTRQA_histFastORL0;FastOR abs. ID;entries above 0");
795  fHistManager.CreateTH1(hname, htitle, fMaxFORabsId, 0, fMaxFORabsId);
796 
797  hname = TString::Format("ByTimeStamp/EMCTRQA_histLargeAmpFastORL0_%u_%u", fEventTimeStampBin, fEventTimeStampBin+fTimeStampBinWidth);
798  htitle = TString::Format("EMCTRQA_histLargeAmpFastORL0 (>%d);FastOR abs. ID;entries above %d", fFastorL0Th, fFastorL0Th);
799  fHistManager.CreateTH1(hname, htitle, fMaxFORabsId, 0, fMaxFORabsId);
800  }
801 
802  hname = TString::Format("ByTimeStamp/EMCTRQA_histEvents_%u_%u", fEventTimeStampBin, fEventTimeStampBin+fTimeStampBinWidth);
803  fHistManager.FillTH1(hname, 0.);
804  }
805 }
void ProcessCell(const AliEMCALCellInfo &cell)
void ReadFastORBadChannelFromFile(const char *fname)
Int_t fNL0EMCal
! EMCal number of L0 FastORs (will be reset each event)
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
const AliEMCALTriggerPatchInfo * fMaxPatchDCal[6][3]
! DCal max patch (will be reset each event)
AliEMCALTriggerOfflineQAPP()
Dummy constructor for ROOT I/O.
Int_t fSumL1DCal
! DCal sum of all online energy deposition (will be reset each event)
void ReadOfflineBadChannelFromStream(std::istream &stream)
TArrayF fFastORPedestal
FastOR pedestal.
Int_t fNL1DCal
! DCal number of L1 FastORs (will be reset each event)
Int_t fSumL0DCal
! DCal sum of all online energy deposition (will be reset each event)
void SetFastORPedestal(Short_t absId, Float_t ped)
Int_t fNL0DCal
! DCal number of L0 FastORs (will be reset each event)
std::set< Short_t > fBadChannels
Container of bad channels.
Class to generate EMCal trigger QA plots in pp collisions.
Double_t fMinCellAmp
Minimum offline amplitude of the cells.
virtual ~AliEMCALTriggerOfflineQAPP()
Destructor.
void ProcessFastor(const AliEMCALTriggerFastOR *fastor, AliVCaloCells *cells=0)
Bool_t fDCalPlots
Whether to add DCal QA plots.
Int_t fNL1EMCal
! EMCal number of L1 FastORs (will be reset each event)
Int_t fNTotTRU
! Total number of TRUs
Int_t fMinL1FastORAmp
Minimum L1 amplitude of the FastORs.
void Init()
Initialize the class, i.e. allocate histograms.
Int_t fMaxFORabsId
! Maximum FastOR abs id
Int_t fSumL1EMCal
! EMCal sum of all online energy deposition (will be reset each event)
Int_t fDebugLevel
void ReadFastORPedestalFromFile(const char *fname)
const AliEMCALTriggerPatchInfo * fMaxPatchEMCal[6][3]
! EMCal max patch (will be reset each event)
void ReadFastORBadChannelFromStream(std::istream &stream)
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
void ReadOfflineBadChannelFromFile(const char *fname)
std::set< Short_t > fOfflineBadChannels
Abs ID of offline bad channels.
void ProcessPatch(const AliEMCALTriggerPatchInfo *patch)
void ReadFastORPedestalFromStream(std::istream &stream)
TFile * file
Double_t fSumOfflineDCal
! DCal sum of all offline energy deposition (will be reset each event)
Int_t fNCellEMCal
! EMCal number of offline cells (will be reset each event)
Int_t fSumL0EMCal
! EMCal sum of all online energy deposition (will be reset each event)
Int_t fMinL0FastORAmp
Minimum L0 amplitude of the FastORs.
Double_t fSumOfflineEMCal
! EMCal sum of all offline energy deposition (will be reset each event)
Int_t fNCellDCal
! DCal number of offline cells (will be reset each event)
THistManager fHistManager
Histogram manager.