AliRoot Core  a565103 (a565103)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliEMCALTriggerOnlineQAPbPb.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2015, 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  **************************************************************************/
21 #include <cstring>
22 
23 #include <TH1D.h>
24 #include <TH2D.h>
25 #include <TH3D.h>
26 #include <TProfile.h>
27 #include <TObjString.h>
28 #include <TObjArray.h>
29 
31 #include "AliEMCALTriggerFastOR.h"
32 #include "AliLog.h"
33 
35 
37 
38 using namespace EMCALTrigger;
39 
43 
49  fBkgPatchType(kTMEMCalBkg),
50  fHistos(0)
51 {
52  for (Int_t i = 0; i < 3; i++) {
53  fBkgADCAmpEMCal[i].Set(100);
54  fBkgADCAmpDCal[i].Set(100);
55  fNBkgPatchesEMCal[i] = 0;
56  fNBkgPatchesDCal[i] = 0;
57 
58  for (Int_t itype = 0; itype < 6; itype++) {
59  fMaxPatchEMCal[itype][i] = 0;
60  fMaxPatchDCal[itype][i] = 0;
61  }
62  }
63 
64  EnablePatchType(kOnlinePatch, kTMEMCalLevel0, kTRUE);
65  EnablePatchType(kOnlinePatch, kTMEMCalGammaL, kTRUE);
66  EnablePatchType(kOnlinePatch, kTMEMCalGammaH, kTRUE);
67  EnablePatchType(kOnlinePatch, kTMEMCalJetL, kTRUE);
68  EnablePatchType(kOnlinePatch, kTMEMCalJetH, kTRUE);
69  EnablePatchType(kOnlinePatch, kTMEMCalBkg, kTRUE);
70 
71  EnablePatchType(kRecalcPatch, kTMEMCalLevel0, kTRUE);
72  EnablePatchType(kRecalcPatch, kTMEMCalGammaH, kTRUE);
73  EnablePatchType(kRecalcPatch, kTMEMCalJetH, kTRUE);
74  EnablePatchType(kRecalcPatch, kTMEMCalBkg, kTRUE);
75 
76  EnablePatchType(kOfflinePatch, kTMEMCalLevel0, kTRUE);
77  EnablePatchType(kOfflinePatch, kTMEMCalGammaH, kTRUE);
78  EnablePatchType(kOfflinePatch, kTMEMCalJetH, kTRUE);
79  EnablePatchType(kOfflinePatch, kTMEMCalBkg, kTRUE);
80 
81  memset(fPatchAreas, 0, sizeof(Int_t)*6);
82 }
83 
88  AliEMCALTriggerQA(name),
89  fBkgPatchType(kTMEMCalBkg),
90  fHistos(0)
91 {
92  for (Int_t i = 0; i < 3; i++) {
93  fBkgADCAmpEMCal[i].Set(100);
94  fBkgADCAmpDCal[i].Set(100);
95  fNBkgPatchesEMCal[i] = 0;
96  fNBkgPatchesDCal[i] = 0;
97 
98  for (Int_t itype = 0; itype < 6; itype++) {
99  fMaxPatchEMCal[itype][i] = 0;
100  fMaxPatchDCal[itype][i] = 0;
101  }
102  }
103 
110 
115 
120 
121  memset(fPatchAreas, 0, sizeof(fPatchAreas));
122 }
123 
124 /*
125 * Copy Constructor
126 */
128  AliEMCALTriggerQA(triggerQA),
129  fBkgPatchType(triggerQA.fBkgPatchType),
130  fHistos(0)
131 {
132  for (Int_t i = 0; i < 3; i++) {
133  fBkgADCAmpEMCal[i].Set(100);
134  fBkgADCAmpDCal[i].Set(100);
135  fNBkgPatchesEMCal[i] = 0;
136  fNBkgPatchesDCal[i] = 0;
137 
138  for (Int_t itype = 0; itype < 6; itype++) {
139  fMaxPatchEMCal[itype][i] = 0;
140  fMaxPatchDCal[itype][i] = 0;
141  }
142  }
143 
144  memset(fPatchAreas, 0, sizeof(fPatchAreas));
145 }
146 
151 {
152 }
153 
158 {
159  TString hname;
160  TString htitle;
161 
162  fHistos = new THashList();
163  fHistos->SetName(Form("histos%s", GetName()));
164  fHistos->SetOwner(kTRUE);
165 
166  hname = Form("EMCTRQA_histFastORL0");
167  htitle = Form("EMCTRQA_histFastORL0;FastOR abs. ID;entries above 0");
168  CreateTH1(hname, htitle, 5000, 0, 5000);
169 
170  hname = Form("EMCTRQA_histLargeAmpFastORL0");
171  htitle = Form("EMCTRQA_histLargeAmpFastORL0 (>%d);FastOR abs. ID;entries above %d", fFastorL0Th, fFastorL0Th);
172  CreateTH1(hname, htitle, 5000, 0, 5000);
173 
174  hname = Form("EMCTRQA_histFastORL0TimeOk");
175  htitle = Form("EMCTRQA_histFastORL0TimeOk;FastOR abs. ID;entries (7 < time < 10)");
176  CreateTH1(hname, htitle, 5000, 0, 5000);
177 
178  hname = Form("EMCTRQA_histFastORL0Mean");
179  htitle = Form("EMCTRQA_histFastORL0Mean;FastOR abs. ID;mean ADC counts");
180  CreateTProfile(hname, htitle, 5000, 0, 5000);
181 
182  hname = Form("EMCTRQA_histFastORL0MeanTimeOk");
183  htitle = Form("EMCTRQA_histFastORL0MeanTimeOk;FastOR abs. ID;mean ADC counts (7 < time < 10)");
184  CreateTProfile(hname, htitle, 5000, 0, 5000);
185 
186  hname = Form("EMCTRQA_histFastORL1");
187  htitle = Form("EMCTRQA_histFastORL1;FastOR abs. ID;entries above 0");
188  CreateTH1(hname, htitle, 5000, 0, 5000);
189 
190  hname = Form("EMCTRQA_histLargeAmpFastORL1");
191  htitle = Form("EMCTRQA_histLargeAmpFastORL1 (>%d);FastOR abs. ID;entries above %d", fFastorL1Th, fFastorL1Th);
192  CreateTH1(hname, htitle, 5000, 0, 5000);
193 
194  hname = Form("EMCTRQA_histFastORL1Mean");
195  htitle = Form("EMCTRQA_histFastORL1Mean;FastOR abs. ID;mean L1 time sum");
196  CreateTProfile(hname, htitle, 5000, 0, 5000);
197 
198  hname = Form("EMCTRQA_histFastORL1AmpVsL0Amp");
199  htitle = Form("EMCTRQA_histFastORL1AmpVsL0Amp;L0 amplitude;L1 time sum;entries");
200  CreateTH2(hname, htitle, 64, 0, 2048, 64, 0, 2048);
201 
202  for (Int_t itype = 0; itype < 3; itype++) {
203  if (!IsPatchTypeEnabled(itype, EMCALTrigger::kTMEMCalBkg)) continue;
204  hname = Form("EMCTRQA_histEMCalMedianVsDCalMedian%s", fgkPatchTypes[itype].Data());
205  htitle = Form("EMCTRQA_histEMCalMedianVsDCalMedian%s;EMCal median;DCal median;entries", fgkPatchTypes[itype].Data());
207  }
208 
209  const char* det[2] = { "EMCal", "DCal" };
210 
211  for (Int_t itrig = 0; itrig < 6; itrig++) {
212  for (Int_t itype = 0; itype < 3; itype++) {
213  if (!IsPatchTypeEnabled(itype, itrig)) continue;
214  for (Int_t idet = 0; idet < 2; idet++) {
215  hname = Form("EMCTRQA_hist%sPatchEnergy%s%s", det[idet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
216  htitle = Form("EMCTRQA_hist%sPatchEnergy%s%s;energy (GeV);entries", det[idet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
217  CreateTH1(hname, htitle, 200, 0, 200);
218 
219  hname = Form("EMCTRQA_hist%sPatchAmp%s%s", det[idet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
220  htitle = Form("EMCTRQA_hist%sPatchAmp%s%s;amplitude;entries", det[idet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
221  CreateTH1(hname, htitle, fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig]);
222 
223  hname = Form("EMCTRQA_hist%sPatchAmpSubtracted%s%s", det[idet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
224  htitle = Form("EMCTRQA_hist%sPatchAmpSubtracted%s%s;amplitude - background * area;entries", det[idet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
225  CreateTH1(hname, htitle, fgkMaxPatchAmp[itrig]/fADCperBin, -fgkMaxPatchAmp[itrig]/2, fgkMaxPatchAmp[itrig]/2);
226 
227  hname = Form("EMCTRQA_hist%sMaxPatchAmp%s%s", det[idet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
228  htitle = Form("EMCTRQA_hist%sMaxPatchAmp%s%s;amplitude;entries", det[idet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
229  CreateTH1(hname, htitle, fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig]);
230 
231  hname = Form("EMCTRQA_hist%sMaxPatchAmpSubtracted%s%s", det[idet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
232  htitle = Form("EMCTRQA_hist%sPatchAmp%s%s;amplitude;entries", det[idet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
233  CreateTH1(hname, htitle, fgkMaxPatchAmp[itrig]/fADCperBin, -fgkMaxPatchAmp[itrig]/2, fgkMaxPatchAmp[itrig]/2);
234 
235  for (Int_t jdet = 0; jdet < 2; jdet++) {
236  hname = Form("EMCTRQA_hist%sMedianVs%sMax%s%s", det[idet], det[jdet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
237  htitle = Form("EMCTRQA_hist%sMedianVs%sMax%s%s;%s max;%s median;entries", det[idet], det[jdet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data(), det[jdet], det[idet]);
238  CreateTH2(hname, htitle, fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig], fgkMaxPatchAmp[itrig]/fADCperBin/10, 0, fgkMaxPatchAmp[itrig]/10);
239  }
240  }
241 
242  hname = Form("EMCTRQA_histEMCalMaxVsDCalMax%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
243  htitle = Form("EMCTRQA_histEMCalMaxVsDCalMax%s%s;EMCal max;DCal max;entries", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
244  CreateTH2(hname, htitle, fgkMaxPatchAmp[itrig]/fADCperBin/4, 0, fgkMaxPatchAmp[itrig], fgkMaxPatchAmp[itrig]/fADCperBin/4, 0, fgkMaxPatchAmp[itrig]);
245 
246  hname = Form("EMCTRQA_histEdgePos%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
247  htitle = Form("EMCTRQA_histEdgePos%s%s;col;row;entries", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
248  CreateTH2(hname, htitle, 48, 0, 48, 105, 0, 105);
249 
250  //hname = Form("EMCTRQA_histCMPos%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
251  //htitle = Form("EMCTRQA_histCMPos%s%s;#eta;#phi;entries", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
252  //CreateTH2(hname, htitle, 60, -1, 1, 150, 0, TMath::TwoPi());
253 
254  hname = Form("EMCTRQA_histGeoPos%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
255  htitle = Form("EMCTRQA_histGeoPos%s%s;#eta;#phi;entries", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
256  CreateTH2(hname, htitle, 60, -1, 1, 150, 0, TMath::TwoPi());
257 
258  hname = Form("EMCTRQA_histLargeAmpEdgePos%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
259  htitle = Form("EMCTRQA_histLargeAmpEdgePos%s%s (>700);col;row;entries above 700", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
260  CreateTH2(hname, htitle, 48, 0, 48, 105, 0, 105);
261  }
262  }
263 }
264 
270 {
271  TString hname;
272 
273  Int_t triggerBits[6] = { patch->GetTriggerBitConfig()->GetLevel0Bit(),
276  patch->GetTriggerBitConfig()->GetJetLowBit(),
278  patch->GetTriggerBitConfig()->GetBkgBit()
279  };
280 
282  Int_t amplitudes[3] = { patch->GetADCAmp(), patch->GetADCAmp(), patch->GetADCOfflineAmp() };
283  Double_t bkg[3] = {0};
284 
285  for (Int_t itrig = 0; itrig < 6; itrig++) {
286  if (itrig == fBkgPatchType) continue;
287  for (Int_t itype = 0; itype < 3; itype++) {
288  if (!IsPatchTypeEnabled(itype, itrig)) continue;
289 
290  if (!patch->TestTriggerBit(triggerBits[itrig]+offsets[itype])) continue;
291  fPatchAreas[itrig] = patch->GetPatchSize()*patch->GetPatchSize();
292 
293  TString det;
294 
295  if (patch->IsEMCal()) {
296  det = "EMCal";
297  if (fMaxPatchEMCal[itrig][itype] < amplitudes[itype]) fMaxPatchEMCal[itrig][itype] = amplitudes[itype];
298  bkg[itype] = fBkgDCal[itype]; // use DCal background for EMCal
299  }
300  else if (patch->IsDCalPHOS()) {
301  det = "DCal";
302  if (fMaxPatchDCal[itrig][itype] < amplitudes[itype]) fMaxPatchDCal[itrig][itype] = amplitudes[itype];
303  bkg[itype] = fBkgEMCal[itype]; // use EMCal background for DCal
304  }
305  else {
306  AliWarning(Form("Patch is not EMCal nor DCal/PHOS (pos: %d, %d)", patch->GetRowStart(), patch->GetColStart()));
307  }
308 
309  hname = Form("EMCTRQA_histEdgePos%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
310  FillTH2(hname, patch->GetColStart(), patch->GetRowStart());
311 
312  //hname = Form("EMCTRQA_histCMPos%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
313  //FillTH2(hname, patch->GetEtaCM(), TVector2::Phi_0_2pi(patch->GetPhiCM()));
314 
315  hname = Form("EMCTRQA_histGeoPos%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
316  FillTH2(hname, patch->GetEtaGeo(), TVector2::Phi_0_2pi(patch->GetPhiGeo()));
317 
318  if (amplitudes[itype] > 700) {
319  hname = Form("EMCTRQA_histLargeAmpEdgePos%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
320  FillTH2(hname, patch->GetColStart(), patch->GetRowStart());
321  }
322 
323  hname = Form("EMCTRQA_hist%sPatchAmp%s%s", det.Data(), kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
324  FillTH1(hname, amplitudes[itype]);
325 
326  hname = Form("EMCTRQA_hist%sPatchAmpSubtracted%s%s", det.Data(), kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
327  FillTH1(hname, Double_t(amplitudes[itype]) - bkg[itype] * fPatchAreas[itrig]);
328 
329  hname = Form("EMCTRQA_hist%sPatchEnergy%s%s", det.Data(), kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
330  FillTH1(hname, patch->GetPatchE());
331  }
332 
333  if (fDebugLevel >= 2) {
334  Printf("Type = %s; global pos = (%d, %d); Amp (online) = %d; Amp (offline) = %d; Patch energy = %.3f\n"
335  "Position (CM): Eta=%.3f, Phi=%.3f\n"
336  "Position (Geo): Eta=%.3f, Phi=%.3f\n",
337  kEMCalTriggerNames[itrig].Data(), patch->GetRowStart(), patch->GetColStart(), patch->GetADCAmp(), patch->GetADCOfflineAmp(), patch->GetPatchE(),
338  patch->GetEtaCM(), patch->GetPhiCM(),
339  patch->GetEtaGeo(), patch->GetPhiGeo());
340  }
341  }
342 }
343 
349 {
350  TString hname;
351 
353  Int_t amplitudes[3] = { patch->GetADCAmp(), patch->GetADCAmp(), patch->GetADCOfflineAmp() };
354  Int_t bkgTriggerBit = patch->GetTriggerBitConfig()->GetBkgBit();
355 
356  for (Int_t itype = 0; itype < 3; itype++) {
357  if (!IsPatchTypeEnabled(itype, EMCALTrigger::kTMEMCalBkg)) continue;
358  if (!patch->TestTriggerBit(bkgTriggerBit+offsets[itype])) continue;
359  fPatchAreas[bkgTriggerBit] = patch->GetPatchSize()*patch->GetPatchSize();
360 
361  TString det;
362 
363  if (patch->IsEMCal()) {
364  det = "EMCal";
365  if (fMaxPatchEMCal[bkgTriggerBit][itype] < amplitudes[itype]) fMaxPatchEMCal[bkgTriggerBit][itype] = amplitudes[itype];
366 
367  if (fNBkgPatchesEMCal[itype] >= fBkgADCAmpEMCal[itype].GetSize()) {
368  fBkgADCAmpEMCal[itype].Set((fNBkgPatchesEMCal[itype]+1)*2);
369  }
370  fBkgADCAmpEMCal[itype].AddAt(amplitudes[itype], fNBkgPatchesEMCal[itype]);
371  fNBkgPatchesEMCal[itype]++;
372 
373  }
374  else if (patch->IsDCalPHOS()) {
375  det = "DCal";
376  if (fMaxPatchDCal[bkgTriggerBit][itype] < amplitudes[itype]) fMaxPatchDCal[bkgTriggerBit][itype] = amplitudes[itype];
377 
378  if (fNBkgPatchesDCal[itype] >= fBkgADCAmpDCal[itype].GetSize()) {
379  fBkgADCAmpDCal[itype].Set((fNBkgPatchesDCal[itype]+1)*2);
380  }
381  fBkgADCAmpDCal[itype].AddAt(amplitudes[itype], fNBkgPatchesDCal[itype]);
382  fNBkgPatchesDCal[itype]++;
383  }
384  else {
385  AliWarning(Form("Patch is not EMCal nor DCal/PHOS (pos: %d, %d)", patch->GetRowStart(), patch->GetColStart()));
386  }
387 
388  hname = Form("EMCTRQA_histEdgePos%s%s", kEMCalTriggerNames[bkgTriggerBit].Data(), fgkPatchTypes[itype].Data());
389  FillTH2(hname, patch->GetColStart(), patch->GetRowStart());
390 
391  //hname = Form("EMCTRQA_histCMPos%s%s", kEMCalTriggerNames[bkgTriggerBit].Data(), fgkPatchTypes[itype].Data());
392  //FillTH2(hname, patch->GetEtaCM(), TVector2::Phi_0_2pi(patch->GetPhiCM()));
393 
394  hname = Form("EMCTRQA_histGeoPos%s%s", kEMCalTriggerNames[bkgTriggerBit].Data(), fgkPatchTypes[itype].Data());
395  FillTH2(hname, patch->GetEtaGeo(), TVector2::Phi_0_2pi(patch->GetPhiGeo()));
396 
397  if (amplitudes[itype] > 700) {
398  hname = Form("EMCTRQA_histLargeAmpEdgePos%s%s", kEMCalTriggerNames[bkgTriggerBit].Data(), fgkPatchTypes[itype].Data());
399  FillTH2(hname, patch->GetColStart(), patch->GetRowStart());
400  }
401 
402  hname = Form("EMCTRQA_hist%sPatchAmp%s%s", det.Data(), kEMCalTriggerNames[bkgTriggerBit].Data(), fgkPatchTypes[itype].Data());
403  FillTH1(hname, amplitudes[itype]);
404 
405  hname = Form("EMCTRQA_hist%sPatchEnergy%s%s", det.Data(), kEMCalTriggerNames[bkgTriggerBit].Data(), fgkPatchTypes[itype].Data());
406  FillTH1(hname, patch->GetPatchE());
407  }
408 
409  if (fDebugLevel >= 2) {
410  Printf("Type = %s; global pos = (%d, %d); Amp (online) = %d; Amp (offline) = %d; Patch energy = %.3f\n"
411  "Position (CM): Eta=%.3f, Phi=%.3f\n"
412  "Position (Geo): Eta=%.3f, Phi=%.3f\n",
413  kEMCalTriggerNames[bkgTriggerBit].Data(), patch->GetRowStart(), patch->GetColStart(), patch->GetADCAmp(), patch->GetADCOfflineAmp(), patch->GetPatchE(),
414  patch->GetEtaCM(), patch->GetPhiCM(),
415  patch->GetEtaGeo(), patch->GetPhiGeo());
416  }
417 
418 }
419 
424 void AliEMCALTriggerOnlineQAPbPb::ProcessFastor(const AliEMCALTriggerFastOR* fastor, AliVCaloCells* /*cells*/)
425 {
426  TString hname;
427 
428  if (fastor->GetL0Amp() > 0) {
429  hname = Form("EMCTRQA_histFastORL0");
430  FillTH1(hname, fastor->GetAbsId());
431 
432  hname = Form("EMCTRQA_histFastORL0Mean");
433  FillTProfile(hname, fastor->GetAbsId(), fastor->GetL0Amp());
434 
435  if (fastor->GetL0Time() < 10 && fastor->GetL0Time() > 7) {
436  hname = Form("EMCTRQA_histFastORL0TimeOk");
437  FillTH1(hname, fastor->GetAbsId());
438 
439  hname = Form("EMCTRQA_histFastORL0MeanTimeOk");
440  FillTProfile(hname, fastor->GetAbsId(), fastor->GetL0Amp());
441  }
442  }
443 
444  if (fastor->GetL0Amp() > fFastorL0Th) {
445  hname = Form("EMCTRQA_histLargeAmpFastORL0");
446  FillTH1(hname, fastor->GetAbsId());
447  }
448 
449  if (fastor->GetL1Amp() > fFastorL1Th) {
450  hname = Form("EMCTRQA_histFastORL1");
451  FillTH1(hname, fastor->GetAbsId());
452 
453  hname = Form("EMCTRQA_histFastORL1Mean");
454  FillTProfile(hname, fastor->GetAbsId(), fastor->GetL1Amp());
455 
456  if (fastor->GetL1Amp() > fFastorL1Th) {
457  hname = Form("EMCTRQA_histLargeAmpFastORL1");
458  FillTH1(hname, fastor->GetAbsId());
459  }
460  }
461 
462  if (fastor->GetL1Amp() > 0 && fastor->GetL0Amp() > 0) {
463  hname = Form("EMCTRQA_histFastORL1AmpVsL0Amp");
464  FillTH2(hname, fastor->GetL0Amp(), fastor->GetL1Amp());
465  }
466 }
467 
472 {
473  AliDebug(2, Form("Entering AliEMCALTriggerQA::ComputeBackground"));
474 
475  for (Int_t itype = 0; itype < 3; itype++) {
476  if (!IsPatchTypeEnabled(itype, EMCALTrigger::kTMEMCalBkg)) continue;
477 
478  AliDebug(2, Form("Patch type %s", fgkPatchTypes[itype].Data()));
479 
480  fMedianEMCal[itype] = TMath::Median(fNBkgPatchesEMCal[itype], fBkgADCAmpEMCal[itype].GetArray());
481  fMedianDCal[itype] = TMath::Median(fNBkgPatchesDCal[itype], fBkgADCAmpDCal[itype].GetArray());
482 
483  fBkgEMCal[itype] = fMedianEMCal[itype] / fPatchAreas[fBkgPatchType];
484  fBkgDCal[itype] = fMedianDCal[itype] / fPatchAreas[fBkgPatchType];
485  }
486 }
487 
492 {
493  AliDebug(2, Form("Entering AliEMCALTriggerQA::EventCompleted"));
494 
495  TString hname;
496 
497  for (Int_t itype = 0; itype < 3; itype++) {
498  AliDebug(2, Form("Patch type %s", fgkPatchTypes[itype].Data()));
499 
500  hname = Form("EMCTRQA_histEMCalMedianVsDCalMedian%s", fgkPatchTypes[itype].Data());
501  FillTH2(hname, fMedianEMCal[itype], fMedianDCal[itype]);
502 
503  for (Int_t itrig = 0; itrig < 6; itrig++) {
504 
505  if (!IsPatchTypeEnabled(itype, itrig)) continue;
506 
507  AliDebug(2, Form("Trigger type: %s", kEMCalTriggerNames[itype].Data()));
508 
509  hname = Form("EMCTRQA_histEMCalMedianVsDCalMax%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
510  FillTH2(hname, fMaxPatchDCal[itrig][itype], fMedianEMCal[itype]);
511 
512  hname = Form("EMCTRQA_histDCalMedianVsEMCalMax%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
513  FillTH2(hname, fMaxPatchEMCal[itrig][itype], fMedianDCal[itype]);
514 
515  hname = Form("EMCTRQA_histDCalMedianVsDCalMax%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
516  FillTH2(hname, fMaxPatchDCal[itrig][itype], fMedianDCal[itype]);
517 
518  hname = Form("EMCTRQA_histEMCalMedianVsEMCalMax%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
519  FillTH2(hname, fMaxPatchEMCal[itrig][itype], fMedianEMCal[itype]);
520 
521  hname = Form("EMCTRQA_histEMCalMaxVsDCalMax%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
522  FillTH2(hname, fMaxPatchEMCal[itrig][itype], fMaxPatchDCal[itrig][itype]);
523 
524  hname = Form("EMCTRQA_histEMCalMaxPatchAmpSubtracted%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
525  FillTH1(hname, fMaxPatchEMCal[itrig][itype] - fBkgDCal[itype] * fPatchAreas[itrig]);
526 
527  if (fMaxPatchEMCal[itrig][itype] > 0) {
528  hname = Form("EMCTRQA_histEMCalMaxPatchAmpSubtracted%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
529  FillTH1(hname, Double_t(fMaxPatchEMCal[itrig][itype]) - fBkgDCal[itype] * fPatchAreas[itrig]);
530 
531  hname = Form("EMCTRQA_histEMCalMaxPatchAmp%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
532  FillTH1(hname, fMaxPatchEMCal[itrig][itype]);
533  }
534 
535  if (fMaxPatchDCal[itrig][itype] > 0) {
536  hname = Form("EMCTRQA_histDCalMaxPatchAmpSubtracted%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
537  FillTH1(hname, Double_t(fMaxPatchDCal[itrig][itype]) - fBkgEMCal[itype] * fPatchAreas[itrig]);
538 
539  hname = Form("EMCTRQA_histDCalMaxPatchAmp%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
540  FillTH1(hname, fMaxPatchDCal[itrig][itype]);
541  }
542 
543  fMaxPatchEMCal[itrig][itype] = 0;
544  fMaxPatchDCal[itrig][itype] = 0;
545  }
546  fNBkgPatchesEMCal[itype] = 0;
547  fNBkgPatchesDCal[itype] = 0;
548  fBkgADCAmpEMCal[itype].Reset();
549  fBkgADCAmpDCal[itype].Reset();
550  }
551 }
552 
553 //______________________________________________________________________________
554 void AliEMCALTriggerOnlineQAPbPb::CreateTProfile(const char *name, const char *title, int nbins, double xmin, double xmax)
555 {
556  /*
557  * Create a new TProfile within the container.
558  *
559  * @param name: Name of the histogram
560  * @param title: Title of the histogram
561  * @param nbins: number of bins
562  * @param xmin: min. value of the range
563  * @param xmax: max. value of the range
564  * Raises fatals in case the object is attempted to be duplicated
565  */
566  if (fHistos->FindObject(name)) {
567  Fatal("AliEMCALTriggerQA::CreateTProfile", "Object %s already exists", name);
568  return;
569  }
570  TProfile* hist = new TProfile(name, title, nbins, xmin, xmax);
571  fHistos->Add(hist);
572 }
573 
574 //______________________________________________________________________________
575 void AliEMCALTriggerOnlineQAPbPb::CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax)
576 {
577  /*
578  * Create a new TH1 within the container.
579  *
580  * @param name: Name of the histogram
581  * @param title: Title of the histogram
582  * @param nbins: number of bins
583  * @param xmin: min. value of the range
584  * @param xmax: max. value of the range
585  * Raises fatals in case the object is attempted to be duplicated
586  */
587  if (fHistos->FindObject(name)) {
588  Fatal("AliEMCALTriggerQA::CreateTH1", "Object %s already exists", name);
589  return;
590  }
591  TH1* hist = new TH1D(name, title, nbins, xmin, xmax);
592  fHistos->Add(hist);
593 }
594 
595 //______________________________________________________________________________
596 void AliEMCALTriggerOnlineQAPbPb::CreateTH2(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax)
597 {
598  /*
599  * Create a new TH2 within the container.
600  *
601  * @param name: Name of the histogram
602  * @param title: Title of the histogram
603  * @param nbinsx: number of bins in x-direction
604  * @param xmin: min. value of the range in x-direction
605  * @param xmax: max. value of the range in x-direction
606  * @param nbinsy: number of bins in y-direction
607  * @param ymin: min. value of the range in y-direction
608  * @param ymax: max. value of the range in y-direction
609  * Raises fatals in case the object is attempted to be duplicated
610  */
611  if (fHistos->FindObject(name)) {
612  Fatal("AliEMCALTriggerQA::CreateTH2", "Object %s already exists", name);
613  return;
614  }
615  TH2* hist = new TH2D(name, title, nbinsx, xmin, xmax, nbinsy, ymin, ymax);
616  fHistos->Add(hist);
617 }
618 
619 //______________________________________________________________________________
620 void AliEMCALTriggerOnlineQAPbPb::CreateTH3(const char* name, const char* title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, int nbinsz, double zmin, double zmax)
621 {
622  /*
623  * Create a new TH3 within the container.
624  *
625  * @param nbinsx: number of bins in x-direction
626  * @param xmin: min. value of the range in x-direction
627  * @param xmax: max. value of the range in x-direction
628  * @param nbinsy: number of bins in y-direction
629  * @param ymin: min. value of the range in y-direction
630  * @param ymax: max. value of the range in y-direction
631  * @param nbinsz: number of bins in z-direction
632  * @param zmin: min. value of the range in z-direction
633  * @param zmax: max. value of the range in z-direction
634  * Raises fatals in case the object is attempted to be duplicated
635  */
636  if (fHistos->FindObject(name)) {
637  Fatal("AliEMCALTriggerQA::CreateTH3", "Object %s already exists", name);
638  return;
639  }
640  TH3* hist = new TH3D(name, title, nbinsx, xmin, xmax, nbinsy, ymin, ymax, nbinsz, zmin, zmax);
641  fHistos->Add(hist);
642 }
643 
644 //______________________________________________________________________________
645 void AliEMCALTriggerOnlineQAPbPb::FillTProfile(const char *name, double x, double y, double weight)
646 {
647  /*
648  * Fill a profile histogram within the container.
649  *
650  * @param name: Name of the histogram
651  * @param x: x-coordinate
652  * @param weight (@default 1): optional weight of the entry
653  * Raises fatals in case the histogram is not found
654  */
655  TProfile* hist = dynamic_cast<TProfile*>(fHistos->FindObject(name));
656  if (!hist) {
657  Fatal("AliEMCALTriggerQA::FillTProfile", "Histogram %s not found", name);
658  return;
659  }
660  hist->Fill(x, y, weight);
661 }
662 
663 //______________________________________________________________________________
664 void AliEMCALTriggerOnlineQAPbPb::FillTH1(const char *name, double x, double weight)
665 {
666  /*
667  * Fill a 1D histogram within the container.
668  *
669  * @param name: Name of the histogram
670  * @param x: x-coordinate
671  * @param weight (@default 1): optional weight of the entry
672  * Raises fatals in case the histogram is not found
673  */
674  TH1* hist = dynamic_cast<TH1*>(fHistos->FindObject(name));
675  if (!hist) {
676  Fatal("AliEMCALTriggerQA::FillTH1", "Histogram %s not found", name);
677  return;
678  }
679  hist->Fill(x, weight);
680 }
681 
682 //______________________________________________________________________________
683 void AliEMCALTriggerOnlineQAPbPb::FillTH2(const char *name, double x, double y, double weight)
684 {
685  /*
686  * Fill a 2D histogram within the container.
687  *
688  * @param name: Name of the histogram
689  * @param x: x-coordinate
690  * @param y: y-coordinate
691  * @param weight (@default 1): optional weight of the entry
692  * Raises fatals in case the histogram is not found
693  */
694  TH2* hist = dynamic_cast<TH2*>(fHistos->FindObject(name));
695  if (!hist) {
696  Fatal("AliEMCALTriggerQA::FillTH2", "Histogram %s not found", name);
697  return;
698  }
699  hist->Fill(x, y, weight);
700 }
701 
702 //______________________________________________________________________________
703 void AliEMCALTriggerOnlineQAPbPb::FillTH3(const char* name, double x, double y, double z, double weight)
704 {
705  /*
706  * Fill a 3D histogram within the container.
707  *
708  * @param name: Name of the histogram
709  * @param x: x-coordinate
710  * @param y: y-coordinate
711  * @param z: z-coordinate
712  * @param weight (@default 1): optional weight of the entry
713  * Raises fatals in case the histogram is not found
714  */
715 
716  TH3* hist = dynamic_cast<TH3*>(fHistos->FindObject(name));
717  if (!hist) {
718  Fatal("AliEMCALTriggerQA::FillTH3", "Histogram %s not found", name);
719  return;
720  }
721  hist->Fill(x, y, z, weight);
722 }
723 
724 //______________________________________________________________________________
725 TObject *AliEMCALTriggerOnlineQAPbPb::FindObject(const char *name) const
726 {
727  /*
728  * Find an object inside the container.
729  *
730  * @param name: Name of the object to find inside the container
731  * @return: pointer to the object (NULL if not found)
732  */
733 
734  return fHistos->FindObject(name);
735 }
736 
737 //______________________________________________________________________________
738 TObject* AliEMCALTriggerOnlineQAPbPb::FindObject(const TObject* obj) const
739 {
740  /*
741  * Find and object inside the container.
742  *
743  * @param obj: the object to find
744  * @return: pointer to the object (NULL if not found)
745  */
746  TString hname(obj->GetName());
747  return fHistos->FindObject(hname);
748 }
Double_t fMedianEMCal[3]
! Median of background patches in the EMCal
Trigger FastOR data struct.
Bool_t TestTriggerBit(UInt_t bitnumber) const
const TString kEMCalTriggerNames[6]
void CreateTH3(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, int nbinsz, double zmin, double zmax)
Int_t fMaxPatchDCal[6][3]
! DCal max ADC amplitude (0=online, 1=offline) (will be reset each event)
static const TString fgkPatchTypes[fgkNPatchTypes]
Patch type names.
Int_t fADCperBin
ADC counts per bin.
void ProcessFastor(const AliEMCALTriggerFastOR *fastor, AliVCaloCells *=0)
Int_t fDebugLevel
Debug level.
Double_t fBkgEMCal[3]
! Background in the EMCal
TObject * FindObject(const char *name) const
void FillTH3(const char *hname, double x, double y, double z, double weight=1.)
Int_t fBkgPatchType
Background patch type.
Bool_t IsPatchTypeEnabled(Int_t patchtype, Int_t triggertype) const
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
const AliEMCALTriggerBitConfig * GetTriggerBitConfig() const
Int_t fPatchAreas[6]
! Patch sizes retrieved directly during the patch processing
void FillTH2(const char *hname, double x, double y, double weight=1.)
void CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax)
TArrayI fBkgADCAmpEMCal[3]
! ADC EMCal amplitudes (0=online, 1=offline) of background patches (will be reset each event) ...
static const Int_t fgkMaxPatchAmp[fgkNTriggerTypes]
Maximum patch amplitude for the histograms.
TArrayI fBkgADCAmpDCal[3]
! ADC DCal amplitudes (0=online, 1=offline) of background patches (will be reset each event) ...
void FillTH1(const char *hname, double x, double weight=1.)
void ProcessBkgPatch(const AliEMCALTriggerPatchInfo *patch)
void FillTProfile(const char *name, double x, double y, double weight=1.)
Double_t fMedianDCal[3]
! Median of background patches in the DCal
THashList * fHistos
! Histograms for QA
Int_t fMaxPatchEMCal[6][3]
! EMCal max ADC amplitude (0=online, 1=offline) (will be reset each event)
Main data structure storing all relevant information of EMCAL/DCAL trigger patches.
Class to generate EMCal trigger QA plots.
void CreateTProfile(const char *name, const char *title, int nbins, double xmin, double xmax)
Int_t fFastorL1Th
FastOR L1 threshold.
void ProcessPatch(const AliEMCALTriggerPatchInfo *patch)
Int_t fFastorL0Th
FastOR L0 threshold.
Class to make array of trigger patch objects in AOD/ESD events.
Double_t fBkgDCal[3]
! Background in the DCal
Int_t fNBkgPatchesEMCal[3]
! Number of processed background patches (will be reset each event)
void CreateTH2(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax)
void EnablePatchType(PatchTypes_t patchtype, EMCalTriggerType_t triggertype, Bool_t e)
Int_t fNBkgPatchesDCal[3]
! Number of processed background patches (will be reset each event)