ATLAS Offline Software
Loading...
Searching...
No Matches
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
22namespace xAOD {
23
25enum class UncalibMeasType {
26 Other = 0,
27 // InDet
30 // Muon
36 // HGTD
38 // Do not add anything after nTypes
40};
41
43using DetectorIDHashType = unsigned int;
44using DetectorIdentType = long unsigned int;
46template <size_t N>
49template <size_t N>
52template <size_t N>
53using MeasVector = Eigen::Matrix<float, N, 1>;
54template <size_t N>
55using MeasMatrix = Eigen::Matrix<float, N, N>;
56
57template <size_t N>
58using VectorMap = Eigen::Map<MeasVector<N>>;
59template <size_t N>
60using ConstVectorMap = Eigen::Map<const MeasVector<N>>;
61
62template <size_t N>
63using MatrixMap = Eigen::Map<MeasMatrix<N>>;
64template <size_t N>
65using ConstMatrixMap = Eigen::Map<const MeasMatrix<N>>;
66
69template <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
77template <int N> MeasMatrix<N> toStorage(const AmgSymMatrix(N)& amgMat)
78 requires (N > 1) {
80 for (int i =0 ; i < N; ++i){
81 for (int j =0 ; j < N; ++j) {
82 mat(i,j) = amgMat(i, j);
83 }
84 }
85 return mat;
86}
87
88template <int N> AmgSymMatrix(N) toEigen(const ConstMatrixMap<N>& xAODmat)
89 requires (N > 1) {
90 AmgSymMatrix(N) mat{AmgSymMatrix(N)::Zero()};
91 for (int i=0; i < N; ++i){
92 for (int j =0; j < N; ++j){
93 mat(i, j) = xAODmat(i, j);
94 }
95 }
96 return mat;
97}
98
99template <int N> AmgVector(N) toEigen(const ConstVectorMap<N>& xAODvec) {
100 AmgVector(N) v{AmgVector(N)::Zero()};
101 for (int i = 0 ; i < N; ++i) {
102 v[i] = xAODvec[i];
103 }
104 return v;
105}
106
107
108} // namespace xAOD
109#endif
Base class for elements of a container that can have aux data.
std::vector< size_t > vec
Ensure that eigen aux variables get properly zeroed.
#define AmgSymMatrix(dim)
#define AmgVector(rows)
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:572
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
SG::AuxElement::Accessor< std::array< float, N > > PosAccessor
xAOD Accessor to the position
Eigen::Matrix< float, N, N > MeasMatrix
Eigen::Map< const MeasMatrix< N > > ConstMatrixMap
Eigen::Matrix< float, N, 1 > MeasVector
Abrivation of the Matrix & Covariance definitions.
Eigen::Map< MeasVector< N > > VectorMap
setRawEt setRawPhi int
long unsigned int DetectorIdentType
MeasVector< N > toStorage(const AmgVector(N)&amgVec)
Converts the double precision of the AmgVector into the floating point storage precision of the MeasV...
UncalibMeasType
Define the type of the uncalibrated measurement.
SG::AuxElement::Accessor< std::array< float, N *N > > CovAccessor
xAOD Accessor to the covariance
Eigen::Map< MeasMatrix< N > > MatrixMap
unsigned int DetectorIDHashType
@ detector ID element hash
Eigen::Map< const MeasVector< N > > ConstVectorMap