Belle II Software development
|
The central user class to manipulate any global constant in any DB object Used to retrieve global parameters from database and access the for update. More...
#include <GlobalParam.h>
Public Member Functions | |
GlobalParamVector (const std::vector< std::string > &components={}) | |
Constructor. | |
~GlobalParamVector () | |
Destructor. | |
void | construct () |
Construct all DB objects using default constructors (should be filled with zeros) | |
GlobalParamVector & | operator+= (GlobalParamVector &rhs) |
TODO: operator += to sum two global vectors. | |
void | addSubDetectorInterface (std::shared_ptr< IGlobalParamInterface > interface={}) |
Add a generic interface (cannot be disabled by 'components' in constructor) | |
template<class DBObjType > | |
void | addDBObj (std::shared_ptr< IGlobalParamInterface > interface={}) |
Add a DB object to the vector, optionally with interface. | |
bool | hasBeenChangedInDB (const std::set< unsigned short > &subset, bool resetChangedState=true) |
Has any DB object in vector changed from last call to this function. | |
bool | hasBeenChangedInDB (const std::set< unsigned short > &subset={}) |
Const version which does not change the state. | |
void | updateGlobalParam (double difference, unsigned short uniqueID, unsigned short element, unsigned short param) |
Add 'difference' to param value. | |
void | setGlobalParam (double value, unsigned short uniqueID, unsigned short element, unsigned short param) |
Set param value. | |
double | getGlobalParam (unsigned short uniqueID, unsigned short element, unsigned short param) |
Get parameter value. | |
std::vector< std::tuple< unsigned short, unsigned short, unsigned short > > | listGlobalParams () |
Create vector of all global parameters maintained by GlobalParamVector. | |
std::vector< TObject * > | releaseObjects (bool onlyConstructed=true) |
Get the vector of raw pointers to DB objects Caller takes the ownership of the objects and has to delete them Use for passing the objects to store in DB (not deleted after GlobalParamVector goes out of scope) | |
void | loadFromDB () |
Load content of all objects in vector with values valid at current EventMetaData Uses DBObjPtr<DBObjType> to access current data. | |
void | loadFromDB (const EventMetaData &event) |
Load content of all objects in vector with values valid for given exp/run/event. | |
void | postReadFromResult (std::vector< std::tuple< unsigned short, unsigned short, unsigned short, double > > &result) |
Function calling interfaces to do post processing after reading millepede result into GlobalParamVector. | |
void | postHierarchyChanged (GlobalDerivativesHierarchy &hierarchy) |
Function calling interfaces to build alignment hierarchy after constants changed in DB. | |
template<class DBObjType > | |
DBObjType * | getDBObj () |
Get the raw pointer toa stored object WARNING: Use with caution, returns nullptr if object not registered (e.g. | |
template<class DBObjType > | |
GlobalParamSetAccess & | getGlobalParamSet () |
Get reference to the underlying DB object container You should check the container. | |
const std::map< unsigned short, std::unique_ptr< GlobalParamSetAccess > > & | getGlobalParamSets () const |
Get map of all contained parameter sets, key = unique id of the set (DB object) | |
const std::vector< std::shared_ptr< IGlobalParamInterface > > & | getSubDetectorInterfaces () const |
Get the vector of added interfaces to subdetectors. | |
std::set< unsigned short > | getComponentsIDs () const |
Get set of unique ids of all db objects considered. | |
Public Attributes | |
GlobalParamSet< EmptyGlobalParamSet > | c_emptyGlobalParamSet {} |
An empty set to which reference is returned if DB object not found Also used e.g. | |
Private Attributes | |
std::map< unsigned short, std::unique_ptr< GlobalParamSetAccess > > | m_vector {} |
The vector (well, actually a map) of DB objects. | |
std::vector< std::shared_ptr< IGlobalParamInterface > > | m_subDetectorInterfacesVector {} |
Vector of interfaces to run at specific points in the workflow. | |
std::vector< std::string > | m_components {} |
Vector of names of DB objects to consider in the vector - if not here and non-empy, ignored by addDBObj() | |
std::set< unsigned short > | m_componentsIDs {} |
Vector of UniqueIDs of DB objects to consider in the vector. | |
The central user class to manipulate any global constant in any DB object Used to retrieve global parameters from database and access the for update.
Finally all objects can be released for storing in the DB. NOTE the objects are not constructed (an thus quite some memory is saved) until you access them. But the monitoring of changes in DB starts since addDBObj<...>() TODO correct constness to not construct on listGlobalParams()
Definition at line 327 of file GlobalParam.h.
|
explicit |
Constructor.
components | vector of string with DB objects default names in the global vector If empty, any component is included by default. |
Definition at line 76 of file GlobalParam.cc.
|
inline |
|
inline |
Add a DB object to the vector, optionally with interface.
interface | shared pointer to an interface added only if this DB object is listed in 'components' or 'components' not specified Does nothing if DB object type already added |
Definition at line 371 of file GlobalParam.h.
|
inline |
Add a generic interface (cannot be disabled by 'components' in constructor)
Definition at line 357 of file GlobalParam.h.
void construct | ( | ) |
Construct all DB objects using default constructors (should be filled with zeros)
Definition at line 147 of file GlobalParam.cc.
|
inline |
Get set of unique ids of all db objects considered.
Definition at line 483 of file GlobalParam.h.
|
inline |
Get the raw pointer toa stored object WARNING: Use with caution, returns nullptr if object not registered (e.g.
disabled via 'components')
Definition at line 449 of file GlobalParam.h.
double getGlobalParam | ( | unsigned short | uniqueID, |
unsigned short | element, | ||
unsigned short | param | ||
) |
Get parameter value.
uniqueID | uinique id of the DB object |
element | id of the element with params inside DB object |
param | id of the parameter of the element |
Definition at line 96 of file GlobalParam.cc.
|
inline |
Get reference to the underlying DB object container You should check the container.
Definition at line 462 of file GlobalParam.h.
|
inline |
Get map of all contained parameter sets, key = unique id of the set (DB object)
Definition at line 471 of file GlobalParam.h.
|
inline |
Get the vector of added interfaces to subdetectors.
Definition at line 477 of file GlobalParam.h.
|
inline |
Has any DB object in vector changed from last call to this function.
subset | set of unique ids of objects we are interested |
resetChangedState | should this call result in hasBeenChangedInDB=true? |
Definition at line 387 of file GlobalParam.h.
|
inline |
Const version which does not change the state.
Definition at line 403 of file GlobalParam.h.
std::vector< std::tuple< short unsigned int, short unsigned int, short unsigned int > > listGlobalParams | ( | ) |
Create vector of all global parameters maintained by GlobalParamVector.
Definition at line 107 of file GlobalParam.cc.
void loadFromDB | ( | ) |
Load content of all objects in vector with values valid at current EventMetaData Uses DBObjPtr<DBObjType> to access current data.
Definition at line 128 of file GlobalParam.cc.
void loadFromDB | ( | const EventMetaData & | event | ) |
Load content of all objects in vector with values valid for given exp/run/event.
Definition at line 134 of file GlobalParam.cc.
|
inline |
TODO: operator += to sum two global vectors.
Definition at line 345 of file GlobalParam.h.
void postHierarchyChanged | ( | GlobalDerivativesHierarchy & | hierarchy | ) |
Function calling interfaces to build alignment hierarchy after constants changed in DB.
Definition at line 140 of file GlobalParam.cc.
void postReadFromResult | ( | std::vector< std::tuple< unsigned short, unsigned short, unsigned short, double > > & | result | ) |
Function calling interfaces to do post processing after reading millepede result into GlobalParamVector.
Definition at line 153 of file GlobalParam.cc.
std::vector< TObject * > releaseObjects | ( | bool | onlyConstructed = true | ) |
Get the vector of raw pointers to DB objects Caller takes the ownership of the objects and has to delete them Use for passing the objects to store in DB (not deleted after GlobalParamVector goes out of scope)
onlyConstructed | if true, only returns objects which have been actually constructed Objects are not constructed until accessed or copied from DB (or constructed explicitly) |
Definition at line 117 of file GlobalParam.cc.
void setGlobalParam | ( | double | value, |
unsigned short | uniqueID, | ||
unsigned short | element, | ||
unsigned short | param | ||
) |
Set param value.
value | value to set |
uniqueID | uinique id of the DB object |
element | id of the element with params inside DB object |
param | id of the parameter of the element |
Definition at line 85 of file GlobalParam.cc.
void updateGlobalParam | ( | double | difference, |
unsigned short | uniqueID, | ||
unsigned short | element, | ||
unsigned short | param | ||
) |
Add 'difference' to param value.
difference | value to add to current value |
uniqueID | uinique id of the DB object |
element | id of the element with params inside DB object |
param | id of the parameter of the element |
Definition at line 78 of file GlobalParam.cc.
GlobalParamSet<EmptyGlobalParamSet> c_emptyGlobalParamSet {} |
An empty set to which reference is returned if DB object not found Also used e.g.
to terminate hierarchy
Definition at line 331 of file GlobalParam.h.
|
private |
Vector of names of DB objects to consider in the vector - if not here and non-empy, ignored by addDBObj()
Definition at line 496 of file GlobalParam.h.
|
private |
Vector of UniqueIDs of DB objects to consider in the vector.
Definition at line 498 of file GlobalParam.h.
|
private |
Vector of interfaces to run at specific points in the workflow.
Definition at line 494 of file GlobalParam.h.
|
private |
The vector (well, actually a map) of DB objects.
Definition at line 492 of file GlobalParam.h.