AliRoot Core  a565103 (a565103)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliEMCALTriggerOnlineQAPP.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 
18 #include <TH1F.h>
19 #include <TH2F.h>
20 
22 #include "AliEMCALTriggerFastOR.h"
23 #include "AliLog.h"
24 #include "AliEMCALGeometry.h"
25 #include "AliVCaloCells.h"
28 
32 
36  fL0MinTime(7),
37  fL0MaxTime(10),
38  fMinCellAmp(0.),
39  fMinL0FastORAmp(0),
40  fMinL1FastORAmp(0),
41  fHistograms(),
42  fHistEvents(0),
43  fHistFastORL0(0),
44  fHistFastORL0LargeAmp(0),
45  fHistFastORL0Amp(0),
46  fHistFastORL0Time(0),
47  fHistFastORL1(0),
48  fHistFastORL1LargeAmp(0),
49  fHistFastORL1Amp(0)
50 {
51  for (Int_t itrigger = 0; itrigger < fgkNTriggerTypes; itrigger++) {
52  for (Int_t ipatch = 0; ipatch < fgkNPatchTypes; ipatch++) {
53  fMaxPatchEMCal[itrigger][ipatch] = new AliEMCALTriggerPatchInfo;
54  fMaxPatchDCal[itrigger][ipatch] = new AliEMCALTriggerPatchInfo;
55 
56  fHistMaxEdgePos[itrigger][ipatch] = 0;
57  fHistAmpEdgePos[itrigger][ipatch] = 0;
58  }
59  }
60 
66 
70 
74 }
75 
80  AliEMCALTriggerQA(name),
81  fL0MinTime(7),
82  fL0MaxTime(10),
83  fMinCellAmp(0.),
84  fMinL0FastORAmp(0),
85  fMinL1FastORAmp(0),
86  fHistograms(),
87  fHistEvents(0),
88  fHistFastORL0(0),
89  fHistFastORL0LargeAmp(0),
90  fHistFastORL0Amp(0),
91  fHistFastORL0Time(0),
92  fHistFastORL1(0),
93  fHistFastORL1LargeAmp(0),
94  fHistFastORL1Amp(0)
95 {
96  fHistograms.SetName(name);
97 
98  for (Int_t itrigger = 0; itrigger < fgkNTriggerTypes; itrigger++) {
99  for (Int_t ipatch = 0; ipatch < fgkNPatchTypes; ipatch++) {
100  fMaxPatchEMCal[itrigger][ipatch] = new AliEMCALTriggerPatchInfo;
101  fMaxPatchDCal[itrigger][ipatch] = new AliEMCALTriggerPatchInfo;
102 
103  fHistMaxEdgePos[itrigger][ipatch] = 0;
104  fHistAmpEdgePos[itrigger][ipatch] = 0;
105  }
106  }
107 
113 
117 
121 }
122 
127  AliEMCALTriggerQA(triggerQA),
128  fL0MinTime(triggerQA.fL0MinTime),
129  fL0MaxTime(triggerQA.fL0MaxTime),
130  fMinCellAmp(triggerQA.fMinCellAmp),
131  fMinL0FastORAmp(triggerQA.fMinL0FastORAmp),
132  fMinL1FastORAmp(triggerQA.fMinL1FastORAmp),
133  fHistograms(),
134  fHistEvents(0),
135  fHistFastORL0(0),
136  fHistFastORL0LargeAmp(0),
137  fHistFastORL0Amp(0),
138  fHistFastORL0Time(0),
139  fHistFastORL1(0),
140  fHistFastORL1LargeAmp(0),
141  fHistFastORL1Amp(0)
142 {
143  fHistograms.SetName(triggerQA.GetName());
144 
145  for (Int_t itrigger = 0; itrigger < fgkNTriggerTypes; itrigger++) {
146 
147  for (Int_t ipatch = 0; ipatch < fgkNPatchTypes; ipatch++) {
148  fMaxPatchEMCal[itrigger][ipatch] = new AliEMCALTriggerPatchInfo;
149  fMaxPatchDCal[itrigger][ipatch] = new AliEMCALTriggerPatchInfo;
150 
151  fHistMaxEdgePos[itrigger][ipatch] = 0;
152  fHistAmpEdgePos[itrigger][ipatch] = 0;
153  }
154  }
155 }
156 
159 {
160  for (Int_t itrigger = 0; itrigger < fgkNTriggerTypes; itrigger++) {
161  for (Int_t ipatch = 0; ipatch < fgkNPatchTypes; ipatch++) {
162  if (fMaxPatchEMCal[itrigger][ipatch]) delete fMaxPatchEMCal[itrigger][ipatch];
163  if (fMaxPatchDCal[itrigger][ipatch]) delete fMaxPatchDCal[itrigger][ipatch];
164  }
165  }
166 }
167 
170 {
171  TString hname;
172  TString htitle;
173 
174  hname = "EMCTRQA_histEvents";
175  htitle = "events;;total events";
176  fHistEvents = new TH1F(hname, htitle, 1, 0, 1);
178 
179  hname = "EMCTRQA_histFastORL0";
180  htitle = "L0;FastOR abs. ID;entries above 0";
181  fHistFastORL0 = new TH1F(hname, htitle, 5000, 0, 5000);
183 
184  hname = "EMCTRQA_histFastORL0LargeAmp";
185  htitle = TString::Format("L0 (amp>%d);FastOR abs. ID;entries above %d", fFastorL0Th, fFastorL0Th);
186  fHistFastORL0LargeAmp = new TH1F(hname, htitle, 5000, 0, 5000);
188 
189  hname = "EMCTRQA_histFastORL0Amp";
190  htitle = "L0 amplitudes;col;row;amplitude";
191  fHistFastORL0Amp = new TH2F(hname, htitle, 48, 0, 48, 104, 0, 104);
193 
194  hname = "EMCTRQA_histFastORL0Time";
195  htitle = "L0 trigger time;FastOR abs. ID;L0 trigger time";
196  fHistFastORL0Time = new TH2F(hname, htitle, 5000, 0, 5000, 20, 0, 20);
198 
199  hname = "EMCTRQA_histFastORL1";
200  htitle = "L1;FastOR abs. ID;entries above 0";
201  fHistFastORL1 = new TH1F(hname, htitle, 5000, 0, 5000);
203 
204  hname = "EMCTRQA_histFastORL1LargeAmp";
205  htitle = TString::Format("L1 (amp>%d);FastOR abs. ID;entries above %d", fFastorL1Th, fFastorL1Th);
206  fHistFastORL1LargeAmp = new TH1F(hname, htitle, 5000, 0, 5000);
208 
209  hname = "EMCTRQA_histFastORL1Amp";
210  htitle = "L1 amplitudes;col;row;amplitude";
211  fHistFastORL1Amp = new TH2F(hname, htitle, 48, 0, 48, 104, 0, 104);
213 
214  Int_t nSM = fgkSM;
215  if (fGeom) nSM = fGeom->GetNumberOfSuperModules();
216 
217  const char* det[fgkNDet] = { "EMCal", "DCal" };
218 
219  for (Int_t itrig = 0; itrig < fgkNTriggerTypes; itrig++) {
220  for (Int_t ipatch = 0; ipatch < fgkNPatchTypes; ipatch++) {
221  if (!IsPatchTypeEnabled(ipatch, itrig)) continue;
222 
223  hname = TString::Format("EMCTRQA_histMaxEdgePos%s%s", EMCALTrigger::kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[ipatch].Data());
224  htitle = TString::Format("Edge Position Max %s patch %s;col;row;entries", EMCALTrigger::kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[ipatch].Data());
225  fHistMaxEdgePos[itrig][ipatch] = new TH2F(hname, htitle, 48, 0, 48, 104, 0, 104);
226  fHistograms.Add(fHistMaxEdgePos[itrig][ipatch]);
227 
228  hname = TString::Format("EMCTRQA_histAmpEdgePos%s%s", EMCALTrigger::kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[ipatch].Data());
229  htitle = TString::Format("Integrated amplitude %s patch %s;col;row;entries", EMCALTrigger::kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[ipatch].Data());
230  fHistAmpEdgePos[itrig][ipatch] = new TH2F(hname, htitle, 48, 0, 48, 104, 0, 104);
231  fHistograms.Add(fHistAmpEdgePos[itrig][ipatch]);
232  }
233  }
234 }
235 
241 {
242  Bool_t (AliEMCALTriggerPatchInfo::* triggerCheck[3][6])(void) const = {
249  },
256  },
263  }
264  };
265 
266  if (fDebugLevel >= 2) {
267  Printf("Processing patch -> global pos = (%d, %d); Amp (online) = %d; Amp (offline) = %d; \n",
268  patch->GetRowStart(), patch->GetColStart(), patch->GetADCAmp(), patch->GetADCOfflineAmp());
269  }
270 
271  for (Int_t itrig = 0; itrig < fgkNTriggerTypes; itrig++) {
272  for (Int_t ipatch = 0; ipatch < fgkNPatchTypes; ipatch++) {
273  if (!IsPatchTypeEnabled(ipatch, itrig)) continue;
274  if (!(patch->*(triggerCheck[ipatch][itrig]))()) continue;
275 
276  Int_t amp = GetAmplitude(patch, ipatch);
277  Int_t idet = 0;
278  if (patch->IsEMCal()) {
279  idet = 0;
280  if (GetAmplitude(fMaxPatchEMCal[itrig][ipatch], ipatch) < amp) {
281  *(fMaxPatchEMCal[itrig][ipatch]) = *patch;
282  }
283  }
284  else if (patch->IsDCalPHOS()) {
285  idet = 1;
286  if (GetAmplitude(fMaxPatchDCal[itrig][ipatch], ipatch) < amp) {
287  *(fMaxPatchDCal[itrig][ipatch]) = *patch;
288  }
289  }
290  else {
291  AliWarning(Form("Patch is not EMCal nor DCal/PHOS (pos: %d, %d)", patch->GetRowStart(), patch->GetColStart()));
292  }
293 
294  fHistAmpEdgePos[itrig][ipatch]->Fill(patch->GetColStart(), patch->GetRowStart(), amp);
295  }
296  }
297 }
298 
303 void AliEMCALTriggerOnlineQAPP::ProcessFastor(const AliEMCALTriggerFastOR* fastor, AliVCaloCells* /*cells*/)
304 {
305  UInt_t L0amp = fastor->GetL0Amp();
306  UInt_t L1amp = fastor->GetL1Amp();
307 
308  if (L0amp > fMinL0FastORAmp) {
309  fHistFastORL0->Fill(fastor->GetAbsId());
310  if (L0amp > fFastorL0Th) fHistFastORL0LargeAmp->Fill(fastor->GetAbsId());
311  fHistFastORL0Amp->Fill(fastor->GetGlobalCol(), fastor->GetGlobalRow(), L0amp);
312  fHistFastORL0Time->Fill(fastor->GetAbsId(), fastor->GetL0Time());
313  }
314 
315  if (L1amp > fMinL1FastORAmp) {
316  fHistFastORL1->Fill(fastor->GetAbsId());
317  if (L1amp > fFastorL1Th) fHistFastORL1LargeAmp->Fill(fastor->GetAbsId());
318  fHistFastORL1Amp->Fill(fastor->GetGlobalCol(), fastor->GetGlobalRow(), L1amp);
319  }
320 
321  if (!fGeom) return;
322  // After this only instructions that require geometry
323  Int_t iSM = -1;
324  Int_t iEta = -1;
325  Int_t iPhi = -1;
326  fGeom->GetPositionInSMFromAbsFastORIndex(fastor->GetAbsId(), iSM, iEta, iPhi);
327  Bool_t isDCal = fGeom->IsDCALSM(iSM);
328 }
329 
334 {
335  fHistEvents->Fill(0);
336 
337  enum {kEMCAL=0,kDCAL=1};
338  for (Int_t itrig = 0; itrig < fgkNTriggerTypes; itrig++) {
339  for (Int_t ipatch = 0; ipatch < fgkNPatchTypes; ipatch++) {
340  if (!IsPatchTypeEnabled(ipatch, itrig)) continue;
341 
342  if (fMaxPatchEMCal[itrig][ipatch]->GetColStart() >= 0) {
343  fHistMaxEdgePos[itrig][ipatch]->Fill(fMaxPatchEMCal[itrig][ipatch]->GetColStart(),
344  fMaxPatchEMCal[itrig][ipatch]->GetRowStart());
345  }
346 
347  if (fMaxPatchDCal[itrig][ipatch]->GetColStart() >= 0) {
348  fHistMaxEdgePos[itrig][ipatch]->Fill(fMaxPatchDCal[itrig][ipatch]->GetColStart(),
349  fMaxPatchDCal[itrig][ipatch]->GetRowStart());
350  }
351 
352  fMaxPatchEMCal[itrig][ipatch]->Reset();
353  fMaxPatchDCal[itrig][ipatch]->Reset();
354  }
355  }
356 }
Trigger FastOR data struct.
Class to generate EMCal trigger QA plots in pp collisions.
const TString kEMCalTriggerNames[6]
TH2 * fHistFastORL0Time
! Time spectra of each FastOR L0 channel
void Init()
Initialize the class, i.e. allocate histograms.
static const TString fgkPatchTypes[fgkNPatchTypes]
Patch type names.
static Int_t GetAmplitude(const AliEMCALTriggerPatchInfo *patch, Int_t itype)
virtual ~AliEMCALTriggerOnlineQAPP()
Destructor.
Int_t fDebugLevel
Debug level.
AliEMCALTriggerPatchInfo * fMaxPatchEMCal[fgkNTriggerTypes][fgkNPatchTypes]
! EMCal max patch (will be reset each event)
TH1 * fHistFastORL0LargeAmp
! Counter of FastOR L0 signal above some large amplitude
void ProcessFastor(const AliEMCALTriggerFastOR *fastor, AliVCaloCells *cells=0)
TH1 * fHistFastORL0
! Counter of FastOR L0 signal above zero
AliEMCALTriggerOnlineQAPP()
Dummy constructor for ROOT I/O.
Bool_t IsPatchTypeEnabled(Int_t patchtype, Int_t triggertype) const
TH1 * fHistEvents
! Total number of events
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
void ProcessPatch(const AliEMCALTriggerPatchInfo *patch)
static const Int_t fgkSM
Int_t fMinL0FastORAmp
Minimum L0 amplitude of the FastORs.
TH2 * fHistFastORL0Amp
! Integrated amplitude of each FastOR L0 channel
static const Int_t fgkNDet
TH1 * fHistFastORL1
! Counter of FastOR L1 signal above zero
TH2 * fHistFastORL1Amp
! Integrated amplitude of each FastOR L1 channel
UChar_t GetGlobalRow() const
Main data structure storing all relevant information of EMCAL/DCAL trigger patches.
Class to generate EMCal trigger QA plots.
static const Int_t fgkNPatchTypes
UChar_t GetGlobalCol() const
TH1 * fHistFastORL1LargeAmp
! Counter of FastOR L1 signal above some large amplitude
Int_t fFastorL1Th
FastOR L1 threshold.
Int_t fFastorL0Th
FastOR L0 threshold.
Class to make array of trigger patch objects in AOD/ESD events.
static const Int_t fgkNTriggerTypes
TH2 * fHistMaxEdgePos[fgkNTriggerTypes][fgkNPatchTypes]
! Position of the maximum patch
AliEMCALTriggerPatchInfo * fMaxPatchDCal[fgkNTriggerTypes][fgkNPatchTypes]
! DCal max patch (will be reset each event)
const AliEMCALGeometry * fGeom
! Pointer to the EMCal geometry
void EnablePatchType(PatchTypes_t patchtype, EMCalTriggerType_t triggertype, Bool_t e)
TH2 * fHistAmpEdgePos[fgkNTriggerTypes][fgkNPatchTypes]
! Integrated amplitude of all patches (edge position)
Int_t fMinL1FastORAmp
Minimum L1 amplitude of the FastORs.
TList fHistograms
! List of histograms