Skip to content

Commit 058c915

Browse files
authored
[Common] allow ignoring period and pass when retrieving reference plots (#2381)
The period and pass names were always included in the QCDB queries for retrieving the reference plots. This means that a run from a given period and pass could not be used as reference for a different period and/or pass, which is a strong limitation that needs to be made configurable. The new code adds two configuration parameters that control whether the period and/or pass names should be ignored or not in the queries (see documentation for details).
1 parent 222ebeb commit 058c915

5 files changed

Lines changed: 31 additions & 6 deletions

File tree

Modules/Common/include/Common/ReferenceComparatorCheck.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ class ReferenceComparatorCheck : public o2::quality_control::checker::CheckInter
5555
std::unique_ptr<ObjectComparatorInterface> mComparator;
5656
std::map<std::string, Quality> mQualityFlags;
5757
std::map<std::string, std::shared_ptr<TPaveText>> mQualityLabels;
58-
quality_control::core::Activity mActivity /*current*/, mReferenceActivity;
58+
quality_control::core::Activity mReferenceActivity;
59+
bool mIgnorePeriodForReference{ true }; /// whether to specify the period name in the reference run query
60+
bool mIgnorePassForReference{ true }; /// whether to specify the pass name in the reference run query
5961
size_t mReferenceRun;
6062
std::unordered_map<std::string, std::shared_ptr<MonitorObject>> mReferencePlots;
6163
};

Modules/Common/include/Common/ReferenceComparatorTask.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@ class ReferenceComparatorTask : public quality_control::postprocessing::PostProc
6060
};
6161

6262
private:
63-
int mReferenceRun{ 0 };
63+
size_t mReferenceRun{ 0 };
6464
int mNotOlderThan{ 120 };
65+
bool mIgnorePeriodForReference{ true }; /// whether to specify the period name in the reference run query
66+
bool mIgnorePassForReference{ true }; /// whether to specify the pass name in the reference run query
6567

6668
/// \brief configuration parameters
6769
ReferenceComparatorTaskConfig mConfig;

Modules/Common/src/ReferenceComparatorCheck.cxx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ void ReferenceComparatorCheck::startOfActivity(const Activity& activity)
5050
auto comparatorName = mCustomParameters.atOptional("comparatorName", activity).value_or("");
5151
double threshold = std::stof(mCustomParameters.atOptional("threshold", activity).value_or("0"));
5252
mReferenceRun = std::stoi(mCustomParameters.atOptional("referenceRun", activity).value_or("0"));
53+
mIgnorePeriodForReference = std::stoi(mCustomParameters.atOptional("ignorePeriodForReference", activity).value_or("1")) != 0;
54+
mIgnorePassForReference = std::stoi(mCustomParameters.atOptional("ignorePassForReference", activity).value_or("1")) != 0;
5355

5456
mComparator.reset();
5557
if (!moduleName.empty() && !comparatorName.empty()) {
@@ -60,9 +62,14 @@ void ReferenceComparatorCheck::startOfActivity(const Activity& activity)
6062
mComparator->setThreshold(threshold);
6163
}
6264

63-
mActivity = activity;
6465
mReferenceActivity = activity;
6566
mReferenceActivity.mId = mReferenceRun;
67+
if (mIgnorePeriodForReference) {
68+
mReferenceActivity.mPeriodName = "";
69+
}
70+
if (mIgnorePassForReference) {
71+
mReferenceActivity.mPassName = "";
72+
}
6673

6774
// clear the cache of reference plots
6875
mReferencePlots.clear();

Modules/Common/src/ReferenceComparatorTask.cxx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,20 @@ void ReferenceComparatorTask::initialize(quality_control::postprocessing::Trigge
106106
auto& qcdb = services.get<repository::DatabaseInterface>();
107107
mNotOlderThan = std::stoi(getCustomParameter(mCustomParameters, "notOlderThan", trigger.activity, "120"));
108108
mReferenceRun = std::stoi(getCustomParameter(mCustomParameters, "referenceRun", trigger.activity, "0"));
109+
mIgnorePeriodForReference = std::stoi(getCustomParameter(mCustomParameters, "ignorePeriodForReference", trigger.activity, "1")) != 0;
110+
mIgnorePassForReference = std::stoi(getCustomParameter(mCustomParameters, "ignorePassForReference", trigger.activity, "1")) != 0;
109111

110112
ILOG(Info, Devel) << "Reference run set to '" << mReferenceRun << "' for activity " << trigger.activity << ENDM;
111113

114+
auto referenceActivity = trigger.activity;
115+
referenceActivity.mId = mReferenceRun;
116+
if (mIgnorePeriodForReference) {
117+
referenceActivity.mPeriodName = "";
118+
}
119+
if (mIgnorePassForReference) {
120+
referenceActivity.mPassName = "";
121+
}
122+
112123
// load and initialize the input groups
113124
for (auto group : mConfig.dataGroups) {
114125
auto groupName = group.name;
@@ -119,10 +130,9 @@ void ReferenceComparatorTask::initialize(quality_control::postprocessing::Trigge
119130
auto fullOutPath = group.outputPath + "/" + path;
120131

121132
// retrieve the reference MO
122-
auto referenceActivity = trigger.activity;
123-
referenceActivity.mId = mReferenceRun;
124133
auto referencePlot = o2::quality_control::checker::getReferencePlot(&qcdb, fullRefPath, referenceActivity);
125134
if (!referencePlot) {
135+
ILOG(Warning, Support) << "Could not load reference plot for object \"" << fullRefPath << "\" and activity " << referenceActivity << ENDM;
126136
continue;
127137
}
128138

doc/PostProcessing.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,8 @@ This post-processing task draws a given set of plots in comparison with their co
458458

459459
Currently the source of reference data is specified as a run-type and beam-type specific `referenceRun` number. This will be modified once a centralized way of accessing reference plots will become available in the framework.
460460
The `notOlderThan` option allows to ignore monitor objects that are older than a given number of seconds. A value of -1 means "no limit".
461+
The `ignorePeriodForReference` and `ignorePassForReference` boolean parameters control whether the period and/or pass names should be matched or not when querying the reference plots from the database.
462+
A value of `"1"` (default) means that the reference plots are not required to match the period and/or pass names of the current run, while a value of `"0"` means that the reference plot is retrieved only if the corresponding period and/or pass names match those of the current run.
461463

462464
The input MonitorObjects to be processed are logically divided in **dataGroups**. Each group is configured via the following parameters:
463465
* `inputPath`: path in the QCDB where the input objects are located
@@ -504,7 +506,9 @@ In the example configuration below, the relationship between the input and outpu
504506
"default": {
505507
"default": {
506508
"notOlderThan" : "300",
507-
"referenceRun" : "551875"
509+
"referenceRun" : "551875",
510+
"ignorePeriodForReference": "1",
511+
"ignorePassForReference": "1"
508512
}
509513
},
510514
"PHYSICS": {

0 commit comments

Comments
 (0)