From 66ef67844bbd17be04b5ccb01e1ff7bd6d50c8eb Mon Sep 17 00:00:00 2001 From: aferrero2707 Date: Mon, 3 Mar 2025 14:06:50 +0100 Subject: [PATCH] [MCH] improvements to HB packets visualization - reduced size of the produced TH2FRatio histograms - simplified counting of TimeFrames for histogram normalization - added configurable range for HBRate plots --- Modules/MUON/MCH/include/MCH/DecodingCheck.h | 2 ++ Modules/MUON/MCH/include/MCH/DecodingTask.h | 4 ++- Modules/MUON/MCH/src/DecodingCheck.cxx | 14 +++++++- Modules/MUON/MCH/src/DecodingTask.cxx | 36 +++++++------------- 4 files changed, 31 insertions(+), 25 deletions(-) diff --git a/Modules/MUON/MCH/include/MCH/DecodingCheck.h b/Modules/MUON/MCH/include/MCH/DecodingCheck.h index d4ebf7e508..21af60144d 100644 --- a/Modules/MUON/MCH/include/MCH/DecodingCheck.h +++ b/Modules/MUON/MCH/include/MCH/DecodingCheck.h @@ -55,6 +55,8 @@ class DecodingCheck : public o2::quality_control::checker::CheckInterface std::array, 5> mMinGoodErrorFracPerStation; double mMinGoodSyncFrac{ 0.9 }; std::array, 5> mMinGoodSyncFracPerStation; + double mMinHeartBeatRate{ 0 }; + double mMaxHeartBeatRate{ 2 }; QualityChecker mQualityChecker; diff --git a/Modules/MUON/MCH/include/MCH/DecodingTask.h b/Modules/MUON/MCH/include/MCH/DecodingTask.h index c103d466d4..33ead304a6 100644 --- a/Modules/MUON/MCH/include/MCH/DecodingTask.h +++ b/Modules/MUON/MCH/include/MCH/DecodingTask.h @@ -30,6 +30,8 @@ using namespace o2::quality_control_modules::common; +class TH1I; + namespace o2::quality_control_modules::muonchambers { @@ -96,7 +98,7 @@ class DecodingTask /*final*/ : public TaskInterface std::array mHBcount; /// \brief number of processed time-frames - std::unique_ptr mHistogramTimeFramesCount; + std::unique_ptr mHistogramTimeFramesCount; /// \brief decoding error plots std::unique_ptr mHistogramErrorsFEC; ///< error codes per FEC diff --git a/Modules/MUON/MCH/src/DecodingCheck.cxx b/Modules/MUON/MCH/src/DecodingCheck.cxx index cf8a354aa3..bc66e789b0 100644 --- a/Modules/MUON/MCH/src/DecodingCheck.cxx +++ b/Modules/MUON/MCH/src/DecodingCheck.cxx @@ -47,9 +47,11 @@ void DecodingCheck::startOfActivity(const Activity& activity) mMaxBadST12 = getConfigurationParameter(mCustomParameters, "MaxBadDE_ST12", mMaxBadST12, activity); mMaxBadST345 = getConfigurationParameter(mCustomParameters, "MaxBadDE_ST345", mMaxBadST345, activity); - mQualityChecker.mMaxBadST12 = mMaxBadST12; mQualityChecker.mMaxBadST345 = mMaxBadST345; + + mMinHeartBeatRate = getConfigurationParameter(mCustomParameters, "MinHeartBeatRate", mMinHeartBeatRate, activity); + mMaxHeartBeatRate = getConfigurationParameter(mCustomParameters, "MaxHeartBeatRate", mMaxHeartBeatRate, activity); } Quality DecodingCheck::check(std::map>* moMap) @@ -264,6 +266,16 @@ void DecodingCheck::beautify(std::shared_ptr mo, Quality checkRes h->SetBinContent(deId + 1, ybin, 1); } } + + // Normalize the heartBeat rate plots + if (mo->getName().find("HBRate_ST") != std::string::npos) { + TH2F* h = dynamic_cast(mo->getObject()); + if (!h) { + return; + } + h->SetMinimum(mMinHeartBeatRate); + h->SetMaximum(mMaxHeartBeatRate); + } } } // namespace o2::quality_control_modules::muonchambers diff --git a/Modules/MUON/MCH/src/DecodingTask.cxx b/Modules/MUON/MCH/src/DecodingTask.cxx index ef05f78ec3..18077503d6 100644 --- a/Modules/MUON/MCH/src/DecodingTask.cxx +++ b/Modules/MUON/MCH/src/DecodingTask.cxx @@ -27,6 +27,8 @@ #include "MCHBase/DecoderError.h" #include "MCHBase/HeartBeatPacket.h" +#include + using namespace o2; using namespace o2::framework; using namespace o2::mch; @@ -57,7 +59,7 @@ void DecodingTask::createErrorHistos() const uint32_t nElecXbins = NumberOfDualSampas; // Number of decoding errors, grouped by chamber ID and normalized to the number of processed TF - mHistogramErrorsFEC = std::make_unique("DecodingErrors_Elec", "Error Code vs. FEC ID", nElecXbins, 0, nElecXbins, getErrorCodesSize(), 0, getErrorCodesSize()); + mHistogramErrorsFEC = std::make_unique("DecodingErrors_Elec", "Error Code vs. FEC ID", nElecXbins, 0, nElecXbins, getErrorCodesSize(), 0, getErrorCodesSize(), true); { TAxis* ax = mHistogramErrorsFEC->GetYaxis(); for (int i = 0; i < getErrorCodesSize(); i++) { @@ -75,16 +77,16 @@ void DecodingTask::createHeartBeatHistos() const uint32_t nElecXbins = NumberOfDualSampas; // Heart-beat packets time distribution and synchronization errors - mHistogramHBTimeFEC = std::make_unique("HBTime_Elec", "HB time vs. FEC ID", nElecXbins, 0, nElecXbins, 40, mHBExpectedBc - 20, mHBExpectedBc + 20); + mHistogramHBTimeFEC = std::make_unique("HBTime_Elec", "HB time vs. FEC ID", nElecXbins, 0, nElecXbins, 40, mHBExpectedBc - 20, mHBExpectedBc + 20, true); mHistogramHBTimeFEC->Sumw2(kFALSE); publishObject(mHistogramHBTimeFEC.get(), "colz", "logz", false, false); uint64_t max = ((static_cast(0x100000) / 100) + 1) * 100; - mHistogramHBCoarseTimeFEC = std::make_unique("HBCoarseTime_Elec", "HB time vs. FEC ID (coarse)", nElecXbins, 0, nElecXbins, 100, 0, max); + mHistogramHBCoarseTimeFEC = std::make_unique("HBCoarseTime_Elec", "HB time vs. FEC ID (coarse)", nElecXbins, 0, nElecXbins, 100, 0, max, true); mHistogramHBCoarseTimeFEC->Sumw2(kFALSE); publishObject(mHistogramHBCoarseTimeFEC.get(), "colz", "", false, false); - mSyncStatusFEC = std::make_unique("SyncStatus_Elec", "Heart-beat status vs. FEC ID", nElecXbins, 0, nElecXbins, 3, 0, 3); + mSyncStatusFEC = std::make_unique("SyncStatus_Elec", "Heart-beat status vs. FEC ID", nElecXbins, 0, nElecXbins, 3, 0, 3, true); mSyncStatusFEC->Sumw2(kFALSE); mSyncStatusFEC->GetYaxis()->SetBinLabel(1, "OK"); mSyncStatusFEC->GetYaxis()->SetBinLabel(2, "Out-of-sync"); @@ -103,7 +105,7 @@ void DecodingTask::initialize(o2::framework::InitContext& /*ic*/) mElec2DetMapper = createElec2DetMapper(); - mHistogramTimeFramesCount = std::make_unique("TimeFramesCount", "Number of Time Frames", 1, 0, 1); + mHistogramTimeFramesCount = std::make_unique("TimeFramesCount", "Number of Time Frames", 1, 0, 1); publishObject(mHistogramTimeFramesCount.get(), "hist", "", true, false); createErrorHistos(); @@ -329,7 +331,6 @@ void DecodingTask::updateSyncErrors() void DecodingTask::monitorData(o2::framework::ProcessingContext& ctx) { - static int nTF = 1; for (auto&& input : ctx.inputs()) { if (input.spec->binding == "readout") { decodeReadout(input); @@ -345,24 +346,7 @@ void DecodingTask::monitorData(o2::framework::ProcessingContext& ctx) } } - // Count the number of processed TF and set the denominators of the error histograms accordingly - nTF += 1; - mHistogramTimeFramesCount->Fill(0.5); - - auto updateTFcount = [](TH2FRatio* hr, int nTF) { - auto hTF = hr->getDen(); - for (int ybin = 1; ybin <= hTF->GetYaxis()->GetNbins(); ybin++) { - for (int xbin = 1; xbin <= hTF->GetXaxis()->GetNbins(); xbin++) { - hTF->SetBinContent(xbin, ybin, nTF); - } - } - }; - - updateTFcount(mHistogramErrorsFEC.get(), nTF); - updateTFcount(mHistogramHBTimeFEC.get(), nTF); - updateTFcount(mHistogramHBCoarseTimeFEC.get(), nTF); - updateTFcount(mSyncStatusFEC.get(), nTF); } //_____________________________________________________________________________ @@ -371,6 +355,12 @@ void DecodingTask::endOfCycle() { ILOG(Debug, Devel) << "endOfCycle" << ENDM; + int nTF = static_cast(mHistogramTimeFramesCount->GetBinContent(1)); + mHistogramErrorsFEC->getDen()->SetBinContent(1, 1, nTF); + mHistogramHBTimeFEC->getDen()->SetBinContent(1, 1, nTF); + mHistogramHBCoarseTimeFEC->getDen()->SetBinContent(1, 1, nTF); + mSyncStatusFEC->getDen()->SetBinContent(1, 1, nTF); + mHistogramErrorsFEC->update(); mHistogramHBCoarseTimeFEC->update(); mHistogramHBTimeFEC->update();