Skip to content

Commit 39489be

Browse files
authored
CCDB: add getSpecificForRun (#13569)
* CCDB: add getSpecificForRun This PR adds a method `getSpecificForRun` to the base CCDB manager class. It is specifically tailored for analysis use in which the reconstruction pass is checked.
1 parent eaba5c2 commit 39489be

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

CCDB/include/CCDB/BasicCCDBManager.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ class CCDBManagerInstance
115115
return getForTimeStamp<T>(path, timestamp);
116116
}
117117

118+
/// retrieve an object of type T from CCDB as stored under path and using the timestamp in the middle of the run + metadata. The run number is provided separately to conform to typical analysis use (in which case metadata does not include runNumber)
119+
template <typename T>
120+
T* getSpecificForRun(std::string const& path, int runNumber, MD metaData = MD());
121+
118122
/// detect online processing modes (i.e. CCDB objects may be updated in the lifetime of the manager)
119123
bool isOnline() const { return mDeplMode == o2::framework::DeploymentMode::OnlineAUX || mDeplMode == o2::framework::DeploymentMode::OnlineDDS || mDeplMode == o2::framework::DeploymentMode::OnlineECS; }
120124

@@ -317,6 +321,14 @@ T* CCDBManagerInstance::getForTimeStamp(std::string const& path, long timestamp)
317321

318322
template <typename T>
319323
T* CCDBManagerInstance::getForRun(std::string const& path, int runNumber, bool setRunMetadata)
324+
{
325+
auto metaData = setRunMetadata ? MD{{"runNumber", std::to_string(runNumber)}} : MD{};
326+
mMetaData = metaData;
327+
return getSpecificForRun<T>(path, runNumber, metaData);
328+
}
329+
330+
template <typename T>
331+
T* CCDBManagerInstance::getSpecificForRun(std::string const& path, int runNumber, MD metaData)
320332
{
321333
auto [start, stop] = getRunDuration(runNumber);
322334
if (start < 0 || stop < 0) {
@@ -325,8 +337,7 @@ T* CCDBManagerInstance::getForRun(std::string const& path, int runNumber, bool s
325337
}
326338
return nullptr;
327339
}
328-
mMetaData = setRunMetadata ? MD{{"runNumber", std::to_string(runNumber)}} : MD{};
329-
return getForTimeStamp<T>(path, start / 2 + stop / 2);
340+
return getSpecific<T>(path, start / 2 + stop / 2, metaData);
330341
}
331342

332343
class BasicCCDBManager : public CCDBManagerInstance

0 commit comments

Comments
 (0)