ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
StandardModelPhys
Validation
ZeeValidation
src
TrueElectronsPlots.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 "
ZeeValidation/TrueElectronsPlots.h
"
6
7
using
CLHEP::GeV;
8
9
namespace
ZeeValidation
{
10
11
TrueElectronsPlots::TrueElectronsPlots
(
PlotBase
* pParent,
const
std::string& sDir,
const
std::string& sParticleType):
12
PlotBase
(pParent, sDir),
13
m_sParticleType
(sParticleType),
14
h_e_response_vs_e
(NULL),
15
h_e_cluster_response_vs_e
(NULL),
16
h_e_response_vs_eta
(NULL),
17
h_e_cluster_response_vs_eta
(NULL) ,
18
h_e_response_vs_phi
(NULL),
19
h_e_cluster_response_vs_phi
(NULL) ,
20
h_dr_electron
(NULL),
21
h_dphi_electron
(NULL),
22
h_deta_electron
(NULL),
23
h_dr_photon
(NULL)
24
{
25
for
(
int
i = 0; i <
nLevels
; i++) {
26
h_electron_pt
[i] = NULL;
27
h_electron_eta
[i] = NULL;
28
h_electron_phi
[i] = NULL;
29
}
30
for
(
int
i = 0; i <
nLevels
-1; i++) {
31
h_electron_eff_pt
[i] = NULL;
32
h_electron_eff_eta
[i] = NULL;
33
h_electron_eff_phi
[i] = NULL;
34
}
35
}
36
//-------------------------------------------------
37
const
std::string
TrueElectronsPlots::cLevelLabel
[nLevels] = {
38
"True"
,
39
"Assoc"
,
40
"Matched"
,
41
"OQ"
,
42
"Loose"
,
43
"Medium"
,
44
"Tight"
,
45
"LHLoose"
,
46
"LHMedium"
,
47
"LHTight"
48
};
49
//-------------------------------------------------
50
void
TrueElectronsPlots::initializePlots
(){
51
TH1::SetDefaultSumw2(kTRUE);
52
TProfile::SetDefaultSumw2(kTRUE);
53
54
for
(
int
i = 0; i <
nLevels
; i++) {
55
h_electron_pt
[i] =
Book1D
(
"Pt"
+
cLevelLabel
[i],
"P_{T} of "
+
m_sParticleType
+
"; P_{T} (GeV);Events"
, 60, 20., 140.);
56
h_electron_eta
[i] =
Book1D
(
"Eta"
+
cLevelLabel
[i],
"#eta of "
+
m_sParticleType
+
";#eta;Events"
, 50, -2.5, 2.5);
57
h_electron_phi
[i] =
Book1D
(
"Phi"
+
cLevelLabel
[i],
"#varphi of "
+
m_sParticleType
+
";#varphi;Events"
, 60, -TMath::Pi(), TMath::Pi());
58
}
59
60
for
(
int
i = 0; i <
nLevels
-1; i++) {
61
h_electron_eff_pt
[i] =
BookTProfile
(
"PtEff"
+
cLevelLabel
[i+1] +
cLevelLabel
[0],
cLevelLabel
[i+1] +
" Efficiency vs P_{T} of "
+
m_sParticleType
+
"; E_{T} (GeV);"
+
cLevelLabel
[i+1] +
"/"
+
cLevelLabel
[0], 60, 20., 140.);
62
h_electron_eff_eta
[i] =
BookTProfile
(
"EtaEff"
+
cLevelLabel
[i+1] +
cLevelLabel
[0],
cLevelLabel
[i+1] +
" Efficiency vs #eta of "
+
m_sParticleType
+
";#eta;"
+
cLevelLabel
[i+1] +
"/"
+
cLevelLabel
[0], 50, -2.5, 2.5);
63
h_electron_eff_phi
[i] =
BookTProfile
(
"PhiEff"
+
cLevelLabel
[i+1] +
cLevelLabel
[0],
cLevelLabel
[i+1] +
" Efficiency vs #varphi of "
+
m_sParticleType
+
";#varphi;"
+
cLevelLabel
[i+1] +
"/"
+
cLevelLabel
[0], 60, -TMath::Pi(), TMath::Pi());
64
}
65
66
h_e_response_vs_e
=
BookTProfile
(
"EnergyResponseVsEnergy"
,
"Energy response vs energy; E^{true}; E^{reco}-E^{true}/E^{true}"
, 20, 0., 200);
67
h_e_response_vs_eta
=
BookTProfile
(
"EnergyResponseVsEta"
,
"Energy response vs #eta; #eta; E^{reco}-E^{true}/E^{true}"
, 30, -3., 3.);
68
h_e_response_vs_phi
=
BookTProfile
(
"EnergyResponseVsPhi"
,
"Energy response vs #varphi; #varphi; E^{reco}-E^{true}/E^{true}"
, 30, -TMath::Pi(), TMath::Pi());
69
h_e_cluster_response_vs_e
=
BookTProfile
(
"EnergyClusterResponseVsEnergy"
,
"Energy of cluster response vs energy; E^{true}; E^{reco}-E^{true}/E^{true}"
, 20, 0., 200);
70
h_e_cluster_response_vs_eta
=
BookTProfile
(
"EnergyClusterResponseVsEta"
,
"Energy of cluster response vs #eta; #eta; E^{reco}-E^{true}/E^{true}"
, 30, -3., 3.);
71
h_e_cluster_response_vs_phi
=
BookTProfile
(
"EnergyClusterResponseVsPhi"
,
"Energy of cluster response vs #varphi; #varphi; E^{reco}-E^{true}/E^{true}"
, 30, -TMath::Pi(), TMath::Pi());
72
73
h_dr_electron
=
Book1D
(
"DeltaRElectron"
,
"#DeltaR(truth particle, electron); #DeltaR; Events"
, 30, 0., 0.2);
74
h_dphi_electron
=
Book1D
(
"DeltaPhiElectron"
,
"#Delta #phi(truth particle, electron); #Delta #phi; Events"
, 20, -0.01, 0.01);
75
h_deta_electron
=
Book1D
(
"DeltaEtaElectron"
,
"#Delta #eta(truth particle, electron); #Delta #eta; Events"
, 20, -0.01, 0.01);
76
77
h_dr_photon
=
Book1D
(
"DeltaRPhoton"
,
"#DeltaR(truth particle, photon); #DeltaR; Events"
, 30, 0., 0.2);
78
79
}
80
//-------------------------------------------------
81
void
TrueElectronsPlots::fill
(
const
xAOD::IParticle
* part,
int
level){
82
h_electron_eta
[level] -> Fill(part ->
eta
());
83
}
84
//-------------------------------------------------
85
void
TrueElectronsPlots::fillinAcc
(
const
xAOD::IParticle
* part,
int
level){
86
h_electron_pt
[level] -> Fill(part -> pt()*(1./
GeV
));
87
h_electron_phi
[level] -> Fill(part ->
phi
());
88
}
89
90
//-------------------------------------------------
91
void
TrueElectronsPlots::fillResponse
(
const
xAOD::IParticle
* part,
const
xAOD::Electron
* electron) {
92
93
h_e_response_vs_e
-> Fill( part -> e()*(1./
GeV
), (electron -> e() - part -> e())/part -> e() );
94
h_e_response_vs_eta
-> Fill( part ->
eta
(), (electron -> e() - part -> e())/part -> e() );
95
h_e_response_vs_phi
-> Fill( part ->
phi
(), (electron -> e() - part -> e())/part -> e() );
96
97
h_dr_electron
-> Fill( part -> p4().DeltaR(electron -> p4()));
98
h_dphi_electron
-> Fill( part -> p4().DeltaPhi(electron -> p4()));
99
h_deta_electron
-> Fill( electron ->
eta
() - part ->
eta
() );
100
101
}
102
//-------------------------------------------------
103
void
TrueElectronsPlots::fillResponseCluster
(
const
xAOD::IParticle
* part,
const
xAOD::CaloCluster
* cluster) {
104
105
h_e_cluster_response_vs_e
-> Fill( part -> e()*(1./
GeV
), (cluster -> e() - part -> e())/part -> e() );
106
h_e_cluster_response_vs_eta
-> Fill( part ->
eta
(), (cluster -> e() - part -> e())/part -> e() );
107
h_e_cluster_response_vs_phi
-> Fill( part ->
phi
(), (cluster -> e() - part -> e())/part -> e() );
108
109
}
110
//-------------------------------------------------
111
void
TrueElectronsPlots::makeEfficiencyPlot
(TH1* hDenom, TH1* hNom, TProfile* hEff){
112
113
if
(hDenom->GetNbinsX() != hNom->GetNbinsX())
return
;
114
else
{
115
for
(
int
bin_i = 1; bin_i <= hDenom -> GetNbinsX(); ++bin_i){
116
if
(hDenom -> GetBinContent(bin_i) == 0)
continue
;
117
double
binContent = hNom -> GetBinContent(bin_i) / hDenom -> GetBinContent(bin_i);
118
double
binCenter = hNom -> GetBinCenter(bin_i);
119
120
hEff -> Fill(binCenter, binContent);
121
}
122
}
123
124
}
125
//-------------------------------------------------
126
void
TrueElectronsPlots::finalizePlots
() {
127
128
for
(
int
i = 0; i <
nLevels
-1; i++) {
129
makeEfficiencyPlot
(
h_electron_pt
[0],
h_electron_pt
[i+1],
h_electron_eff_pt
[i]);
130
makeEfficiencyPlot
(
h_electron_phi
[0],
h_electron_phi
[i+1],
h_electron_eff_phi
[i]);
131
makeEfficiencyPlot
(
h_electron_eta
[0],
h_electron_eta
[i+1],
h_electron_eff_eta
[i]);
132
}
133
134
}
135
}
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
phi
Scalar phi() const
phi method
Definition
AmgMatrixBasePlugin.h:67
GeV
#define GeV
Definition
PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
TrueElectronsPlots.h
PlotBase::Book1D
TH1D * Book1D(std::string_view name, std::string_view labels, int nBins, float start, float end, bool prependDir=true)
Book a TH1D histogram.
Definition
PlotBase.cxx:94
PlotBase::BookTProfile
TProfile * BookTProfile(std::string_view name, std::string_view labels, int nBinsX, float startX, float endX, float startY=-1, float endY=-1, bool prependDir=true, bool useRMS=false)
Book a TProfile histogram.
Definition
PlotBase.cxx:186
PlotBase::PlotBase
PlotBase(PlotBase *parent, std::string_view sDir)
Definition
PlotBase.cxx:29
ZeeValidation::TrueElectronsPlots::h_dphi_electron
TH1 * h_dphi_electron
Definition
TrueElectronsPlots.h:49
ZeeValidation::TrueElectronsPlots::h_dr_electron
TH1 * h_dr_electron
Definition
TrueElectronsPlots.h:48
ZeeValidation::TrueElectronsPlots::nLevels
static const int nLevels
Definition
TrueElectronsPlots.h:30
ZeeValidation::TrueElectronsPlots::m_sParticleType
std::string m_sParticleType
Definition
TrueElectronsPlots.h:27
ZeeValidation::TrueElectronsPlots::finalizePlots
virtual void finalizePlots()
Definition
TrueElectronsPlots.cxx:126
ZeeValidation::TrueElectronsPlots::h_electron_pt
TH1 * h_electron_pt[nLevels]
Definition
TrueElectronsPlots.h:33
ZeeValidation::TrueElectronsPlots::initializePlots
virtual void initializePlots()
Definition
TrueElectronsPlots.cxx:50
ZeeValidation::TrueElectronsPlots::h_e_response_vs_phi
TProfile * h_e_response_vs_phi
Definition
TrueElectronsPlots.h:45
ZeeValidation::TrueElectronsPlots::h_electron_phi
TH1 * h_electron_phi[nLevels]
Definition
TrueElectronsPlots.h:35
ZeeValidation::TrueElectronsPlots::fill
void fill(const xAOD::IParticle *part, int level)
Definition
TrueElectronsPlots.cxx:81
ZeeValidation::TrueElectronsPlots::h_e_response_vs_e
TProfile * h_e_response_vs_e
Definition
TrueElectronsPlots.h:41
ZeeValidation::TrueElectronsPlots::h_deta_electron
TH1 * h_deta_electron
Definition
TrueElectronsPlots.h:50
ZeeValidation::TrueElectronsPlots::makeEfficiencyPlot
void makeEfficiencyPlot(TH1 *hDenom, TH1 *hNom, TProfile *hEff)
Definition
TrueElectronsPlots.cxx:111
ZeeValidation::TrueElectronsPlots::h_e_response_vs_eta
TProfile * h_e_response_vs_eta
Definition
TrueElectronsPlots.h:43
ZeeValidation::TrueElectronsPlots::h_electron_eff_eta
TProfile * h_electron_eff_eta[nLevels-1]
Definition
TrueElectronsPlots.h:38
ZeeValidation::TrueElectronsPlots::h_e_cluster_response_vs_eta
TProfile * h_e_cluster_response_vs_eta
Definition
TrueElectronsPlots.h:44
ZeeValidation::TrueElectronsPlots::h_electron_eff_pt
TProfile * h_electron_eff_pt[nLevels-1]
Definition
TrueElectronsPlots.h:37
ZeeValidation::TrueElectronsPlots::h_e_cluster_response_vs_phi
TProfile * h_e_cluster_response_vs_phi
Definition
TrueElectronsPlots.h:46
ZeeValidation::TrueElectronsPlots::TrueElectronsPlots
TrueElectronsPlots(PlotBase *pParent, const std::string &sDir, const std::string &sParticleType)
Definition
TrueElectronsPlots.cxx:11
ZeeValidation::TrueElectronsPlots::h_e_cluster_response_vs_e
TProfile * h_e_cluster_response_vs_e
Definition
TrueElectronsPlots.h:42
ZeeValidation::TrueElectronsPlots::fillResponseCluster
void fillResponseCluster(const xAOD::IParticle *part, const xAOD::CaloCluster *cluster)
Definition
TrueElectronsPlots.cxx:103
ZeeValidation::TrueElectronsPlots::fillResponse
void fillResponse(const xAOD::IParticle *part, const xAOD::Electron *electron)
Definition
TrueElectronsPlots.cxx:91
ZeeValidation::TrueElectronsPlots::cLevelLabel
static const std::string cLevelLabel[nLevels]
Definition
TrueElectronsPlots.h:31
ZeeValidation::TrueElectronsPlots::fillinAcc
void fillinAcc(const xAOD::IParticle *part, int level)
Definition
TrueElectronsPlots.cxx:85
ZeeValidation::TrueElectronsPlots::h_electron_eff_phi
TProfile * h_electron_eff_phi[nLevels-1]
Definition
TrueElectronsPlots.h:39
ZeeValidation::TrueElectronsPlots::h_dr_photon
TH1 * h_dr_photon
Definition
TrueElectronsPlots.h:52
ZeeValidation::TrueElectronsPlots::h_electron_eta
TH1 * h_electron_eta[nLevels]
Definition
TrueElectronsPlots.h:34
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition
Event/xAOD/xAODBase/xAODBase/IParticle.h:41
ZeeValidation
Definition
FWDZeePlots.cxx:9
xAOD::CaloCluster
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Definition
Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloCluster.h:19
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