2727#include " MCHBase/DecoderError.h"
2828#include " MCHBase/HeartBeatPacket.h"
2929
30+ #include < TH1I.h>
31+
3032using namespace o2 ;
3133using namespace o2 ::framework;
3234using namespace o2 ::mch;
@@ -57,7 +59,7 @@ void DecodingTask::createErrorHistos()
5759 const uint32_t nElecXbins = NumberOfDualSampas;
5860
5961 // Number of decoding errors, grouped by chamber ID and normalized to the number of processed TF
60- mHistogramErrorsFEC = std::make_unique<TH2FRatio>(" DecodingErrors_Elec" , " Error Code vs. FEC ID" , nElecXbins, 0 , nElecXbins, getErrorCodesSize (), 0 , getErrorCodesSize ());
62+ mHistogramErrorsFEC = std::make_unique<TH2FRatio>(" DecodingErrors_Elec" , " Error Code vs. FEC ID" , nElecXbins, 0 , nElecXbins, getErrorCodesSize (), 0 , getErrorCodesSize (), true );
6163 {
6264 TAxis* ax = mHistogramErrorsFEC ->GetYaxis ();
6365 for (int i = 0 ; i < getErrorCodesSize (); i++) {
@@ -75,16 +77,16 @@ void DecodingTask::createHeartBeatHistos()
7577 const uint32_t nElecXbins = NumberOfDualSampas;
7678
7779 // Heart-beat packets time distribution and synchronization errors
78- mHistogramHBTimeFEC = std::make_unique<TH2FRatio>(" HBTime_Elec" , " HB time vs. FEC ID" , nElecXbins, 0 , nElecXbins, 40 , mHBExpectedBc - 20 , mHBExpectedBc + 20 );
80+ mHistogramHBTimeFEC = std::make_unique<TH2FRatio>(" HBTime_Elec" , " HB time vs. FEC ID" , nElecXbins, 0 , nElecXbins, 40 , mHBExpectedBc - 20 , mHBExpectedBc + 20 , true );
7981 mHistogramHBTimeFEC ->Sumw2 (kFALSE );
8082 publishObject (mHistogramHBTimeFEC .get (), " colz" , " logz" , false , false );
8183
8284 uint64_t max = ((static_cast <uint64_t >(0x100000 ) / 100 ) + 1 ) * 100 ;
83- mHistogramHBCoarseTimeFEC = std::make_unique<TH2FRatio>(" HBCoarseTime_Elec" , " HB time vs. FEC ID (coarse)" , nElecXbins, 0 , nElecXbins, 100 , 0 , max);
85+ mHistogramHBCoarseTimeFEC = std::make_unique<TH2FRatio>(" HBCoarseTime_Elec" , " HB time vs. FEC ID (coarse)" , nElecXbins, 0 , nElecXbins, 100 , 0 , max, true );
8486 mHistogramHBCoarseTimeFEC ->Sumw2 (kFALSE );
8587 publishObject (mHistogramHBCoarseTimeFEC .get (), " colz" , " " , false , false );
8688
87- mSyncStatusFEC = std::make_unique<TH2FRatio>(" SyncStatus_Elec" , " Heart-beat status vs. FEC ID" , nElecXbins, 0 , nElecXbins, 3 , 0 , 3 );
89+ mSyncStatusFEC = std::make_unique<TH2FRatio>(" SyncStatus_Elec" , " Heart-beat status vs. FEC ID" , nElecXbins, 0 , nElecXbins, 3 , 0 , 3 , true );
8890 mSyncStatusFEC ->Sumw2 (kFALSE );
8991 mSyncStatusFEC ->GetYaxis ()->SetBinLabel (1 , " OK" );
9092 mSyncStatusFEC ->GetYaxis ()->SetBinLabel (2 , " Out-of-sync" );
@@ -103,7 +105,7 @@ void DecodingTask::initialize(o2::framework::InitContext& /*ic*/)
103105
104106 mElec2DetMapper = createElec2DetMapper<ElectronicMapperGenerated>();
105107
106- mHistogramTimeFramesCount = std::make_unique<TH1F >(" TimeFramesCount" , " Number of Time Frames" , 1 , 0 , 1 );
108+ mHistogramTimeFramesCount = std::make_unique<TH1I >(" TimeFramesCount" , " Number of Time Frames" , 1 , 0 , 1 );
107109 publishObject (mHistogramTimeFramesCount .get (), " hist" , " " , true , false );
108110
109111 createErrorHistos ();
@@ -329,7 +331,6 @@ void DecodingTask::updateSyncErrors()
329331
330332void DecodingTask::monitorData (o2::framework::ProcessingContext& ctx)
331333{
332- static int nTF = 1 ;
333334 for (auto && input : ctx.inputs ()) {
334335 if (input.spec ->binding == " readout" ) {
335336 decodeReadout (input);
@@ -345,24 +346,7 @@ void DecodingTask::monitorData(o2::framework::ProcessingContext& ctx)
345346 }
346347 }
347348
348- // Count the number of processed TF and set the denominators of the error histograms accordingly
349- nTF += 1 ;
350-
351349 mHistogramTimeFramesCount ->Fill (0.5 );
352-
353- auto updateTFcount = [](TH2FRatio* hr, int nTF) {
354- auto hTF = hr->getDen ();
355- for (int ybin = 1 ; ybin <= hTF->GetYaxis ()->GetNbins (); ybin++) {
356- for (int xbin = 1 ; xbin <= hTF->GetXaxis ()->GetNbins (); xbin++) {
357- hTF->SetBinContent (xbin, ybin, nTF);
358- }
359- }
360- };
361-
362- updateTFcount (mHistogramErrorsFEC .get (), nTF);
363- updateTFcount (mHistogramHBTimeFEC .get (), nTF);
364- updateTFcount (mHistogramHBCoarseTimeFEC .get (), nTF);
365- updateTFcount (mSyncStatusFEC .get (), nTF);
366350}
367351
368352// _____________________________________________________________________________
@@ -371,6 +355,12 @@ void DecodingTask::endOfCycle()
371355{
372356 ILOG (Debug, Devel) << " endOfCycle" << ENDM;
373357
358+ int nTF = static_cast <int >(mHistogramTimeFramesCount ->GetBinContent (1 ));
359+ mHistogramErrorsFEC ->getDen ()->SetBinContent (1 , 1 , nTF);
360+ mHistogramHBTimeFEC ->getDen ()->SetBinContent (1 , 1 , nTF);
361+ mHistogramHBCoarseTimeFEC ->getDen ()->SetBinContent (1 , 1 , nTF);
362+ mSyncStatusFEC ->getDen ()->SetBinContent (1 , 1 , nTF);
363+
374364 mHistogramErrorsFEC ->update ();
375365 mHistogramHBCoarseTimeFEC ->update ();
376366 mHistogramHBTimeFEC ->update ();
0 commit comments