13 #include <framework/geometry/B2Vector3.h>
15 #include <genfit/StateOnPlane.h>
17 #include <root/TMatrixD.h>
18 #include <root/TGeoMatrix.h>
20 #include <Geant4/G4Transform3D.hh>
34 typedef std::pair<unsigned short, unsigned short> DetectorLevelElement;
36 typedef std::pair<std::vector<int>, TMatrixD> GlobalDerivativeSet;
38 typedef std::vector<std::pair<int, double>> Constraint;
40 typedef std::map<long, Constraint> Constraints;
43 class GlobalDerivativesHierarchy {
61 template<
class ChildDBObjectType,
class MotherDBObjectType>
62 void insert(
unsigned short child,
unsigned short mother, TMatrixD childToMotherParamTransform)
64 auto childUID = std::make_pair(ChildDBObjectType::getGlobalUniqueID(), child);
65 auto parentUID = std::make_pair(MotherDBObjectType::getGlobalUniqueID(), mother);
67 if (
m_lookup.insert(std::make_pair(childUID, std::make_pair(parentUID, childToMotherParamTransform))).second) {
70 m_hierarchy.insert(std::make_pair(parentUID, std::vector<DetectorLevelElement>()));
77 m_lookup[childUID].second = childToMotherParamTransform;
83 static void mergeGlobals(GlobalDerivativeSet&
main, GlobalDerivativeSet additional);
100 std::map<DetectorLevelElement, std::pair<DetectorLevelElement, TMatrixD>>
m_lookup;
102 std::map<DetectorLevelElement, std::vector<DetectorLevelElement>>
m_hierarchy;
119 template<
class LowestLevelDBObject>
122 if (bField.
Mag() < 1.e-10)
123 return std::make_pair(std::vector<int>(), TMatrixD());
125 DetectorLevelElement elementUID = std::make_pair(LowestLevelDBObject::getGlobalUniqueID(), sensor);
136 template<
class ChildDBObjectType,
class MotherDBObjectType>
139 insert<ChildDBObjectType, MotherDBObjectType>(child, mother, TMatrixD(1, 1).UnitMatrix());
146 class RigidBodyHierarchy :
public GlobalDerivativesHierarchy {
160 template<
class LowestLevelDBObject>
163 DetectorLevelElement elementUID = std::make_pair(LowestLevelDBObject::getGlobalUniqueID(), sensor);
171 template<
class ChildDBObjectType,
class MotherDBObjectType>
172 void insertG4Transform(
unsigned short child,
unsigned short mother, G4Transform3D childToMother)
178 template<
class ChildDBObjectType,
class MotherDBObjectType>
179 void insertTGeoTransform(
unsigned short child,
unsigned short mother, TGeoHMatrix childToMother)