ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonValidation
MuonHistogramming
MuonHistUtils
Root
TruthRelatedMuonPlotOrganizer.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
MuonHistUtils/TruthRelatedMuonPlotOrganizer.h
"
6
7
#include "
AthContainers/ConstAccessor.h
"
8
#include "
xAODTracking/TrackParticleAuxContainer.h
"
9
#include "
xAODTracking/TrackParticleContainer.h
"
10
#include "
xAODTruth/TruthParticleAuxContainer.h
"
11
#include "
xAODTruth/TruthParticleContainer.h
"
12
13
typedef
ElementLink<xAOD::TruthParticleContainer>
TruthLink
;
14
15
namespace
Muon
{
16
17
TruthRelatedMuonPlotOrganizer::TruthRelatedMuonPlotOrganizer
(
18
PlotBase
* pParent,
const
std::string& sDir,
bool
doBinnedResolutionPlots,
19
std::vector<int> selPlots)
20
:
PlotBase
(pParent, sDir)
21
// Truth related plots
22
{
23
24
if
(selPlots.empty()) {
25
for (unsigned int i = 0; i < MAX_TRUTHRELATEDPLOTCLASS; i++) {
26
m_selPlots.push_back(i);
27
}
28
}
else
{
29
m_selPlots = std::move(selPlots);
30
}
31
32
for
(
auto
p : m_selPlots) {
33
switch
(p) {
34
case
TRK_MATCHEDTRUE
:
35
m_oMatchedPlots = std::make_unique<Trk::ParamPlots>(
36
this
,
"/kinematics/"
,
"Matched Muons"
);
37
break
;
38
case
TRK_MATCHEDRECO
:
39
m_oMatchedRecoPlots = std::make_unique<Trk::ParamPlots>(
40
this
,
"/kinematicsReco/"
,
"Matched Muons"
);
41
break
;
42
case
TRK_MSHITDIFF
:
43
m_oMSHitDiffPlots =
44
std::make_unique<Trk::MSHitDiffPlots>(
this
,
"/hits/"
);
45
break
;
46
case
MUON_HITDIFF
:
47
m_oMuonHitDiffSummaryPlots =
48
std::make_unique<Muon::MuonHitDiffSummaryPlots>(
this
,
49
"/hits/"
);
50
break
;
51
case
MUON_TRUTHHIT
:
52
m_oMuonTruthHitPlots =
53
std::make_unique<Muon::MuonTruthHitPlots>(
this
,
54
"/truthHits/"
);
55
break
;
56
case
MUON_RESOL
:
57
m_oMuonResolutionPlots =
58
std::make_unique<Muon::MuonResolutionPlots>(
59
this
,
"/resolution/"
,
""
, doBinnedResolutionPlots);
60
break
;
61
case
TRK_DEFPARAMPULLS
:
62
m_oDefParamPullPlots = std::make_unique<Trk::DefParamPullPlots>(
63
this
,
"/pulls/"
,
""
);
64
break
;
65
case
MUON_PULLSTAIL
:
66
m_oMomentumTruthPullPlots_Tail =
67
std::make_unique<Muon::MomentumTruthPullPlots>(
68
this
,
"/momentumPulls/"
,
"Tail"
);
69
break
;
70
case
MUON_PULLSNOTAIL
:
71
m_oMomentumTruthPullPlots_NoTail =
72
std::make_unique<Muon::MomentumTruthPullPlots>(
73
this
,
"/momentumPulls/"
,
"NoTail"
);
74
break
;
75
case
MUON_PARAMELOSS
:
76
m_oMatchedRecoElossPlots =
77
std::make_unique<Muon::MuonParamElossPlots>(
this
,
78
"/Eloss/"
);
79
break
;
80
}
81
}
82
}
83
TruthRelatedMuonPlotOrganizer::~TruthRelatedMuonPlotOrganizer() =
default
;
84
85
void
TruthRelatedMuonPlotOrganizer::fill
(
86
const
xAOD::TruthParticle
& truthMu,
const
xAOD::Muon
& mu,
float
weight) {
87
if
(
m_oMatchedPlots
) {
88
m_oMatchedPlots
->fill(truthMu, weight);
89
}
90
if
(
m_oMuonHitDiffSummaryPlots
) {
91
m_oMuonHitDiffSummaryPlots
->fill(mu, truthMu, weight);
92
}
93
if
(
m_oMuonTruthHitPlots
) {
94
m_oMuonTruthHitPlots
->fill(mu, weight);
95
}
96
97
// for eloss
98
if
(
m_oMatchedRecoElossPlots
) {
99
m_oMatchedRecoElossPlots
->fill(truthMu, mu, weight);
100
}
101
102
// Tracking related plots
103
const
xAOD::TrackParticle
* primaryTrk =
104
mu.trackParticle(xAOD::Muon::Primary);
105
// const xAOD::TrackParticle* meTrk =
106
// mu.trackParticle(xAOD::Muon::ExtrapolatedMuonSpectrometerTrackParticle);
107
108
if
(!primaryTrk) {
109
return
;
110
}
111
if
(
m_oMatchedRecoPlots
) {
112
m_oMatchedRecoPlots
->fill(*primaryTrk, weight);
113
}
114
if
(
m_oMSHitDiffPlots
) {
115
m_oMSHitDiffPlots
->fill(*primaryTrk, truthMu, weight);
116
}
117
if
(
m_oMuonResolutionPlots
) {
118
m_oMuonResolutionPlots
->fill(*primaryTrk, truthMu, weight);
119
}
120
if
(
m_oDefParamPullPlots
) {
121
m_oDefParamPullPlots
->fill(*primaryTrk, truthMu, weight);
122
}
123
124
if
(
m_oMomentumTruthPullPlots_NoTail
||
m_oMomentumTruthPullPlots_Tail
) {
125
// muon spectrometer track at MS entry (not extrapolated)
126
const
xAOD::TrackParticle
* msTrk = mu.trackParticle(xAOD::Muon::TrackParticleType::MuonSpectrometerTrackParticle);
127
#ifndef XAOD_ANALYSIS
128
float
eloss = 0;
129
if
(mu.parameter(eloss, xAOD::Muon::ParamDef::EnergyLoss)) {
130
if
(mu.energyLossType() != xAOD::Muon::EnergyLossType::Tail) {
// to test MEASURED energy loss
131
if
(
m_oMomentumTruthPullPlots_NoTail
) {
132
m_oMomentumTruthPullPlots_NoTail
->fill(mu, msTrk, truthMu,
133
weight);
134
}
135
}
else
{
136
if
(
m_oMomentumTruthPullPlots_Tail
) {
137
m_oMomentumTruthPullPlots_Tail
->fill(
138
mu, msTrk, truthMu,
139
weight);
// to test PARAMETRIZED energy loss
140
}
141
}
142
}
143
#endif
// not XAOD_ANALYSIS
144
}
145
}
146
147
void
TruthRelatedMuonPlotOrganizer::fill
(
const
xAOD::TruthParticle
& truthMu,
148
const
xAOD::TrackParticle
& muTP,
149
float
weight) {
150
// Tracking related plots
151
if
(m_oMatchedPlots) {
152
m_oMatchedPlots->fill(truthMu, weight);
153
}
154
if
(m_oMatchedRecoPlots) {
155
m_oMatchedRecoPlots->fill(muTP, weight);
156
}
157
if
(m_oDefParamPullPlots) {
158
m_oDefParamPullPlots->fill(muTP, truthMu, weight);
159
}
160
if
(m_oMuonResolutionPlots) {
161
m_oMuonResolutionPlots->fill(muTP, truthMu, weight);
162
}
163
if
(m_oMSHitDiffPlots) {
164
m_oMSHitDiffPlots->fill(muTP, truthMu, weight);
165
}
166
}
167
168
}
// namespace Muon
ConstAccessor.h
Helper class to provide constant type-safe access to aux data.
TrackParticleContainer.h
TruthParticleContainer.h
TrackParticleAuxContainer.h
TruthParticleAuxContainer.h
TruthLink
ElementLink< xAOD::TruthParticleContainer > TruthLink
Definition
TruthRelatedMuonPlotOrganizer.cxx:13
TruthRelatedMuonPlotOrganizer.h
ElementLink
ElementLink implementation for ROOT usage.
Definition
A/AthLinks/ElementLink.h:40
Muon::TruthRelatedMuonPlotOrganizer::m_oMuonHitDiffSummaryPlots
std::unique_ptr< Muon::MuonHitDiffSummaryPlots > m_oMuonHitDiffSummaryPlots
Definition
TruthRelatedMuonPlotOrganizer.h:54
Muon::TruthRelatedMuonPlotOrganizer::m_oDefParamPullPlots
std::unique_ptr< Trk::DefParamPullPlots > m_oDefParamPullPlots
Definition
TruthRelatedMuonPlotOrganizer.h:57
Muon::TruthRelatedMuonPlotOrganizer::m_oMatchedRecoPlots
std::unique_ptr< Trk::ParamPlots > m_oMatchedRecoPlots
Definition
TruthRelatedMuonPlotOrganizer.h:52
Muon::TruthRelatedMuonPlotOrganizer::m_oMatchedPlots
std::unique_ptr< Trk::ParamPlots > m_oMatchedPlots
Definition
TruthRelatedMuonPlotOrganizer.h:51
Muon::TruthRelatedMuonPlotOrganizer::m_oMuonResolutionPlots
std::unique_ptr< Muon::MuonResolutionPlots > m_oMuonResolutionPlots
Definition
TruthRelatedMuonPlotOrganizer.h:56
Muon::TruthRelatedMuonPlotOrganizer::m_oMatchedRecoElossPlots
std::unique_ptr< Muon::MuonParamElossPlots > m_oMatchedRecoElossPlots
Definition
TruthRelatedMuonPlotOrganizer.h:62
Muon::TruthRelatedMuonPlotOrganizer::fill
void fill(const xAOD::TruthParticle &truthMu, const xAOD::Muon &mu, float weight=1.0)
Definition
TruthRelatedMuonPlotOrganizer.cxx:85
Muon::TruthRelatedMuonPlotOrganizer::TruthRelatedMuonPlotOrganizer
TruthRelatedMuonPlotOrganizer(PlotBase *pParent, const std::string &sDir, bool doBinnedResolutionPlots, std::vector< int > selPlots={})
Definition
TruthRelatedMuonPlotOrganizer.cxx:17
Muon::TruthRelatedMuonPlotOrganizer::m_oMomentumTruthPullPlots_NoTail
std::unique_ptr< Muon::MomentumTruthPullPlots > m_oMomentumTruthPullPlots_NoTail
Definition
TruthRelatedMuonPlotOrganizer.h:61
Muon::TruthRelatedMuonPlotOrganizer::m_oMSHitDiffPlots
std::unique_ptr< Trk::MSHitDiffPlots > m_oMSHitDiffPlots
Definition
TruthRelatedMuonPlotOrganizer.h:53
Muon::TruthRelatedMuonPlotOrganizer::m_oMuonTruthHitPlots
std::unique_ptr< Muon::MuonTruthHitPlots > m_oMuonTruthHitPlots
Definition
TruthRelatedMuonPlotOrganizer.h:55
Muon::TruthRelatedMuonPlotOrganizer::m_oMomentumTruthPullPlots_Tail
std::unique_ptr< Muon::MomentumTruthPullPlots > m_oMomentumTruthPullPlots_Tail
Definition
TruthRelatedMuonPlotOrganizer.h:59
PlotBase::PlotBase
PlotBase(PlotBase *parent, std::string_view sDir)
Definition
PlotBase.cxx:29
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition
TrackSystemController.h:46
Muon::TRK_MATCHEDRECO
@ TRK_MATCHEDRECO
Definition
TruthRelatedMuonPlotOrganizer.h:25
Muon::MUON_TRUTHHIT
@ MUON_TRUTHHIT
Definition
TruthRelatedMuonPlotOrganizer.h:28
Muon::MUON_PARAMELOSS
@ MUON_PARAMELOSS
Definition
TruthRelatedMuonPlotOrganizer.h:33
Muon::TRK_DEFPARAMPULLS
@ TRK_DEFPARAMPULLS
Definition
TruthRelatedMuonPlotOrganizer.h:30
Muon::MUON_HITDIFF
@ MUON_HITDIFF
Definition
TruthRelatedMuonPlotOrganizer.h:27
Muon::MUON_RESOL
@ MUON_RESOL
Definition
TruthRelatedMuonPlotOrganizer.h:29
Muon::TRK_MATCHEDTRUE
@ TRK_MATCHEDTRUE
Definition
TruthRelatedMuonPlotOrganizer.h:24
Muon::MUON_PULLSNOTAIL
@ MUON_PULLSNOTAIL
Definition
TruthRelatedMuonPlotOrganizer.h:32
Muon::TRK_MSHITDIFF
@ TRK_MSHITDIFF
Definition
TruthRelatedMuonPlotOrganizer.h:26
Muon::MUON_PULLSTAIL
@ MUON_PULLSTAIL
Definition
TruthRelatedMuonPlotOrganizer.h:31
xAOD::TrackParticle
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Definition
Event/xAOD/xAODTracking/xAODTracking/TrackParticle.h:13
xAOD::TruthParticle
TruthParticle_v1 TruthParticle
Typedef to implementation.
Definition
Event/xAOD/xAODTruth/xAODTruth/TruthParticle.h:15
xAOD::Muon
Muon_v1 Muon
Reference the current persistent version:
Definition
Event/xAOD/xAODMuon/xAODMuon/Muon.h:13
Generated on
for ATLAS Offline Software by
1.17.0