Skip to content

Commit

Permalink
[Common] allow ignoring period and pass when retrieving reference plo…
Browse files Browse the repository at this point in the history
…ts (#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).
  • Loading branch information
aferrero2707 authored Aug 16, 2024
1 parent 222ebeb commit 058c915
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 6 deletions.
4 changes: 3 additions & 1 deletion Modules/Common/include/Common/ReferenceComparatorCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ class ReferenceComparatorCheck : public o2::quality_control::checker::CheckInter
std::unique_ptr<ObjectComparatorInterface> mComparator;
std::map<std::string, Quality> mQualityFlags;
std::map<std::string, std::shared_ptr<TPaveText>> mQualityLabels;
quality_control::core::Activity mActivity /*current*/, mReferenceActivity;
quality_control::core::Activity mReferenceActivity;
bool mIgnorePeriodForReference{ true }; /// whether to specify the period name in the reference run query
bool mIgnorePassForReference{ true }; /// whether to specify the pass name in the reference run query
size_t mReferenceRun;
std::unordered_map<std::string, std::shared_ptr<MonitorObject>> mReferencePlots;
};
Expand Down
4 changes: 3 additions & 1 deletion Modules/Common/include/Common/ReferenceComparatorTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ class ReferenceComparatorTask : public quality_control::postprocessing::PostProc
};

private:
int mReferenceRun{ 0 };
size_t mReferenceRun{ 0 };
int mNotOlderThan{ 120 };
bool mIgnorePeriodForReference{ true }; /// whether to specify the period name in the reference run query
bool mIgnorePassForReference{ true }; /// whether to specify the pass name in the reference run query

/// \brief configuration parameters
ReferenceComparatorTaskConfig mConfig;
Expand Down
9 changes: 8 additions & 1 deletion Modules/Common/src/ReferenceComparatorCheck.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ void ReferenceComparatorCheck::startOfActivity(const Activity& activity)
auto comparatorName = mCustomParameters.atOptional("comparatorName", activity).value_or("");
double threshold = std::stof(mCustomParameters.atOptional("threshold", activity).value_or("0"));
mReferenceRun = std::stoi(mCustomParameters.atOptional("referenceRun", activity).value_or("0"));
mIgnorePeriodForReference = std::stoi(mCustomParameters.atOptional("ignorePeriodForReference", activity).value_or("1")) != 0;
mIgnorePassForReference = std::stoi(mCustomParameters.atOptional("ignorePassForReference", activity).value_or("1")) != 0;

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

mActivity = activity;
mReferenceActivity = activity;
mReferenceActivity.mId = mReferenceRun;
if (mIgnorePeriodForReference) {
mReferenceActivity.mPeriodName = "";
}
if (mIgnorePassForReference) {
mReferenceActivity.mPassName = "";
}

// clear the cache of reference plots
mReferencePlots.clear();
Expand Down
14 changes: 12 additions & 2 deletions Modules/Common/src/ReferenceComparatorTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,20 @@ void ReferenceComparatorTask::initialize(quality_control::postprocessing::Trigge
auto& qcdb = services.get<repository::DatabaseInterface>();
mNotOlderThan = std::stoi(getCustomParameter(mCustomParameters, "notOlderThan", trigger.activity, "120"));
mReferenceRun = std::stoi(getCustomParameter(mCustomParameters, "referenceRun", trigger.activity, "0"));
mIgnorePeriodForReference = std::stoi(getCustomParameter(mCustomParameters, "ignorePeriodForReference", trigger.activity, "1")) != 0;
mIgnorePassForReference = std::stoi(getCustomParameter(mCustomParameters, "ignorePassForReference", trigger.activity, "1")) != 0;

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

auto referenceActivity = trigger.activity;
referenceActivity.mId = mReferenceRun;
if (mIgnorePeriodForReference) {
referenceActivity.mPeriodName = "";
}
if (mIgnorePassForReference) {
referenceActivity.mPassName = "";
}

// load and initialize the input groups
for (auto group : mConfig.dataGroups) {
auto groupName = group.name;
Expand All @@ -119,10 +130,9 @@ void ReferenceComparatorTask::initialize(quality_control::postprocessing::Trigge
auto fullOutPath = group.outputPath + "/" + path;

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

Expand Down
6 changes: 5 additions & 1 deletion doc/PostProcessing.md
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,8 @@ This post-processing task draws a given set of plots in comparison with their co

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.
The `notOlderThan` option allows to ignore monitor objects that are older than a given number of seconds. A value of -1 means "no limit".
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.
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.

The input MonitorObjects to be processed are logically divided in **dataGroups**. Each group is configured via the following parameters:
* `inputPath`: path in the QCDB where the input objects are located
Expand Down Expand Up @@ -504,7 +506,9 @@ In the example configuration below, the relationship between the input and outpu
"default": {
"default": {
"notOlderThan" : "300",
"referenceRun" : "551875"
"referenceRun" : "551875",
"ignorePeriodForReference": "1",
"ignorePassForReference": "1"
}
},
"PHYSICS": {
Expand Down

0 comments on commit 058c915

Please sign in to comment.