LCCD
1.5.0
|
Implementation of ConditionsHandlerBase that reads the conditions data from a special LCIO file. More...
#include <DBFileHandler.hh>
Public Member Functions | |
DBFileHandler (const DBFileHandler &)=delete | |
DBFileHandler & | operator= (const DBFileHandler &)=delete |
DBFileHandler (const std::string &fileName, const std::string &name, const std::string &inputCollection="") | |
Default constructor. More... | |
virtual void | registerDefaultCollection (lcio::LCCollection *col) |
Register a pointer to a default collection which will be passed to the IConditionsChangeListener if no data can be found for a given time stamp. | |
virtual lcio::LCCollection * | defaultCollection () |
The default collection registered with the handler. | |
virtual lcio::LCCollection * | lastValidCollection () |
The last valid collection held by the handler. | |
virtual void | update (LCCDTimeStamp timestamp) |
Reads the event with the conditions data valid for the given time stamp, if: More... | |
Public Member Functions inherited from lccd::ConditionsHandlerBase | |
ConditionsHandlerBase (const ConditionsHandlerBase &)=delete | |
ConditionsHandlerBase & | operator= (const ConditionsHandlerBase &)=delete |
ConditionsHandlerBase (const std::string &name) | |
Default c'tor - need a name for the conditions data set. | |
virtual void | updateEvent (lcio::LCEvent *evt) |
Retrieves the new conditions data if required by evt->getTimestamp() and adds a collection to event with its name. More... | |
virtual lcio::LCCollection * | currentCollection () |
Returns the current collection of conditions data. | |
virtual void | registerChangeListener (IConditionsChangeListener *cl) |
Every IConditionsChangeListener will be notified if the conditions data of this instance has changed. | |
virtual void | removeChangeListener (IConditionsChangeListener *cl) |
Remove the specified listener from list of registered listeners ;. | |
virtual bool | isChangeListenerRegistered (IConditionsChangeListener *cl) |
checks if the changeListner is Registered | |
virtual const std::string | name () |
The name of this conditions handler - used, e.g. More... | |
virtual LCCDTimeStamp | validSince () |
First timestamp for which the current conditions data is valid. | |
virtual LCCDTimeStamp | validTill () |
Last timestamp for which the current conditions data is valid. | |
Protected Member Functions | |
void | init () |
Initializes the validity intervall map from the run header. | |
int | findEventNumber (LCCDTimeStamp timeStamp) |
The conditions event number for the given time stamp. | |
Protected Member Functions inherited from lccd::ConditionsHandlerBase | |
virtual void | notifyListeners () |
Tell all registered listeners that the conditions data has changed. | |
Protected Attributes | |
std::string | _fileName {} |
Name of LCIO input file with conditions data. | |
std::string | _inputCollection {} |
Name of LCCollection in first event. | |
ValidityVector | _valVec {} |
Vector that holds the validity time intervalls for all events. | |
LCReader * | _lcReader = nullptr |
The LCIO input file reader. | |
lcio::LCCollection * | _defaultCollection = nullptr |
The registered default collection. | |
lcio::LCCollection * | _lastValidCollection = nullptr |
The last valid collection of conditions data. More... | |
Protected Attributes inherited from lccd::ConditionsHandlerBase | |
lcio::LCCollection * | _col = nullptr |
The current collection of conditions data. More... | |
std::string | _name {} |
Name assigned with conditions data. | |
LCCDTimeStamp | _validSince {} |
First timestamp for which the current data is valid. More... | |
LCCDTimeStamp | _validTill {} |
Last timestamp for which the current data is valid. More... | |
std::vector < IConditionsChangeListener * > | _changeListeners {} |
The registered change listeners. | |
Implementation of ConditionsHandlerBase that reads the conditions data from a special LCIO file.
The file has to be extracted from a data base beforehand. e.g. with lccd::DBInterface::createDBFile() or created otherwise by fullfilling the following requirements:
consecutive events hold condition collections for consecutive validity time intervalls </lu>
This can be used for example to run a calibration job with a well defined tag of calibration constants from a database without actually having access to the database, e.g. in a grid environment.
In the case where no collection is available for a given time range, the default collection will be set as the present collection, and will be the one returned to the registered IConditionsChangeListener. The previously last valid collection i.e. not the Default Collection, will be held and can be accessed via the method lastValidCollection().
The Default Collection should be set via the method registerDefaultCollection( lcio::LCCollection* col) In the case of no collection found and no Default Collection set an exception will be raised. Only one Default Collection may be registered per Conditions Handler. Trying to register additional Default Collections will cause an lccd::Exception( std::string ) to be thrown.
The default collection may be accessed via the method defaultCollection(), and if so desired this method should be used by the IConditionsChangeListener to verify if this is the collection provided via the call-back method conditionsChanged.
Upon registering an IConditionsChangeListener with the Conditions Handler the call-back method registeredWithHandler( IConditionsHandler* ch ) will be called. Likewise calling removeChangeListener( IConditionsChangeListener* cl) will call the call-back method deRegisteredWithHandler( IConditionsHandler* ch )
lccd::DBFileHandler::DBFileHandler | ( | const std::string & | fileName, |
const std::string & | name, | ||
const std::string & | inputCollection = "" |
||
) |
Default constructor.
You have to specify the following parameters:
fileName,: | the LCIO file that holds the conditions data. |
name,: | of this conditions data set - used, e.g. as collection name in update(LCEvent* evt) |
inputCollection,: | name of collection in input file - if not given the name of this conditions data set is used |
References lccd::ConditionsHandlerBase::_col, _defaultCollection, _inputCollection, _lastValidCollection, and init().
|
virtual |
Reads the event with the conditions data valid for the given time stamp, if:
Implements lccd::ConditionsHandlerBase.
References lccd::ConditionsHandlerBase::_col, _defaultCollection, _fileName, _inputCollection, _lastValidCollection, _lcReader, lccd::ConditionsHandlerBase::_validSince, lccd::ConditionsHandlerBase::_validTill, _valVec, lccd::DBQUERYTIME, lccd::DBSINCE, lccd::DBTILL, findEventNumber(), lccd::ConditionsHandlerBase::name(), and lccd::ConditionsHandlerBase::notifyListeners().
|
protected |
The last valid collection of conditions data.
Referenced by DBFileHandler(), and update().