ATLAS Offline Software
MeasurementDefs.h
Go to the documentation of this file.
1 
2 /*
3  Copyright (C) 2002-2023 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 
12 
13 #define AUX_MEASUREMENTVAR(VAR, DIM) \
14  do { \
15  static const std::string varName = \
16  std::string{#VAR} + "Dim" + std::to_string(DIM); \
17  static const auxid_t auxId = getAuxID(varName, VAR); \
18  regAuxVar(auxId, varName, VAR); \
19  } while (false);
20 
21 namespace xAOD {
22 
24 enum class UncalibMeasType {
25  Other = 0,
26  // InDet
27  PixelClusterType = 1,
28  StripClusterType = 2,
29  // Muon
31  RpcStripType = 4,
32  TgcStripType = 5,
33  MMClusterType = 6,
34  sTgcStripType = 7,
35  // HGTD
36  HGTDClusterType = 8,
37  // Do not add anything after nTypes
38  nTypes
39 };
40 
42 using DetectorIDHashType = unsigned int;
43 using DetectorIdentType = long unsigned int;
45 template <size_t N>
48 template <size_t N>
51 template <size_t N>
52 using MeasVector = Eigen::Matrix<float, N, 1>;
53 template <size_t N>
54 using MeasMatrix = Eigen::Matrix<float, N, N>;
55 
56 template <size_t N>
57 using VectorMap = Eigen::Map<MeasVector<N>>;
58 template <size_t N>
59 using ConstVectorMap = Eigen::Map<const MeasVector<N>>;
60 
61 template <size_t N>
62 using MatrixMap = Eigen::Map<MeasMatrix<N>>;
63 template <size_t N>
64 using ConstMatrixMap = Eigen::Map<const MeasMatrix<N>>;
65 
68 template <int N> MeasVector<N> toStorage(const AmgVector(N)& amgVec){
70  for (int i =0 ; i < N ; ++i) vec[i] = amgVec[i];
71  return vec;
72 }
73 
76 template <int N> MeasMatrix<N> toStorage(const AmgSymMatrix(N)& amgMat) {
78  for (int i =0 ; i < N; ++i){
79  for (int j =0 ; j < N; ++j) {
80  mat(i,j) = amgMat(i, j);
81  }
82  }
83  return mat;
84 }
85 
86 template <int N> AmgSymMatrix(N) toEigen(const ConstMatrixMap<N>& xAODmat) {
87  AmgSymMatrix(N) mat{AmgSymMatrix(N)::Zero()};
88  for (int i=0; i < N; ++i){
89  for (int j =0; j < N; ++j){
90  mat(i, j) = xAODmat(i, j);
91  }
92  }
93  return mat;
94 }
95 
96 template <int N> AmgVector(N) toEigen(const ConstVectorMap<N>& xAODvec) {
97  AmgVector(N) v{AmgVector(N)::Zero()};
98  for (int i = 0 ; i < N; ++i) {
99  v[i] = xAODvec[i];
100  }
101  return v;
102 }
103 
104 
105 } // namespace xAOD
106 #endif
xAOD::DetectorIdentType
long unsigned int DetectorIdentType
Definition: MeasurementDefs.h:43
xAOD::UncalibMeasType::HGTDClusterType
@ HGTDClusterType
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:66
xAOD::UncalibMeasType::StripClusterType
@ StripClusterType
mat
GeoMaterial * mat
Definition: LArDetectorConstructionTBEC.cxx:53
xAOD::ConstMatrixMap
Eigen::Map< const MeasMatrix< N > > ConstMatrixMap
Definition: MeasurementDefs.h:64
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:68
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:12
xAOD::UncalibMeasType::sTgcStripType
@ sTgcStripType
xAOD::MatrixMap
Eigen::Map< MeasMatrix< N > > MatrixMap
Definition: MeasurementDefs.h:62
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:96
lumiFormat.i
int i
Definition: lumiFormat.py:92
xAOD::Other
@ Other
xAOD::MeasVector
Eigen::Matrix< float, N, 1 > MeasVector
Abrivation of the Matrix & Covariance definitions.
Definition: MeasurementDefs.h:52
xAOD::UncalibMeasType::nTypes
@ nTypes
EventPrimitives.h
xAOD::DetectorIDHashType
unsigned int DetectorIDHashType
@ detector ID element hash
Definition: MeasurementDefs.h:42
python.PyAthena.v
v
Definition: PyAthena.py:157
xAOD::VectorMap
Eigen::Map< MeasVector< N > > VectorMap
Definition: MeasurementDefs.h:57
xAOD::UncalibMeasType
UncalibMeasType
Define the type of the uncalibrated measurement.
Definition: MeasurementDefs.h:24
xAOD::MeasMatrix
Eigen::Matrix< float, N, N > MeasMatrix
Definition: MeasurementDefs.h:54
xAOD::UncalibMeasType::RpcStripType
@ RpcStripType
xAOD::UncalibMeasType::MdtDriftCircleType
@ MdtDriftCircleType
xAOD::int
setRawEt setRawPhi int
Definition: TrigCaloCluster_v1.cxx:33
xAOD::ConstVectorMap
Eigen::Map< const MeasVector< N > > ConstVectorMap
Definition: MeasurementDefs.h:59
xAOD::AmgSymMatrix
AmgSymMatrix(N) toEigen(const ConstMatrixMap< N > &xAODmat)
Definition: MeasurementDefs.h:86
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