ATLAS Offline Software
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
NswAsBuilt::Element Class Reference

Element: a node in a hierarchy of alignment frames. More...

#include <Element.h>

Collaboration diagram for NswAsBuilt::Element:

Public Types

enum  ParameterClass { ParameterClass::NOMINAL, ParameterClass::CORRECTION }
 
using ParameterVector = ElementModel::ParameterVector
 
using ipar_t = ElementModel::ipar_t
 
using daughterVec_t = std::vector< std::unique_ptr< Element > >
 
using VectorSetRef = ElementModel::VectorSetRef
 

Public Member Functions

 Element (std::unique_ptr< ElementModel > deformationModel)
 
 Element ()=delete
 
 Element (const Element &)=delete
 
Elementoperator= (const Element &)=delete
 
double getParameter (ParameterClass iclass, ipar_t ipar) const
 
void setParameter (ParameterClass iclass, ipar_t ipar, double value)
 
void setParametersFromMap (ParameterClass iclass, const std::map< std::string, double > &values)
 
void transform (ParameterClass iclass, const VectorSetRef &local) const
 
void transformToFrame (ParameterClass iclass, const VectorSetRef &local, const Element *frame) const
 
void cacheTransforms ()
 
void setAsapId (const std::string &asapId)
 
const std::string & asapId () const
 
ElementaddDaughter (std::unique_ptr< Element > daughter)
 
const Elementmother () const
 
Elementmother ()
 
void traverseTree (const std::function< void(Element &)> &callback)
 

Private Member Functions

ParameterVectorparameterVector (ParameterClass iclass)
 
const ParameterVectorparameterVector (ParameterClass iclass) const
 

Private Attributes

std::unique_ptr< ElementModelm_deformationModel
 
ParameterVector m_nominalPar
 
ParameterVector m_correctedPar
 
daughterVec_t m_daughters
 
Elementm_mother {nullptr}
 
std::string m_asapId {""}
 

Detailed Description

Element: a node in a hierarchy of alignment frames.

The class Element is the building block for chaining alignment transformations in various coordinate systems.

Each Element has attached to it a local coordinate system. The transformation of a point in local coordinates from this Element frame to the higher-level coordinate system is achieved with the method transform. The transform method applies rigid transformation (rotations, translation) and possibly deformations.

The Elements are organized in a tree structure, representing the hierarchy of coordinate systems. Traversal of the tree may be achieved using the mother and daughter pointers, or with the method traverseTree, which applies the user-provided function to all the daughers and grand-daughters of this Element.

In this context, it is interesting to call the transform methods iteratively on all the mothers. This is achieved by the method transformToFrame.

The transformation method is handled by an external class ElementModel, which, by sub-classing, provides the deformation model of this Element. The ElementModel must be set in the constructor.

The ElementModel is parameterized by an array of model parameters, whose meaning is known only to the used ElementModel implementation. The model parameters are members of this class, and are provided in two forms: the NOMINAL parameters (meant to represent the nominal geometry), and the CORRECTION parameters (meant to represent the actually measured parameters). The choice of one or the other of the two forms is possible using the ParameterClass argument of the transform method.

Definition at line 52 of file Element.h.

Member Typedef Documentation

◆ daughterVec_t

using NswAsBuilt::Element::daughterVec_t = std::vector<std::unique_ptr<Element> >

Definition at line 56 of file Element.h.

◆ ipar_t

Definition at line 55 of file Element.h.

◆ ParameterVector

Definition at line 54 of file Element.h.

◆ VectorSetRef

Definition at line 57 of file Element.h.

Member Enumeration Documentation

◆ ParameterClass

Enumerator
NOMINAL 
CORRECTION 

Definition at line 63 of file Element.h.

63  {
64  NOMINAL,
65  CORRECTION
66  };

Constructor & Destructor Documentation

◆ Element() [1/3]

Element::Element ( std::unique_ptr< ElementModel deformationModel)

Definition at line 11 of file Element.cxx.

12 : m_deformationModel(std::move(deformationModel))
13 , m_nominalPar(m_deformationModel->nParameters())
14 , m_correctedPar(m_deformationModel->nParameters())
15 { }

◆ Element() [2/3]

NswAsBuilt::Element::Element ( )
delete

◆ Element() [3/3]

NswAsBuilt::Element::Element ( const Element )
delete

Member Function Documentation

◆ addDaughter()

Element * Element::addDaughter ( std::unique_ptr< Element daughter)

Definition at line 92 of file Element.cxx.

93 {
94  if (daughter->m_mother) {
95  throw std::runtime_error("Element has a defined mother already");
96  }
97  daughter->m_mother = this;
98  m_daughters.push_back(std::move(daughter));
99  return m_daughters.back().get();
100 }

◆ asapId()

const std::string& NswAsBuilt::Element::asapId ( ) const
inline

Definition at line 94 of file Element.h.

94 { return m_asapId; }

◆ cacheTransforms()

void Element::cacheTransforms ( )

Definition at line 51 of file Element.cxx.

52 {
53  m_deformationModel->cacheTransform(m_correctedPar);
54  m_deformationModel->cacheTransform(m_nominalPar);
55 }

◆ getParameter()

double Element::getParameter ( ParameterClass  iclass,
ipar_t  ipar 
) const

Definition at line 59 of file Element.cxx.

60 {
61  const auto& parvec = parameterVector(iclass).parameters;
62  if (ipar>=parvec.size()) {
63  throw std::runtime_error("Element::getParameter: Parameter exceeds parvec size "+std::to_string(ipar));
64  }
65  return parvec[ipar];
66 }

◆ mother() [1/2]

Element* NswAsBuilt::Element::mother ( )
inline

Definition at line 99 of file Element.h.

99 { return m_mother; }

◆ mother() [2/2]

const Element* NswAsBuilt::Element::mother ( ) const
inline

Definition at line 98 of file Element.h.

98 { return m_mother; }

◆ operator=()

Element& NswAsBuilt::Element::operator= ( const Element )
delete

◆ parameterVector() [1/2]

Element::ParameterVector & Element::parameterVector ( ParameterClass  iclass)
private

Definition at line 19 of file Element.cxx.

20 {
22 }

◆ parameterVector() [2/2]

const Element::ParameterVector & Element::parameterVector ( ParameterClass  iclass) const
private

Definition at line 26 of file Element.cxx.

27 {
29 }

◆ setAsapId()

void NswAsBuilt::Element::setAsapId ( const std::string &  asapId)
inline

Definition at line 93 of file Element.h.

93 { m_asapId = asapId; }

◆ setParameter()

void Element::setParameter ( ParameterClass  iclass,
ipar_t  ipar,
double  value 
)

Definition at line 70 of file Element.cxx.

71 {
72  auto& parvec = parameterVector(iclass).parameters;
73  if (ipar>=parvec.size()) {
74  throw std::runtime_error("Element::setParameter: Parameter exceeds parvec size "+std::to_string(ipar));
75  }
76  parvec[ipar] = value;
77  parameterVector(iclass).transformCacheValid = false;
78 }

◆ setParametersFromMap()

void Element::setParametersFromMap ( ParameterClass  iclass,
const std::map< std::string, double > &  values 
)

Definition at line 82 of file Element.cxx.

83 {
84  for (const auto& p : values) {
85  setParameter(iclass, m_deformationModel->getParameterIndex(p.first), p.second);
86  }
87  m_deformationModel->cacheTransform(parameterVector(iclass));
88 }

◆ transform()

void Element::transform ( ParameterClass  iclass,
const VectorSetRef local 
) const

Definition at line 33 of file Element.cxx.

34 {
35  m_deformationModel->transform(parameterVector(iclass), local);
36 }

◆ transformToFrame()

void Element::transformToFrame ( ParameterClass  iclass,
const VectorSetRef local,
const Element frame 
) const

Definition at line 40 of file Element.cxx.

41 {
42  const Element* el = this;
43  while ((el!=nullptr) && (el!=frame)) {
44  el->transform(iclass, local);
45  el = el->m_mother;
46  }
47 }

◆ traverseTree()

void Element::traverseTree ( const std::function< void(Element &)> &  callback)

Definition at line 104 of file Element.cxx.

105 {
106  struct tree_t {
107  using iter = daughterVec_t::iterator;
108  tree_t(iter _it, iter _end):
109  it{_it},end{_end}{}
110  iter it;
111  iter end;
112  };
113  std::list<tree_t> dtree;
114  callback(*this);
115  dtree.emplace_back(m_daughters.begin(), m_daughters.end());
116  while (!dtree.empty()) {
117  auto& it = dtree.back().it;
118  if (it != dtree.back().end) {
119  Element& el = **it;
120  callback(el);
121  dtree.emplace_back(el.m_daughters.begin(), el.m_daughters.end());
122  ++it;
123  } else {
124  dtree.pop_back();
125  }
126  }
127 }

Member Data Documentation

◆ m_asapId

std::string NswAsBuilt::Element::m_asapId {""}
private

Definition at line 118 of file Element.h.

◆ m_correctedPar

ParameterVector NswAsBuilt::Element::m_correctedPar
private

Definition at line 113 of file Element.h.

◆ m_daughters

daughterVec_t NswAsBuilt::Element::m_daughters
private

Definition at line 115 of file Element.h.

◆ m_deformationModel

std::unique_ptr<ElementModel> NswAsBuilt::Element::m_deformationModel
private

Definition at line 111 of file Element.h.

◆ m_mother

Element* NswAsBuilt::Element::m_mother {nullptr}
private

Definition at line 116 of file Element.h.

◆ m_nominalPar

ParameterVector NswAsBuilt::Element::m_nominalPar
private

Definition at line 112 of file Element.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
skel.it
it
Definition: skel.GENtoEVGEN.py:396
runLayerRecalibration.callback
callback
Definition: runLayerRecalibration.py:64
athena.value
value
Definition: athena.py:124
NswAsBuilt::ElementModel::ParameterVector::parameters
std::vector< double > parameters
Definition: ElementModel.h:45
NswAsBuilt::Element::m_mother
Element * m_mother
Definition: Element.h:116
NswAsBuilt::Element::setParameter
void setParameter(ParameterClass iclass, ipar_t ipar, double value)
Definition: Element.cxx:70
python.Bindings.values
values
Definition: Control/AthenaPython/python/Bindings.py:805
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
NswAsBuilt::Element::asapId
const std::string & asapId() const
Definition: Element.h:94
NswAsBuilt::Element::m_correctedPar
ParameterVector m_correctedPar
Definition: Element.h:113
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
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
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
NswAsBuilt::ElementModel::ParameterVector::transformCacheValid
bool transformCacheValid
Definition: ElementModel.h:47
InDetDD::local
@ local
Definition: InDetDD_Defs.h:16
NswAsBuilt::Element::parameterVector
ParameterVector & parameterVector(ParameterClass iclass)
Definition: Element.cxx:19
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
NswAsBuilt::Element::m_daughters
daughterVec_t m_daughters
Definition: Element.h:115
NswAsBuilt::Element
Element: a node in a hierarchy of alignment frames.
Definition: Element.h:52
NswAsBuilt::Element::ParameterClass::CORRECTION
@ CORRECTION
NswAsBuilt::Element::m_asapId
std::string m_asapId
Definition: Element.h:118