Skip to content

Commit

Permalink
Update CheckSlotPartMask.cxx
Browse files Browse the repository at this point in the history
  • Loading branch information
sofiatomassini authored Sep 23, 2024
1 parent 9f43647 commit fd5e198
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions Modules/TOF/src/CheckSlotPartMask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,18 @@ 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 = hitsxcrate[0];
double maxhitsxcrate = 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
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) {
nslot++; // number of inefficient slots in each crate
nSlotsBelowThr++; // number of inefficient slots in each crate
}
}
if (nslot > mMaxNumberIneffientSlotPerCrate) {
if (nSlotsBelowThr > mMaxNumberIneffientSlotPerCrate) {
ncrate++; // if the number of inefficient slots in a crate is above a maximun, the crate is inefficient
}
if (maxhitsxcrate <= hitsxcrate[xbin - 1])
Expand All @@ -75,16 +74,20 @@ Quality CheckSlotPartMask::check(std::map<std::string, std::shared_ptr<MonitorOb
}
}

Quality partialResult = Quality::Null;
if (ncrate > mNCrates) {
result = Quality::Bad;
partialResult = Quality::Bad;
} else if ((ncrate_ineff > mNCrateIneff)) {
result = Quality::Medium;
partialResult = Quality::Medium;
} else {
result = Quality::Good;
partialResult = Quality::Good;
}
if (partialResult.isWorseThan(result) || result == Quality::Null) {
result = partialResult;
}
}
return result;
}
return result;
}
std::string CheckSlotPartMask::getAcceptedType() { return "TH2F"; }

Expand Down

0 comments on commit fd5e198

Please sign in to comment.