Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please consider the following formatting changes to #13554 #41

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions CCDB/include/CCDB/BasicCCDBManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ class CCDBManagerInstance
template <typename T>
T* getForTimeStamp(std::string const& path, long timestamp);

/// retrieve an object of type T from CCDB as stored under path and using the timestamp in the middle of the run
template <typename T>
T* getForRunMiddleTimeStamp(std::string const& path, int runNumber);

/// retrieve an object of type T from CCDB as stored under path, timestamp and metaData
template <typename T>
T* getSpecific(std::string const& path, long timestamp = -1, MD metaData = MD())
Expand Down Expand Up @@ -311,6 +315,19 @@ T* CCDBManagerInstance::getForTimeStamp(std::string const& path, long timestamp)
return ptr;
}

template <typename T>
T* CCDBManagerInstance::getForRunMiddleTimeStamp(std::string const& path, int runNumber)
{
auto [start, stop] = getRunDuration(runNumber);
if (start < 0 || stop < 0) {
if (mFatalWhenNull) {
reportFatal(std::string("Failed to get run duration for run ") + std::to_string(runNumber));
}
return nullptr;
}
return getForTimeStamp<T>(path, start / 2 + stop / 2);
}

class BasicCCDBManager : public CCDBManagerInstance
{
public:
Expand Down
Loading