LCCD  1.5.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
lccd::DBFileHandler Class Reference

Implementation of ConditionsHandlerBase that reads the conditions data from a special LCIO file. More...

#include <DBFileHandler.hh>

Inheritance diagram for lccd::DBFileHandler:
lccd::ConditionsHandlerBase lccd::IConditionsHandler

Public Member Functions

 DBFileHandler (const DBFileHandler &)=delete
 
DBFileHandleroperator= (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
 
ConditionsHandlerBaseoperator= (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.
 

Detailed Description

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:

Constructor & Destructor Documentation

lccd::DBFileHandler::DBFileHandler ( const std::string &  fileName,
const std::string &  name,
const std::string &  inputCollection = "" 
)

Default constructor.

You have to specify the following parameters:

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().

Member Function Documentation

void lccd::DBFileHandler::update ( LCCDTimeStamp  timestamp)
virtual

Reads the event with the conditions data valid for the given time stamp, if:

  • the time stamp lies outside the validity range of the current collection
  • and there is an event in the file that has a corresponding validity range as defined by the string vector parameters DBSince and DBTill in the run header </lu> Note in the case that no valid collection is available for timeStamp, the default collection will be sent if registered, otherwise an exception will be thrown which can not be caught in user code. If sent the default collection will have the following attributes attached as collection parameters: DBSINCE, DBTILL and DBQUERYTIME

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().

Member Data Documentation

lcio::LCCollection* lccd::DBFileHandler::_lastValidCollection = nullptr
protected

The last valid collection of conditions data.

Referenced by DBFileHandler(), and update().


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