Skip to content

Commit b210c8f

Browse files
authored
TRD raw sizes check gets more robust (#2230)
1 parent ad06073 commit b210c8f

1 file changed

Lines changed: 7 additions & 16 deletions

File tree

Modules/TRD/src/RawDataCheck.cxx

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -164,25 +164,16 @@ Quality RawDataCheckSizes::check(std::map<std::string, std::shared_ptr<MonitorOb
164164
if (mo->getName() == "datavolumepersector") {
165165
auto* h = dynamic_cast<TH2F*>(mo->getObject());
166166
result.set(Quality::Good);
167-
TObjArray fits;
168-
h->FitSlicesY(nullptr, 1, 18, 0, "QNR", &fits);
169-
auto hMean = (TH1F*)fits[1];
170-
double sum = 0, sum2 = 0, n = 0;
167+
mMeanDataSize = h->GetMean(2);
168+
mStdDevDataSize = h->GetRMS(2);
171169
for (int iBin = 1; iBin <= 18; ++iBin) {
172-
sum += hMean->GetBinContent(iBin);
173-
sum2 += hMean->GetBinContent(iBin) * hMean->GetBinContent(iBin);
174-
++n;
175-
mMeanDataSize = sum / n;
176-
mStdDevDataSize = sum2 / n - TMath::Power(sum / n, 2);
177-
}
178-
mStdDevDataSize = TMath::Sqrt(mStdDevDataSize);
179-
for (int iBin = 1; iBin <= 18; ++iBin) {
180-
if (TMath::Abs(hMean->GetBinContent(iBin) - mMeanDataSize) > mWarningThreshold * mStdDevDataSize) {
181-
ILOG(Debug, Support) << fmt::format("Found outlier in sector {} with mean value of {}", iBin - 1, hMean->GetBinContent(iBin)) << ENDM;
170+
auto sectorMean = h->ProjectionY("py", iBin, iBin + 1)->GetMean();
171+
if (TMath::Abs(sectorMean - mMeanDataSize) > mWarningThreshold * mStdDevDataSize) {
172+
ILOG(Debug, Support) << fmt::format("Found outlier in sector {} with mean value of {}", iBin - 1, sectorMean) << ENDM;
182173
result.set(Quality::Medium);
183174
}
184-
if (TMath::Abs(hMean->GetBinContent(iBin) - mMeanDataSize) > mErrorThreshold * mStdDevDataSize) {
185-
ILOG(Debug, Support) << fmt::format("Found strong outlier in sector {} with mean value of {}", iBin - 1, hMean->GetBinContent(iBin)) << ENDM;
175+
if (TMath::Abs(sectorMean - mMeanDataSize) > mErrorThreshold * mStdDevDataSize) {
176+
ILOG(Debug, Support) << fmt::format("Found strong outlier in sector {} with mean value of {}", iBin - 1, sectorMean) << ENDM;
186177
result.set(Quality::Bad);
187178
}
188179
}

0 commit comments

Comments
 (0)