diff --git a/Modules/TOF/include/TOF/CheckSlotPartMask.h b/Modules/TOF/include/TOF/CheckSlotPartMask.h index cd13330400..4ec05dc58d 100644 --- a/Modules/TOF/include/TOF/CheckSlotPartMask.h +++ b/Modules/TOF/include/TOF/CheckSlotPartMask.h @@ -46,9 +46,10 @@ class CheckSlotPartMask : public o2::quality_control::checker::CheckInterface // Fraction of entries w.r.t. mean of all crates to decide if a link is inefficient double mIneffThreshold = 0.8; /// Messages to print on the output PAD - MessagePad mShifterMessages{ "", 60.f, 13.f, 72.f, 14.f }; + MessagePad mShifterMessages{ "", 50.f, 13.f, 72.f, 14.5 }; /// To select to check link inefficiencies (if recovery does not work) - int mCheckLinkInefficiency = 0; + int mMaxNumberIneffientSlotPerCrate = 7; + int mMinNhitsPerSlot = 0; ClassDefOverride(CheckSlotPartMask, 2); }; diff --git a/Modules/TOF/src/CheckSlotPartMask.cxx b/Modules/TOF/src/CheckSlotPartMask.cxx index 57dbbe4c4b..ba8aa325fc 100644 --- a/Modules/TOF/src/CheckSlotPartMask.cxx +++ b/Modules/TOF/src/CheckSlotPartMask.cxx @@ -30,7 +30,8 @@ namespace o2::quality_control_modules::tof void CheckSlotPartMask::configure() { utils::parseIntParameter(mCustomParameters, "NCrates", mNCrates); - utils::parseIntParameter(mCustomParameters, "CheckLinkInefficiency", mCheckLinkInefficiency); + utils::parseIntParameter(mCustomParameters, "MinNhitsPerSlot", mMinNhitsPerSlot); + utils::parseIntParameter(mCustomParameters, "MaxNumberIneffientSlotPerCrate", mMaxNumberIneffientSlotPerCrate); utils::parseDoubleParameter(mCustomParameters, "IneffThreshold", mIneffThreshold); utils::parseIntParameter(mCustomParameters, "NCrateIneff", mNCrateIneff); @@ -48,41 +49,46 @@ Quality CheckSlotPartMask::check(std::mapgetName() == "hSlotPartMask") { auto* h = dynamic_cast(mo->getObject()); double hitsxcrate[72] = {}; - double meanhitsxcrate = 0; int ncrate = 0; + double maxhitsxcrate = 0.; + for (int xbin = 1; xbin <= h->GetNbinsX(); xbin++) { // loop over crates + int nSlotsBelowThr = 0; // define couter variable for the slots below the threshold for (int ybin = 1; ybin <= h->GetNbinsY(); ybin++) { // loop over slots hitsxcrate[xbin - 1] += h->GetBinContent(xbin, ybin); + if (h->GetBinContent(xbin, ybin) <= mMinNhitsPerSlot) { + nSlotsBelowThr++; // number of inefficient slots in each crate + } } - if (hitsxcrate[xbin - 1] == 0) { // is entire crate empty? - ncrate++; + if (nSlotsBelowThr > mMaxNumberIneffientSlotPerCrate) { + ncrate++; // if the number of inefficient slots in a crate is above a maximun, the crate is inefficient } - meanhitsxcrate += hitsxcrate[xbin - 1]; + if (maxhitsxcrate <= hitsxcrate[xbin - 1]) + maxhitsxcrate = hitsxcrate[xbin - 1]; // Finding the maximum number of hits in a crate } - meanhitsxcrate /= 72; - // look for inefficient crates int ncrate_ineff = 0; - if (mCheckLinkInefficiency) { - for (int ncrate = 0; ncrate < 72; ncrate++) { // loop over crates - if (hitsxcrate[ncrate] < mIneffThreshold * meanhitsxcrate) { - ncrate_ineff++; - } + for (int ncrate = 0; ncrate < 72; ncrate++) { // loop over crates + if (hitsxcrate[ncrate] < mIneffThreshold * maxhitsxcrate) { + ncrate_ineff++; } } + Quality partialResult = Quality::Null; if (ncrate > mNCrates) { - result = Quality::Bad; - } else if (mCheckLinkInefficiency && (ncrate_ineff > mNCrateIneff)) { - result = Quality::Bad; + partialResult = Quality::Bad; + } else if ((ncrate_ineff > mNCrateIneff)) { + partialResult = Quality::Medium; } else { - result = Quality::Good; + partialResult = Quality::Good; + } + if (partialResult.isWorseThan(result) || result == Quality::Null) { + result = partialResult; } } } return result; } - std::string CheckSlotPartMask::getAcceptedType() { return "TH2F"; } void CheckSlotPartMask::beautify(std::shared_ptr mo, Quality checkResult) @@ -90,16 +96,17 @@ void CheckSlotPartMask::beautify(std::shared_ptr mo, Quality chec if (mo->getName() == "hSlotPartMask") { auto* h = dynamic_cast(mo->getObject()); auto msg = mShifterMessages.MakeMessagePad(h, checkResult, "bl"); + msg->SetTextSize(30); if (!msg) { return; } if (checkResult == Quality::Good) { msg->AddText("OK!"); } else if (checkResult == Quality::Bad) { - msg->AddText("Many links missing."); + msg->AddText("Many crates have many inefficient slots."); msg->AddText("Call TOF on-call."); } else if (checkResult == Quality::Medium) { - // msg->AddText(""); + msg->AddText("Many inefficient crates."); // msg->AddText(""); } } else