ATLAS Offline Software
ElementModelRigid.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include <stdexcept>
7 
8 using namespace NswAsBuilt;
9 
10 //===============================================================================
11 // Transform a set of vectors expressed in local frame, stored in a matrix
13 {
14  if (!parvec.transformCacheValid) {
15  throw std::runtime_error("Should call Element::cacheTransforms() first");
16  }
17  local = (parvec.transformCache * local).eval(); // Needs eval to avoid aliasing (?)
18 }
19 
20 //===============================================================================
21 // Cache the rigid component of this deformation model
23 {
24  const auto& pars = parvec.parameters;
25  parvec.transformCache
26  = Eigen::Translation3d(pars[X], pars[Y], pars[Z])
27  * Eigen::AngleAxisd(pars[THZ], Eigen::Vector3d::UnitZ())
28  * Eigen::AngleAxisd(pars[THY], Eigen::Vector3d::UnitY())
29  * Eigen::AngleAxisd(pars[THX], Eigen::Vector3d::UnitX());
30  parvec.transformCacheValid = true;
31 }
32 
33 //===============================================================================
34 // Helper methods to convert parameter index to string representation
36 {
37  if (parname == "x") return parameter_t::X;
38  if (parname == "y") return parameter_t::Y;
39  if (parname == "z") return parameter_t::Z;
40  if (parname == "thx") return parameter_t::THX;
41  if (parname == "thy") return parameter_t::THY;
42  if (parname == "thz") return parameter_t::THZ;
43  throw std::runtime_error("Invalid parameter name "+parname);
44 }
45 
46 
47 //===============================================================================
49 {
50  switch (ipar) {
51  case X: return "x";
52  case Y: return "y";
53  case Z: return "z";
54  case THX: return "thx";
55  case THY: return "thy";
56  case THZ: return "thz";
57  default: throw std::runtime_error("Invalid parameter");
58  }
59 }
60 
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
NswAsBuilt::ElementModelRigid::Z
@ Z
Definition: ElementModelRigid.h:18
NswAsBuilt::ElementModel::ParameterVector
Definition: ElementModel.h:44
NswAsBuilt::ElementModelRigid::cacheTransform
virtual void cacheTransform(ParameterVector &parvec) const override
Definition: ElementModelRigid.cxx:22
Monitored::Z
@ Z
Definition: HistogramFillerUtils.h:24
NswAsBuilt::ElementModel::VectorSetRef
Eigen::Ref< VectorSet > VectorSetRef
Definition: ElementModel.h:37
NswAsBuilt::ElementModelRigid::transform
virtual void transform(const ParameterVector &parvec, VectorSetRef local) const override
Definition: ElementModelRigid.cxx:12
python.CreateTierZeroArgdict.parname
parname
Definition: CreateTierZeroArgdict.py:194
NswAsBuilt::ElementModel::ParameterVector::parameters
std::vector< double > parameters
Definition: ElementModel.h:45
NswAsBuilt::ElementModelRigid::Y
@ Y
Definition: ElementModelRigid.h:18
NswAsBuilt::ElementModelRigid::THY
@ THY
Definition: ElementModelRigid.h:18
Monitored::X
@ X
Definition: HistogramFillerUtils.h:24
NswAsBuilt::ElementModelRigid::getParameterName
virtual std::string getParameterName(ipar_t ipar) const override
Definition: ElementModelRigid.cxx:48
NswAsBuilt::ElementModelRigid::X
@ X
Definition: ElementModelRigid.h:18
NswAsBuilt::ElementModel::ParameterVector::transformCache
Eigen::Affine3d transformCache
Definition: ElementModel.h:46
NswAsBuilt::ElementModelRigid::getParameterIndex
virtual ipar_t getParameterIndex(const std::string &parname) const override
Definition: ElementModelRigid.cxx:35
ElementModelRigid.h
NswAsBuilt::ElementModel::ParameterVector::transformCacheValid
bool transformCacheValid
Definition: ElementModel.h:47
NswAsBuilt::ElementModel::ipar_t
unsigned int ipar_t
Definition: ElementModel.h:35
InDetDD::local
@ local
Definition: InDetDD_Defs.h:16
Monitored::Y
@ Y
Definition: HistogramFillerUtils.h:24
NswAsBuilt::ElementModelRigid::THX
@ THX
Definition: ElementModelRigid.h:18
NswAsBuilt
Definition: CathodeBoardElement.h:12
NswAsBuilt::ElementModelRigid::THZ
@ THZ
Definition: ElementModelRigid.h:18