Skip to content

Commit

Permalink
- Keep the activity parameter but document it
Browse files Browse the repository at this point in the history
- use size_t for the run number
- use Timestamp::Latest
  • Loading branch information
Barthelemy committed Jul 5, 2024
1 parent 3da5995 commit da17738
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
7 changes: 6 additions & 1 deletion Framework/include/QualityControl/CheckInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,12 @@ class CheckInterface : public core::UserCodeInterface

/// \brief Retrieve a reference plot at the provided path, matching the give activity and for the provided run.
/// the activity is the current one, while the run number is the reference run.
std::shared_ptr<MonitorObject> retrieveReference(std::string path, int referenceRun, Activity activity);
///
/// \param path path to the object (no provenance)
/// \param referenceRun Run number of the reference data
/// \param activity Current activity (necessary for the provenance and the pass)
/// \return
std::shared_ptr<MonitorObject> retrieveReference(std::string path, size_t referenceRun, Activity activity);

private:
std::shared_ptr<o2::quality_control::repository::DatabaseInterface> mDatabase;
Expand Down
15 changes: 2 additions & 13 deletions Framework/include/QualityControl/ReferenceUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,13 @@ namespace o2::quality_control::checker
// Get the reference plot for a given MonitorObject path

static std::shared_ptr<quality_control::core::MonitorObject> getReferencePlot(quality_control::repository::DatabaseInterface* qcdb, std::string& fullPath,
int referenceRun, quality_control::core::Activity activity)
size_t referenceRun, core::Activity activity)
{
uint64_t timeStamp = 0;
activity.mId = referenceRun;
const auto filterMetadata = quality_control::core::activity_helpers::asDatabaseMetadata(activity, false);
const auto objectValidity = qcdb->getLatestObjectValidity(activity.mProvenance + "/" + fullPath, filterMetadata);
if (objectValidity.isValid()) {
timeStamp = objectValidity.getMax() - 1;
} else {
ILOG(Warning, Devel) << "Could not find the object '" << fullPath << "' for run " << activity.mId << ENDM;
return nullptr;
}

auto [success, path, name] = o2::quality_control::core::RepoPathUtils::splitObjectPath(fullPath);
if (!success) {
return nullptr;
}
return qcdb->retrieveMO(path, name, timeStamp, activity);
return qcdb->retrieveMO(path, name, repository::DatabaseInterface::Timestamp::Latest, activity);
}

} // namespace o2::quality_control::checker
Expand Down
2 changes: 1 addition & 1 deletion Framework/src/CheckInterface.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void CheckInterface::endOfActivity(const Activity& activity)
// noop, override it if you want.
}

shared_ptr<MonitorObject> CheckInterface::retrieveReference(std::string path, int referenceRun, Activity activity)
shared_ptr<MonitorObject> CheckInterface::retrieveReference(std::string path, size_t referenceRun, Activity activity)
{
return o2::quality_control::checker::getReferencePlot(mDatabase.get(), path, referenceRun, activity);
}
Expand Down

0 comments on commit da17738

Please sign in to comment.