From d73b2c7f12a60d84118849408e48f3142e91f89e Mon Sep 17 00:00:00 2001 From: aferrero2707 Date: Mon, 28 Jul 2025 17:27:17 +0200 Subject: [PATCH] [MID] fixed Digits check result in case of noisy boards In the presence of noisy boards, the result of the check on the empty boards was incorrectly ignored, leading in some cases to a Medium quality even with a large number of empty boards being present. The fix aggregates the qualities from the bad boards and empty boards checks, and also displays messages from both chekers in case they both detect problems. --- Modules/MUON/MID/src/DigitsQcCheck.cxx | 46 ++++++++++++++++++++------ 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/Modules/MUON/MID/src/DigitsQcCheck.cxx b/Modules/MUON/MID/src/DigitsQcCheck.cxx index fd07d49e3e..577da2b873 100644 --- a/Modules/MUON/MID/src/DigitsQcCheck.cxx +++ b/Modules/MUON/MID/src/DigitsQcCheck.cxx @@ -97,7 +97,6 @@ Quality DigitsQcCheck::check(std::map mMeanMultThreshold || mean < mMinMultThreshold) { qual = Quality::Bad; - result = qual; ++nBad; } else if (mean > mMeanMultThreshold / 2.) { qual = Quality::Medium; @@ -153,22 +152,44 @@ Quality DigitsQcCheck::check(std::map 0) { - qual = Quality::Medium; + qualBadLB = Quality::Medium; if (nBadLB > mNbBadLocalBoard) { - qual = Quality::Bad; + qualBadLB = Quality::Bad; } auto flag = o2::quality_control::FlagType(); - qual.addFlag(flag, fmt::format("{} boards > {} kHz", nBadLB, mLocalBoardThreshold)); - } else if (nEmptyLB > 0) { - qual = Quality::Medium; + qualBadLB.addFlag(flag, fmt::format("{} boards > {} kHz", nBadLB, mLocalBoardThreshold)); + } + if (nEmptyLB > 0) { + qualEmptyLB = Quality::Medium; if (nEmptyLB > mNbEmptyLocalBoard) { - qual = Quality::Bad; + qualEmptyLB = Quality::Bad; } auto flag = o2::quality_control::FlagType(); - qual.addFlag(flag, fmt::format("{} boards empty", nEmptyLB)); + qualEmptyLB.addFlag(flag, fmt::format("{} boards empty", nEmptyLB)); + } + + auto qual = Quality::Good; + if (qualBadLB.isWorseThan(qual)) { + qual.set(qualBadLB); + } + if (qualEmptyLB.isWorseThan(qual)) { + qual.set(qualEmptyLB); } + // copy flags to aggregated quality + for (const auto& flag : qualBadLB.getFlags()) { + qual.addFlag(flag.first, flag.second); + } + for (const auto& flag : qualEmptyLB.getFlags()) { + qual.addFlag(flag.first, flag.second); + } + // copy metadata to aggregated quality + qual.addMetadata(qualBadLB.getMetadataMap()); + qual.addMetadata(qualEmptyLB.getMetadataMap()); + mQualityMap[item.second->getName()] = qual; result = qual; } // if mNTFInSeconds > 0. @@ -251,8 +272,11 @@ void DigitsQcCheck::beautify(std::shared_ptr mo, Quality checkRes if (histo) { if (mo->getName() == lbHistoName) { // This is LocalBoardsMap and it was already scaled in the checker - if (!checkResult.getFlags().empty()) { - mHistoHelper.addLatex(histo, 0.12, 0.72, color, checkResult.getFlags().front().second.c_str()); + float xFlagText = 0.12; + float yFlagText = 0.72; + for (const auto& flag : checkResult.getFlags()) { + mHistoHelper.addLatex(histo, xFlagText, yFlagText, color, flag.second.c_str()); + yFlagText -= 0.1; } mHistoHelper.addLatex(histo, 0.3, 0.32, color, fmt::format("Quality::{}", checkResult.getName())); histo->SetMaximum(zcontoursLoc4.back());