Belle II Software  release-08-01-10
GlobalDerivativesHierarchy Class Referenceabstract

Class for alignment/calibration parameter hierarchy & constraints. More...

#include <Hierarchy.h>

Inheritance diagram for GlobalDerivativesHierarchy:
Collaboration diagram for GlobalDerivativesHierarchy:

Public Member Functions

 GlobalDerivativesHierarchy ()
 Constructor.
 
virtual ~GlobalDerivativesHierarchy ()
 Destructor (virtual)
 
void buildConstraints (Constraints &constraints)
 Adds constraints from current hierarchy to a constraints vector.
 
GlobalDerivativeSet buildGlobalDerivativesHierarchy (TMatrixD matrixChain, DetectorLevelElement child)
 Recursive function which adds labels and derivatives until top element in hierarchy is found.
 
template<class ChildDBObjectType , class MotherDBObjectType >
void insert (unsigned short child, unsigned short mother, TMatrixD childToMotherParamTransform)
 Template function to add relation between two elements (possibly in different objects with constants) First object is the child object, second its hierarchy parent. More...
 
void printHierarchy ()
 print the lookup map
 
virtual std::vector< int > getElementLabels (DetectorLevelElement element)=0
 The only function to implement: what are the global labels for the element?
 
const std::set< unsigned short > & getUsedDBObjUniqueIDs ()
 Get the global unique ids of DB objects used to construct hierarchy Usefull to update hierarchy only when those changed.
 

Static Public Member Functions

static void mergeGlobals (GlobalDerivativeSet &main, GlobalDerivativeSet additional)
 Merge additional set into main set of global labels and derivatives TODO: move to some utilities.
 

Private Member Functions

std::pair< DetectorLevelElement, TMatrixD > getChildToMotherTransform (DetectorLevelElement child)
 Find the transformation in the lookup.
 

Private Attributes

std::map< DetectorLevelElement, std::pair< DetectorLevelElement, TMatrixD > > m_lookup
 Map with all the parameter data (child -> (mother, transform_child2mother))
 
std::map< DetectorLevelElement, std::vector< DetectorLevelElement > > m_hierarchy
 Map of hierarchy relations mother-> child.
 
std::set< unsigned short > m_usedUniqueIDs {}
 The set of unique id of each DB object used for construction For more efficient updates of hierarchy only when used objects change.
 

Detailed Description

Class for alignment/calibration parameter hierarchy & constraints.

Definition at line 41 of file Hierarchy.h.

Member Function Documentation

◆ insert()

void insert ( unsigned short  child,
unsigned short  mother,
TMatrixD  childToMotherParamTransform 
)
inline

Template function to add relation between two elements (possibly in different objects with constants) First object is the child object, second its hierarchy parent.

Parameters
childis the lement numeric id in child obj
motheris the parent object
childToMotherParamTransformis the transformation matrix (placement from geometry of the detector)

Definition at line 60 of file Hierarchy.h.

61  {
62  auto childUID = std::make_pair(ChildDBObjectType::getGlobalUniqueID(), child);
63  auto parentUID = std::make_pair(MotherDBObjectType::getGlobalUniqueID(), mother);
64 
65  if (m_lookup.insert(std::make_pair(childUID, std::make_pair(parentUID, childToMotherParamTransform))).second) {
66  // Just inserted an child element (so each child is inserted exactly once)
67  // Try to insert parent with empty vect (does nothing if parent already in map)
68  m_hierarchy.insert(std::make_pair(parentUID, std::vector<DetectorLevelElement>()));
69  // insert child (can happen only once, so the vect is unique)
70  m_hierarchy[parentUID].push_back(childUID);
71  m_usedUniqueIDs.insert(ChildDBObjectType::getGlobalUniqueID());
72  m_usedUniqueIDs.insert(MotherDBObjectType::getGlobalUniqueID());
73  } else {
74  // Update element transformation if inserted again
75  m_lookup[childUID].second = childToMotherParamTransform;
76  }
77  }
std::map< DetectorLevelElement, std::pair< DetectorLevelElement, TMatrixD > > m_lookup
Map with all the parameter data (child -> (mother, transform_child2mother))
Definition: Hierarchy.h:98
std::map< DetectorLevelElement, std::vector< DetectorLevelElement > > m_hierarchy
Map of hierarchy relations mother-> child.
Definition: Hierarchy.h:100
std::set< unsigned short > m_usedUniqueIDs
The set of unique id of each DB object used for construction For more efficient updates of hierarchy ...
Definition: Hierarchy.h:104

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