ATLAS Offline Software
Loading...
Searching...
No Matches
MeasurementDefs.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef XAODMEASUREMENTBASE_MEASUREMENTDEFS_H
5#define XAODMEASUREMENTBASE_MEASUREMENTDEFS_H
6// EDM include(s):
7#include <array>
8
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
21namespace xAOD {
22
24enum class UncalibMeasType {
25 Other = 0,
26 // InDet
29 // Muon
35 // HGTD
37 // Do not add anything after nTypes
39};
40
42std::string toString(const UncalibMeasType type);
43
44inline std::ostream& operator<<(std::ostream&ostr, const UncalibMeasType type) {
45 return (ostr<<toString(type));
46}
47
48using DetectorIDHashType = unsigned int;
49using DetectorIdentType = long unsigned int;
51template <size_t N>
52using PosAccessor = SG::AuxElement::Accessor<std::array<float, N>>;
54template <size_t N>
55using CovAccessor = SG::AuxElement::Accessor<std::array<float, N * N>>;
57template <size_t N>
58using MeasVector = Eigen::Matrix<float, N, 1>;
59template <size_t N>
60using MeasMatrix = Eigen::Matrix<float, N, N>;
61
62template <size_t N>
63using VectorMap = Eigen::Map<MeasVector<N>>;
64template <size_t N>
65using ConstVectorMap = Eigen::Map<const MeasVector<N>>;
66
67template <size_t N>
68using MatrixMap = Eigen::Map<MeasMatrix<N>>;
69template <size_t N>
70using ConstMatrixMap = Eigen::Map<const MeasMatrix<N>>;
71
74template <int N> MeasVector<N> toStorage(const AmgVector(N)& amgVec){
76 for (int i =0 ; i < N ; ++i) vec[i] = amgVec[i];
77 return vec;
78}
79
82template <int N> MeasMatrix<N> toStorage(const AmgSymMatrix(N)& amgMat)
83 requires (N > 1) {
85 for (int i =0 ; i < N; ++i){
86 for (int j =0 ; j < N; ++j) {
87 mat(i,j) = amgMat(i, j);
88 }
89 }
90 return mat;
91}
92
95template <int N> AmgSymMatrix(N) toEigen(const ConstMatrixMap<N>& xAODmat)
96 requires (N > 1) {
97 AmgSymMatrix(N) mat{AmgSymMatrix(N)::Zero()};
98 for (int i=0; i < N; ++i){
99 for (int j =0; j < N; ++j){
100 mat(i, j) = xAODmat(i, j);
101 }
102 }
103 return mat;
104}
105
108template <int N> AmgVector(N) toEigen(const ConstVectorMap<N>& xAODvec) {
109 AmgVector(N) v{AmgVector(N)::Zero()};
110 for (int i = 0 ; i < N; ++i) {
111 v[i] = xAODvec[i];
112 }
113 return v;
114}
115
116
117} // namespace xAOD
118#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)
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
std::ostream & operator<<(std::ostream &out, const std::pair< FIRST, SECOND > &pair)
Helper print operator.
std::string toString(const UncalibMeasType type)
Convert the measurement enum to a string.
unsigned int DetectorIDHashType
@ detector ID element hash
Eigen::Map< const MeasVector< N > > ConstVectorMap