Project
Loading...
Searching...
No Matches
o2::ccdb::CCDBManagerInstance Class Reference

#include <BasicCCDBManager.h>

Inherited by o2::ccdb::BasicCCDBManager.

Public Types

using MD = std::map< std::string, std::string >
 

Public Member Functions

 CCDBManagerInstance (std::string const &path)
 
void setURL (const std::string &url)
 set a URL to query from
 
void setTimestamp (long t)
 set timestamp cache for all queries
 
std::string const & getURL () const
 query current URL
 
long getTimestamp () const
 query timestamp
 
template<typename T >
T * getForTimeStamp (std::string const &path, long timestamp)
 retrieve an object of type T from CCDB as stored under path and timestamp
 
template<typename T >
T * getForRun (std::string const &path, int runNumber, bool setRunMetadata=false)
 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 * getSpecific (std::string const &path, long timestamp=-1, MD metaData=MD())
 retrieve an object of type T from CCDB as stored under path, timestamp and metaData
 
template<typename T >
T * getSpecificForRun (std::string const &path, int runNumber, MD metaData=MD())
 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)
 
bool isOnline () const
 detect online processing modes (i.e. CCDB objects may be updated in the lifetime of the manager)
 
template<typename T >
T * get (std::string const &path)
 retrieve an object of type T from CCDB as stored under path; will use the timestamp member
 
bool isHostReachable () const
 
void clearCache ()
 clear all entries in the cache
 
void clearCache (std::string const &path)
 clear particular entry in the cache
 
bool isCachingEnabled () const
 check if caching is enabled
 
void setCaching (bool v)
 disable or enable caching
 
bool isCachedObjectValid (std::string const &path, long timestamp)
 Check if an object in cache is valid.
 
bool isLocalObjectValidityCheckingEnabled () const
 check if checks of object validity before CCDB query is enabled
 
void setLocalObjectValidityChecking (bool v=true)
 set the flag to check object validity before CCDB query
 
void setCreatedNotAfter (long v)
 set the object upper validity limit
 
long getCreatedNotAfter () const
 get the object upper validity limit
 
void resetCreatedNotAfter ()
 reset the object upper validity limit
 
void setCreatedNotBefore (long v)
 set the object upper validity limit
 
long getCreatedNotBefore () const
 get the object upper validity limit
 
void resetCreatedNotBefore ()
 reset the object upper validity limit
 
bool getFatalWhenNull () const
 get the fatalWhenNull state
 
void setFatalWhenNull (bool b)
 set the fatal property (when false; nullptr object responses will not abort)
 
std::pair< int64_t, int64_t > getRunDuration (int runnumber, bool fatal=true)
 
std::string getSummaryString () const
 
size_t getFetchedSize () const
 
void report (bool longrep=false)
 
void endOfStream ()
 

Static Public Member Functions

static std::pair< int64_t, int64_t > getRunDuration (o2::ccdb::CcdbApi const &api, int runnumber, bool fatal=true)
 
static std::pair< int64_t, int64_t > getRunDuration (const MD &headers)
 

Detailed Description

A simple class offering simplified access to CCDB (mainly for MC simulation) The class encapsulates timestamp and URL and is easily usable from detector code.

The CDBManager allowing caching of retrieved objects is by definition not thread safe, therefore, to provide a possibility of multithread processing, one should foresee possibility of multiple instances of the manager. CCDBManagerInstance serves to this purpose

In cases where caching is not needed or just 1 instance of the manager is enough, one case use a singleton version BasicCCDBManager

Definition at line 45 of file BasicCCDBManager.h.

Member Typedef Documentation

◆ MD

using o2::ccdb::CCDBManagerInstance::MD = std::map<std::string, std::string>

Definition at line 77 of file BasicCCDBManager.h.

Constructor & Destructor Documentation

◆ CCDBManagerInstance()

o2::ccdb::CCDBManagerInstance::CCDBManagerInstance ( std::string const &  path)
inline

Definition at line 79 of file BasicCCDBManager.h.

Member Function Documentation

◆ clearCache() [1/2]

void o2::ccdb::CCDBManagerInstance::clearCache ( )
inline

clear all entries in the cache

Definition at line 135 of file BasicCCDBManager.h.

◆ clearCache() [2/2]

void o2::ccdb::CCDBManagerInstance::clearCache ( std::string const &  path)
inline

clear particular entry in the cache

Definition at line 138 of file BasicCCDBManager.h.

◆ endOfStream()

void o2::ccdb::CCDBManagerInstance::endOfStream ( )

Definition at line 131 of file BasicCCDBManager.cxx.

◆ get()

template<typename T >
T * o2::ccdb::CCDBManagerInstance::get ( std::string const &  path)
inline

retrieve an object of type T from CCDB as stored under path; will use the timestamp member

Definition at line 127 of file BasicCCDBManager.h.

◆ getCreatedNotAfter()

long o2::ccdb::CCDBManagerInstance::getCreatedNotAfter ( ) const
inline

get the object upper validity limit

Definition at line 171 of file BasicCCDBManager.h.

◆ getCreatedNotBefore()

long o2::ccdb::CCDBManagerInstance::getCreatedNotBefore ( ) const
inline

get the object upper validity limit

Definition at line 180 of file BasicCCDBManager.h.

◆ getFatalWhenNull()

bool o2::ccdb::CCDBManagerInstance::getFatalWhenNull ( ) const
inline

get the fatalWhenNull state

Definition at line 186 of file BasicCCDBManager.h.

◆ getFetchedSize()

size_t o2::ccdb::CCDBManagerInstance::getFetchedSize ( ) const
inline

Definition at line 200 of file BasicCCDBManager.h.

◆ getForRun()

template<typename T >
T * o2::ccdb::CCDBManagerInstance::getForRun ( std::string const &  path,
int  runNumber,
bool  setRunMetadata = false 
)

retrieve an object of type T from CCDB as stored under path and using the timestamp in the middle of the run

Definition at line 323 of file BasicCCDBManager.h.

◆ getForTimeStamp()

template<typename T >
T * o2::ccdb::CCDBManagerInstance::getForTimeStamp ( std::string const &  path,
long  timestamp 
)

retrieve an object of type T from CCDB as stored under path and timestamp

Definition at line 231 of file BasicCCDBManager.h.

◆ getRunDuration() [1/3]

static std::pair< int64_t, int64_t > o2::ccdb::CCDBManagerInstance::getRunDuration ( const MD headers)
static

◆ getRunDuration() [2/3]

std::pair< int64_t, int64_t > o2::ccdb::CCDBManagerInstance::getRunDuration ( int  runnumber,
bool  fatal = true 
)

A convenience function for MC to fetch valid start and end timestamps for recorded TF data given an ALICE run number. In absence of STF/ETF fields in the RCT with fall back to CTP SOX/EOX then to ECS SOR/EOR. On error it fatals (if fatal == true) or else returns the pair -1, -1.

Definition at line 78 of file BasicCCDBManager.cxx.

◆ getRunDuration() [3/3]

std::pair< int64_t, int64_t > o2::ccdb::CCDBManagerInstance::getRunDuration ( o2::ccdb::CcdbApi const &  api,
int  runnumber,
bool  fatal = true 
)
static

Definition at line 68 of file BasicCCDBManager.cxx.

◆ getSpecific()

template<typename T >
T * o2::ccdb::CCDBManagerInstance::getSpecific ( std::string const &  path,
long  timestamp = -1,
MD  metaData = MD() 
)
inline

retrieve an object of type T from CCDB as stored under path, timestamp and metaData

Definition at line 111 of file BasicCCDBManager.h.

◆ getSpecificForRun()

template<typename T >
T * o2::ccdb::CCDBManagerInstance::getSpecificForRun ( std::string const &  path,
int  runNumber,
MD  metaData = MD() 
)

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)

Definition at line 331 of file BasicCCDBManager.h.

◆ getSummaryString()

std::string o2::ccdb::CCDBManagerInstance::getSummaryString ( ) const

Definition at line 100 of file BasicCCDBManager.cxx.

◆ getTimestamp()

long o2::ccdb::CCDBManagerInstance::getTimestamp ( ) const
inline

query timestamp

Definition at line 99 of file BasicCCDBManager.h.

◆ getURL()

std::string const & o2::ccdb::CCDBManagerInstance::getURL ( ) const
inline

query current URL

Definition at line 96 of file BasicCCDBManager.h.

◆ isCachedObjectValid()

bool o2::ccdb::CCDBManagerInstance::isCachedObjectValid ( std::string const &  path,
long  timestamp 
)
inline

Check if an object in cache is valid.

Definition at line 153 of file BasicCCDBManager.h.

◆ isCachingEnabled()

bool o2::ccdb::CCDBManagerInstance::isCachingEnabled ( ) const
inline

check if caching is enabled

Definition at line 141 of file BasicCCDBManager.h.

◆ isHostReachable()

bool o2::ccdb::CCDBManagerInstance::isHostReachable ( ) const
inline

Definition at line 132 of file BasicCCDBManager.h.

◆ isLocalObjectValidityCheckingEnabled()

bool o2::ccdb::CCDBManagerInstance::isLocalObjectValidityCheckingEnabled ( ) const
inline

check if checks of object validity before CCDB query is enabled

Definition at line 162 of file BasicCCDBManager.h.

◆ isOnline()

bool o2::ccdb::CCDBManagerInstance::isOnline ( ) const
inline

detect online processing modes (i.e. CCDB objects may be updated in the lifetime of the manager)

Definition at line 123 of file BasicCCDBManager.h.

◆ report()

void o2::ccdb::CCDBManagerInstance::report ( bool  longrep = false)

Definition at line 120 of file BasicCCDBManager.cxx.

◆ resetCreatedNotAfter()

void o2::ccdb::CCDBManagerInstance::resetCreatedNotAfter ( )
inline

reset the object upper validity limit

Definition at line 174 of file BasicCCDBManager.h.

◆ resetCreatedNotBefore()

void o2::ccdb::CCDBManagerInstance::resetCreatedNotBefore ( )
inline

reset the object upper validity limit

Definition at line 183 of file BasicCCDBManager.h.

◆ setCaching()

void o2::ccdb::CCDBManagerInstance::setCaching ( bool  v)
inline

disable or enable caching

Definition at line 144 of file BasicCCDBManager.h.

◆ setCreatedNotAfter()

void o2::ccdb::CCDBManagerInstance::setCreatedNotAfter ( long  v)
inline

set the object upper validity limit

Definition at line 168 of file BasicCCDBManager.h.

◆ setCreatedNotBefore()

void o2::ccdb::CCDBManagerInstance::setCreatedNotBefore ( long  v)
inline

set the object upper validity limit

Definition at line 177 of file BasicCCDBManager.h.

◆ setFatalWhenNull()

void o2::ccdb::CCDBManagerInstance::setFatalWhenNull ( bool  b)
inline

set the fatal property (when false; nullptr object responses will not abort)

Definition at line 188 of file BasicCCDBManager.h.

◆ setLocalObjectValidityChecking()

void o2::ccdb::CCDBManagerInstance::setLocalObjectValidityChecking ( bool  v = true)
inline

set the flag to check object validity before CCDB query

Definition at line 165 of file BasicCCDBManager.h.

◆ setTimestamp()

void o2::ccdb::CCDBManagerInstance::setTimestamp ( long  t)
inline

set timestamp cache for all queries

Definition at line 88 of file BasicCCDBManager.h.

◆ setURL()

void o2::ccdb::CCDBManagerInstance::setURL ( const std::string &  url)

set a URL to query from

Definition at line 25 of file BasicCCDBManager.cxx.


The documentation for this class was generated from the following files: