Belle II Software  release-08-01-10
GlobalParamSet< DBObjType > Class Template Reference

Template class for generic access to DB objects. More...

#include <GlobalParam.h>

Inheritance diagram for GlobalParamSet< DBObjType >:
Collaboration diagram for GlobalParamSet< DBObjType >:

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. More...
 
virtual GlobalParamSetAccessclone () 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? More...
 
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.
 

Detailed Description

template<class DBObjType>
class Belle2::alignment::GlobalParamSet< DBObjType >

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.

Member Function Documentation

◆ is()

bool is ( ) const
inlineinherited

Is this set of given type?

Returns
true if stored set is of given type

Definition at line 144 of file GlobalParam.h.

◆ releaseObject()

virtual TObject* releaseObject ( )
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.


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