ATLAS Offline Software
MuonObj.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MCPMUONOBJ_H
6 #define MCPMUONOBJ_H
7 
8 #include "xAODMuon/Muon.h"
11 
12 namespace
13 {
14  static constexpr double GeVtoMeV = 1e+3;
15  static constexpr double MeVtoGeV = 1e-3;
16 } // namespace
17 
18 
19 namespace MCP {
21  struct TrackCalibObj{
22  TrackCalibObj() = default;
24  DataYear year, bool isData)
25  : type{t},
26  is_valid{track != nullptr},
27  uncalib_pt{(track != nullptr) ? track->pt() * MeVtoGeV : 0},
29  eta{(track != nullptr) ? track->eta() : FLT_MAX},
30  phi{(track != nullptr) ? track->phi() : FLT_MAX},
31  mass{(track != nullptr) ? track->m() : 0},
34  year{year},
35  isData{isData},
36  pars{(track != nullptr) ? track->definingParameters()
37  : AmgVector(5)::Zero()},
38  covariance{(track != nullptr)
39  ? track->definingParametersCovMatrix()
40  : AmgSymMatrix(5)::Zero()} {}
41 
43  double eta, double phi, DataYear year, bool isData)
44  : type{t},
45  is_valid{track != nullptr},
46  uncalib_pt{(track != nullptr) ? track->pt() * MeVtoGeV : 0},
48  eta{eta},
49  phi{phi},
50  mass{(track != nullptr) ? track->m() : 0},
53  year{year},
54  isData{isData},
55  pars{(track != nullptr) ? track->definingParameters()
56  : AmgVector(5)()},
57  covariance{(track != nullptr)
58  ? track->definingParametersCovMatrix()
59  : AmgSymMatrix(5)()} {}
60 
61  TrackCalibObj(TrackType t, int charge, double pt, double eta, double phi, double mass, AmgVector(5) pars, AmgSymMatrix(5) cov, DataYear year, bool isData):
62  type{t},
63  is_valid{true},
66  eta{eta},
67  phi{phi},
68  mass{mass},
71  year{year},
72  isData{isData},
73  pars {pars},
74  covariance{cov}
75  {}
76 
77  TrackCalibObj(TrackType t, double pt, double eta, double phi, DataYear year, bool isData):
78  type{t},
79  is_valid{true},
82  eta{eta},
83  phi{phi},
84  mass{-999},
85  uncalib_charge{-999},
86  calib_charge{-999},
87  year{year},
88  isData{isData},
89  pars (AmgVector(5)::Zero()),
90  covariance (AmgSymMatrix(5)::Zero())
91  {}
92 
93 
94 
96  const TrackType type{};
98  const bool is_valid{false};
100  const double uncalib_pt{0.};
102  double calib_pt{0.};
104  const double eta{0.};
106  const double phi{0.};
108  const double mass{0.};
110  const int uncalib_charge{0};
112  int calib_charge{0};
113  // Data year
114  const DataYear year{};
115  // isData
116  const bool isData{};
117 
119  const AmgVector(5) pars{AmgVector(5)::Zero()};
121  const AmgSymMatrix(5) covariance{AmgSymMatrix(5)::Zero()};
122  };
123 
124 
125  struct MuonObj
126  {
127  MuonObj(const TrackCalibObj& CB, const TrackCalibObj& ID, const TrackCalibObj& ME): ID{ID}, ME{ME}, CB{CB}{}
128 
132 
134  double rnd_g0{0.};
135  double rnd_g1{0.};
136  double rnd_g2{0.};
137  double rnd_g3{0.};
138  double rnd_g4{0.};
139  double rnd_g_highPt{0.};
140 
141 
144 
145  // Expected resolution number for statistical combination
146  double expectedResID{0.};
147  double expectedResME{0.};
148 
149  double expectedPercentResID{0.};
150  double expectedPercentResME{0.};
151 
152  inline double getCalibpt(TrackType type) const
153  {
154  if(type == MCP::TrackType::CB) return CB.calib_pt;
155  else if(type == MCP::TrackType::ID) return ID.calib_pt;
156  else if(type == MCP::TrackType::ME) return ME.calib_pt;
157  return 0;
158  }
159  };
160 }
161 #endif
MCP::TrackCalibObj::is_valid
const bool is_valid
Flag telling whether the track particle exists at all.
Definition: MuonObj.h:98
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
CP::IMuonSelectionTool::ResolutionCategory
ResolutionCategory
Declare the interface that the class provides.
Definition: IMuonSelectionTool.h:31
ID
std::vector< Identifier > ID
Definition: CalibHitIDCheck.h:24
MCP::TrackCalibObj::uncalib_pt
const double uncalib_pt
Value of the track-pt pre-calibration.
Definition: MuonObj.h:100
Muon.h
MCP::MuonObj::getCalibpt
double getCalibpt(TrackType type) const
Definition: MuonObj.h:152
MCP::TrackCalibObj::TrackCalibObj
TrackCalibObj()=default
plotBeamSpotVxVal.cov
cov
Definition: plotBeamSpotVxVal.py:201
test_pyathena.pt
pt
Definition: test_pyathena.py:11
CP::MeVtoGeV
constexpr float MeVtoGeV
Definition: IsolationCloseByCorrectionTool.cxx:33
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
MCP::TrackCalibObj::uncalib_charge
const int uncalib_charge
Value of the track-charge (before calibration)
Definition: MuonObj.h:110
MCP::TrackCalibObj::TrackCalibObj
TrackCalibObj(TrackType t, double pt, double eta, double phi, DataYear year, bool isData)
Definition: MuonObj.h:77
MCP::TrackCalibObj::year
const DataYear year
Definition: MuonObj.h:114
MCP::TrackCalibObj::calib_charge
int calib_charge
Value of the track-charge (after calibration)
Definition: MuonObj.h:112
IMuonSelectionTool.h
MCP::MuonObj::MuonObj
MuonObj(const TrackCalibObj &CB, const TrackCalibObj &ID, const TrackCalibObj &ME)
Definition: MuonObj.h:127
MCP::TrackCalibObj::TrackCalibObj
TrackCalibObj(const xAOD::TrackParticle *track, TrackType t, int charge, double eta, double phi, DataYear year, bool isData)
Definition: MuonObj.h:42
MCP::TrackCalibObj::eta
const double eta
Value of the track-eta.
Definition: MuonObj.h:104
MCP::TrackCalibObj::type
const TrackType type
Flag telling the code whether this is CB/ME/ID.
Definition: MuonObj.h:96
MCP::TrackCalibObj::phi
const double phi
Value of the track-phi.
Definition: MuonObj.h:106
MCP::TrackCalibObj::AmgVector
const AmgVector(5) pars
Track perigee parameters.
Definition: MuonObj.h:119
charge
double charge(const T &p)
Definition: AtlasPID.h:756
MCP
Definition: CalibContainer.h:18
MCP::TrackCalibObj::calib_pt
double calib_pt
Smeared track pt.
Definition: MuonObj.h:102
EnumDef.h
MCP::TrackCalibObj::TrackCalibObj
TrackCalibObj(TrackType t, int charge, double pt, double eta, double phi, double mass, AmgVector(5) pars, AmgSymMatrix(5) cov, DataYear year, bool isData)
Definition: MuonObj.h:61
MCP::TrackType::CB
@ CB
MCP::TrackCalibObj::TrackCalibObj
TrackCalibObj(const xAOD::TrackParticle *track, TrackType t, int charge, DataYear year, bool isData)
Definition: MuonObj.h:23
MCP::TrackCalibObj::mass
const double mass
Value of the track-mass.
Definition: MuonObj.h:108
MCP::TrackCalibObj::isData
const bool isData
Definition: MuonObj.h:116
MCP::DataYear
DataYear
Definition: EnumDef.h:28
MCP::MuonObj
Definition: MuonObj.h:126
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
MCP::TrackCalibObj::AmgSymMatrix
const AmgSymMatrix(5) covariance
Full track covariance matrix.
Definition: MuonObj.h:121
MCP::TrackCalibObj
Basic object to cache all relevant information from the track.
Definition: MuonObj.h:21
MCP::TrackType::ME
@ ME
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32
xAOD::TauJetParameters::unclassified
@ unclassified
Definition: TauDefs.h:410
TrackType
Definition: TrackTypes.h:10
MCP::TrackType::ID
@ ID