Skip to content

Commit

Permalink
TPC: Fix Checker for changed trending graphs (#2366)
Browse files Browse the repository at this point in the history
* TPC: Fix Reductor for changed trending graphs

* Fix Comment

---------

Co-authored-by: mlesch <ga94pez@mytum.de>
  • Loading branch information
mlesch and mlesch authored Jul 4, 2024
1 parent 931338b commit 37b7d68
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
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

0 comments on commit 37b7d68

Please sign in to comment.