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

An element model implementing the deformations used for the NSW sTGC as-built parameters. More...

#include <ElementModelSTGC.h>

Inheritance diagram for NswAsBuilt::ElementModelSTGC:
Collaboration diagram for NswAsBuilt::ElementModelSTGC:

Public Types

enum  parameter_t {
  X =0, Y =1, Z =2, THX =3,
  THY =4, THZ =5, ROT =6, OFF =7,
  SCL =8, NPAR =9
}
 
using ipar_t = unsigned int
 
using VectorSet = Eigen::Matrix< double, 3, Eigen::Dynamic, Eigen::ColMajor|Eigen::AutoAlign, 3, 5 >
 
using VectorSetRef = Eigen::Ref< VectorSet >
 

Public Member Functions

 ElementModelSTGC (double lenX, double lenY, Amg::Vector3D defo0)
 
 ElementModelSTGC ()=delete
 
virtual int nParameters () const override
 The number of parameters used. More...
 
virtual void transform (const ParameterVector &parvec, VectorSetRef local) const override
 Transform a set of vectors expressed in local frame, stored in a matrix. More...
 
virtual void cacheTransform (ParameterVector &parvec) const override
 Cache the rigid component of this deformation model. More...
 
virtual ipar_t getParameterIndex (const std::string &parname) const override
 
virtual std::string getParameterName (ipar_t ipar) const override
 

Private Member Functions

void applyDeformation (const ParameterVector &parvec, Eigen::Ref< Amg::Vector3D > local) const
 
void applyDeformation2 (const ParameterVector &parvec, VectorSetRef local) const
 
Amg::Vector3D stgcScale (double scl, const Amg::Vector3D &d0) const
 
Amg::Vector3D stgcNonPar (double npar, const Amg::Vector3D &d0) const
 

Static Private Member Functions

static Amg::Vector3D stgcOffset (double off)
 
static Amg::Vector3D stgcRotation (double rot, const Amg::Vector3D &d0)
 

Private Attributes

double m_lenY {0.}
 
double m_lenX {0.}
 
Amg::Vector3D m_defo0 {Amg::Vector3D::Zero()}
 

Detailed Description

An element model implementing the deformations used for the NSW sTGC as-built parameters.

The first 6 parameters represent the rigid component of the transform (a 3D translation and 3 Euler angles to be applied in the order ZYX)

The following parameters are providing deformations, in accordance with the: 4-parameter alingment model implemented for the sTGC quadruplets:

dy = off + rot*x + scl*y + npar*x*y

For more information check https://cds.cern.ch/record/2688394?ln=en

Definition at line 26 of file ElementModelSTGC.h.

Member Typedef Documentation

◆ ipar_t

using NswAsBuilt::ElementModel::ipar_t = unsigned int
inherited

Definition at line 35 of file ElementModel.h.

◆ VectorSet

using NswAsBuilt::ElementModel::VectorSet = Eigen::Matrix<double, 3, Eigen::Dynamic, Eigen::ColMajor|Eigen::AutoAlign, 3, 5>
inherited

Definition at line 36 of file ElementModel.h.

◆ VectorSetRef

using NswAsBuilt::ElementModel::VectorSetRef = Eigen::Ref<VectorSet>
inherited

Definition at line 37 of file ElementModel.h.

Member Enumeration Documentation

◆ parameter_t

Enumerator
THX 
THY 
THZ 
ROT 
OFF 
SCL 
NPAR 

Definition at line 28 of file ElementModelSTGC.h.

28  {
29  X=0,
30  Y=1,
31  Z=2,
32  THX=3,
33  THY=4,
34  THZ=5,
35  ROT=6,
36  OFF=7,
37  SCL=8,
38  NPAR=9
39  };

Constructor & Destructor Documentation

◆ ElementModelSTGC() [1/2]

ElementModelSTGC::ElementModelSTGC ( double  lenX,
double  lenY,
Amg::Vector3D  defo0 
)

Definition at line 11 of file ElementModelSTGC.cxx.

12  : m_lenY(lenY),m_lenX(lenX),
13  m_defo0(std::move(defo0))
14 {
15 }

◆ ElementModelSTGC() [2/2]

NswAsBuilt::ElementModelSTGC::ElementModelSTGC ( )
delete

Member Function Documentation

◆ applyDeformation()

void ElementModelSTGC::applyDeformation ( const ParameterVector parvec,
Eigen::Ref< Amg::Vector3D local 
) const
private

Definition at line 110 of file ElementModelSTGC.cxx.

110  {
111  // Applies the deformation to the set of local vectors given as argument
112  // This old-style implementation is the reference implementation
114  local = local
115  + stgcOffset(parvec[OFF])
116  + stgcRotation(parvec[ROT], d0)
117  + stgcScale(parvec[SCL], d0)
118  + stgcNonPar(parvec[NPAR], d0)
119  ;
120 }

◆ applyDeformation2()

void ElementModelSTGC::applyDeformation2 ( const ParameterVector parvec,
VectorSetRef  local 
) const
private

Definition at line 122 of file ElementModelSTGC.cxx.

122  {
123  // Applies the deformation to the set of local vectors given as argument
124  // This implementation uses Eigen-style algebra (does the same as the method applyDeformation above, but benefits from Eigen's optimizations)
125 
126  // Temporaries allocated on the stack
127  // d0 = local - defo0
128  VectorSet d0 = local.colwise() - m_defo0;
129 
130  double off = parvec[OFF];
131  double rot = parvec[ROT];
132  double scl = parvec[SCL]/m_lenY;
133  double npar = parvec[NPAR]/(m_lenX*m_lenY);
134 
135  // OFF:
136  local.array().colwise() += Eigen::Array3d{0. ,off, 0.};
137 
138  // ROT
139  local.topRows<2>().array() += d0.topRows<2>().array().colwise().reverse().colwise() * Eigen::Array2d{0., rot};
140 
141  // SCL:
142  local.array() += d0.array().colwise() * Eigen::Array3d{0., scl, 0.};
143 
144  // NPAR:
145  local.topRows<2>().array() += (d0.topRows<2>().array().colwise().reverse() * d0.topRows<2>().array()).colwise() * Eigen::Array2d{0., npar};
146 }

◆ cacheTransform()

void ElementModelSTGC::cacheTransform ( ParameterVector parvec) const
overridevirtual

Cache the rigid component of this deformation model.

Cache the rigid component of this deformation model Add rotation and offset obtained from the sTGC fit.

Implements NswAsBuilt::ElementModel.

Definition at line 45 of file ElementModelSTGC.cxx.

45  {
46  const auto& pars = parvec.parameters;
47  parvec.transformCache
48  = Eigen::Translation3d(pars[X], pars[Y], pars[Z])
49  * Eigen::AngleAxisd(pars[THZ], Eigen::Vector3d::UnitZ())
50  * Eigen::AngleAxisd(pars[THY], Eigen::Vector3d::UnitY())
51  * Eigen::AngleAxisd(pars[THX], Eigen::Vector3d::UnitX());
52  parvec.transformCacheValid = true;
53 }

◆ getParameterIndex()

ElementModelSTGC::ipar_t ElementModelSTGC::getParameterIndex ( const std::string &  parname) const
overridevirtual

Implements NswAsBuilt::ElementModel.

Definition at line 58 of file ElementModelSTGC.cxx.

58  {
59  if (parname == "x") return parameter_t::X;
60  if (parname == "y") return parameter_t::Y;
61  if (parname == "z") return parameter_t::Z;
62  if (parname == "thx") return parameter_t::THX;
63  if (parname == "thy") return parameter_t::THY;
64  if (parname == "thz") return parameter_t::THZ;
65  if (parname == "rot") return parameter_t::ROT;
66  if (parname == "off") return parameter_t::OFF;
67  if (parname == "scl") return parameter_t::SCL;
68  if (parname == "npar") return parameter_t::NPAR;
69  throw std::runtime_error("Invalid parameter name "+parname);
70 }

◆ getParameterName()

std::string ElementModelSTGC::getParameterName ( ipar_t  ipar) const
overridevirtual

Implements NswAsBuilt::ElementModel.

Definition at line 72 of file ElementModelSTGC.cxx.

72  {
73  switch (ipar) {
74  case X: return "x";
75  case Y: return "y";
76  case Z: return "z";
77  case THX: return "thx";
78  case THY: return "thy";
79  case THZ: return "thz";
80  case ROT: return "rot";
81  case OFF: return "off";
82  case SCL: return "scl";
83  case NPAR: return "npar";
84  default: throw std::runtime_error("Invalid parameter");
85  }
86 }

◆ nParameters()

virtual int NswAsBuilt::ElementModelSTGC::nParameters ( ) const
inlineoverridevirtual

The number of parameters used.

Implements NswAsBuilt::ElementModel.

Definition at line 47 of file ElementModelSTGC.h.

47 { return 10; }

◆ stgcNonPar()

Amg::Vector3D ElementModelSTGC::stgcNonPar ( double  npar,
const Amg::Vector3D d0 
) const
private

Definition at line 104 of file ElementModelSTGC.cxx.

104  {
105 // Non-parallelism measured by CMM/Faro at construction sites
106  double delta = npar*d0[0]*d0[1]/(m_lenX*m_lenY);
107  return Amg::Vector3D(0., delta, 0.);
108 }

◆ stgcOffset()

Amg::Vector3D ElementModelSTGC::stgcOffset ( double  off)
staticprivate

Definition at line 88 of file ElementModelSTGC.cxx.

88  {
89 // Offset extracted from combined fit of X-ray data and by CMM/Faro measurement at construction sites
90  return off * Amg::Vector3D::UnitY();
91 }

◆ stgcRotation()

Amg::Vector3D ElementModelSTGC::stgcRotation ( double  rot,
const Amg::Vector3D d0 
)
staticprivate

Definition at line 93 of file ElementModelSTGC.cxx.

93  {
94 // Rotation extracted from combined fit of X-ray data and by CMM/Faro measurement at construction sites
95  return -rot * d0.cross(Amg::Vector3D::UnitZ());
96 }

◆ stgcScale()

Amg::Vector3D ElementModelSTGC::stgcScale ( double  scl,
const Amg::Vector3D d0 
) const
private

Definition at line 98 of file ElementModelSTGC.cxx.

98  {
99 // Scale measured by CMM/Faro at construction sites
100  return d0.array() * Eigen::Array3d{0., scl/m_lenY, 0.};
101 }

◆ transform()

void ElementModelSTGC::transform ( const ParameterVector parvec,
VectorSetRef  local 
) const
overridevirtual

Transform a set of vectors expressed in local frame, stored in a matrix.

Implements NswAsBuilt::ElementModel.

Definition at line 20 of file ElementModelSTGC.cxx.

20  {
21 
22  if (!parvec.transformCacheValid) {
23  throw std::runtime_error("Should call Element::cacheTransforms() first");
24  }
25 
26  // Apply the deformation component
27 
28  // old-style (reference) implementation: not optimized, provided for comparison purposes
29  // for (int i=0; i< local.cols(); ++i) {
30  // applyDeformation(parvec, local.col(i));
31  // }
32 
33 
34  // Eigen-style implementation: optimized
35  applyDeformation2(parvec, local);
36 
37  // Apply the rigid component
38  local = (parvec.transformCache * local).eval(); // Needs eval to avoid aliasing (?)
39 }

Member Data Documentation

◆ m_defo0

Amg::Vector3D NswAsBuilt::ElementModelSTGC::m_defo0 {Amg::Vector3D::Zero()}
private

Definition at line 83 of file ElementModelSTGC.h.

◆ m_lenX

double NswAsBuilt::ElementModelSTGC::m_lenX {0.}
private

Definition at line 82 of file ElementModelSTGC.h.

◆ m_lenY

double NswAsBuilt::ElementModelSTGC::m_lenY {0.}
private

Definition at line 81 of file ElementModelSTGC.h.


The documentation for this class was generated from the following files:
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
NswAsBuilt::ElementModelSTGC::SCL
@ SCL
Definition: ElementModelSTGC.h:37
NswAsBuilt::ElementModelSTGC::stgcRotation
static Amg::Vector3D stgcRotation(double rot, const Amg::Vector3D &d0)
Definition: ElementModelSTGC.cxx:93
NswAsBuilt::ElementModelSTGC::OFF
@ OFF
Definition: ElementModelSTGC.h:36
NswAsBuilt::ElementModelSTGC::m_lenX
double m_lenX
Definition: ElementModelSTGC.h:82
Monitored::Z
@ Z
Definition: HistogramFillerUtils.h:24
python.CreateTierZeroArgdict.parname
parname
Definition: CreateTierZeroArgdict.py:194
NswAsBuilt::ElementModelSTGC::ROT
@ ROT
Definition: ElementModelSTGC.h:35
NswAsBuilt::ElementModelSTGC::THY
@ THY
Definition: ElementModelSTGC.h:33
NswAsBuilt::ElementModelSTGC::stgcOffset
static Amg::Vector3D stgcOffset(double off)
Definition: ElementModelSTGC.cxx:88
Monitored::X
@ X
Definition: HistogramFillerUtils.h:24
NswAsBuilt::ElementModelSTGC::THZ
@ THZ
Definition: ElementModelSTGC.h:34
NswAsBuilt::ElementModelSTGC::m_lenY
double m_lenY
Definition: ElementModelSTGC.h:81
NswAsBuilt::ElementModelSTGC::stgcNonPar
Amg::Vector3D stgcNonPar(double npar, const Amg::Vector3D &d0) const
Definition: ElementModelSTGC.cxx:104
NswAsBuilt::ElementModelSTGC::applyDeformation2
void applyDeformation2(const ParameterVector &parvec, VectorSetRef local) const
Definition: ElementModelSTGC.cxx:122
TRT::Track::d0
@ d0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:62
NswAsBuilt::ElementModelSTGC::stgcScale
Amg::Vector3D stgcScale(double scl, const Amg::Vector3D &d0) const
Definition: ElementModelSTGC.cxx:98
NswAsBuilt::ElementModelSTGC::NPAR
@ NPAR
Definition: ElementModelSTGC.h:38
NswAsBuilt::ElementModel::VectorSet
Eigen::Matrix< double, 3, Eigen::Dynamic, Eigen::ColMajor|Eigen::AutoAlign, 3, 5 > VectorSet
Definition: ElementModel.h:36
InDetDD::local
@ local
Definition: InDetDD_Defs.h:16
lumiFormat.array
array
Definition: lumiFormat.py:91
Monitored::Y
@ Y
Definition: HistogramFillerUtils.h:24
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
NswAsBuilt::ElementModelSTGC::THX
@ THX
Definition: ElementModelSTGC.h:32
NswAsBuilt::ElementModelSTGC::Y
@ Y
Definition: ElementModelSTGC.h:30
NswAsBuilt::ElementModelSTGC::m_defo0
Amg::Vector3D m_defo0
Definition: ElementModelSTGC.h:83
NswAsBuilt::ElementModelSTGC::Z
@ Z
Definition: ElementModelSTGC.h:31
NswAsBuilt::ElementModelSTGC::X
@ X
Definition: ElementModelSTGC.h:29