Skip to content

Commit 5f37298

Browse files
mleschmlesch
authored andcommitted
TPC: Fix Checker for changed trending graphs (#2366)
* TPC: Fix Reductor for changed trending graphs * Fix Comment --------- Co-authored-by: mlesch <ga94pez@mytum.de>
1 parent 931338b commit 5f37298

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

Modules/TPC/include/TPC/CheckOfTrendings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class CheckOfTrendings : public o2::quality_control::checker::CheckInterface
4646

4747
private:
4848
ClassDefOverride(CheckOfTrendings, 2);
49-
void getGraphs(TCanvas* canv, std::vector<TGraph*>& graphs);
49+
void getGraphs(TCanvas* canv, std::vector<TGraph*>& graphs, const std::string moName);
5050
std::string createMetaData(const std::vector<std::string>& pointMetaData);
5151
std::string mCheckChoice;
5252
float mExpectedPhysicsValue;

Modules/TPC/src/CheckOfTrendings.cxx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ Quality CheckOfTrendings::check(std::map<std::string, std::shared_ptr<MonitorObj
139139
totalQuality.addMetadata(Quality::Null.getName(), "Canvas not found");
140140
return totalQuality;
141141
}
142-
getGraphs(canv, graphs);
142+
getGraphs(canv, graphs, mo->getName());
143143

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

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

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

600-
void CheckOfTrendings::getGraphs(TCanvas* canv, std::vector<TGraph*>& graphs)
600+
void CheckOfTrendings::getGraphs(TCanvas* canv, std::vector<TGraph*>& graphs, const std::string moName)
601601
{
602602
if (mSliceTrend) {
603603
TList* padList = (TList*)canv->GetListOfPrimitives();
604604
padList->SetOwner(kTRUE);
605605
const int numberPads = padList->GetEntries();
606606
for (int iPad = 0; iPad < numberPads; iPad++) {
607607
auto pad = static_cast<TPad*>(padList->At(iPad));
608-
graphs.push_back(static_cast<TGraph*>(pad->GetPrimitive("Graph")));
608+
graphs.push_back(static_cast<TGraph*>(pad->GetPrimitive("Graph"))); // SliceTrendingTask saves things as Graph
609609
}
610610
} else {
611611
// If we have a standard trending with a TGraphErrors, then there will be a TGraph and a TGraphErrors with the same name ("Graph")
@@ -614,7 +614,10 @@ void CheckOfTrendings::getGraphs(TCanvas* canv, std::vector<TGraph*>& graphs)
614614
TGraph* g;
615615
int jList = canv->GetListOfPrimitives()->LastIndex();
616616
for (; jList > 0; jList--) {
617-
if (!strcmp(canv->GetListOfPrimitives()->At(jList)->GetName(), "Graph")) {
617+
if (!strcmp(canv->GetListOfPrimitives()->At(jList)->GetName(), (moName + "_errors").c_str())) { // Trending Task saves things under the MO name
618+
g = (TGraph*)canv->GetListOfPrimitives()->At(jList);
619+
break;
620+
} else if (!strcmp(canv->GetListOfPrimitives()->At(jList)->GetName(), moName.c_str())) { // Trending Task saves things under the MO name
618621
g = (TGraph*)canv->GetListOfPrimitives()->At(jList);
619622
break;
620623
}

0 commit comments

Comments
 (0)