ATLAS Offline Software
Element.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MUONNSWASBUILT_ELEMENT_H
6 #define MUONNSWASBUILT_ELEMENT_H
7 
8 #include <vector>
9 #include <map>
10 #include <memory>
11 
14 
15 namespace NswAsBuilt {
16 
52  class Element {
53  public:
56  using daughterVec_t = std::vector<std::unique_ptr<Element>>;
58 
59  /* ParameterClass: choose NOMINAL or CORRECTION parameters.
60  *
61  * The CORRECTION parameters are the ones which are actually measured,
62  * while the NOMINAL parameters are the ones of the design */
63  enum class ParameterClass {
64  NOMINAL,
66  };
67 
68  /* Constructors: pass a unique_ptr to the deformation model */
69  Element(std::unique_ptr<ElementModel> deformationModel);
70 
71  // delete others
72  Element() = delete;
73  Element(const Element&) = delete;
74  Element& operator=(const Element&) = delete;
75 
76  /* Getters and setters for the ElementModel parameters */
77  double getParameter(ParameterClass iclass, ipar_t ipar) const;
78  void setParameter(ParameterClass iclass, ipar_t ipar, double value);
79  void setParametersFromMap(ParameterClass iclass, const std::map<std::string, double>& values);
80 
81  /* Transforms a set of vectors in local coordinates of this Element's
82  * frame to the coordinates of the mother frame */
83  void transform(ParameterClass iclass, const VectorSetRef& local) const;
84 
85  /* Repeatedly call the transform method using all mothers up to frame.
86  * Set frame to nullptr to loop on all mothers. */
87  void transformToFrame(ParameterClass iclass, const VectorSetRef& local, const Element* frame) const;
88 
89  /* Cache the rigid component of the transform, for quicker access */
90  void cacheTransforms();
91 
92  /* asapId: optional string identifier (imported from ASAP) */
93  void setAsapId(const std::string& asapId) { m_asapId = asapId; }
94  const std::string& asapId() const { return m_asapId; }
95 
96  /* Getters and setters for the tree structure */
97  Element* addDaughter(std::unique_ptr<Element> daughter);
98  const Element* mother() const { return m_mother; }
99  Element* mother() { return m_mother; }
100 
101  /* Applies the callback function to this Element and to all its daughters
102  * down to the leaves*/
103  void traverseTree(const std::function<void(Element&)>& callback);
104 
105 
106  private:
107 
109  const ParameterVector& parameterVector(ParameterClass iclass) const;
110 
111  std::unique_ptr<ElementModel> m_deformationModel; // The deformation model
112  ParameterVector m_nominalPar; // The parameter vector for the NOMINAL class
113  ParameterVector m_correctedPar; // The parameter vector for the CORRECTION class
114 
115  daughterVec_t m_daughters; // The list of daughter Elements
116  Element* m_mother{nullptr}; // The mother Element
117 
118  std::string m_asapId{""}; // Optional string identifier (imported from ASAP)
119  };
120 }
121 
122 #endif
123 
ElementModel.h
NswAsBuilt::Element::Element
Element()=delete
NswAsBuilt::ElementModel::ParameterVector
Definition: ElementModel.h:44
NswAsBuilt::ElementModel::VectorSetRef
Eigen::Ref< VectorSet > VectorSetRef
Definition: ElementModel.h:37
NswAsBuilt::Element::mother
const Element * mother() const
Definition: Element.h:98
runLayerRecalibration.callback
callback
Definition: runLayerRecalibration.py:64
athena.value
value
Definition: athena.py:124
NswAsBuilt::Element::traverseTree
void traverseTree(const std::function< void(Element &)> &callback)
Definition: Element.cxx:104
NswAsBuilt::Element::m_mother
Element * m_mother
Definition: Element.h:116
NswAsBuilt::Element::operator=
Element & operator=(const Element &)=delete
NswAsBuilt::Element::setParameter
void setParameter(ParameterClass iclass, ipar_t ipar, double value)
Definition: Element.cxx:70
NswAsBuilt::Element::ipar_t
ElementModel::ipar_t ipar_t
Definition: Element.h:55
python.Bindings.values
values
Definition: Control/AthenaPython/python/Bindings.py:805
NswAsBuilt::Element::asapId
const std::string & asapId() const
Definition: Element.h:94
GeoPrimitives.h
NswAsBuilt::Element::m_correctedPar
ParameterVector m_correctedPar
Definition: Element.h:113
NswAsBuilt::Element::m_deformationModel
std::unique_ptr< ElementModel > m_deformationModel
Definition: Element.h:111
NswAsBuilt::Element::m_nominalPar
ParameterVector m_nominalPar
Definition: Element.h:112
NswAsBuilt::Element::ParameterClass::NOMINAL
@ NOMINAL
NswAsBuilt::Element::ParameterVector
ElementModel::ParameterVector ParameterVector
Definition: Element.h:54
NswAsBuilt::Element::setAsapId
void setAsapId(const std::string &asapId)
Definition: Element.h:93
NswAsBuilt::Element::Element
Element(const Element &)=delete
NswAsBuilt::ElementModel::ipar_t
unsigned int ipar_t
Definition: ElementModel.h:35
InDetDD::local
@ local
Definition: InDetDD_Defs.h:16
NswAsBuilt::Element::parameterVector
ParameterVector & parameterVector(ParameterClass iclass)
Definition: Element.cxx:19
NswAsBuilt::Element::transform
void transform(ParameterClass iclass, const VectorSetRef &local) const
Definition: Element.cxx:33
NswAsBuilt::Element::ParameterClass
ParameterClass
Definition: Element.h:63
NswAsBuilt::Element::m_daughters
daughterVec_t m_daughters
Definition: Element.h:115
NswAsBuilt::Element::getParameter
double getParameter(ParameterClass iclass, ipar_t ipar) const
Definition: Element.cxx:59
NswAsBuilt
Definition: CathodeBoardElement.h:12
NswAsBuilt::Element
Element: a node in a hierarchy of alignment frames.
Definition: Element.h:52
NswAsBuilt::Element::transformToFrame
void transformToFrame(ParameterClass iclass, const VectorSetRef &local, const Element *frame) const
Definition: Element.cxx:40
NswAsBuilt::Element::ParameterClass::CORRECTION
@ CORRECTION
NswAsBuilt::Element::m_asapId
std::string m_asapId
Definition: Element.h:118
NswAsBuilt::Element::mother
Element * mother()
Definition: Element.h:99
NswAsBuilt::Element::daughterVec_t
std::vector< std::unique_ptr< Element > > daughterVec_t
Definition: Element.h:56
NswAsBuilt::Element::addDaughter
Element * addDaughter(std::unique_ptr< Element > daughter)
Definition: Element.cxx:92
NswAsBuilt::Element::VectorSetRef
ElementModel::VectorSetRef VectorSetRef
Definition: Element.h:57
NswAsBuilt::Element::cacheTransforms
void cacheTransforms()
Definition: Element.cxx:51
NswAsBuilt::Element::setParametersFromMap
void setParametersFromMap(ParameterClass iclass, const std::map< std::string, double > &values)
Definition: Element.cxx:82