AliPhysics  4c20e6b (4c20e6b)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliEmcalTriggerQAPP.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 
33 #include "AliEMCALTriggerConstants.h"
34 
35 #include "AliEmcalTriggerQAPP.h"
36 
37 using namespace EMCALTrigger;
38 
42 
43 const Int_t AliEmcalTriggerQAPP::fgkMaxPatchAmp[6] = {3000, 3000, 3000, 6000, 6000, 5000};
44 const TString AliEmcalTriggerQAPP::fgkPatchTypes[3] = {"Online", "Recalc", "Offline"};
45 
48  TNamed(),
49  fOfflineBadChannels(),
50  fBadChannels(),
51  fFastORPedestal(),
52  fFastorL0Th(400),
53  fFastorL1Th(400),
54  fADCperBin(16),
55  fDebugLevel(0),
56  fL0MinTime(7),
57  fL0MaxTime(10),
58  fMinCellAmp(0.),
59  fMinL0FastORAmp(0),
60  fMinL1FastORAmp(0),
61  fHistManager(),
62  fDCalPlots(kTRUE),
63  fTimeStampBinWidth(0),
64  fGeom(0),
65  fSumOfflineEMCal(0),
66  fSumL0EMCal(0),
67  fSumL1EMCal(0),
68  fSumOfflineDCal(0),
69  fSumL0DCal(0),
70  fSumL1DCal(0),
71  fNCellEMCal(0),
72  fNL0EMCal(0),
73  fNL1EMCal(0),
74  fNCellDCal(0),
75  fNL0DCal(0),
76  fNL1DCal(0),
77  fEventTimeStamp(0),
78  fEventTimeStampBin(0),
79  fNTotTRU(0),
80  fMaxFORabsId(0)
81 {
82  for (Int_t i = 0; i < 3; i++) {
83  fEnabledPatchTypes[i] = kTRUE;
84 
85  for (Int_t itype = 0; itype < 6; itype++) {
86  fMaxPatchEMCal[itype][i] = 0;
87  fMaxPatchDCal[itype][i] = 0;
88  }
89  }
90 
91  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalBkg] = kFALSE;
92  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalLevel0] = kTRUE;
93  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalGammaL] = kFALSE;
94  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalJetL] = kFALSE;
95  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalGammaH] = kTRUE;
96  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalJetH] = kTRUE;
97 }
98 
103  TNamed(name,name),
104  fOfflineBadChannels(),
105  fBadChannels(),
106  fFastORPedestal(5000),
107  fFastorL0Th(400),
108  fFastorL1Th(400),
109  fADCperBin(16),
110  fDebugLevel(0),
111  fL0MinTime(7),
112  fL0MaxTime(10),
113  fMinCellAmp(0.),
114  fMinL0FastORAmp(0),
115  fMinL1FastORAmp(0),
116  fHistManager(name),
117  fDCalPlots(kTRUE),
118  fTimeStampBinWidth(0),
119  fGeom(0),
120  fSumOfflineEMCal(0),
121  fSumL0EMCal(0),
122  fSumL1EMCal(0),
123  fSumOfflineDCal(0),
124  fSumL0DCal(0),
125  fSumL1DCal(0),
126  fNCellEMCal(0),
127  fNL0EMCal(0),
128  fNL1EMCal(0),
129  fNCellDCal(0),
130  fNL0DCal(0),
131  fNL1DCal(0),
132  fEventTimeStamp(0),
133  fEventTimeStampBin(0),
134  fNTotTRU(0),
135  fMaxFORabsId(0)
136 {
137  for (Int_t i = 0; i < 3; i++) {
138  fEnabledPatchTypes[i] = kTRUE;
139 
140  for (Int_t itype = 0; itype < 6; itype++) {
141  fMaxPatchEMCal[itype][i] = 0;
142  fMaxPatchDCal[itype][i] = 0;
143  }
144  }
145 
146  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalBkg] = kFALSE;
147  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalLevel0] = kTRUE;
148  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalGammaL] = kFALSE;
149  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalJetL] = kFALSE;
150  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalGammaH] = kTRUE;
151  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalJetH] = kTRUE;
152 }
153 
158  TNamed(triggerQA),
159  fOfflineBadChannels(triggerQA.fOfflineBadChannels),
160  fBadChannels(),
161  fFastORPedestal(triggerQA.fFastORPedestal),
162  fFastorL0Th(triggerQA.fFastorL0Th),
163  fFastorL1Th(triggerQA.fFastorL1Th),
164  fADCperBin(triggerQA.fADCperBin),
165  fDebugLevel(triggerQA.fDebugLevel),
166  fL0MinTime(triggerQA.fL0MinTime),
167  fL0MaxTime(triggerQA.fL0MaxTime),
168  fMinCellAmp(triggerQA.fMinCellAmp),
169  fMinL0FastORAmp(triggerQA.fMinL0FastORAmp),
170  fMinL1FastORAmp(triggerQA.fMinL1FastORAmp),
171  fHistManager(triggerQA.GetName()),
172  fDCalPlots(triggerQA.fDCalPlots),
173  fTimeStampBinWidth(triggerQA.fTimeStampBinWidth),
174  fGeom(0),
175  fSumOfflineEMCal(0),
176  fSumL0EMCal(0),
177  fSumL1EMCal(0),
178  fSumOfflineDCal(0),
179  fSumL0DCal(0),
180  fSumL1DCal(0),
181  fNCellEMCal(0),
182  fNL0EMCal(0),
183  fNL1EMCal(0),
184  fNCellDCal(0),
185  fNL0DCal(0),
186  fNL1DCal(0),
187  fEventTimeStamp(0),
188  fEventTimeStampBin(0),
189  fNTotTRU(0),
190  fMaxFORabsId(0)
191 {
192  for (Int_t i = 0; i < 3; i++) {
193  fEnabledPatchTypes[i] = kTRUE;
194 
195  for (Int_t itype = 0; itype < 6; itype++) {
196  fMaxPatchEMCal[itype][i] = 0;
197  fMaxPatchDCal[itype][i] = 0;
198  }
199  }
200 }
201 
204 {
205 }
206 
211 {
212  Short_t absId = 0;
213 
214  while (stream.good()) {
215  stream >> absId;
216  AddOfflineBadChannel(absId);
217  }
218 }
219 
224 {
225  std::ifstream file(fname);
227 }
228 
233 {
234  Short_t absId = -1;
235 
236  while (stream.good()) {
237  stream >> absId;
238  AddFastORBadChannel(absId);
239  }
240 }
241 
246 {
247  std::ifstream file(fname);
249 }
250 
255 void AliEmcalTriggerQAPP::SetFastORPedestal(Short_t absId, Float_t ped)
256 {
257  if (absId < 0 || absId >= fFastORPedestal.GetSize()) {
258  AliWarning(Form("Abs. ID %d out of range (0,5000)", absId));
259  return;
260  }
261  fFastORPedestal[absId] = ped;
262 }
263 
264 
269 {
270  Short_t absId = 0;
271  Float_t ped = 0;
272  while (stream.good()) {
273  stream >> ped;
274  SetFastORPedestal(absId, ped);
275  absId++;
276  }
277 }
278 
283 {
284  std::ifstream file(fname);
286 }
287 
293 {
294  fEnabledPatchTypes[type] = e;
295 }
296 
302 {
303  fEnabledTriggerTypes[type] = e;
304 }
305 
308 {
309  fGeom = AliEMCALGeometry::GetInstance();
310  if (!fGeom) {
311  AliError("Could not get geometry!");
312  }
313 }
314 
317 {
318  TString hname;
319  TString htitle;
320 
321  fNTotTRU = 32; // there are 32 TRU in the EMCal (10 full SM * 3 TRU + 2 small SM * 1 TRU)
322  Int_t ndet = 1;
323  if (fDCalPlots) {
324  fNTotTRU += 20; // there are additional 14 TRU in DCal, some skip in between (see below)
325  ndet += 1;
326  }
327  fMaxFORabsId = fNTotTRU * 96; // there are 96 channels in each TRU
328 
329  if (fTimeStampBinWidth > 0) fHistManager.CreateHistoGroup("ByTimeStamp");
330 
331  hname = Form("EMCTRQA_histFastORL0");
332  htitle = Form("EMCTRQA_histFastORL0;FastOR abs. ID;entries above 0");
333  fHistManager.CreateTH1(hname, htitle, fMaxFORabsId, 0, fMaxFORabsId);
334 
335  hname = Form("EMCTRQA_histLargeAmpFastORL0");
336  htitle = Form("EMCTRQA_histLargeAmpFastORL0 (>%d);FastOR abs. ID;entries above %d", fFastorL0Th, fFastorL0Th);
337  fHistManager.CreateTH1(hname, htitle, fMaxFORabsId, 0, fMaxFORabsId);
338 
339  hname = Form("EMCTRQA_histFastORL0Amp");
340  htitle = Form("EMCTRQA_histFastORL0Amp;FastOR abs. ID;ADC counts");
341  fHistManager.CreateTH2(hname, htitle, fMaxFORabsId, 0, fMaxFORabsId, 1024, 0, 4096);
342 
343  hname = Form("EMCTRQA_histFastORL0Time");
344  htitle = Form("EMCTRQA_histFastORL0Time;FastOR abs. ID;time");
345  fHistManager.CreateTH2(hname, htitle, fMaxFORabsId, 0, fMaxFORabsId, 21, -1, 20);
346 
347  hname = Form("EMCTRQA_histFastORL0AmpVsTime");
348  htitle = Form("EMCTRQA_histFastORL0AmpVsTime;time;amplitude");
349  fHistManager.CreateTH2(hname, htitle, 21, -1, 20, 1024, 0, 4096);
350 
351  hname = Form("EMCTRQA_histFastORL0TimeOk");
352  htitle = Form("EMCTRQA_histFastORL0TimeOk;FastOR abs. ID;entries (%d < time < %d)", fL0MinTime, fL0MaxTime);
353  fHistManager.CreateTH1(hname, htitle, fMaxFORabsId, 0, fMaxFORabsId);
354 
355  hname = Form("EMCTRQA_histFastORL0AmpTimeOk");
356  htitle = Form("EMCTRQA_histFastORL0AmpTimeOk;FastOR abs. ID;ADC counts (%d < time < %d)", fL0MinTime, fL0MaxTime);
357  fHistManager.CreateTH2(hname, htitle, fMaxFORabsId, 0, fMaxFORabsId, 1024, 0, 4096);
358 
359  hname = Form("EMCTRQA_histFastORL1");
360  htitle = Form("EMCTRQA_histFastORL1;FastOR abs. ID;entries above 0");
361  fHistManager.CreateTH1(hname, htitle, fMaxFORabsId, 0, fMaxFORabsId);
362 
363  hname = Form("EMCTRQA_histLargeAmpFastORL1");
364  htitle = Form("EMCTRQA_histLargeAmpFastORL1 (>%d);FastOR abs. ID;entries above %d", fFastorL1Th, fFastorL1Th);
365  fHistManager.CreateTH1(hname, htitle, fMaxFORabsId, 0, fMaxFORabsId);
366 
367  hname = Form("EMCTRQA_histFastORL1Amp");
368  htitle = Form("EMCTRQA_histFastORL1Amp;FastOR abs. ID;L1 time sum");
369  fHistManager.CreateTH2(hname, htitle, fMaxFORabsId, 0, fMaxFORabsId, 1024, 0, 4096);
370 
371  hname = Form("EMCTRQA_histFastORL1AmpVsL0Amp");
372  htitle = Form("EMCTRQA_histFastORL1AmpVsL0Amp;L0 amplitude;L1 time sum;entries");
373  fHistManager.CreateTH2(hname, htitle, 256, 0, 1024, 256, 0, 1024);
374 
375  hname = Form("EMCTRQA_histCellAmp");
376  htitle = Form("EMCTRQA_histCellAmp;cell abs. ID;energy (GeV)");
377  fHistManager.CreateTH2(hname, htitle, fMaxFORabsId*4, 0, fMaxFORabsId*4, 400, 0, 200);
378 
379  hname = Form("EMCTRQA_histCell");
380  htitle = Form("EMCTRQA_histCell;cell abs. ID;entries above 0 GeV");
381  fHistManager.CreateTH1(hname, htitle, fMaxFORabsId*4, 0, fMaxFORabsId*4);
382 
383  hname = Form("EMCTRQA_histLargeAmpCell");
384  htitle = Form("EMCTRQA_histLargeAmpCell (>%.1f);cell abs. ID;entries above %.1f GeV", fFastorL1Th * EMCALTrigger::kEMCL1ADCtoGeV, fFastorL1Th * EMCALTrigger::kEMCL1ADCtoGeV);
385  fHistManager.CreateTH1(hname, htitle, fMaxFORabsId*4, 0, fMaxFORabsId*4);
386 
387  hname = Form("EMCTRQA_histCellAmpVsFastORL0Amp");
388  htitle = Form("EMCTRQA_histCellAmpVsFastORL0Amp;FastOR L0 amplitude;2x2 cell sum energy (GeV)");
389  fHistManager.CreateTH2(hname, htitle, 1024, 0, 4096, 400, 0, 200);
390 
391  hname = Form("EMCTRQA_histCellAmpVsFastORL0AmpTriggered");
392  htitle = Form("EMCTRQA_histCellAmpVsFastORL0AmpTriggered;FastOR L0 amplitude;2x2 cell sum energy (GeV)");
393  fHistManager.CreateTH2(hname, htitle, 1024, 0, 4096, 400, 0, 200);
394 
395  hname = Form("EMCTRQA_histCellAmpVsFastORL1Amp");
396  htitle = Form("EMCTRQA_histCellAmpVsFastORL1Amp;FastOR L1 amplitude;2x2 cell sum energy (GeV)");
397  fHistManager.CreateTH2(hname, htitle, 1024, 0, 4096, 400, 0, 200);
398 
399  for (Int_t nTRU = 0; nTRU < fNTotTRU; nTRU++) {
400  if (nTRU == 34 || nTRU == 35 ||
401  nTRU == 40 || nTRU == 41 ||
402  nTRU == 46 || nTRU == 47) continue;
403  hname = Form("EMCTRQA_histCellAmpVsFastORL0AmpTRU%d", nTRU);
404  htitle = Form("EMCTRQA_histCellAmpVsFastORL0Amp%d;FastOR L0 amplitude;2x2 cell sum energy (GeV)", nTRU);
405  fHistManager.CreateTH2(hname, htitle, 1024, 0, 4096, 400, 0, 200);
406 
407  hname = Form("EMCTRQA_histCellAmpVsFastORL0AmpTriggeredTRU%d", nTRU);
408  htitle = Form("EMCTRQA_histCellAmpVsFastORL0AmpTriggeredTRU%d;FastOR L0 amplitude;2x2 cell sum energy (GeV)", nTRU);
409  fHistManager.CreateTH2(hname, htitle, 1024, 0, 4096, 400, 0, 200);
410  }
411 
412  hname = Form("EMCTRQA_histFastORNoOffline");
413  htitle = Form("EMCTRQA_histFastORNoOffline;FastOR abs. ID;entries with no offline energy");
414  fHistManager.CreateTH1(hname, htitle, fMaxFORabsId, 0, fMaxFORabsId);
415 
416  const char* det[2] = { "EMCal", "DCal" };
417 
418  for (Int_t itrig = 0; itrig < 6; itrig++) {
419  if (kEMCalTriggerNames[itrig].IsNull() || fEnabledTriggerTypes[itrig] == kFALSE) continue;
420 
421  for (Int_t idet = 0; idet < ndet; idet++) {
422  hname = Form("EMCTRQA_hist%s%sMaxOfflineVsRecalc", det[idet], kEMCalTriggerNames[itrig].Data());
423  htitle = Form("EMCTRQA_hist%s%sMaxOfflineVsRecalc;Recalc;Offline;entries", det[idet], kEMCalTriggerNames[itrig].Data());
424  fHistManager.CreateTH2(hname, htitle, fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig], fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig]);
425 
426  hname = Form("EMCTRQA_hist%s%sOfflineVsRecalc", det[idet], kEMCalTriggerNames[itrig].Data());
427  htitle = Form("EMCTRQA_hist%s%sOfflineVsRecalc;Recalc;Offline;entries", det[idet], kEMCalTriggerNames[itrig].Data());
428  fHistManager.CreateTH2(hname, htitle, fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig], fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig]);
429  }
430 
431  for (Int_t itype = 0; itype < 3; itype++) {
432  if (!fEnabledPatchTypes[itype]) continue;
433  for (Int_t idet = 0; idet < ndet; idet++) {
434  hname = Form("EMCTRQA_hist%sPatchAmp%s%s", det[idet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
435  htitle = Form("EMCTRQA_hist%sPatchAmp%s%s;amplitude;entries", det[idet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
436  fHistManager.CreateTH1(hname, htitle, fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig]);
437 
438  hname = Form("EMCTRQA_hist%sMaxPatchAmp%s%s", det[idet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
439  htitle = Form("EMCTRQA_hist%sMaxPatchAmp%s%s;amplitude;entries", det[idet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
440  fHistManager.CreateTH1(hname, htitle, fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig]);
441 
442  for (Int_t itrig2 = itrig+1; itrig2 < 6; itrig2++) {
443  if (kEMCalTriggerNames[itrig2].IsNull() || fEnabledTriggerTypes[itrig2] == kFALSE) continue;
444  hname = Form("EMCTRQA_hist%s%sMaxVs%sMax%s", det[idet], kEMCalTriggerNames[itrig].Data(), kEMCalTriggerNames[itrig2].Data(), fgkPatchTypes[itype].Data());
445  htitle = Form("EMCTRQA_hist%s%sMaxVs%sMax%s;%s max;%s max;entries", det[idet], kEMCalTriggerNames[itrig].Data(), kEMCalTriggerNames[itrig2].Data(), fgkPatchTypes[itype].Data(), kEMCalTriggerNames[itrig2].Data(), kEMCalTriggerNames[itrig].Data());
446  fHistManager.CreateTH2(hname, htitle, fgkMaxPatchAmp[itrig2]/fADCperBin, 0, fgkMaxPatchAmp[itrig2], fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig]);
447  }
448  }
449 
450  hname = Form("EMCTRQA_histMaxEdgePos%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
451  htitle = Form("EMCTRQA_histMaxEdgePos%s%s;col;row;entries", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
452  fHistManager.CreateTH2(hname, htitle, 48, 0, 48, 105, 0, 105);
453 
454  if (fDCalPlots) {
455  hname = Form("EMCTRQA_histEMCalMaxVsDCalMax%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
456  htitle = Form("EMCTRQA_histEMCalMaxVsDCalMax%s%s;EMCal max;DCal max;entries", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
457  fHistManager.CreateTH2(hname, htitle, fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig], fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig]);
458  }
459  }
460  }
461 
462  for (Int_t idet = 0; idet < ndet; idet++) {
463  hname = Form("EMCTRQA_hist%sOfflineSumVsL0Sum", det[idet]);
464  htitle = hname + ";Sum of L0 amplitudes;Sum of cell energies (GeV)";
465  fHistManager.CreateTH2(hname, htitle, 250, 0, 5000, 400, 0, 200);
466 
467  hname = Form("EMCTRQA_hist%sOfflineSumVsL1Sum", det[idet]);
468  htitle = hname + ";Sum of L1 amplitudes;Sum of cell energies (GeV)";
469  fHistManager.CreateTH2(hname, htitle, 250, 0, 5000, 400, 0, 200);
470 
471  hname = Form("EMCTRQA_hist%sL1SumVsL0Sum", det[idet]);
472  htitle = hname + ";Sum of L0 amplitudes;Sum of L1 amplitudes";
473  fHistManager.CreateTH2(hname, htitle, 250, 0, 5000, 250, 0, 5000);
474 
475  hname = Form("EMCTRQA_hist%sNCellVsNL0", det[idet]);
476  htitle = hname + ";Number of L0 FastORs;Number of cells";
477  fHistManager.CreateTH2(hname, htitle, 250, 0, 500, 250, 0, 2000);
478 
479  hname = Form("EMCTRQA_hist%sNCellVsNL1", det[idet]);
480  htitle = hname + ";Number of L1 FastORs;Number of cells";
481  fHistManager.CreateTH2(hname, htitle, 250, 0, 500, 250, 0, 2000);
482 
483  hname = Form("EMCTRQA_hist%sNL1VsNL0", det[idet]);
484  htitle = hname + ";Number of L0 FastORs;Number of L1 FastORs";
485  fHistManager.CreateTH2(hname, htitle, 250, 0, 500, 250, 0, 500);
486  }
487 }
488 
493 void AliEmcalTriggerQAPP::ProcessPatch(AliEMCALTriggerPatchInfo* patch)
494 {
495  TString hname;
496 
497  Int_t triggerBits[6] = { patch->GetTriggerBitConfig()->GetLevel0Bit(),
498  patch->GetTriggerBitConfig()->GetGammaLowBit(),
499  patch->GetTriggerBitConfig()->GetGammaHighBit(),
500  patch->GetTriggerBitConfig()->GetJetLowBit(),
501  patch->GetTriggerBitConfig()->GetJetHighBit(),
502  patch->GetTriggerBitConfig()->GetBkgBit()
503  };
504 
505  Int_t offsets[3] = { 0, AliEMCALTriggerPatchInfo::kRecalcOffset, AliEMCALTriggerPatchInfo::kOfflineOffset };
506  Int_t amplitudes[3] = { patch->GetADCAmp(), patch->GetADCAmp(), patch->GetADCOfflineAmp() };
507 
508  for (Int_t itrig = 0; itrig < 6; itrig++) {
509  if (kEMCalTriggerNames[itrig].IsNull() || fEnabledTriggerTypes[itrig] == kFALSE) continue;
510 
511  for (Int_t itype = 0; itype < 3; itype++) {
512  if (!fEnabledPatchTypes[itype]) continue;
513  if (!patch->TestTriggerBit(triggerBits[itrig]+offsets[itype])) continue;
514 
515  TString det;
516 
517  if (patch->IsEMCal()) {
518  det = "EMCal";
519  if (GetAmplitude(fMaxPatchEMCal[itrig][itype], itype) < amplitudes[itype]) fMaxPatchEMCal[itrig][itype] = patch;
520  }
521  else if (patch->IsDCalPHOS()) {
522  if (!fDCalPlots) return;
523  det = "DCal";
524  if (GetAmplitude(fMaxPatchDCal[itrig][itype], itype) < amplitudes[itype]) fMaxPatchDCal[itrig][itype] = patch;
525  }
526  else {
527  AliWarning(Form("Patch is not EMCal nor DCal/PHOS (pos: %d, %d)", patch->GetRowStart(), patch->GetColStart()));
528  }
529 
530  hname = Form("EMCTRQA_hist%s%sOfflineVsRecalc", det.Data(), kEMCalTriggerNames[itrig].Data());
531  fHistManager.FillTH2(hname, amplitudes[1], amplitudes[2]);
532 
533  hname = Form("EMCTRQA_hist%sPatchAmp%s%s", det.Data(), kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
534  fHistManager.FillTH1(hname, amplitudes[itype]);
535  }
536 
537  if (fDebugLevel >= 2) {
538  Printf("Type = %s; global pos = (%d, %d); Amp (online) = %d; Amp (offline) = %d; Patch energy = %.3f\n"
539  "Position (CM): Eta=%.3f, Phi=%.3f\n"
540  "Position (Geo): Eta=%.3f, Phi=%.3f\n",
541  kEMCalTriggerNames[itrig].Data(), patch->GetRowStart(), patch->GetColStart(), patch->GetADCAmp(), patch->GetADCOfflineAmp(), patch->GetPatchE(),
542  patch->GetEtaCM(), patch->GetPhiCM(),
543  patch->GetEtaGeo(), patch->GetPhiGeo());
544  }
545  }
546 }
547 
553 {
554  TString hname;
555 
556  if (fGeom) {
557  Double_t pos[3] = {0};
558  fGeom->GetGlobal(cell.fAbsId, pos);
559  if (fGeom->IsInDCAL(pos[0], pos[1], pos[2])) {
560  if (!fDCalPlots) return;
561  fSumOfflineDCal += cell.fEnergy;
562  fNCellDCal++;
563  }
564  else if (fGeom->IsInEMCAL(pos[0], pos[1], pos[2])) {
565  fSumOfflineEMCal += cell.fEnergy;
566  fNCellEMCal++;
567  }
568  else {
569  AliWarning(Form("Cell with absolute ID %hd was not identified as neither DCal or EMCal!!", cell.fAbsId));
570  }
571  }
572 
573  if (fOfflineBadChannels.find(cell.fAbsId) != fOfflineBadChannels.end()) return;
574 
575  if (cell.fEnergy < fMinCellAmp) return;
576 
577  hname = Form("EMCTRQA_histCell");
578  fHistManager.FillTH1(hname, cell.fAbsId);
579 
580  hname = Form("EMCTRQA_histCellAmp");
581  fHistManager.FillTH2(hname, cell.fAbsId, cell.fEnergy);
582 
583  if (cell.fEnergy > fFastorL1Th * EMCALTrigger::kEMCL1ADCtoGeV) {
584  hname = Form("EMCTRQA_histLargeAmpCell");
585  fHistManager.FillTH1(hname, cell.fAbsId);
586  }
587 }
588 
593 void AliEmcalTriggerQAPP::ProcessFastor(AliEMCALTriggerFastOR* fastor, AliVCaloCells* cells)
594 {
595  TString hname;
596 
597  if (fBadChannels.find(fastor->GetAbsId()) != fBadChannels.end()) return;
598 
599  Int_t L0amp = fastor->GetL0Amp() - fFastORPedestal[fastor->GetAbsId()];
600  Bool_t isDCal = kFALSE;
601 
602  Double_t offlineAmp = 0;
603  Int_t nTRU = -1;
604  Int_t nADC = -1;
605 
606  if (fGeom) {
607  Int_t idx[4] = {-1};
608  fGeom->GetCellIndexFromFastORIndex(fastor->GetAbsId(), idx);
609  fGeom->GetTRUFromAbsFastORIndex(fastor->GetAbsId(), nTRU, nADC);
610  Double_t pos[3] = {0};
611  if (idx[0] >= 0) {
612  fGeom->GetGlobal(idx[0], pos);
613  isDCal = fGeom->IsInDCAL(pos[0], pos[1], pos[2]);
614  if (isDCal && !fDCalPlots) return;
615 
616  if (L0amp > fMinL0FastORAmp) {
617  if (cells) {
618  for (Int_t i = 0; i < 4; i++) {
619  offlineAmp += cells->GetCellAmplitude(idx[i]);
620  }
621  }
622  }
623  }
624  }
625 
626  if (L0amp > fMinL0FastORAmp) {
627  if (fTimeStampBinWidth > 0) {
628  hname = TString::Format("ByTimeStamp/EMCTRQA_histFastORL0_%u_%u", fEventTimeStampBin, fEventTimeStampBin+fTimeStampBinWidth);
629  fHistManager.FillTH1(hname, fastor->GetAbsId());
630  }
631 
632  hname = Form("EMCTRQA_histFastORL0");
633  fHistManager.FillTH1(hname, fastor->GetAbsId());
634 
635  hname = Form("EMCTRQA_histFastORL0Amp");
636  fHistManager.FillTH2(hname, fastor->GetAbsId(), L0amp);
637 
638  hname = Form("EMCTRQA_histFastORL0Time");
639  fHistManager.FillTH2(hname, fastor->GetAbsId(), fastor->GetL0Time());
640 
641  hname = Form("EMCTRQA_histFastORL0AmpVsTime");
642  fHistManager.FillTH2(hname, fastor->GetL0Time(), L0amp);
643 
644  if (fastor->GetL0Time() > fL0MinTime && fastor->GetL0Time() < fL0MaxTime) {
645  hname = Form("EMCTRQA_histFastORL0TimeOk");
646  fHistManager.FillTH1(hname, fastor->GetAbsId());
647 
648  hname = Form("EMCTRQA_histFastORL0AmpTimeOk");
649  fHistManager.FillTH2(hname, fastor->GetAbsId(), L0amp);
650 
651  hname = Form("EMCTRQA_histCellAmpVsFastORL0AmpTriggered");
652  fHistManager.FillTH2(hname, L0amp, offlineAmp);
653 
654  hname = Form("EMCTRQA_histCellAmpVsFastORL0AmpTriggeredTRU%d",nTRU);
655  fHistManager.FillTH2(hname, L0amp, offlineAmp);
656  }
657 
658  hname = Form("EMCTRQA_histCellAmpVsFastORL0Amp");
659  fHistManager.FillTH2(hname, L0amp, offlineAmp);
660 
661  hname = Form("EMCTRQA_histCellAmpVsFastORL0AmpTRU%d",nTRU);
662  fHistManager.FillTH2(hname, L0amp, offlineAmp);
663 
664  if (offlineAmp == 0) {
665  hname = Form("EMCTRQA_histFastORNoOffline");
666  fHistManager.FillTH1(hname, fastor->GetAbsId());
667  }
668 
669  if (isDCal) {
670  fSumL0DCal += L0amp;
671  fNL0DCal++;
672  }
673  else {
674  fSumL0EMCal += L0amp;
675  fNL0EMCal++;
676  }
677  }
678 
679  if (L0amp > fFastorL0Th) {
680  if (fTimeStampBinWidth > 0) {
681  hname = TString::Format("ByTimeStamp/EMCTRQA_histLargeAmpFastORL0_%u_%u", fEventTimeStampBin, fEventTimeStampBin+fTimeStampBinWidth);
682  fHistManager.FillTH1(hname, fastor->GetAbsId());
683  }
684 
685  hname = Form("EMCTRQA_histLargeAmpFastORL0");
686  fHistManager.FillTH1(hname, fastor->GetAbsId());
687  }
688 
689  if (fastor->GetL1Amp() > fMinL1FastORAmp) {
690  hname = Form("EMCTRQA_histFastORL1");
691  fHistManager.FillTH1(hname, fastor->GetAbsId());
692 
693  hname = Form("EMCTRQA_histFastORL1Amp");
694  fHistManager.FillTH2(hname, fastor->GetAbsId(), fastor->GetL1Amp());
695 
696  if (isDCal) {
697  fSumL1DCal += fastor->GetL1Amp();
698  fNL1DCal++;
699  }
700  else {
701  fSumL1EMCal += fastor->GetL1Amp();
702  fNL1EMCal++;
703  }
704 
705  hname = Form("EMCTRQA_histCellAmpVsFastORL1Amp");
706  fHistManager.FillTH2(hname, fastor->GetL1Amp(), offlineAmp);
707  }
708 
709  if (fastor->GetL1Amp() > fFastorL1Th) {
710  hname = Form("EMCTRQA_histLargeAmpFastORL1");
711  fHistManager.FillTH1(hname, fastor->GetAbsId());
712  }
713 
714  if (fastor->GetL1Amp() > fMinL1FastORAmp || L0amp > fMinL0FastORAmp) {
715  hname = Form("EMCTRQA_histFastORL1AmpVsL0Amp");
716  fHistManager.FillTH2(hname, L0amp, fastor->GetL1Amp());
717  }
718 }
719 
720 
725 {
726  AliDebug(2, Form("Entering AliEmcalTriggerQAAP::EventCompleted"));
727 
728  TString hname;
729 
730  for (Int_t itrig = 0; itrig < 6; itrig++) {
731  if (kEMCalTriggerNames[itrig].IsNull() || fEnabledTriggerTypes[itrig] == kFALSE) continue;
732  AliDebug(2, Form("Trigger type: %s", kEMCalTriggerNames[itrig].Data()));
733 
734  hname = Form("EMCTRQA_histEMCal%sMaxOfflineVsRecalc", kEMCalTriggerNames[itrig].Data());
735  fHistManager.FillTH2(hname, GetAmplitude(fMaxPatchEMCal[itrig][1], 1), GetAmplitude(fMaxPatchEMCal[itrig][2], 2));
736 
737  if (fDCalPlots) {
738  hname = Form("EMCTRQA_histDCal%sMaxOfflineVsRecalc", kEMCalTriggerNames[itrig].Data());
739  fHistManager.FillTH2(hname, GetAmplitude(fMaxPatchDCal[itrig][1], 1), GetAmplitude(fMaxPatchDCal[itrig][2], 2));
740  }
741 
742  for (Int_t itype = 0; itype < 3; itype++) {
743  if (!fEnabledPatchTypes[itype]) continue;
744  AliDebug(2, Form("Patch type %s", fgkPatchTypes[itype].Data()));
745 
746  if (fMaxPatchEMCal[itrig][itype]) {
747  hname = Form("EMCTRQA_histMaxEdgePos%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
748  fHistManager.FillTH2(hname, fMaxPatchEMCal[itrig][itype]->GetColStart(), fMaxPatchEMCal[itrig][itype]->GetRowStart());
749  }
750 
751  hname = Form("EMCTRQA_histEMCalMaxPatchAmp%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
752  fHistManager.FillTH1(hname, GetAmplitude(fMaxPatchEMCal[itrig][itype], itype));
753 
754  if (fDCalPlots) {
755  if (fMaxPatchDCal[itrig][itype]) {
756  hname = Form("EMCTRQA_histMaxEdgePos%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
757  fHistManager.FillTH2(hname, fMaxPatchDCal[itrig][itype]->GetColStart(), fMaxPatchDCal[itrig][itype]->GetRowStart());
758  }
759 
760  hname = Form("EMCTRQA_histDCalMaxPatchAmp%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
761  fHistManager.FillTH1(hname, GetAmplitude(fMaxPatchDCal[itrig][itype], itype));
762 
763  hname = Form("EMCTRQA_histEMCalMaxVsDCalMax%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
764  fHistManager.FillTH2(hname, GetAmplitude(fMaxPatchEMCal[itrig][itype], itype), GetAmplitude(fMaxPatchDCal[itrig][itype], itype));
765  }
766 
767  for (Int_t itrig2 = itrig+1; itrig2 < 6; itrig2++) {
768  if (kEMCalTriggerNames[itrig2].IsNull() || fEnabledTriggerTypes[itrig2] == kFALSE) continue;
769 
770  hname = Form("EMCTRQA_histEMCal%sMaxVs%sMax%s", kEMCalTriggerNames[itrig].Data(), kEMCalTriggerNames[itrig2].Data(), fgkPatchTypes[itype].Data());
771  fHistManager.FillTH2(hname, GetAmplitude(fMaxPatchEMCal[itrig2][itype], itype), GetAmplitude(fMaxPatchEMCal[itrig][itype], itype));
772 
773  if (fDCalPlots) {
774  hname = Form("EMCTRQA_histDCal%sMaxVs%sMax%s", kEMCalTriggerNames[itrig].Data(), kEMCalTriggerNames[itrig2].Data(), fgkPatchTypes[itype].Data());
775  fHistManager.FillTH2(hname, GetAmplitude(fMaxPatchDCal[itrig2][itype], itype), GetAmplitude(fMaxPatchDCal[itrig][itype], itype));
776  }
777  }
778 
779  fMaxPatchEMCal[itrig][itype] = 0;
780  fMaxPatchDCal[itrig][itype] = 0;
781  }
782  }
783 
784 
785  fHistManager.FillTH2("EMCTRQA_histEMCalOfflineSumVsL0Sum", fSumL0EMCal, fSumOfflineEMCal);
786  fHistManager.FillTH2("EMCTRQA_histEMCalOfflineSumVsL1Sum", fSumL1EMCal, fSumOfflineEMCal);
787  fHistManager.FillTH2("EMCTRQA_histEMCalL1SumVsL0Sum", fSumL0EMCal, fSumL1EMCal);
788  fHistManager.FillTH2("EMCTRQA_histEMCalNCellVsNL0", fNL0EMCal, fNCellEMCal);
789  fHistManager.FillTH2("EMCTRQA_histEMCalNCellVsNL1", fNL1EMCal, fNCellEMCal);
790  fHistManager.FillTH2("EMCTRQA_histEMCalNL1VsNL0", fNL0EMCal, fNL1EMCal);
791 
792  if (fDCalPlots) {
793  fHistManager.FillTH2("EMCTRQA_histDCalOfflineSumVsL0Sum", fSumL0DCal, fSumOfflineDCal);
794  fHistManager.FillTH2("EMCTRQA_histDCalOfflineSumVsL1Sum", fSumL1DCal, fSumOfflineDCal);
795  fHistManager.FillTH2("EMCTRQA_histDCalL1SumVsL0Sum", fSumL0DCal, fSumL1DCal);
796  fHistManager.FillTH2("EMCTRQA_histDCalNCellVsNL0", fNL0DCal, fNCellDCal);
797  fHistManager.FillTH2("EMCTRQA_histDCalNCellVsNL1", fNL1DCal, fNCellDCal);
798  fHistManager.FillTH2("EMCTRQA_histDCalNL1VsNL0", fNL0DCal, fNL1DCal);
799  }
800 
801  fSumOfflineEMCal = 0;
802  fSumL0EMCal = 0;
803  fSumL1EMCal = 0;
804  fSumOfflineDCal = 0;
805  fSumL0DCal = 0;
806  fSumL1DCal = 0;
807 
808  fNCellEMCal = 0;
809  fNL0EMCal = 0;
810  fNL1EMCal = 0;
811  fNCellDCal = 0;
812  fNL0DCal = 0;
813  fNL1DCal = 0;
814 }
815 
822 Int_t AliEmcalTriggerQAPP::GetAmplitude(AliEMCALTriggerPatchInfo* patch, Int_t itype)
823 {
824  if (!patch) return 0;
825  if (itype == 0 || itype == 1) {
826  return patch->GetADCAmp();
827  }
828  else if (itype == 2) {
829  return patch->GetADCOfflineAmp();
830  }
831  else {
832  return 0;
833  }
834 }
835 
843 {
844  fEventTimeStamp = timeStamp;
845 
846  if (fTimeStampBinWidth == 0) return;
847 
848  UInt_t timeStampBins = fEventTimeStamp / fTimeStampBinWidth;
849  fEventTimeStampBin = timeStampBins*fTimeStampBinWidth;
850 
851  TString hname = TString::Format("ByTimeStamp/EMCTRQA_histEvents_%u_%u", fEventTimeStampBin, fEventTimeStampBin+fTimeStampBinWidth);
852  if (!fHistManager.FindObject(hname)) {
853  TString htitle;
854 
855  hname = TString::Format("ByTimeStamp/EMCTRQA_histEvents_%u_%u", fEventTimeStampBin, fEventTimeStampBin+fTimeStampBinWidth);
856  htitle = TString::Format("EMCTRQA_histEvents;;events");
857  TH1* hevents = fHistManager.CreateTH1(hname, htitle, 1, 0, 1);
858  hevents->GetXaxis()->SetBinLabel(1, TString::Format("%u <= time stamp < %u", fEventTimeStampBin, fEventTimeStampBin+fTimeStampBinWidth));
859 
860  hname = TString::Format("ByTimeStamp/EMCTRQA_histFastORL0_%u_%u", fEventTimeStampBin, fEventTimeStampBin+fTimeStampBinWidth);
861  htitle = TString::Format("EMCTRQA_histFastORL0;FastOR abs. ID;entries above 0");
862  fHistManager.CreateTH1(hname, htitle, fMaxFORabsId, 0, fMaxFORabsId);
863 
864  hname = TString::Format("ByTimeStamp/EMCTRQA_histLargeAmpFastORL0_%u_%u", fEventTimeStampBin, fEventTimeStampBin+fTimeStampBinWidth);
865  htitle = TString::Format("EMCTRQA_histLargeAmpFastORL0 (>%d);FastOR abs. ID;entries above %d", fFastorL0Th, fFastorL0Th);
866  fHistManager.CreateTH1(hname, htitle, fMaxFORabsId, 0, fMaxFORabsId);
867  }
868 
869  hname = TString::Format("ByTimeStamp/EMCTRQA_histEvents_%u_%u", fEventTimeStampBin, fEventTimeStampBin+fTimeStampBinWidth);
870  fHistManager.FillTH1(hname, 0.);
871 }
Int_t fNL0EMCal
! EMCal number of L0 FastORs (will be reset each event)
static Int_t GetAmplitude(AliEMCALTriggerPatchInfo *patch, Int_t itype)
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
Double_t fMinCellAmp
Minimum offline amplitude of the cells.
void EnablePatchType(PatchTypes_t type, Bool_t e=kTRUE)
Int_t fNCellDCal
! DCal number of offline cells (will be reset each event)
UInt_t fEventTimeStamp
! Time stamp of the current event
void EventTimeStamp(UInt_t timeStamp)
TArrayF fFastORPedestal
FastOR pedestal.
Int_t fSumL1EMCal
! EMCal sum of all online energy deposition (will be reset each event)
AliEMCALGeometry * fGeom
! EMCal geometry
EMCALTrigger::EMCalTriggerType_t EMCalTriggerType_t
void ExecOnce()
Actions to be executed only once for the first event.
Int_t fNCellEMCal
! EMCal number of offline cells (will be reset each event)
void EnableTriggerType(EMCalTriggerType_t type, Bool_t e=kTRUE)
Int_t fFastorL1Th
FastOR L1 threshold.
void SetFastORPedestal(Short_t absId, Float_t ped)
Bool_t fDCalPlots
Whether to add DCal QA plots.
void ReadFastORBadChannelFromStream(std::istream &stream)
void ReadFastORPedestalFromFile(const char *fname)
Int_t fMinL1FastORAmp
Minimum L1 amplitude of the FastORs.
static const Int_t fgkMaxPatchAmp[6]
Maximum patch amplitude for the histograms.
AliEMCALTriggerPatchInfo * fMaxPatchDCal[6][3]
! DCal max patch (will be reset each event)
void ReadFastORPedestalFromStream(std::istream &stream)
std::set< Short_t > fOfflineBadChannels
Abs ID of offline bad channels.
void ReadOfflineBadChannelFromFile(const char *fname)
void ProcessFastor(AliEMCALTriggerFastOR *fastor, AliVCaloCells *cells)
Double_t fSumOfflineEMCal
! EMCal sum of all offline energy deposition (will be reset each event)
Int_t fNTotTRU
! Total number of TRUs
Int_t fMaxFORabsId
! Maximum FastOR abs id
Int_t fADCperBin
ADC counts per bin.
virtual ~AliEmcalTriggerQAPP()
Destructor.
AliEmcalTriggerQAPP()
Dummy constructor for ROOT I/O.
void ReadOfflineBadChannelFromStream(std::istream &stream)
Int_t fNL0DCal
! DCal number of L0 FastORs (will be reset each event)
void AddOfflineBadChannel(Short_t absId)
UInt_t fTimeStampBinWidth
Time stamp bin width.
Int_t fL0MaxTime
Maximum L0 time.
Bool_t fEnabledTriggerTypes[6]
Trigger types to be plotted.
Int_t fDebugLevel
void ProcessPatch(AliEMCALTriggerPatchInfo *patch)
Int_t fSumL0DCal
! DCal sum of all online energy deposition (will be reset each event)
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)
Int_t fFastorL0Th
FastOR L0 threshold.
static const TString fgkPatchTypes[3]
Patch type names.
Double_t fSumOfflineDCal
! DCal sum of all offline energy deposition (will be reset each event)
Int_t fSumL0EMCal
! EMCal sum of all online energy deposition (will be reset each event)
THistManager fHistManager
Histogram manager.
Int_t fNL1DCal
! DCal number of L1 FastORs (will be reset each event)
TFile * file
void Init()
Initialize the class, i.e. allocate histograms.
Int_t fL0MinTime
Minimum L0 time.
void ReadFastORBadChannelFromFile(const char *fname)
Bool_t fEnabledPatchTypes[3]
Patch types to be plotted.
Int_t fDebugLevel
Debug level.
Class to generate EMCal trigger QA plots in pp collisions.
Int_t fSumL1DCal
! DCal sum of all online energy deposition (will be reset each event)
UInt_t fEventTimeStampBin
! Time stamp bin
Int_t fMinL0FastORAmp
Minimum L0 amplitude of the FastORs.
std::set< Short_t > fBadChannels
Container of bad channels.
AliEMCALTriggerPatchInfo * fMaxPatchEMCal[6][3]
! EMCal max patch (will be reset each event)
Int_t fNL1EMCal
! EMCal number of L1 FastORs (will be reset each event)
void AddFastORBadChannel(Short_t absId)
void ProcessCell(const AliEmcalCellInfo &cell)