2828#include " EMCALReconstruction/RawReaderMemory.h"
2929#include " EMCALReconstruction/RawHeaderStream.h"
3030#include < Framework/InputRecord.h>
31+ #include < CommonConstants/Triggers.h>
3132
3233using namespace o2 ::emcal;
3334
@@ -61,32 +62,45 @@ RawTask::~RawTask()
6162 delete mErrorTypeAltro ;
6263 }
6364
64- for (auto h : mRawAmplitudeEMCAL ) {
65- delete h;
66- }
65+ for (auto & histos : mRawAmplitudeEMCAL ) {
66+ for (auto h : histos.second ) {
6767
68- for ( auto h : mRawAmplMaxEMCAL ) {
69- delete h;
68+ delete h;
69+ }
7070 }
7171
72- for (auto h : mRawAmplMinEMCAL ) {
73- delete h;
72+ for (auto & histos : mRawAmplMaxEMCAL ) {
73+ for (auto h : histos.second ) {
74+ delete h;
75+ }
7476 }
7577
76- for (auto h : mRMSperSM ) {
77- delete h;
78+ for (auto & histos : mRawAmplMinEMCAL ) {
79+ for (auto h : histos.second ) {
80+ delete h;
81+ }
7882 }
79-
80- for (auto h : mMEANperSM ) {
81- delete h;
83+ for (auto & histos : mRMSperSM ) {
84+ for (auto h : histos.second ) {
85+ delete h;
86+ }
8287 }
8388
84- for (auto h : mMAXperSM ) {
85- delete h;
89+ for (auto & histos : mMEANperSM ) {
90+ for (auto h : histos.second ) {
91+ delete h;
92+ }
8693 }
8794
88- for (auto h : mMINperSM ) {
89- delete h;
95+ for (auto & histos : mMAXperSM ) {
96+ for (auto h : histos.second ) {
97+ delete h;
98+ }
99+ }
100+ for (auto & histos : mMINperSM ) {
101+ for (auto h : histos.second ) {
102+ delete h;
103+ }
90104 }
91105}
92106void RawTask::initialize (o2::framework::InitContext& /* ctx*/ )
@@ -103,7 +117,6 @@ void RawTask::initialize(o2::framework::InitContext& /*ctx*/)
103117 if (auto param = mCustomParameters .find (" myOwnKey" ); param != mCustomParameters .end ()) {
104118 QcInfoLogger::GetInstance () << " Custom parameter - myOwnKey : " << param->second << AliceO2::InfoLogger::InfoLogger::endm;
105119 }
106-
107120 mMappings = std::unique_ptr<o2::emcal::MappingHandler>(new o2::emcal::MappingHandler); // initialize the unique pointer to Mapper
108121
109122 // Statistics histograms
@@ -162,42 +175,63 @@ void RawTask::initialize(o2::framework::InitContext& /*ctx*/)
162175 getObjectsManager ()->startPublishing (mErrorTypeAltro );
163176
164177 // histos per SM
165- for (Int_t i = 0 ; i < 20 ; i++) {
166- mRawAmplitudeEMCAL [i] = new TH1F (Form (" RawAmplitudeEMCAL_sm%d" , i), Form (" RawAmplitudeEMCAL%d" , i), 100 , 0 ., 100 .);
167- mRawAmplitudeEMCAL [i]->GetXaxis ()->SetTitle (" Raw Amplitude" );
168- mRawAmplitudeEMCAL [i]->GetYaxis ()->SetTitle (" Counts" );
169- getObjectsManager ()->startPublishing (mRawAmplitudeEMCAL [i]);
170-
171- mRawAmplMaxEMCAL [i] = new TH1F (Form (" RawAmplMaxEMCAL_sm%d" , i), Form (" RawAmpMaxEMCAL%d" , i), 100 , 0 ., 100 .);
172- mRawAmplMaxEMCAL [i]->GetXaxis ()->SetTitle (" Max Raw Amplitude" );
173- mRawAmplMaxEMCAL [i]->GetYaxis ()->SetTitle (" Counts" );
174- getObjectsManager ()->startPublishing (mRawAmplMaxEMCAL [i]);
175-
176- mRawAmplMinEMCAL [i] = new TH1F (Form (" RawAmplMinEMCAL_sm%d" , i), Form (" RawAmpMinEMCAL%d" , i), 100 , 0 ., 100 .);
177- mRawAmplMinEMCAL [i]->GetXaxis ()->SetTitle (" Min Raw Amplitude" );
178- mRawAmplMinEMCAL [i]->GetYaxis ()->SetTitle (" Counts" );
179- getObjectsManager ()->startPublishing (mRawAmplMinEMCAL [i]);
180-
181- mRMSperSM [i] = new TProfile2D (Form (" RMSADCperSM%d" , i), Form (" RMSperSM%d" , i), 48 , 0 , 48 , 24 , 0 , 24 );
182- mRMSperSM [i]->GetXaxis ()->SetTitle (" col" );
183- mRMSperSM [i]->GetYaxis ()->SetTitle (" row" );
184- getObjectsManager ()->startPublishing (mRMSperSM [i]);
185-
186- mMEANperSM [i] = new TProfile2D (Form (" MeanADCperSM%d" , i), Form (" MeanADCperSM%d" , i), 48 , 0 , 48 , 24 , 0 , 24 );
187- mMEANperSM [i]->GetXaxis ()->SetTitle (" col" );
188- mMEANperSM [i]->GetYaxis ()->SetTitle (" row" );
189- getObjectsManager ()->startPublishing (mMEANperSM [i]);
190-
191- mMAXperSM [i] = new TProfile2D (Form (" MaxADCperSM%d" , i), Form (" MaxADCperSM%d" , i), 48 , 0 , 47 , 24 , 0 , 23 );
192- mMAXperSM [i]->GetXaxis ()->SetTitle (" col" );
193- mMAXperSM [i]->GetYaxis ()->SetTitle (" row" );
194- getObjectsManager ()->startPublishing (mMAXperSM [i]);
195-
196- mMINperSM [i] = new TProfile2D (Form (" MinADCperSM%d" , i), Form (" MinADCperSM%d" , i), 48 , 0 , 47 , 24 , 0 , 23 );
197- mMINperSM [i]->GetXaxis ()->SetTitle (" col" );
198- mMINperSM [i]->GetYaxis ()->SetTitle (" row" );
199- getObjectsManager ()->startPublishing (mMINperSM [i]);
200- }
178+
179+ std::array<std::string, 2 > triggers = { { " CAL" , " PHYS" } };
180+ for (const auto & trg : triggers) {
181+ std::array<TH1 *, 20 > histosRawAmplEMCALSM;
182+ std::array<TH1 *, 20 > histosRawAmplMaxEMCALSM;
183+ std::array<TH1 *, 20 > histosRawAmplMinEMCALSM;
184+ std::array<TProfile2D*, 20 > histosRawAmplRmsSM;
185+ std::array<TProfile2D*, 20 > histosRawAmplMeanSM;
186+ std::array<TProfile2D*, 20 > histosRawAmplMaxSM;
187+ std::array<TProfile2D*, 20 > histosRawAmplMinSM;
188+
189+ for (auto ism = 0 ; ism < 20 ; ism++) {
190+
191+ histosRawAmplEMCALSM[ism] = new TH1F (Form (" RawAmplitudeEMCAL_sm%d_%s" , ism, trg.data ()), Form (" RawAmplitudeEMCAL%d, %s" , ism, trg.data ()), 100 , 0 ., 100 .);
192+ histosRawAmplEMCALSM[ism]->GetXaxis ()->SetTitle (" Raw Amplitude" );
193+ histosRawAmplEMCALSM[ism]->GetYaxis ()->SetTitle (" Counts" );
194+ getObjectsManager ()->startPublishing (histosRawAmplEMCALSM[ism]);
195+
196+ histosRawAmplMaxEMCALSM[ism] = new TH1F (Form (" RawAmplMaxEMCAL_sm%d_%s" , ism, trg.data ()), Form (" RawAmplMaxEMCAL_sm%d_%s" , ism, trg.data ()), 500 , 0 ., 500 .);
197+ histosRawAmplMaxEMCALSM[ism]->GetXaxis ()->SetTitle (" Max Raw Amplitude [ADC]" );
198+ histosRawAmplMaxEMCALSM[ism]->GetYaxis ()->SetTitle (" Counts" );
199+ getObjectsManager ()->startPublishing (histosRawAmplMaxEMCALSM[ism]);
200+
201+ histosRawAmplMinEMCALSM[ism] = new TH1F (Form (" RawAmplMinEMCAL_sm%d_%s" , ism, trg.data ()), Form (" RawAmplMinEMCAL_sm%d_%s" , ism, trg.data ()), 100 , 0 ., 100 .);
202+ histosRawAmplMinEMCALSM[ism]->GetXaxis ()->SetTitle (" Min Raw Amplitude" );
203+ histosRawAmplMinEMCALSM[ism]->GetYaxis ()->SetTitle (" Counts" );
204+ getObjectsManager ()->startPublishing (histosRawAmplMinEMCALSM[ism]);
205+
206+ histosRawAmplRmsSM[ism] = new TProfile2D (Form (" RMSADCperSM%d_%s" , ism, trg.data ()), Form (" RMSperSM%d_%s" , ism, trg.data ()), 48 , 0 , 48 , 24 , 0 , 24 );
207+ histosRawAmplRmsSM[ism]->GetXaxis ()->SetTitle (" col" );
208+ histosRawAmplRmsSM[ism]->GetYaxis ()->SetTitle (" row" );
209+ getObjectsManager ()->startPublishing (histosRawAmplRmsSM[ism]);
210+
211+ histosRawAmplMeanSM[ism] = new TProfile2D (Form (" MeanADCperSM%d_%s" , ism, trg.data ()), Form (" MeanADCperSM%d_%s" , ism, trg.data ()), 48 , 0 , 48 , 24 , 0 , 24 );
212+ histosRawAmplMeanSM[ism]->GetXaxis ()->SetTitle (" col" );
213+ histosRawAmplMeanSM[ism]->GetYaxis ()->SetTitle (" row" );
214+ getObjectsManager ()->startPublishing (histosRawAmplMeanSM[ism]);
215+
216+ histosRawAmplMaxSM[ism] = new TProfile2D (Form (" MaxADCperSM%d_%s" , ism, trg.data ()), Form (" MaxADCperSM%d_%s" , ism, trg.data ()), 48 , 0 , 47 , 24 , 0 , 23 );
217+ histosRawAmplMaxSM[ism]->GetXaxis ()->SetTitle (" col" );
218+ histosRawAmplMaxSM[ism]->GetYaxis ()->SetTitle (" row" );
219+ getObjectsManager ()->startPublishing (histosRawAmplMaxSM[ism]);
220+
221+ histosRawAmplMinSM[ism] = new TProfile2D (Form (" MinADCperSM%d_%s" , ism, trg.data ()), Form (" MinADCperSM%d_%s" , ism, trg.data ()), 48 , 0 , 47 , 24 , 0 , 23 );
222+ histosRawAmplMinSM[ism]->GetXaxis ()->SetTitle (" col" );
223+ histosRawAmplMinSM[ism]->GetYaxis ()->SetTitle (" raw" );
224+ getObjectsManager ()->startPublishing (histosRawAmplMinSM[ism]);
225+ } // loop SM
226+ mRawAmplitudeEMCAL [trg] = histosRawAmplEMCALSM;
227+ mRawAmplMaxEMCAL [trg] = histosRawAmplMaxEMCALSM;
228+ mRawAmplMinEMCAL [trg] = histosRawAmplMinEMCALSM;
229+ mRMSperSM [trg] = histosRawAmplRmsSM;
230+ mMEANperSM [trg] = histosRawAmplMeanSM;
231+ mMAXperSM [trg] = histosRawAmplMaxSM;
232+ mMINperSM [trg] = histosRawAmplMinSM;
233+
234+ } // loop trigger case
201235}
202236
203237void RawTask::startOfActivity (Activity& /* activity*/ )
@@ -272,11 +306,26 @@ void RawTask::monitorData(o2::framework::ProcessingContext& ctx)
272306 auto triggerBC = o2::raw::RDHUtils::getTriggerBC (headerR);
273307 mPayloadSizePerDDL ->Fill (feeID, payLoadSize / 1024 .);
274308
309+ // trigger type
310+ auto triggertype = o2::raw::RDHUtils::getTriggerType (headerR);
311+ bool isPhysTrigger = triggertype & o2::trigger::PhT, isCalibTrigger = triggertype & o2::trigger::Cal;
312+ std::string trgClass;
313+ if (isPhysTrigger)
314+ trgClass = " PHYS" ;
315+ else if (isCalibTrigger)
316+ trgClass = " CAL" ;
317+ else {
318+ QcInfoLogger::GetInstance () << QcInfoLogger::Error << " Unmonitored trigger class requested " << AliceO2::InfoLogger::InfoLogger::endm;
319+ continue ;
320+ }
321+
275322 // fill histograms with max ADC for each supermodules and reset cache
276323 if (!first) { // check if it is the first event in the payload
277324 if (triggerBC > currentTrigger) { // new event
278325 for (int sm = 0 ; sm < 20 ; sm++) {
279- mRawAmplitudeEMCAL [sm]->Fill (maxADCSM[sm]);
326+
327+ mRawAmplitudeEMCAL [trgClass][sm]->Fill (maxADCSM[sm]);
328+
280329 maxADCSM[sm] = 0 ;
281330 // initialize
282331 minADCSM[sm] = SHRT_MAX ;
@@ -364,26 +413,25 @@ void RawTask::monitorData(o2::framework::ProcessingContext& ctx)
364413 auto maxADCbunch = *max_element (adcs.begin (), adcs.end ());
365414 if (maxADCbunch > maxADC)
366415 maxADC = maxADCbunch;
367- mRawAmplMaxEMCAL [j]->Fill (maxADCbunch); // max for each cell
416+ mRawAmplMaxEMCAL [trgClass][ j]->Fill (maxADCbunch); // max for each cell
368417
369418 auto minADCbunch = *min_element (adcs.begin (), adcs.end ());
370419 if (minADCbunch < minADC)
371420 minADC = minADCbunch;
372- mRawAmplMinEMCAL [j]->Fill (minADCbunch); // min for each cell
421+ mRawAmplMinEMCAL [trgClass][ j]->Fill (minADCbunch); // min for each cell
373422
374423 meanADC = TMath::Mean (adcs.begin (), adcs.end ());
375424 rmsADC = TMath::RMS (adcs.begin (), adcs.end ());
376- mRMSperSM [j]->Fill (col, row, rmsADC);
377- mMEANperSM [j]->Fill (col, row, meanADC);
425+ mRMSperSM [trgClass][ j]->Fill (col, row, rmsADC);
426+ mMEANperSM [trgClass][ j]->Fill (col, row, meanADC);
378427 }
379428 if (maxADC > maxADCSM[j])
380429 maxADCSM[j] = maxADC;
381- mMAXperSM [j]->Fill (col, row, maxADC);
430+ mMAXperSM [trgClass][ j]->Fill (col, row, maxADC);
382431
383432 if (minADC < minADCSM[j])
384433 minADCSM[j] = minADC;
385- mMINperSM [j]->Fill (col, row, minADC);
386-
434+ mMINperSM [trgClass][j]->Fill (col, row, minADC);
387435 } // channels
388436 } // new page
389437 } // header
@@ -410,14 +458,17 @@ void RawTask::reset()
410458
411459 QcInfoLogger::GetInstance () << " Resetting the histogram" << AliceO2::InfoLogger::InfoLogger::endm;
412460 mHistogram ->Reset ();
413- for (Int_t i = 0 ; i < 20 ; i++) {
414- mRawAmplitudeEMCAL [i]->Reset ();
415- mRawAmplMaxEMCAL [i]->Reset ();
416- mRawAmplMinEMCAL [i]->Reset ();
417- mRMSperSM [i]->Reset ();
418- mMEANperSM [i]->Reset ();
419- mMAXperSM [i]->Reset ();
420- mMINperSM [i]->Reset ();
461+ std::array<std::string, 2 > triggers = { { " CAL" , " PHYS" } };
462+ for (const auto & trg : triggers) {
463+ for (Int_t i = 0 ; i < 20 ; i++) {
464+ mRawAmplitudeEMCAL [trg][i]->Reset ();
465+ mRawAmplMaxEMCAL [trg][i]->Reset ();
466+ mRawAmplMinEMCAL [trg][i]->Reset ();
467+ mRMSperSM [trg][i]->Reset ();
468+ mMEANperSM [trg][i]->Reset ();
469+ mMAXperSM [trg][i]->Reset ();
470+ mMINperSM [trg][i]->Reset ();
471+ }
421472 }
422473 mPayloadSizePerDDL ->Reset ();
423474 mHistogram ->Reset ();
0 commit comments