19 #include <THashList.h>
24 #include <TObjString.h>
25 #include <TObjArray.h>
27 #include <AliEMCALTriggerPatchInfo.h>
28 #include <AliEMCALTriggerFastOR.h>
30 #include <AliEMCALGeometry.h>
31 #include <AliVCaloCells.h>
32 #include <AliEMCALTriggerConstants.h>
52 for (
Int_t i = 0; i < 3; i++) {
53 for (
Int_t itype = 0; itype < 6; itype++) {
64 AliEMCALTriggerQA(name),
74 for (
Int_t i = 0; i < 3; i++) {
75 for (
Int_t itype = 0; itype < 6; itype++) {
86 AliEMCALTriggerQA(triggerQA),
88 fL0MinTime(triggerQA.fL0MinTime),
89 fL0MaxTime(triggerQA.fL0MaxTime),
90 fMinL0FastORAmp(triggerQA.fMinL0FastORAmp),
91 fMinL1FastORAmp(triggerQA.fMinL1FastORAmp),
92 fHistManager(triggerQA.GetName()),
96 for (
Int_t i = 0; i < 3; i++) {
97 for (
Int_t itype = 0; itype < 6; itype++) {
116 while (stream.good()) {
127 std::ifstream
file(fname);
145 hname =
"EMCTRQA_histFastORL0Hits";
146 htitle =
"EMCTRQA_histFastORL0Hits;col;row;entries";
149 hname =
"EMCTRQA_histFastORL0AccumulatedAmplitude";
150 htitle =
"EMCTRQA_histFastORL0AccumulatedAmplitude;col;row;accumulated amplitude";
153 hname =
"EMCTRQA_histFastORL0HitsTriggered";
154 htitle =
"EMCTRQA_histFastORL0HitsTriggered;col;row;entries";
157 hname =
"EMCTRQA_histFastORL0AccumulatedAmplitudeTriggered";
158 htitle =
"EMCTRQA_histFastORL0AccumulatedAmplitudeTriggered;col;row;accumulated amplitude";
161 hname =
"EMCTRQA_histFastORL0Time";
162 htitle =
"EMCTRQA_histFastORL0Time;FastOR abs. ID;time";
165 hname =
"EMCTRQA_histFastORL0AmpVsTime";
166 htitle =
"EMCTRQA_histFastORL0AmpVsTime;time;amplitude";
169 hname =
"EMCTRQA_histFastORL1Hits";
170 htitle =
"EMCTRQA_histFastORL1Hits;col;row;entries";
173 hname =
"EMCTRQA_histFastORL1AccumulatedAmplitude";
174 htitle =
"EMCTRQA_histFastORL1AccumulatedAmplitude;col;row;accumulated amplitude";
177 hname =
"EMCTRQA_histFastORL1AmpVsL0Amp";
178 htitle =
"EMCTRQA_histFastORL1AmpVsL0Amp;L0 amplitude;L1 time sum;entries";
181 hname =
"EMCTRQA_histFastORL1AmpVsL0AmpTriggered";
182 htitle =
"EMCTRQA_histFastORL1AmpVsL0AmpTriggered;L0 amplitude;L1 time sum;entries";
185 hname =
"EMCTRQA_histCellAmpVsFastORL0Amp";
186 htitle =
"EMCTRQA_histCellAmpVsFastORL0Amp;FastOR L0 amplitude;2x2 cell sum energy (GeV)";
189 hname =
"EMCTRQA_histCellAmpVsFastORL0AmpTriggered";
190 htitle =
"EMCTRQA_histCellAmpVsFastORL0AmpTriggered;FastOR L0 amplitude;2x2 cell sum energy (GeV)";
193 hname =
"EMCTRQA_histCellAmpVsFastORL1Amp";
194 htitle =
"EMCTRQA_histCellAmpVsFastORL1Amp;FastOR L1 amplitude;2x2 cell sum energy (GeV)";
198 if (nTRU == 34 || nTRU == 35 ||
199 nTRU == 40 || nTRU == 41 ||
200 nTRU == 46 || nTRU == 47)
continue;
201 hname = TString::Format(
"ByTRU/EMCTRQA_histCellAmpVsFastORL0AmpTRU%d", nTRU);
202 htitle = TString::Format(
"ByTRU/EMCTRQA_histCellAmpVsFastORL0Amp%d;FastOR L0 amplitude;2x2 cell sum energy (GeV)", nTRU);
205 hname = TString::Format(
"ByTRU/EMCTRQA_histFastORAmpSTUVsTRU%d", nTRU);
206 htitle = TString::Format(
"ByTRU/EMCTRQA_histFastORAmpSTUVsTRU%d;TRU amplitude;STU amplitude", nTRU);
209 hname = TString::Format(
"ByTRU/EMCTRQA_histCellAmpVsFastORL1AmpSTU%d", nTRU);
210 htitle = TString::Format(
"ByTRU/EMCTRQA_histCellAmpVsFastORL0Amp%d;FastOR L1 amplitude;2x2 cell sum energy (GeV)", nTRU);
214 const char* det[2] = {
"EMCal",
"DCal" };
216 for (
Int_t itrig = 0; itrig < fgkNTriggerTypes; itrig++) {
218 for (
Int_t itype = 0; itype < fgkNPatchTypes; itype++) {
219 if (!IsPatchTypeEnabled(itype, itrig))
continue;
220 for (
Int_t idet = 0; idet < ndet; idet++) {
221 hname = TString::Format(
"EMCTRQA_hist%sPatchAmp%s%s", det[idet], EMCALTrigger::kEMCalTriggerNames[itrig].
Data(), fgkPatchTypes[itype].
Data());
222 htitle = TString::Format(
"EMCTRQA_hist%sPatchAmp%s%s;amplitude;entries", det[idet], EMCALTrigger::kEMCalTriggerNames[itrig].
Data(), fgkPatchTypes[itype].
Data());
225 hname = TString::Format(
"EMCTRQA_hist%sMaxPatchAmp%s%s", det[idet], EMCALTrigger::kEMCalTriggerNames[itrig].
Data(), fgkPatchTypes[itype].
Data());
226 htitle = TString::Format(
"EMCTRQA_hist%sMaxPatchAmp%s%s;amplitude;entries", det[idet], EMCALTrigger::kEMCalTriggerNames[itrig].
Data(), fgkPatchTypes[itype].
Data());
230 hname = TString::Format(
"EMCTRQA_histMaxEdgePos%s%s", EMCALTrigger::kEMCalTriggerNames[itrig].
Data(), fgkPatchTypes[itype].
Data());
231 htitle = TString::Format(
"EMCTRQA_histMaxEdgePos%s%s;col;row;entries", EMCALTrigger::kEMCalTriggerNames[itrig].
Data(), fgkPatchTypes[itype].
Data());
234 hname = TString::Format(
"EMCTRQA_histAccAmpEdgePos%s%s", EMCALTrigger::kEMCalTriggerNames[itrig].
Data(), fgkPatchTypes[itype].
Data());
235 htitle = TString::Format(
"EMCTRQA_histAccAmpEdgePos%s%s;col;row;accumulated amplitude", EMCALTrigger::kEMCalTriggerNames[itrig].
Data(), fgkPatchTypes[itype].
Data());
249 Bool_t (AliEMCALTriggerPatchInfo::* triggerCheck[fgkNPatchTypes][fgkNTriggerTypes])(void)
const = {
250 { &AliEMCALTriggerPatchInfo::IsLevel0,
251 &AliEMCALTriggerPatchInfo::IsGammaLow,
252 &AliEMCALTriggerPatchInfo::IsGammaHigh,
253 &AliEMCALTriggerPatchInfo::IsJetLow,
254 &AliEMCALTriggerPatchInfo::IsJetHigh,
255 &AliEMCALTriggerPatchInfo::IsBkg
257 { &AliEMCALTriggerPatchInfo::IsLevel0Recalc,
258 &AliEMCALTriggerPatchInfo::IsGammaLowRecalc,
259 &AliEMCALTriggerPatchInfo::IsGammaHighRecalc,
260 &AliEMCALTriggerPatchInfo::IsJetLowRecalc,
261 &AliEMCALTriggerPatchInfo::IsJetHighRecalc,
262 &AliEMCALTriggerPatchInfo::IsBkgRecalc
264 { &AliEMCALTriggerPatchInfo::IsLevel0Simple,
265 &AliEMCALTriggerPatchInfo::IsGammaLowSimple,
266 &AliEMCALTriggerPatchInfo::IsGammaHighSimple,
267 &AliEMCALTriggerPatchInfo::IsJetLowSimple,
268 &AliEMCALTriggerPatchInfo::IsJetHighSimple,
269 &AliEMCALTriggerPatchInfo::IsBkgSimple
275 if (patch->IsEMCal()) {
278 else if (patch->IsDCalPHOS()) {
282 AliWarning(Form(
"Patch is not EMCal nor DCal/PHOS (pos: %d, %d)", patch->GetRowStart(), patch->GetColStart()));
285 for (
Int_t itrig = 0; itrig < fgkNTriggerTypes; itrig++) {
286 for (
Int_t itype = 0; itype < fgkNPatchTypes; itype++) {
287 if (!IsPatchTypeEnabled(itype, itrig))
continue;
289 if (!(patch->*(triggerCheck[itype][itrig]))())
continue;
293 if (patch->IsEMCal()) {
296 else if (patch->IsDCalPHOS()) {
300 hname = TString::Format(
"EMCTRQA_histAccAmpEdgePos%s%s", EMCALTrigger::kEMCalTriggerNames[itrig].
Data(), fgkPatchTypes[itype].
Data());
301 fHistManager.
FillTH2(hname, patch->GetColStart(), patch->GetRowStart(), GetAmplitude(patch, itype));
303 hname = Form(
"EMCTRQA_hist%sPatchAmp%s%s", det.Data(), EMCALTrigger::kEMCalTriggerNames[itrig].Data(), fgkPatchTypes[itype].Data());
307 Printf(
"Type = %s; global pos = (%d, %d); Amp (online) = %d; Amp (offline) = %d; Patch energy = %.3f\n"
308 "Position (CM): Eta=%.3f, Phi=%.3f\n"
309 "Position (Geo): Eta=%.3f, Phi=%.3f\n",
310 EMCALTrigger::kEMCalTriggerNames[itrig].
Data(), patch->GetRowStart(), patch->GetColStart(), patch->GetADCAmp(), patch->GetADCOfflineAmp(), patch->GetPatchE(),
311 patch->GetEtaCM(), patch->GetPhiCM(),
312 patch->GetEtaGeo(), patch->GetPhiGeo());
338 fGeom->GetPositionInSMFromAbsFastORIndex(fastor->GetAbsId(), iSM, iEta, iPhi);
339 isDCal = fGeom->IsDCALSM(iSM);
342 fGeom->GetCellIndexFromFastORIndex(fastor->GetAbsId(), idx);
343 fGeom->GetTRUFromAbsFastORIndex(fastor->GetAbsId(), nTRU, nADC);
346 nTRU == 34 || nTRU == 35 ||
347 nTRU == 40 || nTRU == 41 ||
348 nTRU == 46 || nTRU == 47) {
349 if (fastor->GetL0Amp() > 0) AliError(Form(
"FastOR with abs ID %d (amp = %u) and TRU number %d: this TRU does not exist!!", fastor->GetAbsId(), fastor->GetL0Amp(), nTRU));
356 for (
Int_t i = 0; i < 4; i++) {
357 offlineAmp += cells->GetCellAmplitude(idx[i]);
365 if (fTimeStampBinWidth > 0) {
366 hname = TString::Format(
"ByTimeStamp/EMCTRQA_histFastORL0_%u_%u", fEventTimeStampBin, fEventTimeStampBin+fTimeStampBinWidth);
370 hname =
"EMCTRQA_histFastORL0Hits";
373 hname =
"EMCTRQA_histFastORL0AccumulatedAmplitude";
374 fHistManager.
FillTH2(hname, fastor->GetGlobalCol(), fastor->GetGlobalRow(), fastor->GetL0Amp());
376 hname =
"EMCTRQA_histFastORL0Time";
379 hname =
"EMCTRQA_histFastORL0AmpVsTime";
382 hname =
"EMCTRQA_histCellAmpVsFastORL0Amp";
386 hname =
"EMCTRQA_histFastORL0HitsTriggered";
389 hname =
"EMCTRQA_histFastORL0AccumulatedAmplitudeTriggered";
390 fHistManager.
FillTH2(hname, fastor->GetGlobalCol(), fastor->GetGlobalRow(), fastor->GetL0Amp());
392 hname =
"EMCTRQA_histCellAmpVsFastORL0AmpTriggered";
396 hname = TString::Format(
"ByTRU/EMCTRQA_histCellAmpVsFastORL0AmpTRU%d",nTRU);
401 hname =
"EMCTRQA_histFastORL1Hits";
404 hname =
"EMCTRQA_histFastORL1AccumulatedAmplitude";
405 fHistManager.
FillTH2(hname, fastor->GetGlobalCol(), fastor->GetGlobalRow(), fastor->GetL1Amp());
407 hname =
"EMCTRQA_histCellAmpVsFastORL1Amp";
410 hname = TString::Format(
"ByTRU/EMCTRQA_histCellAmpVsFastORL1AmpSTU%d",nTRU);
414 UInt_t L1ampChopped = (fastor->GetL1Amp() >> 2) * 4;
416 hname = TString::Format(
"ByTRU/EMCTRQA_histFastORAmpSTUVsTRU%d",nTRU);
419 hname =
"EMCTRQA_histFastORL1AmpVsL0Amp";
423 hname =
"EMCTRQA_histFastORL1AmpVsL0AmpTriggered";
435 AliDebug(2, Form(
"Entering AliEmcalTriggerQAAP::EventCompleted"));
439 for (
Int_t itrig = 0; itrig < fgkNTriggerTypes; itrig++) {
440 AliDebug(2, Form(
"Trigger type: %s", EMCALTrigger::kEMCalTriggerNames[itrig].
Data()));
442 for (
Int_t itype = 0; itype < fgkNPatchTypes; itype++) {
443 if (!IsPatchTypeEnabled(itype, itrig))
continue;
445 AliDebug(2, Form(
"Patch type %s", fgkPatchTypes[itype].
Data()));
448 hname = TString::Format(
"EMCTRQA_histMaxEdgePos%s%s", EMCALTrigger::kEMCalTriggerNames[itrig].
Data(), fgkPatchTypes[itype].
Data());
452 hname = TString::Format(
"EMCTRQA_histEMCalMaxPatchAmp%s%s", EMCALTrigger::kEMCalTriggerNames[itrig].
Data(), fgkPatchTypes[itype].
Data());
456 hname = TString::Format(
"EMCTRQA_histMaxEdgePos%s%s", EMCALTrigger::kEMCalTriggerNames[itrig].
Data(), fgkPatchTypes[itype].
Data());
460 hname = TString::Format(
"EMCTRQA_histDCalMaxPatchAmp%s%s", EMCALTrigger::kEMCalTriggerNames[itrig].
Data(), fgkPatchTypes[itype].
Data());
465 for (
Int_t itype = 0; itype < fgkNPatchTypes; itype++) {
466 for (
Int_t itrig = 0; itrig < fgkNTriggerTypes; itrig++) {
481 AliEMCALTriggerQA::EventTimeStamp(timeStamp);
483 if (fTimeStampBinWidth > 0) {
484 TString hname = TString::Format(
"ByTimeStamp/EMCTRQA_histEvents_%u_%u", fEventTimeStampBin, fEventTimeStampBin+fTimeStampBinWidth);
488 hname = TString::Format(
"ByTimeStamp/EMCTRQA_histEvents_%u_%u", fEventTimeStampBin, fEventTimeStampBin+fTimeStampBinWidth);
489 htitle = TString::Format(
"EMCTRQA_histEvents;;events");
491 hevents->GetXaxis()->SetBinLabel(1, TString::Format(
"%u <= time stamp < %u", fEventTimeStampBin, fEventTimeStampBin+fTimeStampBinWidth));
493 hname = TString::Format(
"ByTimeStamp/EMCTRQA_histFastORL0_%u_%u", fEventTimeStampBin, fEventTimeStampBin+fTimeStampBinWidth);
494 htitle = TString::Format(
"EMCTRQA_histFastORL0;FastOR abs. ID;entries above 0");
498 hname = TString::Format(
"ByTimeStamp/EMCTRQA_histEvents_%u_%u", fEventTimeStampBin, fEventTimeStampBin+fTimeStampBinWidth);
THashList * CreateHistoGroup(const char *groupname)
Create a new group of histograms within a parent group.
AliEMCALTriggerOfflineLightQAPP()
Dummy constructor for ROOT I/O.
virtual ~AliEMCALTriggerOfflineLightQAPP()
Destructor.
void ReadFastORBadChannelFromStream(std::istream &stream)
void FillTH2(const char *hname, double x, double y, double weight=1., Option_t *opt="")
Fill a 2D histogram within the container.
Int_t fMaxFORabsId
! Maximum FastOR abs id
Int_t fMinL0FastORAmp
Minimum L0 amplitude of the FastORs.
void ProcessFastor(const AliEMCALTriggerFastOR *fastor, AliVCaloCells *cells=0)
Int_t fL0MinTime
Minimum L0 time.
const AliEMCALTriggerPatchInfo * fMaxPatchDCal[fgkNTriggerTypes][fgkNPatchTypes]
! DCal max patch (will be reset each event)
Int_t fL0MaxTime
Maximum L0 time.
void Init()
Initialize the class, i.e. allocate histograms.
void EventTimeStamp(UInt_t timeStamp)
TH2 * CreateTH2(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, Option_t *opt="")
Create a new TH2 within the container.
TObject * FindObject(const char *name) const
Find an object inside the container.
Int_t fNTotTRU
! Total number of TRUs
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
Create a new TH1 within the container.
void ProcessPatch(const AliEMCALTriggerPatchInfo *patch)
THistManager fHistManager
Histogram manager.
const AliEMCALTriggerPatchInfo * fMaxPatchEMCal[fgkNTriggerTypes][fgkNPatchTypes]
! EMCal max patch (will be reset each event)
void ReadFastORBadChannelFromFile(const char *fname)
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
Fill a 1D histogram within the container.
std::set< Short_t > fBadChannels
Container of bad channels.
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
TFile * file
TList with histograms for a given trigger.
void AddFastORBadChannel(Short_t absId)
Int_t fMinL1FastORAmp
Minimum L1 amplitude of the FastORs.