Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TPC: Change Severity of Checkers #2010

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions Modules/TPC/src/CheckOfSlices.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ void CheckOfSlices::configure()
Quality CheckOfSlices::check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap)
{
Quality totalQuality = Quality::Null;
totalQuality.addMetadata("Comment", mMetadataComment);

std::vector<Quality> qualities;
std::unordered_map<std::string, std::vector<std::string>> checks;
Expand All @@ -112,11 +113,15 @@ Quality CheckOfSlices::check(std::map<std::string, std::shared_ptr<MonitorObject

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<TCanvas*>(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);
Expand All @@ -125,13 +130,17 @@ Quality CheckOfSlices::check(std::map<std::string, std::shared_ptr<MonitorObject
}
auto pad = static_cast<TPad*>(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<TGraphErrors*>(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();
Expand Down Expand Up @@ -253,7 +262,6 @@ Quality CheckOfSlices::check(std::map<std::string, std::shared_ptr<MonitorObject
totalQuality.addMetadata(Quality::Medium.getName(), mMediumString);
totalQuality.addMetadata(Quality::Good.getName(), mGoodString);
totalQuality.addMetadata(Quality::Null.getName(), mNullString);
totalQuality.addMetadata("Comment", mMetadataComment);

return totalQuality;
}
Expand All @@ -262,7 +270,8 @@ void CheckOfSlices::beautify(std::shared_ptr<MonitorObject> mo, Quality checkRes
{
auto* canv = dynamic_cast<TCanvas*>(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);
Expand All @@ -271,17 +280,20 @@ void CheckOfSlices::beautify(std::shared_ptr<MonitorObject> mo, Quality checkRes
}
auto pad = static_cast<TPad*>(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<TGraphErrors*>(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();
Expand Down
36 changes: 25 additions & 11 deletions Modules/TPC/src/CheckOfTrendings.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -124,27 +124,39 @@ Quality CheckOfTrendings::check(std::map<std::string, std::shared_ptr<MonitorObj
mPadMetaData[Quality::Good.getName()] = std::vector<std::string>();

std::vector<TGraph*> 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<TCanvas*>(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++) {
Expand Down Expand Up @@ -329,7 +341,6 @@ Quality CheckOfTrendings::check(std::map<std::string, std::shared_ptr<MonitorObj
std::string totalMediumString = "";
std::string totalGoodString = "";
std::string totalNullString = "";
Quality totalQuality = Quality::Null;

if (mPadQualities.size() >= 1) {
auto worst_Quality = std::max_element(mPadQualities.begin(), mPadQualities.end(),
Expand All @@ -351,7 +362,6 @@ Quality CheckOfTrendings::check(std::map<std::string, std::shared_ptr<MonitorObj
totalQuality.addMetadata(Quality::Medium.getName(), totalMediumString);
totalQuality.addMetadata(Quality::Good.getName(), totalGoodString);
totalQuality.addMetadata(Quality::Null.getName(), totalNullString);
totalQuality.addMetadata("Comment", mMetadataComment);

return totalQuality;
}
Expand All @@ -362,22 +372,26 @@ void CheckOfTrendings::beautify(std::shared_ptr<MonitorObject> mo, Quality check
{
auto* canv = dynamic_cast<TCanvas*>(mo->getObject());
if (!canv) {
ILOG(Fatal, Support) << "Canvas not found" << ENDM;
ILOG(Error, Support) << "Canvas not found (beautify function)" << ENDM;
return;
}

std::vector<TGraph*> 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++) {
Expand Down
13 changes: 7 additions & 6 deletions Modules/TPC/src/GenericHistogramCheck.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -126,19 +126,21 @@ Quality GenericHistogramCheck::check(std::map<std::string, std::shared_ptr<Monit
std::string message;

Quality result = Quality::Null;
result.addMetadata("Comment", mMetadataComment);

for (auto const& moObj : *moMap) {
auto mo = moObj.second;
if (!mo) {
continue;
ILOG(Error, Support) << "No MO found" << ENDM;
message = "No MO found!";
checkMessage.push_back(message);
result.addMetadata(Quality::Null.getName(), "No MO found");
return result;
}
auto h = dynamic_cast<TH1*>(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();
Expand Down Expand Up @@ -232,7 +234,6 @@ Quality GenericHistogramCheck::check(std::map<std::string, std::shared_ptr<Monit
result.addMetadata(Quality::Medium.getName(), mMediumString);
result.addMetadata(Quality::Good.getName(), mGoodString);
result.addMetadata(Quality::Null.getName(), mNullString);
result.addMetadata("Comment", mMetadataComment);

return result;
}
Expand Down
Loading