ATLAS Offline Software
MeasurementDefs.h
Go to the documentation of this file.
1 
2 /*
3  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
4 */
5 #ifndef XAODMEASUREMENTBASE_MEASUREMENTDEFS_H
6 #define XAODMEASUREMENTBASE_MEASUREMENTDEFS_H
7 // EDM include(s):
8 #include <array>
9 
13 
14 #define AUX_MEASUREMENTVAR(VAR, DIM) \
15  do { \
16  static const std::string varName = \
17  std::string{#VAR} + "Dim" + std::to_string(DIM); \
18  static const auxid_t auxId = getAuxID(varName, VAR); \
19  regAuxVar(auxId, varName, VAR); \
20  } while (false);
21 
22 namespace xAOD {
23 
25 enum class UncalibMeasType {
26  Other = 0,
27  // InDet
28  PixelClusterType = 1,
29  StripClusterType = 2,
30  // Muon
32  RpcStripType = 4,
33  TgcStripType = 5,
34  MMClusterType = 6,
35  sTgcStripType = 7,
36  // HGTD
37  HGTDClusterType = 8,
38  // Do not add anything after nTypes
39  nTypes
40 };
41 
43 using DetectorIDHashType = unsigned int;
44 using DetectorIdentType = long unsigned int;
46 template <size_t N>
49 template <size_t N>
52 template <size_t N>
53 using MeasVector = Eigen::Matrix<float, N, 1>;
54 template <size_t N>
55 using MeasMatrix = Eigen::Matrix<float, N, N>;
56 
57 template <size_t N>
58 using VectorMap = Eigen::Map<MeasVector<N>>;
59 template <size_t N>
60 using ConstVectorMap = Eigen::Map<const MeasVector<N>>;
61 
62 template <size_t N>
63 using MatrixMap = Eigen::Map<MeasMatrix<N>>;
64 template <size_t N>
65 using ConstMatrixMap = Eigen::Map<const MeasMatrix<N>>;
66 
69 template <int N> MeasVector<N> toStorage(const AmgVector(N)& amgVec){
71  for (int i =0 ; i < N ; ++i) vec[i] = amgVec[i];
72  return vec;
73 }
74 
77 template <int N> MeasMatrix<N> toStorage(const AmgSymMatrix(N)& amgMat) {
79  for (int i =0 ; i < N; ++i){
80  for (int j =0 ; j < N; ++j) {
81  mat(i,j) = amgMat(i, j);
82  }
83  }
84  return mat;
85 }
86 
87 template <int N> AmgSymMatrix(N) toEigen(const ConstMatrixMap<N>& xAODmat) {
88  AmgSymMatrix(N) mat{AmgSymMatrix(N)::Zero()};
89  for (int i=0; i < N; ++i){
90  for (int j =0; j < N; ++j){
91  mat(i, j) = xAODmat(i, j);
92  }
93  }
94  return mat;
95 }
96 
97 template <int N> AmgVector(N) toEigen(const ConstVectorMap<N>& xAODvec) {
98  AmgVector(N) v{AmgVector(N)::Zero()};
99  for (int i = 0 ; i < N; ++i) {
100  v[i] = xAODvec[i];
101  }
102  return v;
103 }
104 
105 
106 } // namespace xAOD
107 #endif
xAOD::DetectorIdentType
long unsigned int DetectorIdentType
Definition: MeasurementDefs.h:44
xAOD::UncalibMeasType::HGTDClusterType
@ HGTDClusterType
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
xAOD::UncalibMeasType::StripClusterType
@ StripClusterType
mat
GeoMaterial * mat
Definition: LArDetectorConstructionTBEC.cxx:55
xAOD::ConstMatrixMap
Eigen::Map< const MeasMatrix< N > > ConstMatrixMap
Definition: MeasurementDefs.h:65
xAOD::UncalibMeasType::MMClusterType
@ MMClusterType
xAOD::toStorage
MeasVector< N > toStorage(const AmgVector(N)&amgVec)
Converts the double precision of the AmgVector into the floating point storage precision of the MeasV...
Definition: MeasurementDefs.h:69
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
JetTiledMap::N
@ N
Definition: TiledEtaPhiMap.h:44
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:9
xAOD::UncalibMeasType::sTgcStripType
@ sTgcStripType
xAOD::MatrixMap
Eigen::Map< MeasMatrix< N > > MatrixMap
Definition: MeasurementDefs.h:63
xAOD::UncalibMeasType::TgcStripType
@ TgcStripType
CxxUtils::vec
typename vecDetail::vec_typedef< T, N >::type vec
Define a nice alias for the vectorized type.
Definition: vec.h:207
xAOD::AmgVector
AmgVector(N) toEigen(const ConstVectorMap< N > &xAODvec)
Definition: MeasurementDefs.h:97
lumiFormat.i
int i
Definition: lumiFormat.py:85
xAOD::Other
@ Other
EigenZeroDefs.h
Ensure that eigen aux variables get properly zeroed.
xAOD::int
setRawEt setRawPhi int
Definition: TrigCaloCluster_v1.cxx:33
xAOD::MeasVector
Eigen::Matrix< float, N, 1 > MeasVector
Abrivation of the Matrix & Covariance definitions.
Definition: MeasurementDefs.h:53
xAOD::UncalibMeasType::nTypes
@ nTypes
EventPrimitives.h
xAOD::DetectorIDHashType
unsigned int DetectorIDHashType
@ detector ID element hash
Definition: MeasurementDefs.h:43
python.PyAthena.v
v
Definition: PyAthena.py:154
xAOD::VectorMap
Eigen::Map< MeasVector< N > > VectorMap
Definition: MeasurementDefs.h:58
xAOD::UncalibMeasType
UncalibMeasType
Define the type of the uncalibrated measurement.
Definition: MeasurementDefs.h:25
xAOD::MeasMatrix
Eigen::Matrix< float, N, N > MeasMatrix
Definition: MeasurementDefs.h:55
xAOD::UncalibMeasType::RpcStripType
@ RpcStripType
xAOD::UncalibMeasType::MdtDriftCircleType
@ MdtDriftCircleType
xAOD::ConstVectorMap
Eigen::Map< const MeasVector< N > > ConstVectorMap
Definition: MeasurementDefs.h:60
xAOD::AmgSymMatrix
AmgSymMatrix(N) toEigen(const ConstMatrixMap< N > &xAODmat)
Definition: MeasurementDefs.h:87
AuxElement.h
Base class for elements of a container that can have aux data.
xAOD::UncalibMeasType::PixelClusterType
@ PixelClusterType
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32