AliPhysics  eff0747 (eff0747)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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  fGeom(0),
64  fSumOfflineEMCal(0),
65  fSumL0EMCal(0),
66  fSumL1EMCal(0),
67  fSumOfflineDCal(0),
68  fSumL0DCal(0),
69  fSumL1DCal(0),
70  fNCellEMCal(0),
71  fNL0EMCal(0),
72  fNL1EMCal(0),
73  fNCellDCal(0),
74  fNL0DCal(0),
75  fNL1DCal(0)
76 {
77  for (Int_t i = 0; i < 3; i++) {
78  fEnabledPatchTypes[i] = kTRUE;
79 
80  for (Int_t itype = 0; itype < 6; itype++) {
81  fMaxPatchEMCal[itype][i] = 0;
82  fMaxPatchDCal[itype][i] = 0;
83  }
84  }
85 
86  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalBkg] = kFALSE;
87  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalLevel0] = kTRUE;
88  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalGammaL] = kFALSE;
89  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalJetL] = kFALSE;
90  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalGammaH] = kTRUE;
91  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalJetH] = kTRUE;
92 }
93 
98  TNamed(name,name),
99  fOfflineBadChannels(),
100  fFastORPedestal(5000),
101  fBadChannels(),
102  fFastorL0Th(400),
103  fFastorL1Th(400),
104  fADCperBin(16),
105  fDebugLevel(0),
106  fL0MinTime(7),
107  fL0MaxTime(10),
108  fMinCellAmp(0.),
109  fMinL0FastORAmp(0),
110  fMinL1FastORAmp(0),
111  fHistManager(name),
112  fDCalPlots(kTRUE),
113  fGeom(0),
114  fSumOfflineEMCal(0),
115  fSumL0EMCal(0),
116  fSumL1EMCal(0),
117  fSumOfflineDCal(0),
118  fSumL0DCal(0),
119  fSumL1DCal(0),
120  fNCellEMCal(0),
121  fNL0EMCal(0),
122  fNL1EMCal(0),
123  fNCellDCal(0),
124  fNL0DCal(0),
125  fNL1DCal(0)
126 {
127  for (Int_t i = 0; i < 3; i++) {
128  fEnabledPatchTypes[i] = kTRUE;
129 
130  for (Int_t itype = 0; itype < 6; itype++) {
131  fMaxPatchEMCal[itype][i] = 0;
132  fMaxPatchDCal[itype][i] = 0;
133  }
134  }
135 
136  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalBkg] = kFALSE;
137  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalLevel0] = kTRUE;
138  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalGammaL] = kFALSE;
139  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalJetL] = kFALSE;
140  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalGammaH] = kTRUE;
141  fEnabledTriggerTypes[EMCALTrigger::kTMEMCalJetH] = kTRUE;
142 }
143 
148  TNamed(triggerQA),
149  fOfflineBadChannels(triggerQA.fOfflineBadChannels),
150  fBadChannels(),
151  fFastORPedestal(triggerQA.fFastORPedestal),
152  fFastorL0Th(triggerQA.fFastorL0Th),
153  fFastorL1Th(triggerQA.fFastorL1Th),
154  fADCperBin(triggerQA.fADCperBin),
155  fDebugLevel(triggerQA.fDebugLevel),
156  fL0MinTime(triggerQA.fL0MinTime),
157  fL0MaxTime(triggerQA.fL0MaxTime),
158  fMinCellAmp(triggerQA.fMinCellAmp),
159  fMinL0FastORAmp(triggerQA.fMinL0FastORAmp),
160  fMinL1FastORAmp(triggerQA.fMinL1FastORAmp),
161  fHistManager(triggerQA.GetName()),
162  fDCalPlots(triggerQA.fDCalPlots),
163  fGeom(0),
164  fSumOfflineEMCal(0),
165  fSumL0EMCal(0),
166  fSumL1EMCal(0),
167  fSumOfflineDCal(0),
168  fSumL0DCal(0),
169  fSumL1DCal(0),
170  fNCellEMCal(0),
171  fNL0EMCal(0),
172  fNL1EMCal(0),
173  fNCellDCal(0),
174  fNL0DCal(0),
175  fNL1DCal(0)
176 {
177  for (Int_t i = 0; i < 3; i++) {
178  fEnabledPatchTypes[i] = kTRUE;
179 
180  for (Int_t itype = 0; itype < 6; itype++) {
181  fMaxPatchEMCal[itype][i] = 0;
182  fMaxPatchDCal[itype][i] = 0;
183  }
184  }
185 }
186 
189 {
190 }
191 
196 {
197  Short_t absId = 0;
198 
199  while (stream.good()) {
200  stream >> absId;
201  AddOfflineBadChannel(absId);
202  }
203 }
204 
209 {
210  std::ifstream file(fname);
212 }
213 
218 {
219  Short_t absId = -1;
220 
221  while (stream.good()) {
222  stream >> absId;
223  AddFastORBadChannel(absId);
224  }
225 }
226 
231 {
232  std::ifstream file(fname);
234 }
235 
240 void AliEmcalTriggerQAPP::SetFastORPedestal(Short_t absId, Float_t ped)
241 {
242  if (absId < 0 || absId >= fFastORPedestal.GetSize()) {
243  AliWarning(Form("Abs. ID %d out of range (0,5000)", absId));
244  return;
245  }
246  fFastORPedestal[absId] = ped;
247 }
248 
249 
254 {
255  Short_t absId = 0;
256  Float_t ped = 0;
257  while (stream.good()) {
258  stream >> ped;
259  SetFastORPedestal(absId, ped);
260  absId++;
261  }
262 }
263 
268 {
269  std::ifstream file(fname);
271 }
272 
278 {
279  fEnabledPatchTypes[type] = e;
280 }
281 
287 {
288  fEnabledTriggerTypes[type] = e;
289 }
290 
293 {
294  fGeom = AliEMCALGeometry::GetInstance();
295  if (!fGeom) {
296  AliError("Could not get geometry!");
297  }
298 }
299 
302 {
303  TString hname;
304  TString htitle;
305 
306  Int_t maxFORabsId = 5000;
307  Int_t ndet = 2;
308  if (!fDCalPlots) {
309  maxFORabsId = 3000;
310  ndet = 1;
311  }
312 
313  hname = Form("EMCTRQA_histFastORL0");
314  htitle = Form("EMCTRQA_histFastORL0;FastOR abs. ID;entries above 0");
315  fHistManager.CreateTH1(hname, htitle, maxFORabsId, 0, maxFORabsId);
316 
317  hname = Form("EMCTRQA_histLargeAmpFastORL0");
318  htitle = Form("EMCTRQA_histLargeAmpFastORL0 (>%d);FastOR abs. ID;entries above %d", fFastorL0Th, fFastorL0Th);
319  fHistManager.CreateTH1(hname, htitle, maxFORabsId, 0, maxFORabsId);
320 
321  hname = Form("EMCTRQA_histFastORL0Amp");
322  htitle = Form("EMCTRQA_histFastORL0Amp;FastOR abs. ID;ADC counts");
323  fHistManager.CreateTH2(hname, htitle, maxFORabsId, 0, maxFORabsId, 1024, 0, 4096);
324 
325  hname = Form("EMCTRQA_histFastORL0Time");
326  htitle = Form("EMCTRQA_histFastORL0Time;FastOR abs. ID;time");
327  fHistManager.CreateTH2(hname, htitle, maxFORabsId, 0, maxFORabsId, 21, -1, 20);
328 
329  hname = Form("EMCTRQA_histFastORL0AmpVsTime");
330  htitle = Form("EMCTRQA_histFastORL0AmpVsTime;time;amplitude");
331  fHistManager.CreateTH2(hname, htitle, 21, -1, 20, 1024, 0, 4096);
332 
333  hname = Form("EMCTRQA_histFastORL0TimeOk");
334  htitle = Form("EMCTRQA_histFastORL0TimeOk;FastOR abs. ID;entries (%d < time < %d)", fL0MinTime, fL0MaxTime);
335  fHistManager.CreateTH1(hname, htitle, maxFORabsId, 0, maxFORabsId);
336 
337  hname = Form("EMCTRQA_histFastORL0AmpTimeOk");
338  htitle = Form("EMCTRQA_histFastORL0AmpTimeOk;FastOR abs. ID;ADC counts (%d < time < %d)", fL0MinTime, fL0MaxTime);
339  fHistManager.CreateTH2(hname, htitle, maxFORabsId, 0, maxFORabsId, 1024, 0, 4096);
340 
341  hname = Form("EMCTRQA_histFastORL1");
342  htitle = Form("EMCTRQA_histFastORL1;FastOR abs. ID;entries above 0");
343  fHistManager.CreateTH1(hname, htitle, maxFORabsId, 0, maxFORabsId);
344 
345  hname = Form("EMCTRQA_histLargeAmpFastORL1");
346  htitle = Form("EMCTRQA_histLargeAmpFastORL1 (>%d);FastOR abs. ID;entries above %d", fFastorL1Th, fFastorL1Th);
347  fHistManager.CreateTH1(hname, htitle, maxFORabsId, 0, maxFORabsId);
348 
349  hname = Form("EMCTRQA_histFastORL1Amp");
350  htitle = Form("EMCTRQA_histFastORL1Amp;FastOR abs. ID;L1 time sum");
351  fHistManager.CreateTH2(hname, htitle, maxFORabsId, 0, maxFORabsId, 1024, 0, 4096);
352 
353  hname = Form("EMCTRQA_histFastORL1AmpVsL0Amp");
354  htitle = Form("EMCTRQA_histFastORL1AmpVsL0Amp;L0 amplitude;L1 time sum;entries");
355  fHistManager.CreateTH2(hname, htitle, 256, 0, 1024, 256, 0, 1024);
356 
357  hname = Form("EMCTRQA_histCellAmp");
358  htitle = Form("EMCTRQA_histCellAmp;cell abs. ID;energy (GeV)");
359  fHistManager.CreateTH2(hname, htitle, maxFORabsId*4, 0, maxFORabsId*4, 400, 0, 200);
360 
361  hname = Form("EMCTRQA_histCell");
362  htitle = Form("EMCTRQA_histCell;cell abs. ID;entries above 0 GeV");
363  fHistManager.CreateTH1(hname, htitle, maxFORabsId*4, 0, maxFORabsId*4);
364 
365  hname = Form("EMCTRQA_histLargeAmpCell");
366  htitle = Form("EMCTRQA_histLargeAmpCell (>%.1f);cell abs. ID;entries above %.1f GeV", fFastorL1Th * EMCALTrigger::kEMCL1ADCtoGeV, fFastorL1Th * EMCALTrigger::kEMCL1ADCtoGeV);
367  fHistManager.CreateTH1(hname, htitle, maxFORabsId*4, 0, maxFORabsId*4);
368 
369  hname = Form("EMCTRQA_histCellAmpVsFastORL0Amp");
370  htitle = Form("EMCTRQA_histCellAmpVsFastORL0Amp;FastOR L0 amplitude;2x2 cell sum energy (GeV)");
371  fHistManager.CreateTH2(hname, htitle, 1024, 0, 4096, 400, 0, 200);
372 
373  hname = Form("EMCTRQA_histCellAmpVsFastORL1Amp");
374  htitle = Form("EMCTRQA_histCellAmpVsFastORL1Amp;FastOR L1 amplitude;2x2 cell sum energy (GeV)");
375  fHistManager.CreateTH2(hname, htitle, 1024, 0, 4096, 400, 0, 200);
376 
377  hname = Form("EMCTRQA_histFastORNoOffline");
378  htitle = Form("EMCTRQA_histFastORNoOffline;FastOR abs. ID;entries with no offline energy");
379  fHistManager.CreateTH1(hname, htitle, maxFORabsId, 0, maxFORabsId);
380 
381  const char* det[2] = { "EMCal", "DCal" };
382 
383  for (Int_t itrig = 0; itrig < 6; itrig++) {
384  if (kEMCalTriggerNames[itrig].IsNull() || fEnabledTriggerTypes[itrig] == kFALSE) continue;
385 
386  for (Int_t idet = 0; idet < ndet; idet++) {
387  hname = Form("EMCTRQA_hist%s%sMaxOfflineVsRecalc", det[idet], kEMCalTriggerNames[itrig].Data());
388  htitle = Form("EMCTRQA_hist%s%sMaxOfflineVsRecalc;Offline;Recalc;entries", det[idet], kEMCalTriggerNames[itrig].Data());
389  fHistManager.CreateTH2(hname, htitle, fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig], fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig]);
390 
391  hname = Form("EMCTRQA_hist%s%sOfflineVsRecalc", det[idet], kEMCalTriggerNames[itrig].Data());
392  htitle = Form("EMCTRQA_hist%s%sOfflineVsRecalc;Offline;Recalc;entries", det[idet], kEMCalTriggerNames[itrig].Data());
393  fHistManager.CreateTH2(hname, htitle, fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig], fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig]);
394  }
395 
396  for (Int_t itype = 0; itype < 3; itype++) {
397  if (!fEnabledPatchTypes[itype]) continue;
398  for (Int_t idet = 0; idet < ndet; idet++) {
399  hname = Form("EMCTRQA_hist%sPatchAmp%s%s", det[idet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
400  htitle = Form("EMCTRQA_hist%sPatchAmp%s%s;amplitude;entries", det[idet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
401  fHistManager.CreateTH1(hname, htitle, fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig]);
402 
403  hname = Form("EMCTRQA_hist%sMaxPatchAmp%s%s", det[idet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
404  htitle = Form("EMCTRQA_hist%sMaxPatchAmp%s%s;amplitude;entries", det[idet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
405  fHistManager.CreateTH1(hname, htitle, fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig]);
406 
407  for (Int_t itrig2 = itrig+1; itrig2 < 6; itrig2++) {
408  if (kEMCalTriggerNames[itrig2].IsNull() || fEnabledTriggerTypes[itrig2] == kFALSE) continue;
409  hname = Form("EMCTRQA_hist%s%sMaxVs%sMax%s", det[idet], kEMCalTriggerNames[itrig].Data(), kEMCalTriggerNames[itrig2].Data(), fgkPatchTypes[itype].Data());
410  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());
411  fHistManager.CreateTH2(hname, htitle, fgkMaxPatchAmp[itrig2]/fADCperBin, 0, fgkMaxPatchAmp[itrig2], fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig]);
412  }
413  }
414 
415  if (fDCalPlots) {
416  hname = Form("EMCTRQA_histEMCalMaxVsDCalMax%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
417  htitle = Form("EMCTRQA_histEMCalMaxVsDCalMax%s%s;EMCal max;DCal max;entries", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
418  fHistManager.CreateTH2(hname, htitle, fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig], fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig]);
419  }
420 
421  hname = Form("EMCTRQA_histEdgePos%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
422  htitle = Form("EMCTRQA_histEdgePos%s%s;col;row;entries", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
423  fHistManager.CreateTH2(hname, htitle, 48, 0, 48, 105, 0, 105);
424 
425  hname = Form("EMCTRQA_histGeoPos%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
426  htitle = Form("EMCTRQA_histGeoPos%s%s;#eta;#phi;entries", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
427  fHistManager.CreateTH2(hname, htitle, 60, -1, 1, 150, 0, TMath::TwoPi());
428 
429  hname = Form("EMCTRQA_histLargeAmpEdgePos%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
430  htitle = Form("EMCTRQA_histLargeAmpEdgePos%s%s (>700);col;row;entries above 700", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
431  fHistManager.CreateTH2(hname, htitle, 48, 0, 48, 105, 0, 105);
432  }
433  }
434 
435  for (Int_t idet = 0; idet < ndet; idet++) {
436  hname = Form("EMCTRQA_hist%sOfflineSumVsL0Sum", det[idet]);
437  htitle = hname + ";Sum of L0 amplitudes;Sum of cell energies (GeV)";
438  fHistManager.CreateTH2(hname, htitle, 250, 0, 5000, 400, 0, 200);
439 
440  hname = Form("EMCTRQA_hist%sOfflineSumVsL1Sum", det[idet]);
441  htitle = hname + ";Sum of L1 amplitudes;Sum of cell energies (GeV)";
442  fHistManager.CreateTH2(hname, htitle, 250, 0, 5000, 400, 0, 200);
443 
444  hname = Form("EMCTRQA_hist%sL1SumVsL0Sum", det[idet]);
445  htitle = hname + ";Sum of L0 amplitudes;Sum of L1 amplitudes";
446  fHistManager.CreateTH2(hname, htitle, 250, 0, 5000, 250, 0, 5000);
447 
448  hname = Form("EMCTRQA_hist%sNCellVsNL0", det[idet]);
449  htitle = hname + ";Number of L0 FastORs;Number of cells";
450  fHistManager.CreateTH2(hname, htitle, 250, 0, 500, 250, 0, 2000);
451 
452  hname = Form("EMCTRQA_hist%sNCellVsNL1", det[idet]);
453  htitle = hname + ";Number of L1 FastORs;Number of cells";
454  fHistManager.CreateTH2(hname, htitle, 250, 0, 500, 250, 0, 2000);
455 
456  hname = Form("EMCTRQA_hist%sNL1VsNL0", det[idet]);
457  htitle = hname + ";Number of L0 FastORs;Number of L1 FastORs";
458  fHistManager.CreateTH2(hname, htitle, 250, 0, 500, 250, 0, 500);
459  }
460 }
461 
466 void AliEmcalTriggerQAPP::ProcessPatch(AliEMCALTriggerPatchInfo* patch)
467 {
468  TString hname;
469 
470  Int_t triggerBits[6] = { patch->GetTriggerBitConfig()->GetLevel0Bit(),
471  patch->GetTriggerBitConfig()->GetGammaLowBit(),
472  patch->GetTriggerBitConfig()->GetGammaHighBit(),
473  patch->GetTriggerBitConfig()->GetJetLowBit(),
474  patch->GetTriggerBitConfig()->GetJetHighBit(),
475  patch->GetTriggerBitConfig()->GetBkgBit()
476  };
477 
478  Int_t offsets[3] = { 0, AliEMCALTriggerPatchInfo::kRecalcOffset, AliEMCALTriggerPatchInfo::kOfflineOffset };
479  Int_t amplitudes[3] = { patch->GetADCAmp(), patch->GetADCAmp(), patch->GetADCOfflineAmp() };
480  Double_t bkg[3] = {0};
481 
482  for (Int_t itrig = 0; itrig < 6; itrig++) {
483  if (kEMCalTriggerNames[itrig].IsNull() || fEnabledTriggerTypes[itrig] == kFALSE) continue;
484 
485  for (Int_t itype = 0; itype < 3; itype++) {
486  if (!fEnabledPatchTypes[itype]) continue;
487  if (!patch->TestTriggerBit(triggerBits[itrig]+offsets[itype])) continue;
488 
489  TString det;
490 
491  if (patch->IsEMCal()) {
492  det = "EMCal";
493  if (fMaxPatchEMCal[itrig][itype] < amplitudes[itype]) fMaxPatchEMCal[itrig][itype] = amplitudes[itype];
494  }
495  else if (patch->IsDCalPHOS()) {
496  if (!fDCalPlots) return;
497  det = "DCal";
498  if (fMaxPatchDCal[itrig][itype] < amplitudes[itype]) fMaxPatchDCal[itrig][itype] = amplitudes[itype];
499  }
500  else {
501  AliWarning(Form("Patch is not EMCal nor DCal/PHOS (pos: %d, %d)", patch->GetRowStart(), patch->GetColStart()));
502  }
503 
504  hname = Form("EMCTRQA_hist%s%sOfflineVsRecalc", det.Data(), kEMCalTriggerNames[itrig].Data());
505  fHistManager.FillTH2(hname, amplitudes[2], amplitudes[1]);
506 
507  hname = Form("EMCTRQA_histEdgePos%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
508  fHistManager.FillTH2(hname, patch->GetColStart(), patch->GetRowStart());
509 
510  hname = Form("EMCTRQA_histGeoPos%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
511  fHistManager.FillTH2(hname, patch->GetEtaGeo(), TVector2::Phi_0_2pi(patch->GetPhiGeo()));
512 
513  if (amplitudes[itype] > 700) {
514  hname = Form("EMCTRQA_histLargeAmpEdgePos%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
515  fHistManager.FillTH2(hname, patch->GetColStart(), patch->GetRowStart());
516  }
517 
518  hname = Form("EMCTRQA_hist%sPatchAmp%s%s", det.Data(), kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
519  fHistManager.FillTH1(hname, amplitudes[itype]);
520  }
521 
522  if (fDebugLevel >= 2) {
523  Printf("Type = %s; global pos = (%d, %d); Amp (online) = %d; Amp (offline) = %d; Patch energy = %.3f\n"
524  "Position (CM): Eta=%.3f, Phi=%.3f\n"
525  "Position (Geo): Eta=%.3f, Phi=%.3f\n",
526  kEMCalTriggerNames[itrig].Data(), patch->GetRowStart(), patch->GetColStart(), patch->GetADCAmp(), patch->GetADCOfflineAmp(), patch->GetPatchE(),
527  patch->GetEtaCM(), patch->GetPhiCM(),
528  patch->GetEtaGeo(), patch->GetPhiGeo());
529  }
530  }
531 }
532 
538 {
539  TString hname;
540 
541  if (fGeom) {
542  Double_t pos[3] = {0};
543  fGeom->GetGlobal(cell.fAbsId, pos);
544  if (fGeom->IsInDCAL(pos[0], pos[1], pos[2])) {
545  if (!fDCalPlots) return;
546  fSumOfflineDCal += cell.fEnergy;
547  fNCellDCal++;
548  }
549  else if (fGeom->IsInEMCAL(pos[0], pos[1], pos[2])) {
550  fSumOfflineEMCal += cell.fEnergy;
551  fNCellEMCal++;
552  }
553  else {
554  AliWarning(Form("Cell with absolute ID %hd was not identified as neither DCal or EMCal!!", cell.fAbsId));
555  }
556  }
557 
558  if (fOfflineBadChannels.find(cell.fAbsId) != fOfflineBadChannels.end()) return;
559 
560  if (cell.fEnergy < fMinCellAmp) return;
561 
562  hname = Form("EMCTRQA_histCell");
563  fHistManager.FillTH1(hname, cell.fAbsId);
564 
565  hname = Form("EMCTRQA_histCellAmp");
566  fHistManager.FillTH2(hname, cell.fAbsId, cell.fEnergy);
567 
568  if (cell.fEnergy > fFastorL1Th * EMCALTrigger::kEMCL1ADCtoGeV) {
569  hname = Form("EMCTRQA_histLargeAmpCell");
570  fHistManager.FillTH1(hname, cell.fAbsId);
571  }
572 }
573 
578 void AliEmcalTriggerQAPP::ProcessFastor(AliEMCALTriggerFastOR* fastor, AliVCaloCells* cells)
579 {
580  TString hname;
581 
582  if (fBadChannels.find(fastor->GetAbsId()) != fBadChannels.end()) return;
583 
584  Int_t L0amp = fastor->GetL0Amp() - fFastORPedestal[fastor->GetAbsId()];
585  Bool_t isDCal = kFALSE;
586 
587  Double_t offlineAmp = 0;
588 
589  if (fGeom) {
590  Int_t idx[4] = {-1};
591  fGeom->GetCellIndexFromFastORIndex(fastor->GetAbsId(), idx);
592  Double_t pos[3] = {0};
593  if (idx[0] >= 0) {
594  fGeom->GetGlobal(idx[0], pos);
595  isDCal = fGeom->IsInDCAL(pos[0], pos[1], pos[2]);
596  if (isDCal && !fDCalPlots) return;
597 
598  if (L0amp > fMinL0FastORAmp) {
599  if (cells) {
600  for (Int_t i = 0; i < 4; i++) {
601  offlineAmp += cells->GetCellAmplitude(idx[i]);
602  }
603  }
604  }
605  }
606  }
607 
608  if (L0amp > fMinL0FastORAmp) {
609  hname = Form("EMCTRQA_histFastORL0");
610  fHistManager.FillTH1(hname, fastor->GetAbsId());
611 
612  hname = Form("EMCTRQA_histFastORL0Amp");
613  fHistManager.FillTH2(hname, fastor->GetAbsId(), L0amp);
614 
615  hname = Form("EMCTRQA_histFastORL0Time");
616  fHistManager.FillTH2(hname, fastor->GetAbsId(), fastor->GetL0Time());
617 
618  hname = Form("EMCTRQA_histFastORL0AmpVsTime");
619  fHistManager.FillTH2(hname, fastor->GetL0Time(), L0amp);
620 
621  if (fastor->GetL0Time() > fL0MinTime && fastor->GetL0Time() < fL0MaxTime) {
622  hname = Form("EMCTRQA_histFastORL0TimeOk");
623  fHistManager.FillTH1(hname, fastor->GetAbsId());
624 
625  hname = Form("EMCTRQA_histFastORL0AmpTimeOk");
626  fHistManager.FillTH2(hname, fastor->GetAbsId(), L0amp);
627  }
628 
629  hname = Form("EMCTRQA_histCellAmpVsFastORL0Amp");
630  fHistManager.FillTH2(hname, L0amp, offlineAmp);
631  if (offlineAmp == 0) {
632  hname = Form("EMCTRQA_histFastORNoOffline");
633  fHistManager.FillTH1(hname, fastor->GetAbsId());
634  }
635 
636  if (isDCal) {
637  fSumL0DCal += L0amp;
638  fNL0DCal++;
639  }
640  else {
641  fSumL0EMCal += L0amp;
642  fNL0EMCal++;
643  }
644  }
645 
646  if (L0amp > fFastorL0Th) {
647  hname = Form("EMCTRQA_histLargeAmpFastORL0");
648  fHistManager.FillTH1(hname, fastor->GetAbsId());
649  }
650 
651  if (fastor->GetL1Amp() > fMinL1FastORAmp) {
652  hname = Form("EMCTRQA_histFastORL1");
653  fHistManager.FillTH1(hname, fastor->GetAbsId());
654 
655  hname = Form("EMCTRQA_histFastORL1Amp");
656  fHistManager.FillTH2(hname, fastor->GetAbsId(), fastor->GetL1Amp());
657 
658  if (isDCal) {
659  fSumL1DCal += fastor->GetL1Amp();
660  fNL1DCal++;
661  }
662  else {
663  fSumL1EMCal += fastor->GetL1Amp();
664  fNL1EMCal++;
665  }
666 
667  hname = Form("EMCTRQA_histCellAmpVsFastORL1Amp");
668  fHistManager.FillTH2(hname, fastor->GetL1Amp(), offlineAmp);
669  }
670 
671  if (fastor->GetL1Amp() > fFastorL1Th) {
672  hname = Form("EMCTRQA_histLargeAmpFastORL1");
673  fHistManager.FillTH1(hname, fastor->GetAbsId());
674  }
675 
676  if (fastor->GetL1Amp() > fMinL1FastORAmp || L0amp > fMinL0FastORAmp) {
677  hname = Form("EMCTRQA_histFastORL1AmpVsL0Amp");
678  fHistManager.FillTH2(hname, L0amp, fastor->GetL1Amp());
679  }
680 }
681 
682 
687 {
688  AliDebug(2, Form("Entering AliEmcalTriggerQAAP::EventCompleted"));
689 
690  TString hname;
691 
692  for (Int_t itrig = 0; itrig < 6; itrig++) {
693  if (kEMCalTriggerNames[itrig].IsNull() || fEnabledTriggerTypes[itrig] == kFALSE) continue;
694  AliDebug(2, Form("Trigger type: %s", kEMCalTriggerNames[itrig].Data()));
695 
696  hname = Form("EMCTRQA_histEMCal%sMaxOfflineVsRecalc", kEMCalTriggerNames[itrig].Data());
697  fHistManager.FillTH2(hname, fMaxPatchEMCal[itrig][2], fMaxPatchEMCal[itrig][1]);
698 
699  if (fDCalPlots) {
700  hname = Form("EMCTRQA_histDCal%sMaxOfflineVsRecalc", kEMCalTriggerNames[itrig].Data());
701  fHistManager.FillTH2(hname, fMaxPatchEMCal[itrig][2], fMaxPatchEMCal[itrig][1]);
702  }
703 
704  for (Int_t itype = 0; itype < 3; itype++) {
705  if (!fEnabledPatchTypes[itype]) continue;
706  AliDebug(2, Form("Patch type %s", fgkPatchTypes[itype].Data()));
707 
708  hname = Form("EMCTRQA_histEMCalMaxPatchAmp%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
709  fHistManager.FillTH1(hname, fMaxPatchEMCal[itrig][itype]);
710 
711  if (fDCalPlots) {
712  hname = Form("EMCTRQA_histDCalMaxPatchAmp%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
713  fHistManager.FillTH1(hname, fMaxPatchDCal[itrig][itype]);
714 
715  hname = Form("EMCTRQA_histEMCalMaxVsDCalMax%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
716  fHistManager.FillTH2(hname, fMaxPatchEMCal[itrig][itype], fMaxPatchDCal[itrig][itype]);
717  }
718 
719  for (Int_t itrig2 = itrig+1; itrig2 < 6; itrig2++) {
720  if (kEMCalTriggerNames[itrig2].IsNull() || fEnabledTriggerTypes[itrig2] == kFALSE) continue;
721 
722  hname = Form("EMCTRQA_histEMCal%sMaxVs%sMax%s", kEMCalTriggerNames[itrig].Data(), kEMCalTriggerNames[itrig2].Data(), fgkPatchTypes[itype].Data());
723  fHistManager.FillTH2(hname, fMaxPatchEMCal[itrig2][itype], fMaxPatchEMCal[itrig][itype]);
724 
725  if (fDCalPlots) {
726  hname = Form("EMCTRQA_histDCal%sMaxVs%sMax%s", kEMCalTriggerNames[itrig].Data(), kEMCalTriggerNames[itrig2].Data(), fgkPatchTypes[itype].Data());
727  fHistManager.FillTH2(hname, fMaxPatchDCal[itrig2][itype], fMaxPatchDCal[itrig][itype]);
728  }
729  }
730 
731  fMaxPatchEMCal[itrig][itype] = 0;
732  fMaxPatchDCal[itrig][itype] = 0;
733  }
734  }
735 
736 
737  fHistManager.FillTH2("EMCTRQA_histEMCalOfflineSumVsL0Sum", fSumL0EMCal, fSumOfflineEMCal);
738  fHistManager.FillTH2("EMCTRQA_histEMCalOfflineSumVsL1Sum", fSumL1EMCal, fSumOfflineEMCal);
739  fHistManager.FillTH2("EMCTRQA_histEMCalL1SumVsL0Sum", fSumL0EMCal, fSumL1EMCal);
740  fHistManager.FillTH2("EMCTRQA_histEMCalNCellVsNL0", fNL0EMCal, fNCellEMCal);
741  fHistManager.FillTH2("EMCTRQA_histEMCalNCellVsNL1", fNL1EMCal, fNCellEMCal);
742  fHistManager.FillTH2("EMCTRQA_histEMCalNL1VsNL0", fNL0EMCal, fNL1EMCal);
743 
744  if (fDCalPlots) {
745  fHistManager.FillTH2("EMCTRQA_histDCalOfflineSumVsL0Sum", fSumL0DCal, fSumOfflineDCal);
746  fHistManager.FillTH2("EMCTRQA_histDCalOfflineSumVsL1Sum", fSumL1DCal, fSumOfflineDCal);
747  fHistManager.FillTH2("EMCTRQA_histDCalL1SumVsL0Sum", fSumL0DCal, fSumL1DCal);
748  fHistManager.FillTH2("EMCTRQA_histDCalNCellVsNL0", fNL0DCal, fNCellDCal);
749  fHistManager.FillTH2("EMCTRQA_histDCalNCellVsNL1", fNL1DCal, fNCellDCal);
750  fHistManager.FillTH2("EMCTRQA_histDCalNL1VsNL0", fNL0DCal, fNL1DCal);
751  }
752 
753  fSumOfflineEMCal = 0;
754  fSumL0EMCal = 0;
755  fSumL1EMCal = 0;
756  fSumOfflineDCal = 0;
757  fSumL0DCal = 0;
758  fSumL1DCal = 0;
759 
760  fNCellEMCal = 0;
761  fNL0EMCal = 0;
762  fNL1EMCal = 0;
763  fNCellDCal = 0;
764  fNL0DCal = 0;
765  fNL1DCal = 0;
766 }
Int_t fNL0EMCal
! EMCal number of L0 FastORs (will be reset each event)
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)
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)
Int_t fMaxPatchDCal[6][3]
! DCal max ADC amplitude (will be reset each event)
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.
void ReadFastORPedestalFromStream(std::istream &stream)
std::set< Short_t > fOfflineBadChannels
Abd 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 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)
Int_t fL0MaxTime
Maximum L0 time.
Bool_t fEnabledTriggerTypes[6]
Trigger types to be plotted.
Int_t fMaxPatchEMCal[6][3]
! EMCal max ADC amplitude (will be reset each event)
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)
Int_t fMinL0FastORAmp
Minimum L0 amplitude of the FastORs.
std::set< Short_t > fBadChannels
Container of bad channels.
Int_t fNL1EMCal
! EMCal number of L1 FastORs (will be reset each event)
void AddFastORBadChannel(Short_t absId)
void ProcessCell(const AliEmcalCellInfo &cell)