![]() |
Belle II Software development
|
Template class for generic access to DB objects. More...
#include <GlobalParam.h>
Public Member Functions | |
GlobalParamSet () | |
Constructor. Sets callback for DB object changes. | |
~GlobalParamSet () | |
Destructor. | |
virtual unsigned short | getGlobalUniqueID () const override final |
The DB object unique id in global calibration. | |
virtual double | getGlobalParam (unsigned short element, unsigned short param) override final |
Get global parameter of the DB object by its element and parameter number Note this is not const, it might need to construct the object. | |
virtual void | setGlobalParam (double value, unsigned short element, unsigned short param) override final |
Set global parameter of the DB object by its element and parameter number. | |
virtual std::vector< std::pair< unsigned short, unsigned short > > | listGlobalParams () override final |
List global parameters in this DB object. | |
virtual std::string | getDefaultName () const override final |
Get the DB object default name used by datastore. | |
virtual TObject * | getDBObj () override final |
Get the raw pointer to the stored object WARNING: Use with caution if you really need to access the internal object. | |
GlobalParamSet (const GlobalParamSet< DBObjType > &other) | |
Copy constructor. | |
GlobalParamSet< DBObjType > & | operator= (const GlobalParamSet< DBObjType > &other) |
Assignment operator. | |
virtual TObject * | releaseObject () override final |
Release the DB object from the internal unique pointer to be managed elsewhere (e.g. | |
virtual GlobalParamSetAccess * | clone () override final |
Clone the object, making a copy of the internal object. | |
virtual void | loadFromDBObjPtr () override final |
Load content of the object using DBObjPtr<DBObjType> which will try to load object valid for current EventMetaData Also resets if the object has been changed. | |
virtual void | loadFromDB (EventMetaData event) override final |
Load content of the object valid at given event from DB Also resets if the object has been changed. | |
virtual void | construct () override final |
Construct the internal object using default constructor. | |
virtual bool | isConstructed () const override final |
Is the internal object already constructed? we construct the object on first access to the stored values. | |
virtual void | callbackDB () override final |
Function to call when object has been changed in DB since last loaded TODO Hide and find the class which calls this to make it friend. | |
unsigned short | getGlobalUniqueID () const |
The DB object unique id in global calibration. | |
double | getGlobalParam (unsigned short element, unsigned short param) |
Get global parameter of the DB object by its element and parameter number Note this is not const, it might need to construct the object. | |
void | setGlobalParam (double value, unsigned short element, unsigned short param) |
Set global parameter of the DB object by its element and parameter number. | |
std::vector< std::pair< unsigned short, unsigned short > > | listGlobalParams () |
List global parameters in this DB object. | |
unsigned short | getGlobalUniqueID () const |
The DB object unique id in global calibration. | |
double | getGlobalParam (unsigned short element, unsigned short param) |
Get global parameter of the DB object by its element and parameter number Note this is not const, it might need to construct the object. | |
void | setGlobalParam (double value, unsigned short element, unsigned short param) |
Set global parameter of the DB object by its element and parameter number. | |
std::vector< std::pair< unsigned short, unsigned short > > | listGlobalParams () |
List global parameters in this DB object. | |
virtual void | updateGlobalParam (double correction, unsigned short element, unsigned short param) |
Sum value of global element param with a correction. | |
virtual bool | hasBeenChangedInDB (bool resetChangedState=true) final |
Has the object been updated in DB since GlobalParamSet<...> has been constructed? Since last call to this function with resetChangedState=true. | |
template<class DBObjType > | |
bool | is () const |
Is this set of given type? | |
bool | empty () |
Is this set empty or otherwise 'invalid' to identify null sets, end of hierarchy. | |
operator bool () | |
Tentative operator to quickly check the set Returns true when the set is not empty() and the DB object is constructed and can be accessed. | |
Protected Attributes | |
bool | m_hasBeenChangedInDB {false} |
Flag for object changed in DB. | |
Private Member Functions | |
void | ensureConstructed () |
Function to construct the object if not already done. | |
Private Attributes | |
std::unique_ptr< DBObjType > | m_object {} |
The internal DB object. | |
Template class for generic access to DB objects.
Use to access any global calibration DB object, e.g.
GlobalParamSet<BeamSpot> params; params.setGlobalParam(0.0012, 0, 1);
will set X-postion of BeamSpot vertex to 0.0012
Definition at line 186 of file GlobalParam.h.
|
inline |
Constructor. Sets callback for DB object changes.
Definition at line 190 of file GlobalParam.h.
|
inline |
Destructor.
Definition at line 199 of file GlobalParam.h.
|
inline |
Copy constructor.
Definition at line 224 of file GlobalParam.h.
|
inlinefinaloverridevirtual |
Function to call when object has been changed in DB since last loaded TODO Hide and find the class which calls this to make it friend.
Reimplemented from GlobalParamSetAccess.
Definition at line 294 of file GlobalParam.h.
|
inlinefinaloverridevirtual |
Clone the object, making a copy of the internal object.
Implements GlobalParamSetAccess.
Definition at line 254 of file GlobalParam.h.
|
inlinefinaloverridevirtual |
Construct the internal object using default constructor.
Implements GlobalParamSetAccess.
Definition at line 287 of file GlobalParam.h.
|
inlineinherited |
Is this set empty or otherwise 'invalid' to identify null sets, end of hierarchy.
Definition at line 148 of file GlobalParam.h.
|
inlineprivate |
Function to construct the object if not already done.
Definition at line 301 of file GlobalParam.h.
|
inlinefinaloverridevirtual |
Get the raw pointer to the stored object WARNING: Use with caution if you really need to access the internal object.
Implements GlobalParamSetAccess.
Definition at line 215 of file GlobalParam.h.
|
inlinefinaloverridevirtual |
Get the DB object default name used by datastore.
Implements GlobalParamSetAccess.
Definition at line 211 of file GlobalParam.h.
|
virtual |
Get global parameter of the DB object by its element and parameter number Note this is not const, it might need to construct the object.
Implements GlobalParamSetAccess.
|
virtual |
Get global parameter of the DB object by its element and parameter number Note this is not const, it might need to construct the object.
Implements GlobalParamSetAccess.
Definition at line 34 of file GlobalParam.cc.
|
inlinefinaloverridevirtual |
Get global parameter of the DB object by its element and parameter number Note this is not const, it might need to construct the object.
Implements GlobalParamSetAccess.
Definition at line 205 of file GlobalParam.h.
|
virtual |
The DB object unique id in global calibration.
Implements GlobalParamSetAccess.
|
virtual |
The DB object unique id in global calibration.
Implements GlobalParamSetAccess.
Definition at line 30 of file GlobalParam.cc.
|
inlinefinaloverridevirtual |
The DB object unique id in global calibration.
Implements GlobalParamSetAccess.
Definition at line 202 of file GlobalParam.h.
|
inlinefinalvirtualinherited |
Has the object been updated in DB since GlobalParamSet<...> has been constructed? Since last call to this function with resetChangedState=true.
Definition at line 137 of file GlobalParam.h.
|
inlineinherited |
Is this set of given type?
Definition at line 144 of file GlobalParam.h.
|
inlinefinaloverridevirtual |
Is the internal object already constructed? we construct the object on first access to the stored values.
Implements GlobalParamSetAccess.
Definition at line 290 of file GlobalParam.h.
|
virtual |
List global parameters in this DB object.
Implements GlobalParamSetAccess.
|
virtual |
List global parameters in this DB object.
Implements GlobalParamSetAccess.
Definition at line 68 of file GlobalParam.cc.
|
inlinefinaloverridevirtual |
List global parameters in this DB object.
Implements GlobalParamSetAccess.
Definition at line 209 of file GlobalParam.h.
|
inlinefinaloverridevirtual |
Load content of the object valid at given event from DB Also resets if the object has been changed.
Implements GlobalParamSetAccess.
Definition at line 273 of file GlobalParam.h.
|
inlinefinaloverridevirtual |
Load content of the object using DBObjPtr<DBObjType> which will try to load object valid for current EventMetaData Also resets if the object has been changed.
Implements GlobalParamSetAccess.
Definition at line 262 of file GlobalParam.h.
|
inlineinherited |
Tentative operator to quickly check the set Returns true when the set is not empty() and the DB object is constructed and can be accessed.
Definition at line 167 of file GlobalParam.h.
|
inline |
Assignment operator.
Definition at line 233 of file GlobalParam.h.
|
inlinefinaloverridevirtual |
Release the DB object from the internal unique pointer to be managed elsewhere (e.g.
stored to the DB and deleted by it)
Implements GlobalParamSetAccess.
Definition at line 247 of file GlobalParam.h.
|
virtual |
Set global parameter of the DB object by its element and parameter number.
Implements GlobalParamSetAccess.
|
virtual |
Set global parameter of the DB object by its element and parameter number.
Implements GlobalParamSetAccess.
Definition at line 50 of file GlobalParam.cc.
|
inlinefinaloverridevirtual |
Set global parameter of the DB object by its element and parameter number.
Implements GlobalParamSetAccess.
Definition at line 207 of file GlobalParam.h.
|
inlinevirtualinherited |
Sum value of global element param with a correction.
Definition at line 112 of file GlobalParam.h.
|
protectedinherited |
Flag for object changed in DB.
Definition at line 174 of file GlobalParam.h.
|
private |
The internal DB object.
Definition at line 299 of file GlobalParam.h.