Skip to content

Commit

Permalink
Change the checker on partecipating slots
Browse files Browse the repository at this point in the history
  • Loading branch information
Sofia Tomassini committed Sep 23, 2024
1 parent 255f9d3 commit 9f43647
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 21 deletions.
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
42 changes: 23 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 @@ -50,56 +51,59 @@ Quality CheckSlotPartMask::check(std::map<std::string, std::shared_ptr<MonitorOb
double hitsxcrate[72] = {};
double meanhitsxcrate = 0;
int ncrate = 0;
for (int xbin = 1; xbin <= h->GetNbinsX(); xbin++) { // loop over crates
for (int ybin = 1; ybin <= h->GetNbinsY(); ybin++) { // loop over slots
double maxhitsxcrate = hitsxcrate[0];

for (int xbin = 1; xbin <= h->GetNbinsX(); xbin++) { // loop over crates
int nslot = 0;
for (int ybin = 1; ybin <= h->GetNbinsY(); ybin++) { // loop over slot
hitsxcrate[xbin - 1] += h->GetBinContent(xbin, ybin);
if (h->GetBinContent(xbin, ybin) <= mMinNhitsPerSlot) {
nslot++; // number of inefficient slots in each crate
}
}
if (hitsxcrate[xbin - 1] == 0) { // is entire crate empty?
ncrate++;
if (nslot > 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++;
}
}

if (ncrate > mNCrates) {
result = Quality::Bad;
} else if (mCheckLinkInefficiency && (ncrate_ineff > mNCrateIneff)) {
result = Quality::Bad;
} else if ((ncrate_ineff > mNCrateIneff)) {
result = Quality::Medium;
} else {
result = Quality::Good;
}
}
return result;
}
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

0 comments on commit 9f43647

Please sign in to comment.