ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
egamma
egammaValidation
src
TruthElectronHistograms.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TruthElectronHistograms.h
"
6
#include "
xAODTruth/TruthParticle.h
"
7
#include "
xAODEgamma/Electron.h
"
8
#include "
AsgTools/AnaToolHandle.h
"
9
#include "GaudiKernel/ITHistSvc.h"
10
11
#include "
xAODTracking/TrackParticle.h
"
12
13
#include "TH1D.h"
14
#include "TH2D.h"
15
16
using namespace
egammaMonitoring
;
17
18
StatusCode
TruthElectronHistograms::initializePlots
() {
19
return
initializePlots
(
false
);
20
}
21
22
StatusCode
TruthElectronHistograms::initializePlots
(
bool
reducedHistSet) {
23
24
const
char
* fN =
m_name
.c_str();
25
26
if
(!reducedHistSet) {
27
histoMap
[
"deltaPhi2"
] =
new
TH1D(Form(
"%s_deltaPhi2"
,fN),
";deltaPhi2; Events"
, 40, -0.06, 0.06);
28
histoMap
[
"deltaEta2"
] =
new
TH1D(Form(
"%s_deltaEta2"
,fN),
";deltaEta2; Events"
, 40, -0.04, 0.04);
29
histoMap
[
"deltaPhiRescaled2"
] =
new
TH1D(Form(
"%s_deltaPhiRescaled2"
,fN),
";deltaPhiRescaled2; Events"
, 40, -0.04, 0.04);
30
31
histoMap
[
"d0Oversigmad0"
] =
new
TH1D(Form(
"%s_d0Oversigmad0"
,fN),
"; d0Oversigmad0; Events"
, 40, -10, 10);
32
histoMap
[
"qOverp_resolution"
] =
new
TH1D(Form(
"%s_qOverp_resolution"
,fN),
";(q/P reco - q/P truth)/ q/p truth; Events"
, 60, -1, 1.5);
33
34
ATH_CHECK
(
m_rootHistSvc
->regHist(
m_folder
+
"deltaPhi2"
,
histoMap
[
"deltaPhi2"
]));
35
ATH_CHECK
(
m_rootHistSvc
->regHist(
m_folder
+
"deltaEta2"
,
histoMap
[
"deltaEta2"
]));
36
ATH_CHECK
(
m_rootHistSvc
->regHist(
m_folder
+
"deltaPhiRescaled2"
,
histoMap
[
"deltaPhiRescaled2"
]));
37
ATH_CHECK
(
m_rootHistSvc
->regHist(
m_folder
+
"d0Oversigmad0"
,
histoMap
[
"d0Oversigmad0"
]));
38
ATH_CHECK
(
m_rootHistSvc
->regHist(
m_folder
+
"qOverp_resolution"
,
histoMap
[
"qOverp_resolution"
]));
39
40
// 2D only for truthPromptElectronWithRecoTrack (temporary)
41
if
(
m_name
==
"truthPromptElectronWithRecoTrack"
) {
42
histoMap2D
[
"eta_deltaPhi2"
] =
new
TH2D(Form(
"%s_eta_deltaPhi2"
,fN),
43
";#eta;#Delta#phi_{2}; Events"
, 90, -4.5, 4.5, 40, -0.06, 0.06);
44
histoMap2D
[
"eta_deltaEta2"
] =
new
TH2D(Form(
"%s_eta_deltaEta2"
,fN),
45
";#eta;#Delta#eta_{2}; Events"
, 90, -4.5, 4.5, 40, -0.06, 0.06);
46
histoMap2D
[
"eta_deltaPhiRescaled2"
] =
new
TH2D(Form(
"%s_eta_deltaPhiRescaled2"
,fN),
47
";#eta;#Delta#phi_{2}^{Rescaled}; Events"
, 90, -4.5, 4.5, 40, -0.06, 0.06);
48
histoMap2D
[
"eta_d0Oversigmad0"
] =
new
TH2D(Form(
"%s_eta_d0Oversigmad0"
,fN),
49
";#eta;d_{0}/#sigma_{d_{0}}; Events"
, 90, -4.5, 4.5, 40, -10, 10);
50
histoMap2D
[
"eta_qOverp_resolution"
] =
new
TH2D(Form(
"%s_eta_qOverp_resolution"
,fN),
51
";#eta;(q/P_{reco})/(q/P_{truth}) -1; Events"
, 90, -4.5, 4.5, 60, -1, 1.5);
52
53
for
(
const
auto
& e :
histoMap2D
) {
54
ATH_CHECK
(
m_rootHistSvc
->regHist(
m_folder
+e.first, e.second));
55
}
56
}
57
}
58
59
ATH_CHECK
(
ParticleHistograms::initializePlots
());
60
61
m_reducedHistSet
= reducedHistSet;
62
63
return
StatusCode::SUCCESS;
64
65
}
66
67
68
void
TruthElectronHistograms::fill
(
const
xAOD::TruthParticle
*truth,
const
xAOD::Electron
* electron) {
69
70
ParticleHistograms::fill
(*truth);
71
72
if
(!electron ||
m_reducedHistSet
)
return
;
73
74
const
xAOD::TrackParticle
* track = electron->trackParticle();
75
76
// This can happen if we use it for forwardElectron
77
if
(!track)
return
;
78
79
bool
has2DHis = !
histoMap2D
.empty();
80
81
float
dphires2(0.);
82
float
dphi2(0.);
83
float
deta2(0);
84
85
if
(electron->trackCaloMatchValue(dphires2,
xAOD::EgammaParameters::deltaPhiRescaled2
)) {
86
histoMap
[
"deltaPhiRescaled2"
]->Fill(dphires2);
87
if
(has2DHis)
histoMap2D
[
"eta_deltaPhiRescaled2"
]->Fill(electron->eta(),dphires2);
88
}
89
if
(electron->trackCaloMatchValue(dphi2,
xAOD::EgammaParameters::deltaPhi2
)) {
90
histoMap
[
"deltaPhi2"
]->Fill(dphi2);
91
if
(has2DHis)
histoMap2D
[
"eta_deltaPhi2"
]->Fill(electron->eta(),dphi2);
92
}
93
if
(electron->trackCaloMatchValue(deta2,
xAOD::EgammaParameters::deltaEta2
)) {
94
histoMap
[
"deltaEta2"
]->Fill(deta2);
95
if
(has2DHis)
histoMap2D
[
"eta_deltaEta2"
]->Fill(electron->eta(),deta2);
96
}
97
98
float
d0 = track->d0();
99
float
reco_qp = track->qOverP();
100
float
truth_qp = truth->
charge
()/(truth->
pt
()*cosh(truth->
eta
()));
101
float
vard0 = track->definingParametersCovMatrix()(0, 0);
102
103
if
(vard0 > 0) {
104
histoMap
[
"d0Oversigmad0"
]->Fill(d0/sqrtf(vard0));
105
if
(has2DHis)
histoMap2D
[
"eta_d0Oversigmad0"
]->Fill(electron->eta(),d0/sqrtf(vard0));
106
}
107
108
if
(truth_qp > 0) {
109
histoMap
[
"qOverp_resolution"
]->Fill((reco_qp-truth_qp)/truth_qp);
110
if
(has2DHis)
histoMap2D
[
"eta_qOverp_resolution"
]->Fill(electron->eta(),(reco_qp-truth_qp)/truth_qp);
111
}
112
113
114
}
115
AnaToolHandle.h
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
Electron.h
TrackParticle.h
TruthParticle.h
TruthElectronHistograms.h
egammaMonitoring::IHistograms::m_folder
std::string m_folder
Definition
IHistograms.h:47
egammaMonitoring::IHistograms::m_rootHistSvc
SmartIF< ITHistSvc > m_rootHistSvc
Definition
IHistograms.h:48
egammaMonitoring::IHistograms::m_name
std::string m_name
Definition
IHistograms.h:45
egammaMonitoring::IHistograms::histoMap
std::map< std::string, TH1D * > histoMap
Definition
IHistograms.h:42
egammaMonitoring::ParticleHistograms::initializePlots
StatusCode initializePlots()
Definition
ParticleHistograms.cxx:13
egammaMonitoring::ParticleHistograms::fill
void fill(const xAOD::IParticle &egamma)
Definition
ParticleHistograms.cxx:41
egammaMonitoring::TruthElectronHistograms::initializePlots
virtual StatusCode initializePlots() override
Definition
TruthElectronHistograms.cxx:18
egammaMonitoring::TruthElectronHistograms::m_reducedHistSet
bool m_reducedHistSet
Definition
TruthElectronHistograms.h:37
egammaMonitoring::TruthElectronHistograms::fill
void fill(const xAOD::TruthParticle *truth, const xAOD::Electron *el=nullptr)
Definition
TruthElectronHistograms.cxx:68
egammaMonitoring::TruthElectronHistograms::histoMap2D
std::map< std::string, TH2D * > histoMap2D
Definition
TruthElectronHistograms.h:33
xAOD::TruthParticle_v1::pt
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Definition
TruthParticle_v1.cxx:161
xAOD::TruthParticle_v1::charge
double charge() const
Physical charge.
xAOD::TruthParticle_v1::eta
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Definition
TruthParticle_v1.cxx:169
egammaMonitoring
Definition
ClusterHistograms.h:19
xAOD::EgammaParameters::deltaEta2
@ deltaEta2
difference between the cluster eta (second sampling) and the eta of the track extrapolated to the sec...
Definition
EgammaEnums.h:188
xAOD::EgammaParameters::deltaPhiRescaled2
@ deltaPhiRescaled2
difference between the cluster phi (second sampling) and the phi of the track extrapolated to the sec...
Definition
EgammaEnums.h:226
xAOD::EgammaParameters::deltaPhi2
@ deltaPhi2
difference between the cluster phi (second sampling) and the phi of the track extrapolated to the sec...
Definition
EgammaEnums.h:205
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::Electron
Electron_v1 Electron
Definition of the current "egamma version".
Definition
Event/xAOD/xAODEgamma/xAODEgamma/Electron.h:17
Generated on
for ATLAS Offline Software by
1.17.0