ATLAS Offline Software
ElementModel.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MUONNSWASBUILT_ELEMENTMODEL_H
6 #define MUONNSWASBUILT_ELEMENTMODEL_H
7 
8 #include <vector>
10 
11 namespace NswAsBuilt {
12 
33  class ElementModel {
34  public:
35  using ipar_t = unsigned int;
36  using VectorSet = Eigen::Matrix<double, 3, Eigen::Dynamic, Eigen::ColMajor|Eigen::AutoAlign, 3, 5>;
37  using VectorSetRef = Eigen::Ref<VectorSet>;
38  virtual ~ElementModel() = default;
39 
40  /* The ParameterVector: a wrapper around a std::vector<double> containing
41  * the actual model parameters.
42  * In addition, this struct may save the cache-able rigid component of the
43  * transformation represented by the parameter vector */
44  struct ParameterVector {
45  std::vector<double> parameters{};
46  Eigen::Affine3d transformCache{Eigen::Affine3d::Identity()};
47  bool transformCacheValid{false};
48 
49  // Contructed: provide the number of parameters
50  ParameterVector(size_t npars) : parameters(npars, 0.0) {}
51 
52  // accessors
53  double operator[] (size_t ipar) const { return parameters.at(ipar); }
54  double& operator[] (size_t ipar) { return parameters.at(ipar); }
55  };
56 
57  /* The number of parameters used */
58  virtual int nParameters() const = 0;
59 
60  /* Transform a set of vectors expressed in local frame, stored in a matrix */
61  virtual void transform(const ParameterVector& parvec, VectorSetRef local) const = 0;
62 
63  /* Cache the rigid component of this deformation model */
64  virtual void cacheTransform(ParameterVector& parvec) const = 0;
65 
66  /* Helper methods to convert parameter index to string representation */
67  virtual ipar_t getParameterIndex(const std::string& parname) const = 0;
68  virtual std::string getParameterName(ipar_t ipar) const = 0;
69  };
70 }
71 
72 #endif
73 
NswAsBuilt::ElementModel::ParameterVector
Definition: ElementModel.h:44
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
NswAsBuilt::ElementModel::getParameterName
virtual std::string getParameterName(ipar_t ipar) const =0
NswAsBuilt::ElementModel::VectorSetRef
Eigen::Ref< VectorSet > VectorSetRef
Definition: ElementModel.h:37
python.CreateTierZeroArgdict.parname
parname
Definition: CreateTierZeroArgdict.py:194
NswAsBuilt::ElementModel::ParameterVector::parameters
std::vector< double > parameters
Definition: ElementModel.h:45
NswAsBuilt::ElementModel::ParameterVector::operator[]
double operator[](size_t ipar) const
Definition: ElementModel.h:53
NswAsBuilt::ElementModel::ParameterVector::ParameterVector
ParameterVector(size_t npars)
Definition: ElementModel.h:50
NswAsBuilt::ElementModel::nParameters
virtual int nParameters() const =0
GeoPrimitives.h
NswAsBuilt::ElementModel::ParameterVector::transformCache
Eigen::Affine3d transformCache
Definition: ElementModel.h:46
NswAsBuilt::ElementModel::ParameterVector::transformCacheValid
bool transformCacheValid
Definition: ElementModel.h:47
NswAsBuilt::ElementModel::~ElementModel
virtual ~ElementModel()=default
NswAsBuilt::ElementModel::ipar_t
unsigned int ipar_t
Definition: ElementModel.h:35
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
NswAsBuilt::ElementModel::transform
virtual void transform(const ParameterVector &parvec, VectorSetRef local) const =0
NswAsBuilt::ElementModel::getParameterIndex
virtual ipar_t getParameterIndex(const std::string &parname) const =0
NswAsBuilt::ElementModel
Pure abstract class representing the deformation model of an Element.
Definition: ElementModel.h:33
NswAsBuilt
Definition: CathodeBoardElement.h:12
NswAsBuilt::ElementModel::cacheTransform
virtual void cacheTransform(ParameterVector &parvec) const =0