ATLAS Offline Software
Loading...
Searching...
No Matches
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
15namespace NswAsBuilt {
16
51
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 */
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
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
Eigen::Ref< VectorSet > VectorSetRef
Element: a node in a hierarchy of alignment frames.
Definition Element.h:52
void traverseTree(const std::function< void(Element &)> &callback)
Definition Element.cxx:104
ParameterVector m_correctedPar
Definition Element.h:113
ParameterVector m_nominalPar
Definition Element.h:112
Element(const Element &)=delete
ElementModel::VectorSetRef VectorSetRef
Definition Element.h:57
void setParametersFromMap(ParameterClass iclass, const std::map< std::string, double > &values)
Definition Element.cxx:82
Element(std::unique_ptr< ElementModel > deformationModel)
Definition Element.cxx:11
std::unique_ptr< ElementModel > m_deformationModel
Definition Element.h:111
void setParameter(ParameterClass iclass, ipar_t ipar, double value)
Definition Element.cxx:70
Element * addDaughter(std::unique_ptr< Element > daughter)
Definition Element.cxx:92
daughterVec_t m_daughters
Definition Element.h:115
std::vector< std::unique_ptr< Element > > daughterVec_t
Definition Element.h:56
void transform(ParameterClass iclass, const VectorSetRef &local) const
Definition Element.cxx:33
std::string m_asapId
Definition Element.h:118
const Element * mother() const
Definition Element.h:98
void setAsapId(const std::string &asapId)
Definition Element.h:93
void transformToFrame(ParameterClass iclass, const VectorSetRef &local, const Element *frame) const
Definition Element.cxx:40
ParameterVector & parameterVector(ParameterClass iclass)
Definition Element.cxx:19
Element & operator=(const Element &)=delete
Element * m_mother
Definition Element.h:116
ElementModel::ParameterVector ParameterVector
Definition Element.h:54
double getParameter(ParameterClass iclass, ipar_t ipar) const
Definition Element.cxx:59
const std::string & asapId() const
Definition Element.h:94
ElementModel::ipar_t ipar_t
Definition Element.h:55
Element * mother()
Definition Element.h:99