Skip to content

Commit 7b7ed0e

Browse files
authored
Common: use extended parameters in ReferenceComparatorTask (#2359)
* [Common] use extended parameters in ReferenceComparatorTask The access to the custom parameters is modified to make use of the extended version, such that the reference run number can be configured separately for different run and beam types * [Common] improved logging Added an Info message to log the path, reference run number and current Activity before attempting to load the reference object. Can help to diagnose cases where the reference object is not properly retrieved.
1 parent bf1bc56 commit 7b7ed0e

1 file changed

Lines changed: 23 additions & 5 deletions

File tree

Modules/Common/src/ReferenceComparatorTask.cxx

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,15 @@ static bool splitObjectPath(const std::string& fullPath, std::string& path, std:
5555

5656
static std::shared_ptr<MonitorObject> getMOFromRun(repository::DatabaseInterface* qcdb, const std::string& fullPath, uint32_t run, Activity activity)
5757
{
58+
ILOG(Info, Devel) << "Loading object '" << fullPath << "' for reference run '" << run << "' and activity " << activity << ENDM;
5859
uint64_t timeStamp = 0;
5960
activity.mId = run;
6061
const auto filterMetadata = activity_helpers::asDatabaseMetadata(activity, false);
6162
const auto objectValidity = qcdb->getLatestObjectValidity(activity.mProvenance + "/" + fullPath, filterMetadata);
6263
if (objectValidity.isValid()) {
6364
timeStamp = objectValidity.getMax() - 1;
6465
} else {
65-
ILOG(Warning, Devel) << "Could not find the object '" << fullPath << "' for run " << activity.mId << ENDM;
66+
ILOG(Warning, Devel) << "Could not find the object '" << fullPath << "' for reference run " << activity.mId << ENDM;
6667
return nullptr;
6768
}
6869

@@ -135,16 +136,33 @@ void ReferenceComparatorTask::configure(const boost::property_tree::ptree& confi
135136

136137
//_________________________________________________________________________________________
137138

138-
void ReferenceComparatorTask::initialize(quality_control::postprocessing::Trigger t, framework::ServiceRegistryRef services)
139+
static std::string getCustomParameter(const o2::quality_control::core::CustomParameters& customParameters, const std::string& key, const Activity& activity, const std::string& defaultValue)
140+
{
141+
std::string value;
142+
auto valueOptional = customParameters.atOptional(key, activity);
143+
if (valueOptional.has_value()) {
144+
value = valueOptional.value();
145+
} else {
146+
value = customParameters.atOptional(key).value_or(defaultValue);
147+
}
148+
149+
return value;
150+
}
151+
152+
//_________________________________________________________________________________________
153+
154+
void ReferenceComparatorTask::initialize(quality_control::postprocessing::Trigger trigger, framework::ServiceRegistryRef services)
139155
{
140156
// reset all existing objects
141157
mPlotNames.clear();
142158
mReferencePlots.clear();
143159
mHistograms.clear();
144160

145161
auto& qcdb = services.get<repository::DatabaseInterface>();
146-
mNotOlderThan = std::stoi(mCustomParameters.atOptional("notOlderThan").value_or("120"));
147-
mReferenceRun = std::stoi(mCustomParameters.atOptional("referenceRun").value_or("0"));
162+
mNotOlderThan = std::stoi(getCustomParameter(mCustomParameters, "notOlderThan", trigger.activity, "120"));
163+
mReferenceRun = std::stoi(getCustomParameter(mCustomParameters, "referenceRun", trigger.activity, "0"));
164+
165+
ILOG(Info, Devel) << "Reference run set to '" << mReferenceRun << "' for activity " << trigger.activity << ENDM;
148166

149167
// load and initialize the input groups
150168
for (auto group : mConfig.dataGroups) {
@@ -156,7 +174,7 @@ void ReferenceComparatorTask::initialize(quality_control::postprocessing::Trigge
156174
auto fullOutPath = group.outputPath + "/" + path;
157175

158176
// retrieve the reference MO
159-
auto referencePlot = getReferencePlot(qcdb, fullRefPath, t.activity);
177+
auto referencePlot = getReferencePlot(qcdb, fullRefPath, trigger.activity);
160178
if (!referencePlot) {
161179
continue;
162180
}

0 commit comments

Comments
 (0)