Line data Source code
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 :
21 : #include "AliEMCALTriggerPatchInfo.h"
22 : #include "AliEMCALTriggerFastOR.h"
23 : #include "AliLog.h"
24 : #include "AliEMCALGeometry.h"
25 : #include "AliVCaloCells.h"
26 : #include "AliEMCALTriggerConstants.h"
27 : #include "AliEMCALTriggerOnlineQAPP.h"
28 :
29 : /// \cond CLASSIMP
30 22 : ClassImp(AliEMCALTriggerOnlineQAPP);
31 : /// \endcond
32 :
33 : /// Dummy constructor for ROOT I/O
34 : AliEMCALTriggerOnlineQAPP::AliEMCALTriggerOnlineQAPP():
35 0 : AliEMCALTriggerQA(),
36 0 : fL0MinTime(7),
37 0 : fL0MaxTime(10),
38 0 : fMinCellAmp(0.),
39 0 : fMinL0FastORAmp(0),
40 0 : fMinL1FastORAmp(0),
41 0 : fHistograms(),
42 99 : fHistEvents(0),
43 0 : fHistFastORL0(0),
44 0 : fHistFastORL0LargeAmp(0),
45 0 : fHistFastORL0Amp(0),
46 0 : fHistFastORL0Time(0),
47 0 : fHistFastORL1(0),
48 0 : fHistFastORL1LargeAmp(0),
49 0 : fHistFastORL1Amp(0)
50 0 : {
51 0 : for (Int_t itrigger = 0; itrigger < fgkNTriggerTypes; itrigger++) {
52 0 : for (Int_t ipatch = 0; ipatch < fgkNPatchTypes; ipatch++) {
53 0 : fMaxPatchEMCal[itrigger][ipatch] = new AliEMCALTriggerPatchInfo;
54 0 : fMaxPatchDCal[itrigger][ipatch] = new AliEMCALTriggerPatchInfo;
55 :
56 0 : fHistMaxEdgePos[itrigger][ipatch] = 0;
57 0 : fHistAmpEdgePos[itrigger][ipatch] = 0;
58 : }
59 : }
60 :
61 0 : EnablePatchType(kOnlinePatch, EMCALTrigger::kTMEMCalLevel0, kTRUE);
62 0 : EnablePatchType(kOnlinePatch, EMCALTrigger::kTMEMCalGammaL, kTRUE);
63 0 : EnablePatchType(kOnlinePatch, EMCALTrigger::kTMEMCalGammaH, kTRUE);
64 0 : EnablePatchType(kOnlinePatch, EMCALTrigger::kTMEMCalJetL, kTRUE);
65 0 : EnablePatchType(kOnlinePatch, EMCALTrigger::kTMEMCalJetH, kTRUE);
66 :
67 0 : EnablePatchType(kRecalcPatch, EMCALTrigger::kTMEMCalLevel0, kTRUE);
68 0 : EnablePatchType(kRecalcPatch, EMCALTrigger::kTMEMCalGammaH, kTRUE);
69 0 : EnablePatchType(kRecalcPatch, EMCALTrigger::kTMEMCalJetH, kTRUE);
70 :
71 0 : EnablePatchType(kOfflinePatch, EMCALTrigger::kTMEMCalLevel0, kTRUE);
72 0 : EnablePatchType(kOfflinePatch, EMCALTrigger::kTMEMCalGammaH, kTRUE);
73 0 : EnablePatchType(kOfflinePatch, EMCALTrigger::kTMEMCalJetH, kTRUE);
74 0 : }
75 :
76 : /// Default constructor
77 : ///
78 : /// \param name Name of the object
79 : AliEMCALTriggerOnlineQAPP::AliEMCALTriggerOnlineQAPP(const char* name):
80 0 : AliEMCALTriggerQA(name),
81 0 : fL0MinTime(7),
82 0 : fL0MaxTime(10),
83 0 : fMinCellAmp(0.),
84 0 : fMinL0FastORAmp(0),
85 0 : fMinL1FastORAmp(0),
86 0 : fHistograms(),
87 0 : fHistEvents(0),
88 0 : fHistFastORL0(0),
89 0 : fHistFastORL0LargeAmp(0),
90 0 : fHistFastORL0Amp(0),
91 0 : fHistFastORL0Time(0),
92 0 : fHistFastORL1(0),
93 0 : fHistFastORL1LargeAmp(0),
94 0 : fHistFastORL1Amp(0)
95 0 : {
96 0 : fHistograms.SetName(name);
97 :
98 0 : for (Int_t itrigger = 0; itrigger < fgkNTriggerTypes; itrigger++) {
99 0 : for (Int_t ipatch = 0; ipatch < fgkNPatchTypes; ipatch++) {
100 0 : fMaxPatchEMCal[itrigger][ipatch] = new AliEMCALTriggerPatchInfo;
101 0 : fMaxPatchDCal[itrigger][ipatch] = new AliEMCALTriggerPatchInfo;
102 :
103 0 : fHistMaxEdgePos[itrigger][ipatch] = 0;
104 0 : fHistAmpEdgePos[itrigger][ipatch] = 0;
105 : }
106 : }
107 :
108 0 : EnablePatchType(kOnlinePatch, EMCALTrigger::kTMEMCalLevel0, kTRUE);
109 0 : EnablePatchType(kOnlinePatch, EMCALTrigger::kTMEMCalGammaL, kTRUE);
110 0 : EnablePatchType(kOnlinePatch, EMCALTrigger::kTMEMCalGammaH, kTRUE);
111 0 : EnablePatchType(kOnlinePatch, EMCALTrigger::kTMEMCalJetL, kTRUE);
112 0 : EnablePatchType(kOnlinePatch, EMCALTrigger::kTMEMCalJetH, kTRUE);
113 :
114 0 : EnablePatchType(kRecalcPatch, EMCALTrigger::kTMEMCalLevel0, kTRUE);
115 0 : EnablePatchType(kRecalcPatch, EMCALTrigger::kTMEMCalGammaH, kTRUE);
116 0 : EnablePatchType(kRecalcPatch, EMCALTrigger::kTMEMCalJetH, kTRUE);
117 :
118 0 : EnablePatchType(kOfflinePatch, EMCALTrigger::kTMEMCalLevel0, kTRUE);
119 0 : EnablePatchType(kOfflinePatch, EMCALTrigger::kTMEMCalGammaH, kTRUE);
120 0 : EnablePatchType(kOfflinePatch, EMCALTrigger::kTMEMCalJetH, kTRUE);
121 0 : }
122 :
123 : /// Copy constructor
124 : ///
125 : /// \param triggerQA Reference to an object to copy from
126 : AliEMCALTriggerOnlineQAPP::AliEMCALTriggerOnlineQAPP(const AliEMCALTriggerOnlineQAPP& triggerQA) :
127 0 : AliEMCALTriggerQA(triggerQA),
128 0 : fL0MinTime(triggerQA.fL0MinTime),
129 0 : fL0MaxTime(triggerQA.fL0MaxTime),
130 0 : fMinCellAmp(triggerQA.fMinCellAmp),
131 0 : fMinL0FastORAmp(triggerQA.fMinL0FastORAmp),
132 0 : fMinL1FastORAmp(triggerQA.fMinL1FastORAmp),
133 0 : fHistograms(),
134 0 : fHistEvents(0),
135 0 : fHistFastORL0(0),
136 0 : fHistFastORL0LargeAmp(0),
137 0 : fHistFastORL0Amp(0),
138 0 : fHistFastORL0Time(0),
139 0 : fHistFastORL1(0),
140 0 : fHistFastORL1LargeAmp(0),
141 0 : fHistFastORL1Amp(0)
142 0 : {
143 0 : fHistograms.SetName(triggerQA.GetName());
144 :
145 0 : for (Int_t itrigger = 0; itrigger < fgkNTriggerTypes; itrigger++) {
146 :
147 0 : for (Int_t ipatch = 0; ipatch < fgkNPatchTypes; ipatch++) {
148 0 : fMaxPatchEMCal[itrigger][ipatch] = new AliEMCALTriggerPatchInfo;
149 0 : fMaxPatchDCal[itrigger][ipatch] = new AliEMCALTriggerPatchInfo;
150 :
151 0 : fHistMaxEdgePos[itrigger][ipatch] = 0;
152 0 : fHistAmpEdgePos[itrigger][ipatch] = 0;
153 : }
154 : }
155 0 : }
156 :
157 : /// Destructor
158 : AliEMCALTriggerOnlineQAPP::~AliEMCALTriggerOnlineQAPP()
159 0 : {
160 0 : for (Int_t itrigger = 0; itrigger < fgkNTriggerTypes; itrigger++) {
161 0 : for (Int_t ipatch = 0; ipatch < fgkNPatchTypes; ipatch++) {
162 0 : if (fMaxPatchEMCal[itrigger][ipatch]) delete fMaxPatchEMCal[itrigger][ipatch];
163 0 : if (fMaxPatchDCal[itrigger][ipatch]) delete fMaxPatchDCal[itrigger][ipatch];
164 : }
165 : }
166 0 : }
167 :
168 : /// Initialize the class, i.e. allocate histograms.
169 : void AliEMCALTriggerOnlineQAPP::Init()
170 : {
171 0 : TString hname;
172 0 : TString htitle;
173 :
174 0 : hname = "EMCTRQA_histEvents";
175 0 : htitle = "events;;total events";
176 0 : fHistEvents = new TH1F(hname, htitle, 1, 0, 1);
177 0 : fHistograms.Add(fHistEvents);
178 :
179 0 : hname = "EMCTRQA_histFastORL0";
180 0 : htitle = "L0;FastOR abs. ID;entries above 0";
181 0 : fHistFastORL0 = new TH1F(hname, htitle, 5000, 0, 5000);
182 0 : fHistograms.Add(fHistFastORL0);
183 :
184 0 : hname = "EMCTRQA_histFastORL0LargeAmp";
185 0 : htitle = TString::Format("L0 (amp>%d);FastOR abs. ID;entries above %d", fFastorL0Th, fFastorL0Th);
186 0 : fHistFastORL0LargeAmp = new TH1F(hname, htitle, 5000, 0, 5000);
187 0 : fHistograms.Add(fHistFastORL0LargeAmp);
188 :
189 0 : hname = "EMCTRQA_histFastORL0Amp";
190 0 : htitle = "L0 amplitudes;col;row;amplitude";
191 0 : fHistFastORL0Amp = new TH2F(hname, htitle, 48, 0, 48, 104, 0, 104);
192 0 : fHistograms.Add(fHistFastORL0Amp);
193 :
194 0 : hname = "EMCTRQA_histFastORL0Time";
195 0 : htitle = "L0 trigger time;FastOR abs. ID;L0 trigger time";
196 0 : fHistFastORL0Time = new TH2F(hname, htitle, 5000, 0, 5000, 20, 0, 20);
197 0 : fHistograms.Add(fHistFastORL0Time);
198 :
199 0 : hname = "EMCTRQA_histFastORL1";
200 0 : htitle = "L1;FastOR abs. ID;entries above 0";
201 0 : fHistFastORL1 = new TH1F(hname, htitle, 5000, 0, 5000);
202 0 : fHistograms.Add(fHistFastORL1);
203 :
204 0 : hname = "EMCTRQA_histFastORL1LargeAmp";
205 0 : htitle = TString::Format("L1 (amp>%d);FastOR abs. ID;entries above %d", fFastorL1Th, fFastorL1Th);
206 0 : fHistFastORL1LargeAmp = new TH1F(hname, htitle, 5000, 0, 5000);
207 0 : fHistograms.Add(fHistFastORL1LargeAmp);
208 :
209 0 : hname = "EMCTRQA_histFastORL1Amp";
210 0 : htitle = "L1 amplitudes;col;row;amplitude";
211 0 : fHistFastORL1Amp = new TH2F(hname, htitle, 48, 0, 48, 104, 0, 104);
212 0 : fHistograms.Add(fHistFastORL1Amp);
213 :
214 : Int_t nSM = fgkSM;
215 0 : if (fGeom) nSM = fGeom->GetNumberOfSuperModules();
216 :
217 0 : const char* det[fgkNDet] = { "EMCal", "DCal" };
218 :
219 0 : for (Int_t itrig = 0; itrig < fgkNTriggerTypes; itrig++) {
220 0 : for (Int_t ipatch = 0; ipatch < fgkNPatchTypes; ipatch++) {
221 0 : if (!IsPatchTypeEnabled(ipatch, itrig)) continue;
222 :
223 0 : hname = TString::Format("EMCTRQA_histMaxEdgePos%s%s", EMCALTrigger::kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[ipatch].Data());
224 0 : htitle = TString::Format("Edge Position Max %s patch %s;col;row;entries", EMCALTrigger::kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[ipatch].Data());
225 0 : fHistMaxEdgePos[itrig][ipatch] = new TH2F(hname, htitle, 48, 0, 48, 104, 0, 104);
226 0 : fHistograms.Add(fHistMaxEdgePos[itrig][ipatch]);
227 :
228 0 : hname = TString::Format("EMCTRQA_histAmpEdgePos%s%s", EMCALTrigger::kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[ipatch].Data());
229 0 : htitle = TString::Format("Integrated amplitude %s patch %s;col;row;entries", EMCALTrigger::kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[ipatch].Data());
230 0 : fHistAmpEdgePos[itrig][ipatch] = new TH2F(hname, htitle, 48, 0, 48, 104, 0, 104);
231 0 : fHistograms.Add(fHistAmpEdgePos[itrig][ipatch]);
232 : }
233 : }
234 0 : }
235 :
236 : /**
237 : * Process a patch, filling relevant histograms.
238 : * \param patch Pointer to a valid trigger patch
239 : */
240 : void AliEMCALTriggerOnlineQAPP::ProcessPatch(const AliEMCALTriggerPatchInfo* patch)
241 : {
242 0 : Bool_t (AliEMCALTriggerPatchInfo::* triggerCheck[3][6])(void) const = {
243 : { &AliEMCALTriggerPatchInfo::IsLevel0,
244 : &AliEMCALTriggerPatchInfo::IsGammaLow,
245 : &AliEMCALTriggerPatchInfo::IsGammaHigh,
246 : &AliEMCALTriggerPatchInfo::IsJetLow,
247 : &AliEMCALTriggerPatchInfo::IsJetHigh,
248 : &AliEMCALTriggerPatchInfo::IsBkg
249 : },
250 : { &AliEMCALTriggerPatchInfo::IsLevel0Recalc,
251 : &AliEMCALTriggerPatchInfo::IsGammaLowRecalc,
252 : &AliEMCALTriggerPatchInfo::IsGammaHighRecalc,
253 : &AliEMCALTriggerPatchInfo::IsJetLowRecalc,
254 : &AliEMCALTriggerPatchInfo::IsJetHighRecalc,
255 : &AliEMCALTriggerPatchInfo::IsBkgRecalc
256 : },
257 : { &AliEMCALTriggerPatchInfo::IsLevel0Simple,
258 : &AliEMCALTriggerPatchInfo::IsGammaLowSimple,
259 : &AliEMCALTriggerPatchInfo::IsGammaHighSimple,
260 : &AliEMCALTriggerPatchInfo::IsJetLowSimple,
261 : &AliEMCALTriggerPatchInfo::IsJetHighSimple,
262 : &AliEMCALTriggerPatchInfo::IsBkgSimple
263 : }
264 : };
265 :
266 0 : if (fDebugLevel >= 2) {
267 0 : Printf("Processing patch -> global pos = (%d, %d); Amp (online) = %d; Amp (offline) = %d; \n",
268 0 : patch->GetRowStart(), patch->GetColStart(), patch->GetADCAmp(), patch->GetADCOfflineAmp());
269 0 : }
270 :
271 0 : for (Int_t itrig = 0; itrig < fgkNTriggerTypes; itrig++) {
272 0 : for (Int_t ipatch = 0; ipatch < fgkNPatchTypes; ipatch++) {
273 0 : if (!IsPatchTypeEnabled(ipatch, itrig)) continue;
274 0 : if (!(patch->*(triggerCheck[ipatch][itrig]))()) continue;
275 :
276 0 : Int_t amp = GetAmplitude(patch, ipatch);
277 : Int_t idet = 0;
278 0 : if (patch->IsEMCal()) {
279 : idet = 0;
280 0 : if (GetAmplitude(fMaxPatchEMCal[itrig][ipatch], ipatch) < amp) {
281 0 : *(fMaxPatchEMCal[itrig][ipatch]) = *patch;
282 0 : }
283 : }
284 0 : else if (patch->IsDCalPHOS()) {
285 : idet = 1;
286 0 : if (GetAmplitude(fMaxPatchDCal[itrig][ipatch], ipatch) < amp) {
287 0 : *(fMaxPatchDCal[itrig][ipatch]) = *patch;
288 0 : }
289 : }
290 : else {
291 0 : AliWarning(Form("Patch is not EMCal nor DCal/PHOS (pos: %d, %d)", patch->GetRowStart(), patch->GetColStart()));
292 : }
293 :
294 0 : fHistAmpEdgePos[itrig][ipatch]->Fill(patch->GetColStart(), patch->GetRowStart(), amp);
295 0 : }
296 : }
297 0 : }
298 :
299 : /**
300 : * Process a FastOR, filling relevant histograms.
301 : * \param patch Pointer to a valid trigger FastOR
302 : */
303 : void AliEMCALTriggerOnlineQAPP::ProcessFastor(const AliEMCALTriggerFastOR* fastor, AliVCaloCells* /*cells*/)
304 : {
305 0 : UInt_t L0amp = fastor->GetL0Amp();
306 0 : UInt_t L1amp = fastor->GetL1Amp();
307 :
308 0 : if (L0amp > fMinL0FastORAmp) {
309 0 : fHistFastORL0->Fill(fastor->GetAbsId());
310 0 : if (L0amp > fFastorL0Th) fHistFastORL0LargeAmp->Fill(fastor->GetAbsId());
311 0 : fHistFastORL0Amp->Fill(fastor->GetGlobalCol(), fastor->GetGlobalRow(), L0amp);
312 0 : fHistFastORL0Time->Fill(fastor->GetAbsId(), fastor->GetL0Time());
313 0 : }
314 :
315 0 : if (L1amp > fMinL1FastORAmp) {
316 0 : fHistFastORL1->Fill(fastor->GetAbsId());
317 0 : if (L1amp > fFastorL1Th) fHistFastORL1LargeAmp->Fill(fastor->GetAbsId());
318 0 : fHistFastORL1Amp->Fill(fastor->GetGlobalCol(), fastor->GetGlobalRow(), L1amp);
319 0 : }
320 :
321 0 : if (!fGeom) return;
322 : // After this only instructions that require geometry
323 0 : Int_t iSM = -1;
324 0 : Int_t iEta = -1;
325 0 : Int_t iPhi = -1;
326 0 : fGeom->GetPositionInSMFromAbsFastORIndex(fastor->GetAbsId(), iSM, iEta, iPhi);
327 0 : Bool_t isDCal = fGeom->IsDCALSM(iSM);
328 0 : }
329 :
330 : /**
331 : * This method should be called at the end of each event.
332 : */
333 : void AliEMCALTriggerOnlineQAPP::EventCompleted()
334 : {
335 0 : fHistEvents->Fill(0);
336 :
337 : enum {kEMCAL=0,kDCAL=1};
338 0 : for (Int_t itrig = 0; itrig < fgkNTriggerTypes; itrig++) {
339 0 : for (Int_t ipatch = 0; ipatch < fgkNPatchTypes; ipatch++) {
340 0 : if (!IsPatchTypeEnabled(ipatch, itrig)) continue;
341 :
342 0 : if (fMaxPatchEMCal[itrig][ipatch]->GetColStart() >= 0) {
343 0 : fHistMaxEdgePos[itrig][ipatch]->Fill(fMaxPatchEMCal[itrig][ipatch]->GetColStart(),
344 0 : fMaxPatchEMCal[itrig][ipatch]->GetRowStart());
345 0 : }
346 :
347 0 : if (fMaxPatchDCal[itrig][ipatch]->GetColStart() >= 0) {
348 0 : fHistMaxEdgePos[itrig][ipatch]->Fill(fMaxPatchDCal[itrig][ipatch]->GetColStart(),
349 0 : fMaxPatchDCal[itrig][ipatch]->GetRowStart());
350 0 : }
351 :
352 0 : fMaxPatchEMCal[itrig][ipatch]->Reset();
353 0 : fMaxPatchDCal[itrig][ipatch]->Reset();
354 0 : }
355 : }
356 0 : }
|