Skip to content

Commit 59a1793

Browse files
authored
[MCH] improvements to HB packets visualization (#2515)
- reduced size of the produced TH2FRatio histograms - simplified counting of TimeFrames for histogram normalization - added configurable range for HBRate plots
1 parent ace19c2 commit 59a1793

File tree

4 files changed

+31
-25
lines changed

4 files changed

+31
-25
lines changed

Modules/MUON/MCH/include/MCH/DecodingCheck.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ class DecodingCheck : public o2::quality_control::checker::CheckInterface
5555
std::array<std::optional<double>, 5> mMinGoodErrorFracPerStation;
5656
double mMinGoodSyncFrac{ 0.9 };
5757
std::array<std::optional<double>, 5> mMinGoodSyncFracPerStation;
58+
double mMinHeartBeatRate{ 0 };
59+
double mMaxHeartBeatRate{ 2 };
5860

5961
QualityChecker mQualityChecker;
6062

Modules/MUON/MCH/include/MCH/DecodingTask.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
using namespace o2::quality_control_modules::common;
3232

33+
class TH1I;
34+
3335
namespace o2::quality_control_modules::muonchambers
3436
{
3537

@@ -96,7 +98,7 @@ class DecodingTask /*final*/ : public TaskInterface
9698
std::array<HBCount, o2::mch::NumberOfDualSampas> mHBcount;
9799

98100
/// \brief number of processed time-frames
99-
std::unique_ptr<TH1F> mHistogramTimeFramesCount;
101+
std::unique_ptr<TH1I> mHistogramTimeFramesCount;
100102

101103
/// \brief decoding error plots
102104
std::unique_ptr<TH2FRatio> mHistogramErrorsFEC; ///< error codes per FEC

Modules/MUON/MCH/src/DecodingCheck.cxx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ void DecodingCheck::startOfActivity(const Activity& activity)
4747

4848
mMaxBadST12 = getConfigurationParameter<int>(mCustomParameters, "MaxBadDE_ST12", mMaxBadST12, activity);
4949
mMaxBadST345 = getConfigurationParameter<int>(mCustomParameters, "MaxBadDE_ST345", mMaxBadST345, activity);
50-
5150
mQualityChecker.mMaxBadST12 = mMaxBadST12;
5251
mQualityChecker.mMaxBadST345 = mMaxBadST345;
52+
53+
mMinHeartBeatRate = getConfigurationParameter<double>(mCustomParameters, "MinHeartBeatRate", mMinHeartBeatRate, activity);
54+
mMaxHeartBeatRate = getConfigurationParameter<double>(mCustomParameters, "MaxHeartBeatRate", mMaxHeartBeatRate, activity);
5355
}
5456

5557
Quality DecodingCheck::check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap)
@@ -264,6 +266,16 @@ void DecodingCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality checkRes
264266
h->SetBinContent(deId + 1, ybin, 1);
265267
}
266268
}
269+
270+
// Normalize the heartBeat rate plots
271+
if (mo->getName().find("HBRate_ST") != std::string::npos) {
272+
TH2F* h = dynamic_cast<TH2F*>(mo->getObject());
273+
if (!h) {
274+
return;
275+
}
276+
h->SetMinimum(mMinHeartBeatRate);
277+
h->SetMaximum(mMaxHeartBeatRate);
278+
}
267279
}
268280

269281
} // namespace o2::quality_control_modules::muonchambers

Modules/MUON/MCH/src/DecodingTask.cxx

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
#include "MCHBase/DecoderError.h"
2828
#include "MCHBase/HeartBeatPacket.h"
2929

30+
#include <TH1I.h>
31+
3032
using namespace o2;
3133
using namespace o2::framework;
3234
using 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

330332
void 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

Comments
 (0)