Skip to content

Commit 842accf

Browse files
jokonigjokonig
andauthored
[EMCAL-792]: Add thresholds to EMCal Raw Errors for Medium Quality (#2555)
- Minor Altro errors were fixed up until now as soon as they appeared. To increase the data taking time of EMCal, we now consider to only fix them at beam dump. - New configurable values in the QC now allow to set specific values on how many minor altro errors can be presenent during data taking. The new flag "medium" is used to indicate minor altro errors that can be fixed at beam dump. Co-authored-by: jokonig <jokonig@cern.ch>
1 parent b9f1b80 commit 842accf

File tree

2 files changed

+97
-2
lines changed

2 files changed

+97
-2
lines changed

Modules/EMCAL/include/EMCAL/RawErrorCheck.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ class RawErrorCheck : public o2::quality_control::checker::CheckInterface
113113
std::map<int, int> mErrorCountThresholdRFE; ///< Thresholds for Raw Fit Error histogram
114114
std::map<int, int> mErrorCountThresholdGEE; ///< Thresholds for Geometry Error histogram
115115
std::map<int, int> mErrorCountThresholdGTE; ///< Thresholds for Gain Type Error histogram
116+
117+
std::map<int, std::array<int, 2>> mErrorCountThresholdRDESummary; ///< Thresholds for Raw Data Error Summary histograms. Values are for error and warning
116118
};
117119

118120
} // namespace o2::quality_control_modules::emcal

Modules/EMCAL/src/RawErrorCheck.cxx

Lines changed: 95 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ void RawErrorCheck::configure()
6060
keyThresRawFitError = "ThresholdRFE",
6161
keyThresholdGeometryError = "ThresholdGEE",
6262
keyThresholdGainTypeError = "ThresholdGTE";
63+
6364
try {
6465
for (auto& [param, value] : mCustomParameters.getAllDefaults()) {
6566
if (param.find(keyThreshRawdataErrors) == 0) {
@@ -78,6 +79,41 @@ void RawErrorCheck::configure()
7879
}
7980
}
8081

82+
// Raw data error summary hists start with RDESummaryErr for error values and RDESummaryWarn for warning values
83+
std::string strSummaryErr = "RDESummaryErr";
84+
if (param.starts_with(strSummaryErr)) {
85+
auto errortype = param.substr(strSummaryErr.length());
86+
auto errorcode = findErrorCodeRDE(errortype);
87+
if (errorcode > -1) {
88+
try {
89+
auto threshold = std::stoi(value);
90+
ILOG(Info) << "Setting custom threshold in Histogram RawDataErrors Summary Errors: " << errortype << " <= " << threshold << ENDM;
91+
mErrorCountThresholdRDESummary[errorcode][0] = threshold;
92+
} catch (...) {
93+
ILOG(Error) << "Thresholds for histogram RawDataErrors Summary Errors: Failure in decoding threshold value (" << value << ") for error type " << errortype << ENDM;
94+
}
95+
} else {
96+
ILOG(Error) << "Thresholds for histogram RawDataErrors Summary Errors: Requested error type " << errortype << " not found" << ENDM;
97+
}
98+
}
99+
100+
std::string strSummaryWarn = "RDESummaryWarn";
101+
if (param.starts_with(strSummaryWarn)) {
102+
auto errortype = param.substr(strSummaryWarn.length());
103+
auto errorcode = findErrorCodeRDE(errortype);
104+
if (errorcode > -1) {
105+
try {
106+
auto threshold = std::stoi(value);
107+
ILOG(Info) << "Setting custom threshold in Histogram RawDataErrors Summary Warning: " << errortype << " <= " << threshold << ENDM;
108+
mErrorCountThresholdRDESummary[errorcode][1] = threshold;
109+
} catch (...) {
110+
ILOG(Error) << "Thresholds for histogram RawDataErrors Summary Warning: Failure in decoding threshold value (" << value << ") for error type " << errortype << ENDM;
111+
}
112+
} else {
113+
ILOG(Error) << "Thresholds for histogram RawDataErrors Summary Warning: Requested error type " << errortype << " not found" << ENDM;
114+
}
115+
}
116+
81117
if (param.find(keyThreshPageError) == 0) {
82118
auto errortype = param.substr(keyThreshPageError.length());
83119
auto errorcode = findErrorCodePE(errortype);
@@ -182,7 +218,8 @@ void RawErrorCheck::configure()
182218

183219
Quality RawErrorCheck::check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap)
184220
{
185-
std::array<std::string, 7> errorhists = { { "RawDataErrors", "PageErrors", "MajorAltroErrors", "MinorAltroError", "RawFitError", "GeometryError", "GainTypeError" } };
221+
std::array<std::string, 1> errorSummaryHists = { { "RawDataErrors" } };
222+
std::array<std::string, 6> errorhists = { { "PageErrors", "MajorAltroErrors", "MinorAltroError", "RawFitError", "GeometryError", "GainTypeError" } };
186223
std::array<std::string, 2> gainhists = { { "NoHGPerDDL", "NoLGPerDDL" } };
187224
std::array<std::string, 2> channelgainhists = { { "ChannelLGnoHG", "ChannelHGnoLG" } };
188225
Quality result = Quality::Good;
@@ -198,7 +235,50 @@ Quality RawErrorCheck::check(std::map<std::string, std::shared_ptr<MonitorObject
198235
};
199236

200237
for (auto& [moName, mo] : *moMap) {
201-
if (std::find(errorhists.begin(), errorhists.end(), mo->getName()) != errorhists.end()) {
238+
if (std::find(errorSummaryHists.begin(), errorSummaryHists.end(), mo->getName()) != errorSummaryHists.end()) {
239+
// Check for presence of error codes
240+
auto* errorhist = dynamic_cast<TH2*>(mo->getObject());
241+
242+
for (int errorcode = 0; errorcode < errorhist->GetYaxis()->GetNbins(); errorcode++) {
243+
// try to find a threshold for the number of errors per bin
244+
int threshold = 0;
245+
auto thresholdHandler = thresholdConfigErrorHists.find(mo->getName());
246+
if (thresholdHandler != thresholdConfigErrorHists.end()) {
247+
auto thresholdFound = thresholdHandler->second->find(errorcode);
248+
if (thresholdFound != thresholdHandler->second->end()) {
249+
threshold = thresholdFound->second;
250+
}
251+
}
252+
// try to find the threshold for the number of links from when on it is considered to be warning ot bad
253+
int thresholdTotalErrBad = 0;
254+
int thresholdTotalErrWarn = 0;
255+
if (mErrorCountThresholdRDESummary.contains(errorcode)) {
256+
thresholdTotalErrBad = mErrorCountThresholdRDESummary[errorcode][0];
257+
thresholdTotalErrWarn = mErrorCountThresholdRDESummary[errorcode][1];
258+
}
259+
260+
int numErrors = 0;
261+
for (int linkID = 0; linkID < errorhist->GetXaxis()->GetNbins(); linkID++) {
262+
int nErr = errorhist->GetBinContent(linkID + 1, errorcode + 1);
263+
if (nErr > threshold) {
264+
numErrors++;
265+
}
266+
}
267+
268+
if (numErrors > thresholdTotalErrBad) { // Number of raw error exceeds the threshold and is considered to be bad
269+
if (result != Quality::Bad) {
270+
result = Quality::Bad;
271+
}
272+
result.addFlag(FlagTypeFactory::Unknown(), "Raw error " + std::string(errorhist->GetYaxis()->GetBinLabel(errorcode + 1)) + " above threshold " + std::to_string(thresholdTotalErrBad));
273+
274+
} else if (numErrors > thresholdTotalErrWarn) { // Number of raw error exceeds the threshold but is considered to be okay. Error can be fixed at beam dump
275+
if (result != Quality::Medium) {
276+
result = Quality::Medium;
277+
}
278+
result.addFlag(FlagTypeFactory::Unknown(), "Raw error " + std::string(errorhist->GetYaxis()->GetBinLabel(errorcode + 1)) + " above threshold " + std::to_string(thresholdTotalErrWarn) + " not critical ");
279+
}
280+
}
281+
} else if (std::find(errorhists.begin(), errorhists.end(), mo->getName()) != errorhists.end()) {
202282
// Check for presence of error codes
203283
auto* errorhist = dynamic_cast<TH2*>(mo->getObject());
204284

@@ -300,6 +380,19 @@ void RawErrorCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality checkRes
300380
ILOG(Warning, Devel) << "Raw Error in " << mo->GetName() << " found: " << flag.second << ENDM;
301381
}
302382
}
383+
} else if (checkResult == Quality::Medium) {
384+
TLatex* msg = new TLatex(0.2, 0.8, "#color[802]{Non-critical error codes present: call EMCAL oncall at beam dump}");
385+
msg->SetNDC();
386+
msg->SetTextSize(16);
387+
msg->SetTextFont(43);
388+
h->GetListOfFunctions()->Add(msg);
389+
msg->Draw();
390+
// Notify about found errors on the infoLogger:
391+
if (mNotifyInfologger) {
392+
for (const auto& flag : checkResult.getFlags()) {
393+
ILOG(Warning, Devel) << "Non-critical raw Error in " << mo->GetName() << " found: " << flag.second << " call EMCal oncall at beam dump!" << ENDM;
394+
}
395+
}
303396
}
304397
// SM grid
305398
if (mo->getName().find("Channel") != std::string::npos) {

0 commit comments

Comments
 (0)