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: Fix Checker for changed trending graphs #2366

Merged
merged 2 commits into from
Jul 4, 2024
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
2 changes: 1 addition & 1 deletion Modules/TPC/include/TPC/CheckOfTrendings.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class CheckOfTrendings : public o2::quality_control::checker::CheckInterface

private:
ClassDefOverride(CheckOfTrendings, 2);
void getGraphs(TCanvas* canv, std::vector<TGraph*>& graphs);
void getGraphs(TCanvas* canv, std::vector<TGraph*>& graphs, const std::string moName);
std::string createMetaData(const std::vector<std::string>& pointMetaData);
std::string mCheckChoice;
float mExpectedPhysicsValue;
Expand Down
13 changes: 8 additions & 5 deletions Modules/TPC/src/CheckOfTrendings.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ Quality CheckOfTrendings::check(std::map<std::string, std::shared_ptr<MonitorObj
totalQuality.addMetadata(Quality::Null.getName(), "Canvas not found");
return totalQuality;
}
getGraphs(canv, graphs);
getGraphs(canv, graphs, mo->getName());

if (graphs.size() == 0) {
ILOG(Error, Support) << "Could not retrieve any TGraph for CheckOfTrendings" << ENDM;
Expand Down Expand Up @@ -390,7 +390,7 @@ void CheckOfTrendings::beautify(std::shared_ptr<MonitorObject> mo, Quality check
}

std::vector<TGraph*> graphs;
getGraphs(canv, graphs);
getGraphs(canv, graphs, mo->getName());

if (graphs.size() == 0) {
ILOG(Error, Support) << "Could not retrieve any TGraph for CheckOfTrendings (beautify function)" << ENDM;
Expand Down Expand Up @@ -597,15 +597,15 @@ void CheckOfTrendings::beautify(std::shared_ptr<MonitorObject> mo, Quality check
} // for(size_t iGraph = 0; iGraph < graphs.size(); iGraph++)
}

void CheckOfTrendings::getGraphs(TCanvas* canv, std::vector<TGraph*>& graphs)
void CheckOfTrendings::getGraphs(TCanvas* canv, std::vector<TGraph*>& graphs, const std::string moName)
{
if (mSliceTrend) {
TList* padList = (TList*)canv->GetListOfPrimitives();
padList->SetOwner(kTRUE);
const int numberPads = padList->GetEntries();
for (int iPad = 0; iPad < numberPads; iPad++) {
auto pad = static_cast<TPad*>(padList->At(iPad));
graphs.push_back(static_cast<TGraph*>(pad->GetPrimitive("Graph")));
graphs.push_back(static_cast<TGraph*>(pad->GetPrimitive("Graph"))); // SliceTrendingTask saves things as Graph
}
} else {
// If we have a standard trending with a TGraphErrors, then there will be a TGraph and a TGraphErrors with the same name ("Graph")
Expand All @@ -614,7 +614,10 @@ void CheckOfTrendings::getGraphs(TCanvas* canv, std::vector<TGraph*>& graphs)
TGraph* g;
int jList = canv->GetListOfPrimitives()->LastIndex();
for (; jList > 0; jList--) {
if (!strcmp(canv->GetListOfPrimitives()->At(jList)->GetName(), "Graph")) {
if (!strcmp(canv->GetListOfPrimitives()->At(jList)->GetName(), (moName + "_errors").c_str())) { // Trending Task saves things under the MO name
g = (TGraph*)canv->GetListOfPrimitives()->At(jList);
break;
} else if (!strcmp(canv->GetListOfPrimitives()->At(jList)->GetName(), moName.c_str())) { // Trending Task saves things under the MO name
g = (TGraph*)canv->GetListOfPrimitives()->At(jList);
break;
}
Expand Down
Loading