Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TOF] Change the checker on partecipating slots #2431

Merged
merged 2 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Modules/TOF/include/TOF/CheckSlotPartMask.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down
45 changes: 26 additions & 19 deletions Modules/TOF/src/CheckSlotPartMask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -48,58 +49,64 @@ Quality CheckSlotPartMask::check(std::map<std::string, std::shared_ptr<MonitorOb
if (mo->getName() == "hSlotPartMask") {
auto* h = dynamic_cast<TH2F*>(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<MonitorObject> mo, Quality checkResult)
{
if (mo->getName() == "hSlotPartMask") {
auto* h = dynamic_cast<TH2F*>(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
Expand Down
Loading