Line data Source code
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 : **************************************************************************/
15 : /**
16 : * @file AliEMCALTriggerOnlineQAPbPb.cxx
17 : * @date Apr. 4, 2016
18 : * @author Salvatore Aiola <salvatore.aiola@cern.ch>, Yale University
19 : */
20 :
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 :
30 : #include "AliEMCALTriggerPatchInfo.h"
31 : #include "AliEMCALTriggerFastOR.h"
32 : #include "AliLog.h"
33 :
34 : #include "AliEMCALTriggerConstants.h"
35 :
36 : #include "AliEMCALTriggerOnlineQAPbPb.h"
37 :
38 : using namespace EMCALTrigger;
39 :
40 : /// \cond CLASSIMP
41 22 : ClassImp(AliEMCALTriggerOnlineQAPbPb)
42 99 : /// \endcond
43 :
44 : /**
45 : * Dummy constructor
46 : */
47 0 : AliEMCALTriggerOnlineQAPbPb::AliEMCALTriggerOnlineQAPbPb():
48 0 : AliEMCALTriggerQA(),
49 0 : fBkgPatchType(kTMEMCalBkg),
50 0 : fHistos(0)
51 0 : {
52 0 : for (Int_t i = 0; i < 3; i++) {
53 0 : fBkgADCAmpEMCal[i].Set(100);
54 0 : fBkgADCAmpDCal[i].Set(100);
55 0 : fNBkgPatchesEMCal[i] = 0;
56 0 : fNBkgPatchesDCal[i] = 0;
57 :
58 0 : for (Int_t itype = 0; itype < 6; itype++) {
59 0 : fMaxPatchEMCal[itype][i] = 0;
60 0 : fMaxPatchDCal[itype][i] = 0;
61 : }
62 : }
63 :
64 0 : EnablePatchType(kOnlinePatch, kTMEMCalLevel0, kTRUE);
65 0 : EnablePatchType(kOnlinePatch, kTMEMCalGammaL, kTRUE);
66 0 : EnablePatchType(kOnlinePatch, kTMEMCalGammaH, kTRUE);
67 0 : EnablePatchType(kOnlinePatch, kTMEMCalJetL, kTRUE);
68 0 : EnablePatchType(kOnlinePatch, kTMEMCalJetH, kTRUE);
69 0 : EnablePatchType(kOnlinePatch, kTMEMCalBkg, kTRUE);
70 :
71 0 : EnablePatchType(kRecalcPatch, kTMEMCalLevel0, kTRUE);
72 0 : EnablePatchType(kRecalcPatch, kTMEMCalGammaH, kTRUE);
73 0 : EnablePatchType(kRecalcPatch, kTMEMCalJetH, kTRUE);
74 0 : EnablePatchType(kRecalcPatch, kTMEMCalBkg, kTRUE);
75 :
76 0 : EnablePatchType(kOfflinePatch, kTMEMCalLevel0, kTRUE);
77 0 : EnablePatchType(kOfflinePatch, kTMEMCalGammaH, kTRUE);
78 0 : EnablePatchType(kOfflinePatch, kTMEMCalJetH, kTRUE);
79 0 : EnablePatchType(kOfflinePatch, kTMEMCalBkg, kTRUE);
80 :
81 0 : memset(fPatchAreas, 0, sizeof(Int_t)*6);
82 0 : }
83 :
84 : /**
85 : * Constructor
86 : */
87 0 : AliEMCALTriggerOnlineQAPbPb::AliEMCALTriggerOnlineQAPbPb(const char* name):
88 0 : AliEMCALTriggerQA(name),
89 0 : fBkgPatchType(kTMEMCalBkg),
90 0 : fHistos(0)
91 0 : {
92 0 : for (Int_t i = 0; i < 3; i++) {
93 0 : fBkgADCAmpEMCal[i].Set(100);
94 0 : fBkgADCAmpDCal[i].Set(100);
95 0 : fNBkgPatchesEMCal[i] = 0;
96 0 : fNBkgPatchesDCal[i] = 0;
97 :
98 0 : for (Int_t itype = 0; itype < 6; itype++) {
99 0 : fMaxPatchEMCal[itype][i] = 0;
100 0 : fMaxPatchDCal[itype][i] = 0;
101 : }
102 : }
103 :
104 0 : EnablePatchType(kOnlinePatch, kTMEMCalLevel0, kTRUE);
105 0 : EnablePatchType(kOnlinePatch, kTMEMCalGammaL, kTRUE);
106 0 : EnablePatchType(kOnlinePatch, kTMEMCalGammaH, kTRUE);
107 0 : EnablePatchType(kOnlinePatch, kTMEMCalJetL, kTRUE);
108 0 : EnablePatchType(kOnlinePatch, kTMEMCalJetH, kTRUE);
109 0 : EnablePatchType(kOnlinePatch, kTMEMCalBkg, kTRUE);
110 :
111 0 : EnablePatchType(kRecalcPatch, kTMEMCalLevel0, kTRUE);
112 0 : EnablePatchType(kRecalcPatch, kTMEMCalGammaH, kTRUE);
113 0 : EnablePatchType(kRecalcPatch, kTMEMCalJetH, kTRUE);
114 0 : EnablePatchType(kRecalcPatch, kTMEMCalBkg, kTRUE);
115 :
116 0 : EnablePatchType(kOfflinePatch, kTMEMCalLevel0, kTRUE);
117 0 : EnablePatchType(kOfflinePatch, kTMEMCalGammaH, kTRUE);
118 0 : EnablePatchType(kOfflinePatch, kTMEMCalJetH, kTRUE);
119 0 : EnablePatchType(kOfflinePatch, kTMEMCalBkg, kTRUE);
120 :
121 0 : memset(fPatchAreas, 0, sizeof(fPatchAreas));
122 0 : }
123 :
124 : /*
125 : * Copy Constructor
126 : */
127 0 : AliEMCALTriggerOnlineQAPbPb::AliEMCALTriggerOnlineQAPbPb(const AliEMCALTriggerOnlineQAPbPb& triggerQA) :
128 0 : AliEMCALTriggerQA(triggerQA),
129 0 : fBkgPatchType(triggerQA.fBkgPatchType),
130 0 : fHistos(0)
131 0 : {
132 0 : for (Int_t i = 0; i < 3; i++) {
133 0 : fBkgADCAmpEMCal[i].Set(100);
134 0 : fBkgADCAmpDCal[i].Set(100);
135 0 : fNBkgPatchesEMCal[i] = 0;
136 0 : fNBkgPatchesDCal[i] = 0;
137 :
138 0 : for (Int_t itype = 0; itype < 6; itype++) {
139 0 : fMaxPatchEMCal[itype][i] = 0;
140 0 : fMaxPatchDCal[itype][i] = 0;
141 : }
142 : }
143 :
144 0 : memset(fPatchAreas, 0, sizeof(fPatchAreas));
145 0 : }
146 :
147 : /**
148 : * Destructor
149 : */
150 : AliEMCALTriggerOnlineQAPbPb::~AliEMCALTriggerOnlineQAPbPb()
151 0 : {
152 0 : }
153 :
154 : /**
155 : * Initialize the class, i.e. allocate histograms.
156 : */
157 : void AliEMCALTriggerOnlineQAPbPb::Init()
158 : {
159 0 : TString hname;
160 0 : TString htitle;
161 :
162 0 : fHistos = new THashList();
163 0 : fHistos->SetName(Form("histos%s", GetName()));
164 0 : fHistos->SetOwner(kTRUE);
165 :
166 0 : hname = Form("EMCTRQA_histFastORL0");
167 0 : htitle = Form("EMCTRQA_histFastORL0;FastOR abs. ID;entries above 0");
168 0 : CreateTH1(hname, htitle, 5000, 0, 5000);
169 :
170 0 : hname = Form("EMCTRQA_histLargeAmpFastORL0");
171 0 : htitle = Form("EMCTRQA_histLargeAmpFastORL0 (>%d);FastOR abs. ID;entries above %d", fFastorL0Th, fFastorL0Th);
172 0 : CreateTH1(hname, htitle, 5000, 0, 5000);
173 :
174 0 : hname = Form("EMCTRQA_histFastORL0TimeOk");
175 0 : htitle = Form("EMCTRQA_histFastORL0TimeOk;FastOR abs. ID;entries (7 < time < 10)");
176 0 : CreateTH1(hname, htitle, 5000, 0, 5000);
177 :
178 0 : hname = Form("EMCTRQA_histFastORL0Mean");
179 0 : htitle = Form("EMCTRQA_histFastORL0Mean;FastOR abs. ID;mean ADC counts");
180 0 : CreateTProfile(hname, htitle, 5000, 0, 5000);
181 :
182 0 : hname = Form("EMCTRQA_histFastORL0MeanTimeOk");
183 0 : htitle = Form("EMCTRQA_histFastORL0MeanTimeOk;FastOR abs. ID;mean ADC counts (7 < time < 10)");
184 0 : CreateTProfile(hname, htitle, 5000, 0, 5000);
185 :
186 0 : hname = Form("EMCTRQA_histFastORL1");
187 0 : htitle = Form("EMCTRQA_histFastORL1;FastOR abs. ID;entries above 0");
188 0 : CreateTH1(hname, htitle, 5000, 0, 5000);
189 :
190 0 : hname = Form("EMCTRQA_histLargeAmpFastORL1");
191 0 : htitle = Form("EMCTRQA_histLargeAmpFastORL1 (>%d);FastOR abs. ID;entries above %d", fFastorL1Th, fFastorL1Th);
192 0 : CreateTH1(hname, htitle, 5000, 0, 5000);
193 :
194 0 : hname = Form("EMCTRQA_histFastORL1Mean");
195 0 : htitle = Form("EMCTRQA_histFastORL1Mean;FastOR abs. ID;mean L1 time sum");
196 0 : CreateTProfile(hname, htitle, 5000, 0, 5000);
197 :
198 0 : hname = Form("EMCTRQA_histFastORL1AmpVsL0Amp");
199 0 : htitle = Form("EMCTRQA_histFastORL1AmpVsL0Amp;L0 amplitude;L1 time sum;entries");
200 0 : CreateTH2(hname, htitle, 64, 0, 2048, 64, 0, 2048);
201 :
202 0 : for (Int_t itype = 0; itype < 3; itype++) {
203 0 : if (!IsPatchTypeEnabled(itype, EMCALTrigger::kTMEMCalBkg)) continue;
204 0 : hname = Form("EMCTRQA_histEMCalMedianVsDCalMedian%s", fgkPatchTypes[itype].Data());
205 0 : htitle = Form("EMCTRQA_histEMCalMedianVsDCalMedian%s;EMCal median;DCal median;entries", fgkPatchTypes[itype].Data());
206 0 : CreateTH2(hname, htitle, fgkMaxPatchAmp[fBkgPatchType]/fADCperBin/10, 0, fgkMaxPatchAmp[fBkgPatchType]/10, fgkMaxPatchAmp[fBkgPatchType]/fADCperBin/10, 0, fgkMaxPatchAmp[fBkgPatchType]/10);
207 : }
208 :
209 0 : const char* det[2] = { "EMCal", "DCal" };
210 :
211 0 : for (Int_t itrig = 0; itrig < 6; itrig++) {
212 0 : for (Int_t itype = 0; itype < 3; itype++) {
213 0 : if (!IsPatchTypeEnabled(itype, itrig)) continue;
214 0 : for (Int_t idet = 0; idet < 2; idet++) {
215 0 : hname = Form("EMCTRQA_hist%sPatchEnergy%s%s", det[idet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
216 0 : htitle = Form("EMCTRQA_hist%sPatchEnergy%s%s;energy (GeV);entries", det[idet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
217 0 : CreateTH1(hname, htitle, 200, 0, 200);
218 :
219 0 : hname = Form("EMCTRQA_hist%sPatchAmp%s%s", det[idet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
220 0 : htitle = Form("EMCTRQA_hist%sPatchAmp%s%s;amplitude;entries", det[idet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
221 0 : CreateTH1(hname, htitle, fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig]);
222 :
223 0 : hname = Form("EMCTRQA_hist%sPatchAmpSubtracted%s%s", det[idet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
224 0 : htitle = Form("EMCTRQA_hist%sPatchAmpSubtracted%s%s;amplitude - background * area;entries", det[idet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
225 0 : CreateTH1(hname, htitle, fgkMaxPatchAmp[itrig]/fADCperBin, -fgkMaxPatchAmp[itrig]/2, fgkMaxPatchAmp[itrig]/2);
226 :
227 0 : hname = Form("EMCTRQA_hist%sMaxPatchAmp%s%s", det[idet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
228 0 : htitle = Form("EMCTRQA_hist%sMaxPatchAmp%s%s;amplitude;entries", det[idet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
229 0 : CreateTH1(hname, htitle, fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig]);
230 :
231 0 : hname = Form("EMCTRQA_hist%sMaxPatchAmpSubtracted%s%s", det[idet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
232 0 : htitle = Form("EMCTRQA_hist%sPatchAmp%s%s;amplitude;entries", det[idet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
233 0 : CreateTH1(hname, htitle, fgkMaxPatchAmp[itrig]/fADCperBin, -fgkMaxPatchAmp[itrig]/2, fgkMaxPatchAmp[itrig]/2);
234 :
235 0 : for (Int_t jdet = 0; jdet < 2; jdet++) {
236 0 : hname = Form("EMCTRQA_hist%sMedianVs%sMax%s%s", det[idet], det[jdet], kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
237 0 : 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 0 : CreateTH2(hname, htitle, fgkMaxPatchAmp[itrig]/fADCperBin, 0, fgkMaxPatchAmp[itrig], fgkMaxPatchAmp[itrig]/fADCperBin/10, 0, fgkMaxPatchAmp[itrig]/10);
239 : }
240 : }
241 :
242 0 : hname = Form("EMCTRQA_histEMCalMaxVsDCalMax%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
243 0 : htitle = Form("EMCTRQA_histEMCalMaxVsDCalMax%s%s;EMCal max;DCal max;entries", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
244 0 : CreateTH2(hname, htitle, fgkMaxPatchAmp[itrig]/fADCperBin/4, 0, fgkMaxPatchAmp[itrig], fgkMaxPatchAmp[itrig]/fADCperBin/4, 0, fgkMaxPatchAmp[itrig]);
245 :
246 0 : hname = Form("EMCTRQA_histEdgePos%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
247 0 : htitle = Form("EMCTRQA_histEdgePos%s%s;col;row;entries", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
248 0 : 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 0 : hname = Form("EMCTRQA_histGeoPos%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
255 0 : htitle = Form("EMCTRQA_histGeoPos%s%s;#eta;#phi;entries", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
256 0 : CreateTH2(hname, htitle, 60, -1, 1, 150, 0, TMath::TwoPi());
257 :
258 0 : hname = Form("EMCTRQA_histLargeAmpEdgePos%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
259 0 : htitle = Form("EMCTRQA_histLargeAmpEdgePos%s%s (>700);col;row;entries above 700", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
260 0 : CreateTH2(hname, htitle, 48, 0, 48, 105, 0, 105);
261 : }
262 : }
263 0 : }
264 :
265 : /**
266 : * Process a patch, filling relevant histograms.
267 : * \param patch Pointer to a valid trigger patch
268 : */
269 : void AliEMCALTriggerOnlineQAPbPb::ProcessPatch(const AliEMCALTriggerPatchInfo* patch)
270 : {
271 0 : TString hname;
272 :
273 0 : Int_t triggerBits[6] = { patch->GetTriggerBitConfig()->GetLevel0Bit(),
274 0 : patch->GetTriggerBitConfig()->GetGammaLowBit(),
275 0 : patch->GetTriggerBitConfig()->GetGammaHighBit(),
276 0 : patch->GetTriggerBitConfig()->GetJetLowBit(),
277 0 : patch->GetTriggerBitConfig()->GetJetHighBit(),
278 0 : patch->GetTriggerBitConfig()->GetBkgBit()
279 : };
280 :
281 0 : Int_t offsets[3] = { 0, AliEMCALTriggerPatchInfo::kRecalcOffset, AliEMCALTriggerPatchInfo::kOfflineOffset };
282 0 : Int_t amplitudes[3] = { patch->GetADCAmp(), patch->GetADCAmp(), patch->GetADCOfflineAmp() };
283 0 : Double_t bkg[3] = {0};
284 :
285 0 : for (Int_t itrig = 0; itrig < 6; itrig++) {
286 0 : if (itrig == fBkgPatchType) continue;
287 0 : for (Int_t itype = 0; itype < 3; itype++) {
288 0 : if (!IsPatchTypeEnabled(itype, itrig)) continue;
289 :
290 0 : if (!patch->TestTriggerBit(triggerBits[itrig]+offsets[itype])) continue;
291 0 : fPatchAreas[itrig] = patch->GetPatchSize()*patch->GetPatchSize();
292 :
293 0 : TString det;
294 :
295 0 : if (patch->IsEMCal()) {
296 0 : det = "EMCal";
297 0 : if (fMaxPatchEMCal[itrig][itype] < amplitudes[itype]) fMaxPatchEMCal[itrig][itype] = amplitudes[itype];
298 0 : bkg[itype] = fBkgDCal[itype]; // use DCal background for EMCal
299 0 : }
300 0 : else if (patch->IsDCalPHOS()) {
301 0 : det = "DCal";
302 0 : if (fMaxPatchDCal[itrig][itype] < amplitudes[itype]) fMaxPatchDCal[itrig][itype] = amplitudes[itype];
303 0 : bkg[itype] = fBkgEMCal[itype]; // use EMCal background for DCal
304 0 : }
305 : else {
306 0 : AliWarning(Form("Patch is not EMCal nor DCal/PHOS (pos: %d, %d)", patch->GetRowStart(), patch->GetColStart()));
307 : }
308 :
309 0 : hname = Form("EMCTRQA_histEdgePos%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
310 0 : 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 0 : hname = Form("EMCTRQA_histGeoPos%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
316 0 : FillTH2(hname, patch->GetEtaGeo(), TVector2::Phi_0_2pi(patch->GetPhiGeo()));
317 :
318 0 : if (amplitudes[itype] > 700) {
319 0 : hname = Form("EMCTRQA_histLargeAmpEdgePos%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
320 0 : FillTH2(hname, patch->GetColStart(), patch->GetRowStart());
321 : }
322 :
323 0 : hname = Form("EMCTRQA_hist%sPatchAmp%s%s", det.Data(), kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
324 0 : FillTH1(hname, amplitudes[itype]);
325 :
326 0 : hname = Form("EMCTRQA_hist%sPatchAmpSubtracted%s%s", det.Data(), kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
327 0 : FillTH1(hname, Double_t(amplitudes[itype]) - bkg[itype] * fPatchAreas[itrig]);
328 :
329 0 : hname = Form("EMCTRQA_hist%sPatchEnergy%s%s", det.Data(), kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
330 0 : FillTH1(hname, patch->GetPatchE());
331 0 : }
332 :
333 0 : if (fDebugLevel >= 2) {
334 0 : 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 0 : kEMCalTriggerNames[itrig].Data(), patch->GetRowStart(), patch->GetColStart(), patch->GetADCAmp(), patch->GetADCOfflineAmp(), patch->GetPatchE(),
338 0 : patch->GetEtaCM(), patch->GetPhiCM(),
339 0 : patch->GetEtaGeo(), patch->GetPhiGeo());
340 : }
341 : }
342 0 : }
343 :
344 : /**
345 : * Process a patch, filling relevant histograms.
346 : * \param patch Pointer to a valid trigger patch
347 : */
348 : void AliEMCALTriggerOnlineQAPbPb::ProcessBkgPatch(const AliEMCALTriggerPatchInfo* patch)
349 : {
350 0 : TString hname;
351 :
352 0 : Int_t offsets[3] = { 0, AliEMCALTriggerPatchInfo::kRecalcOffset, AliEMCALTriggerPatchInfo::kOfflineOffset };
353 0 : Int_t amplitudes[3] = { patch->GetADCAmp(), patch->GetADCAmp(), patch->GetADCOfflineAmp() };
354 0 : Int_t bkgTriggerBit = patch->GetTriggerBitConfig()->GetBkgBit();
355 :
356 0 : for (Int_t itype = 0; itype < 3; itype++) {
357 0 : if (!IsPatchTypeEnabled(itype, EMCALTrigger::kTMEMCalBkg)) continue;
358 0 : if (!patch->TestTriggerBit(bkgTriggerBit+offsets[itype])) continue;
359 0 : fPatchAreas[bkgTriggerBit] = patch->GetPatchSize()*patch->GetPatchSize();
360 :
361 0 : TString det;
362 :
363 0 : if (patch->IsEMCal()) {
364 0 : det = "EMCal";
365 0 : if (fMaxPatchEMCal[bkgTriggerBit][itype] < amplitudes[itype]) fMaxPatchEMCal[bkgTriggerBit][itype] = amplitudes[itype];
366 :
367 0 : if (fNBkgPatchesEMCal[itype] >= fBkgADCAmpEMCal[itype].GetSize()) {
368 0 : fBkgADCAmpEMCal[itype].Set((fNBkgPatchesEMCal[itype]+1)*2);
369 : }
370 0 : fBkgADCAmpEMCal[itype].AddAt(amplitudes[itype], fNBkgPatchesEMCal[itype]);
371 0 : fNBkgPatchesEMCal[itype]++;
372 :
373 0 : }
374 0 : else if (patch->IsDCalPHOS()) {
375 0 : det = "DCal";
376 0 : if (fMaxPatchDCal[bkgTriggerBit][itype] < amplitudes[itype]) fMaxPatchDCal[bkgTriggerBit][itype] = amplitudes[itype];
377 :
378 0 : if (fNBkgPatchesDCal[itype] >= fBkgADCAmpDCal[itype].GetSize()) {
379 0 : fBkgADCAmpDCal[itype].Set((fNBkgPatchesDCal[itype]+1)*2);
380 : }
381 0 : fBkgADCAmpDCal[itype].AddAt(amplitudes[itype], fNBkgPatchesDCal[itype]);
382 0 : fNBkgPatchesDCal[itype]++;
383 0 : }
384 : else {
385 0 : AliWarning(Form("Patch is not EMCal nor DCal/PHOS (pos: %d, %d)", patch->GetRowStart(), patch->GetColStart()));
386 : }
387 :
388 0 : hname = Form("EMCTRQA_histEdgePos%s%s", kEMCalTriggerNames[bkgTriggerBit].Data(), fgkPatchTypes[itype].Data());
389 0 : 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 0 : hname = Form("EMCTRQA_histGeoPos%s%s", kEMCalTriggerNames[bkgTriggerBit].Data(), fgkPatchTypes[itype].Data());
395 0 : FillTH2(hname, patch->GetEtaGeo(), TVector2::Phi_0_2pi(patch->GetPhiGeo()));
396 :
397 0 : if (amplitudes[itype] > 700) {
398 0 : hname = Form("EMCTRQA_histLargeAmpEdgePos%s%s", kEMCalTriggerNames[bkgTriggerBit].Data(), fgkPatchTypes[itype].Data());
399 0 : FillTH2(hname, patch->GetColStart(), patch->GetRowStart());
400 : }
401 :
402 0 : hname = Form("EMCTRQA_hist%sPatchAmp%s%s", det.Data(), kEMCalTriggerNames[bkgTriggerBit].Data(), fgkPatchTypes[itype].Data());
403 0 : FillTH1(hname, amplitudes[itype]);
404 :
405 0 : hname = Form("EMCTRQA_hist%sPatchEnergy%s%s", det.Data(), kEMCalTriggerNames[bkgTriggerBit].Data(), fgkPatchTypes[itype].Data());
406 0 : FillTH1(hname, patch->GetPatchE());
407 0 : }
408 :
409 0 : if (fDebugLevel >= 2) {
410 0 : 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 0 : kEMCalTriggerNames[bkgTriggerBit].Data(), patch->GetRowStart(), patch->GetColStart(), patch->GetADCAmp(), patch->GetADCOfflineAmp(), patch->GetPatchE(),
414 0 : patch->GetEtaCM(), patch->GetPhiCM(),
415 0 : patch->GetEtaGeo(), patch->GetPhiGeo());
416 : }
417 :
418 0 : }
419 :
420 : /**
421 : * Process a FastOR, filling relevant histograms.
422 : * \param patch Pointer to a valid trigger FastOR
423 : */
424 : void AliEMCALTriggerOnlineQAPbPb::ProcessFastor(const AliEMCALTriggerFastOR* fastor, AliVCaloCells* /*cells*/)
425 : {
426 0 : TString hname;
427 :
428 0 : if (fastor->GetL0Amp() > 0) {
429 0 : hname = Form("EMCTRQA_histFastORL0");
430 0 : FillTH1(hname, fastor->GetAbsId());
431 :
432 0 : hname = Form("EMCTRQA_histFastORL0Mean");
433 0 : FillTProfile(hname, fastor->GetAbsId(), fastor->GetL0Amp());
434 :
435 0 : if (fastor->GetL0Time() < 10 && fastor->GetL0Time() > 7) {
436 0 : hname = Form("EMCTRQA_histFastORL0TimeOk");
437 0 : FillTH1(hname, fastor->GetAbsId());
438 :
439 0 : hname = Form("EMCTRQA_histFastORL0MeanTimeOk");
440 0 : FillTProfile(hname, fastor->GetAbsId(), fastor->GetL0Amp());
441 : }
442 : }
443 :
444 0 : if (fastor->GetL0Amp() > fFastorL0Th) {
445 0 : hname = Form("EMCTRQA_histLargeAmpFastORL0");
446 0 : FillTH1(hname, fastor->GetAbsId());
447 : }
448 :
449 0 : if (fastor->GetL1Amp() > fFastorL1Th) {
450 0 : hname = Form("EMCTRQA_histFastORL1");
451 0 : FillTH1(hname, fastor->GetAbsId());
452 :
453 0 : hname = Form("EMCTRQA_histFastORL1Mean");
454 0 : FillTProfile(hname, fastor->GetAbsId(), fastor->GetL1Amp());
455 :
456 0 : if (fastor->GetL1Amp() > fFastorL1Th) {
457 0 : hname = Form("EMCTRQA_histLargeAmpFastORL1");
458 0 : FillTH1(hname, fastor->GetAbsId());
459 : }
460 : }
461 :
462 0 : if (fastor->GetL1Amp() > 0 && fastor->GetL0Amp() > 0) {
463 0 : hname = Form("EMCTRQA_histFastORL1AmpVsL0Amp");
464 0 : FillTH2(hname, fastor->GetL0Amp(), fastor->GetL1Amp());
465 : }
466 0 : }
467 :
468 : /**
469 : * Computes background for the current event
470 : */
471 : void AliEMCALTriggerOnlineQAPbPb::ComputeBackground()
472 : {
473 0 : AliDebug(2, Form("Entering AliEMCALTriggerQA::ComputeBackground"));
474 :
475 0 : for (Int_t itype = 0; itype < 3; itype++) {
476 0 : if (!IsPatchTypeEnabled(itype, EMCALTrigger::kTMEMCalBkg)) continue;
477 :
478 0 : AliDebug(2, Form("Patch type %s", fgkPatchTypes[itype].Data()));
479 :
480 0 : fMedianEMCal[itype] = TMath::Median(fNBkgPatchesEMCal[itype], fBkgADCAmpEMCal[itype].GetArray());
481 0 : fMedianDCal[itype] = TMath::Median(fNBkgPatchesDCal[itype], fBkgADCAmpDCal[itype].GetArray());
482 :
483 0 : fBkgEMCal[itype] = fMedianEMCal[itype] / fPatchAreas[fBkgPatchType];
484 0 : fBkgDCal[itype] = fMedianDCal[itype] / fPatchAreas[fBkgPatchType];
485 0 : }
486 0 : }
487 :
488 : /**
489 : * This method should be called at the end of each event.
490 : */
491 : void AliEMCALTriggerOnlineQAPbPb::EventCompleted()
492 : {
493 0 : AliDebug(2, Form("Entering AliEMCALTriggerQA::EventCompleted"));
494 :
495 0 : TString hname;
496 :
497 0 : for (Int_t itype = 0; itype < 3; itype++) {
498 0 : AliDebug(2, Form("Patch type %s", fgkPatchTypes[itype].Data()));
499 :
500 0 : hname = Form("EMCTRQA_histEMCalMedianVsDCalMedian%s", fgkPatchTypes[itype].Data());
501 0 : FillTH2(hname, fMedianEMCal[itype], fMedianDCal[itype]);
502 :
503 0 : for (Int_t itrig = 0; itrig < 6; itrig++) {
504 :
505 0 : if (!IsPatchTypeEnabled(itype, itrig)) continue;
506 :
507 0 : AliDebug(2, Form("Trigger type: %s", kEMCalTriggerNames[itype].Data()));
508 :
509 0 : hname = Form("EMCTRQA_histEMCalMedianVsDCalMax%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
510 0 : FillTH2(hname, fMaxPatchDCal[itrig][itype], fMedianEMCal[itype]);
511 :
512 0 : hname = Form("EMCTRQA_histDCalMedianVsEMCalMax%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
513 0 : FillTH2(hname, fMaxPatchEMCal[itrig][itype], fMedianDCal[itype]);
514 :
515 0 : hname = Form("EMCTRQA_histDCalMedianVsDCalMax%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
516 0 : FillTH2(hname, fMaxPatchDCal[itrig][itype], fMedianDCal[itype]);
517 :
518 0 : hname = Form("EMCTRQA_histEMCalMedianVsEMCalMax%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
519 0 : FillTH2(hname, fMaxPatchEMCal[itrig][itype], fMedianEMCal[itype]);
520 :
521 0 : hname = Form("EMCTRQA_histEMCalMaxVsDCalMax%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
522 0 : FillTH2(hname, fMaxPatchEMCal[itrig][itype], fMaxPatchDCal[itrig][itype]);
523 :
524 0 : hname = Form("EMCTRQA_histEMCalMaxPatchAmpSubtracted%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
525 0 : FillTH1(hname, fMaxPatchEMCal[itrig][itype] - fBkgDCal[itype] * fPatchAreas[itrig]);
526 :
527 0 : if (fMaxPatchEMCal[itrig][itype] > 0) {
528 0 : hname = Form("EMCTRQA_histEMCalMaxPatchAmpSubtracted%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
529 0 : FillTH1(hname, Double_t(fMaxPatchEMCal[itrig][itype]) - fBkgDCal[itype] * fPatchAreas[itrig]);
530 :
531 0 : hname = Form("EMCTRQA_histEMCalMaxPatchAmp%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
532 0 : FillTH1(hname, fMaxPatchEMCal[itrig][itype]);
533 : }
534 :
535 0 : if (fMaxPatchDCal[itrig][itype] > 0) {
536 0 : hname = Form("EMCTRQA_histDCalMaxPatchAmpSubtracted%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
537 0 : FillTH1(hname, Double_t(fMaxPatchDCal[itrig][itype]) - fBkgEMCal[itype] * fPatchAreas[itrig]);
538 :
539 0 : hname = Form("EMCTRQA_histDCalMaxPatchAmp%s%s", kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
540 0 : FillTH1(hname, fMaxPatchDCal[itrig][itype]);
541 : }
542 :
543 0 : fMaxPatchEMCal[itrig][itype] = 0;
544 0 : fMaxPatchDCal[itrig][itype] = 0;
545 0 : }
546 0 : fNBkgPatchesEMCal[itype] = 0;
547 0 : fNBkgPatchesDCal[itype] = 0;
548 0 : fBkgADCAmpEMCal[itype].Reset();
549 0 : fBkgADCAmpDCal[itype].Reset();
550 : }
551 0 : }
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 0 : if (fHistos->FindObject(name)) {
567 0 : Fatal("AliEMCALTriggerQA::CreateTProfile", "Object %s already exists", name);
568 0 : return;
569 : }
570 0 : TProfile* hist = new TProfile(name, title, nbins, xmin, xmax);
571 0 : fHistos->Add(hist);
572 0 : }
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 0 : if (fHistos->FindObject(name)) {
588 0 : Fatal("AliEMCALTriggerQA::CreateTH1", "Object %s already exists", name);
589 0 : return;
590 : }
591 0 : TH1* hist = new TH1D(name, title, nbins, xmin, xmax);
592 0 : fHistos->Add(hist);
593 0 : }
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 0 : if (fHistos->FindObject(name)) {
612 0 : Fatal("AliEMCALTriggerQA::CreateTH2", "Object %s already exists", name);
613 0 : return;
614 : }
615 0 : TH2* hist = new TH2D(name, title, nbinsx, xmin, xmax, nbinsy, ymin, ymax);
616 0 : fHistos->Add(hist);
617 0 : }
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 0 : if (fHistos->FindObject(name)) {
637 0 : Fatal("AliEMCALTriggerQA::CreateTH3", "Object %s already exists", name);
638 0 : return;
639 : }
640 0 : TH3* hist = new TH3D(name, title, nbinsx, xmin, xmax, nbinsy, ymin, ymax, nbinsz, zmin, zmax);
641 0 : fHistos->Add(hist);
642 0 : }
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 0 : TProfile* hist = dynamic_cast<TProfile*>(fHistos->FindObject(name));
656 0 : if (!hist) {
657 0 : Fatal("AliEMCALTriggerQA::FillTProfile", "Histogram %s not found", name);
658 0 : return;
659 : }
660 0 : hist->Fill(x, y, weight);
661 0 : }
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 0 : TH1* hist = dynamic_cast<TH1*>(fHistos->FindObject(name));
675 0 : if (!hist) {
676 0 : Fatal("AliEMCALTriggerQA::FillTH1", "Histogram %s not found", name);
677 0 : return;
678 : }
679 0 : hist->Fill(x, weight);
680 0 : }
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 0 : TH2* hist = dynamic_cast<TH2*>(fHistos->FindObject(name));
695 0 : if (!hist) {
696 0 : Fatal("AliEMCALTriggerQA::FillTH2", "Histogram %s not found", name);
697 0 : return;
698 : }
699 0 : hist->Fill(x, y, weight);
700 0 : }
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 0 : TH3* hist = dynamic_cast<TH3*>(fHistos->FindObject(name));
717 0 : if (!hist) {
718 0 : Fatal("AliEMCALTriggerQA::FillTH3", "Histogram %s not found", name);
719 0 : return;
720 : }
721 0 : hist->Fill(x, y, z, weight);
722 0 : }
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 0 : 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 0 : TString hname(obj->GetName());
747 0 : return fHistos->FindObject(hname);
748 0 : }
|