From 5078fefda88af0818d2eb6d50b349df9d4df84fd Mon Sep 17 00:00:00 2001 From: mlesch Date: Wed, 11 Oct 2023 14:41:31 +0200 Subject: [PATCH] TPC: Change Severity of Checkers --- Modules/TPC/src/CheckOfSlices.cxx | 30 +++++++++++++------ Modules/TPC/src/CheckOfTrendings.cxx | 36 ++++++++++++++++------- Modules/TPC/src/GenericHistogramCheck.cxx | 13 ++++---- 3 files changed, 53 insertions(+), 26 deletions(-) diff --git a/Modules/TPC/src/CheckOfSlices.cxx b/Modules/TPC/src/CheckOfSlices.cxx index ee0d69bea8..de1c3ce78a 100644 --- a/Modules/TPC/src/CheckOfSlices.cxx +++ b/Modules/TPC/src/CheckOfSlices.cxx @@ -103,6 +103,7 @@ void CheckOfSlices::configure() Quality CheckOfSlices::check(std::map>* moMap) { Quality totalQuality = Quality::Null; + totalQuality.addMetadata("Comment", mMetadataComment); std::vector qualities; std::unordered_map> checks; @@ -112,11 +113,15 @@ Quality CheckOfSlices::check(std::mapbegin()->second; if (!mo) { - ILOG(Fatal, Support) << "Monitoring object not found" << ENDM; + ILOG(Error, Support) << "Monitoring object not found" << ENDM; + totalQuality.addMetadata(Quality::Null.getName(), "Monitoring object not found"); + return totalQuality; } auto* canv = dynamic_cast(mo->getObject()); if (!canv) { - ILOG(Fatal, Support) << "Canvas not found" << ENDM; + ILOG(Error, Support) << "Canvas not found" << ENDM; + totalQuality.addMetadata(Quality::Null.getName(), "Canvas not found"); + return totalQuality; } TList* padList = (TList*)canv->GetListOfPrimitives(); padList->SetOwner(kTRUE); @@ -125,13 +130,17 @@ Quality CheckOfSlices::check(std::map(padList->At(0)); if (!pad) { - ILOG(Fatal, Support) << "Could not retrieve pad containing slice graph" << ENDM; + ILOG(Error, Support) << "Could not retrieve pad containing slice graph" << ENDM; + totalQuality.addMetadata(Quality::Null.getName(), "Could not retrieve pad containing slice graph"); + return totalQuality; } TGraphErrors* g = nullptr; g = static_cast(pad->GetPrimitive("Graph")); if (!g) { - ILOG(Fatal, Support) << "No Graph object found" << ENDM; + ILOG(Error, Support) << "No Graph object found" << ENDM; + totalQuality.addMetadata(Quality::Null.getName(), "No Graph object found"); + return totalQuality; } const int NBins = g->GetN(); @@ -253,7 +262,6 @@ Quality CheckOfSlices::check(std::map mo, Quality checkRes { auto* canv = dynamic_cast(mo->getObject()); if (!canv) { - ILOG(Fatal, Support) << "Canvas not found" << ENDM; + ILOG(Error, Support) << "Canvas not found (beautify function)" << ENDM; + return; } TList* padList = (TList*)canv->GetListOfPrimitives(); padList->SetOwner(kTRUE); @@ -271,17 +280,20 @@ void CheckOfSlices::beautify(std::shared_ptr mo, Quality checkRes } auto pad = static_cast(padList->At(0)); if (!pad) { - ILOG(Fatal, Support) << "Could not retrieve pad containing slice graph" << ENDM; + ILOG(Error, Support) << "Could not retrieve pad containing slice graph (beautify function)" << ENDM; + return; } TGraphErrors* h = nullptr; h = static_cast(pad->GetPrimitive("Graph")); if (!h) { - ILOG(Fatal, Support) << "No Graph object found" << ENDM; + ILOG(Error, Support) << "No Graph object found (beautify function)" << ENDM; + return; } const int nPoints = h->GetN(); if (nPoints == 0) { - ILOG(Fatal, Support) << "No bins were found for the Graph!" << ENDM; + ILOG(Error, Support) << "No bins were found for the Graph! (beautify function)" << ENDM; + return; } const double* yValues = h->GetY(); diff --git a/Modules/TPC/src/CheckOfTrendings.cxx b/Modules/TPC/src/CheckOfTrendings.cxx index 923d2fa507..fd095dab03 100644 --- a/Modules/TPC/src/CheckOfTrendings.cxx +++ b/Modules/TPC/src/CheckOfTrendings.cxx @@ -124,27 +124,39 @@ Quality CheckOfTrendings::check(std::map(); std::vector graphs; + Quality totalQuality = Quality::Null; + totalQuality.addMetadata("Comment", mMetadataComment); auto mo = moMap->begin()->second; if (!mo) { - ILOG(Fatal, Support) << "Monitoring object not found" << ENDM; + ILOG(Error, Support) << "Monitoring object not found" << ENDM; + totalQuality.addMetadata(Quality::Null.getName(), "Monitoring object not found"); + return totalQuality; } auto* canv = dynamic_cast(mo->getObject()); if (!canv) { - ILOG(Fatal, Support) << "Canvas not found" << ENDM; + ILOG(Error, Support) << "Canvas not found" << ENDM; + totalQuality.addMetadata(Quality::Null.getName(), "Canvas not found"); + return totalQuality; } getGraphs(canv, graphs); if (graphs.size() == 0) { - ILOG(Fatal, Support) << "Could not retrieve any TGraph for CheckOfTrendings" << ENDM; + ILOG(Error, Support) << "Could not retrieve any TGraph for CheckOfTrendings" << ENDM; + totalQuality.addMetadata(Quality::Null.getName(), "Could not retrieve any TGraph for CheckOfTrendings"); + return totalQuality; } for (size_t iGraph = 0; iGraph < graphs.size(); iGraph++) { if (!graphs[iGraph]) { // if there is no TGraph, give an error and break - ILOG(Fatal, Support) << "TGraph number " << iGraph << " is NULL." << ENDM; + ILOG(Error, Support) << "TGraph number " << iGraph << " is NULL." << ENDM; + totalQuality.addMetadata(Quality::Null.getName(), "Could not retrieve all TGraphs"); + return totalQuality; } } if (!mSliceTrend && graphs.size() > 1) { - ILOG(Fatal, Support) << "Multiple Graphs found even though this is not a slice trending" << ENDM; + ILOG(Error, Support) << "Multiple Graphs found even though this is not a slice trending" << ENDM; + totalQuality.addMetadata(Quality::Null.getName(), "Multiple Graphs found even though this is not a slice trending"); + return totalQuality; } for (size_t iGraph = 0; iGraph < graphs.size(); iGraph++) { @@ -329,7 +341,6 @@ Quality CheckOfTrendings::check(std::map= 1) { auto worst_Quality = std::max_element(mPadQualities.begin(), mPadQualities.end(), @@ -351,7 +362,6 @@ Quality CheckOfTrendings::check(std::map mo, Quality check { auto* canv = dynamic_cast(mo->getObject()); if (!canv) { - ILOG(Fatal, Support) << "Canvas not found" << ENDM; + ILOG(Error, Support) << "Canvas not found (beautify function)" << ENDM; + return; } std::vector graphs; getGraphs(canv, graphs); if (graphs.size() == 0) { - ILOG(Fatal, Support) << "Could not retrieve any TGraph for CheckOfTrendings" << ENDM; + ILOG(Error, Support) << "Could not retrieve any TGraph for CheckOfTrendings (beautify function)" << ENDM; + return; } for (size_t iGraph = 0; iGraph < graphs.size(); iGraph++) { if (!graphs[iGraph]) { // if there is no TGraph, give an error and break - ILOG(Fatal, Support) << "TGraph number " << iGraph << " is NULL." << ENDM; + ILOG(Error, Support) << "TGraph number " << iGraph << " is NULL. (beautify function)" << ENDM; + return; } } if (!mSliceTrend && graphs.size() > 1) { - ILOG(Fatal, Support) << "Multiple Graphs found even though this is not a slice trending" << ENDM; + ILOG(Error, Support) << "Multiple Graphs found even though this is not a slice trending (beautify function)" << ENDM; + return; } for (size_t iGraph = 0; iGraph < graphs.size(); iGraph++) { diff --git a/Modules/TPC/src/GenericHistogramCheck.cxx b/Modules/TPC/src/GenericHistogramCheck.cxx index be80c2ab61..ce8bdcaea7 100644 --- a/Modules/TPC/src/GenericHistogramCheck.cxx +++ b/Modules/TPC/src/GenericHistogramCheck.cxx @@ -126,19 +126,21 @@ Quality GenericHistogramCheck::check(std::map(mo->getObject()); if (!h) { - ILOG(Fatal, Support) << "No Histogram found!" << ENDM; - message = "No Histogram found!"; - checkMessage.push_back(message); + ILOG(Error, Support) << "No Histogram found" << ENDM; + result.addMetadata(Quality::Null.getName(), "No Histogram found"); + return result; } mHistDimension = h->GetDimension(); @@ -232,7 +234,6 @@ Quality GenericHistogramCheck::check(std::map