ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
StandardModelPhys
Validation
ZeeValidation
src
TrueFwdElectronsPlots.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/TrueFwdElectronsPlots.h
"
6
7
using
CLHEP::GeV;
8
9
namespace
ZeeValidation
{
10
11
TrueFwdElectronsPlots::TrueFwdElectronsPlots
(
PlotBase
* pParent,
const
std::string& sDir,
const
std::string& sParticleType):
12
PlotBase
(pParent, sDir),
13
m_sParticleType
(sParticleType),
14
h_fwd_e_response_vs_e
(NULL),
15
h_fwd_e_response_vs_eta
(NULL),
16
h_fwd_e_response_vs_abseta
(NULL),
17
h_fwd_e_response_vs_phi
(NULL),
18
h_fwd_dr_electron
(NULL),
19
h_fwd_dphi_electron
(NULL),
20
h_fwd_deta_electron
(NULL)
21
{
22
for
(
int
i = 0; i <
nLevels
; i++) {
23
h_true_fwd_electron_pt
[i] = NULL;
24
h_true_fwd_electron_eta
[i] = NULL;
25
h_true_fwd_electron_abseta
[i] = NULL;
26
h_true_fwd_electron_phi
[i] = NULL;
27
}
28
for
(
int
i = 0; i <
nLevels
-1; i++) {
29
h_true_fwd_electron_eff_pt
[i] = NULL;
30
h_true_fwd_electron_eff_eta
[i] = NULL;
31
h_true_fwd_electron_eff_abseta
[i] = NULL;
32
h_true_fwd_electron_eff_phi
[i] = NULL;
33
}
34
}
35
36
const
std::string
TrueFwdElectronsPlots::cLevelLabel
[nLevels] = {
37
"True"
,
38
"Matched"
,
39
"Loose"
,
40
"Tight"
41
};
42
//-------------------------------------------------
43
void
TrueFwdElectronsPlots::initializePlots
(){
44
TH1::SetDefaultSumw2(kTRUE);
45
46
for
(
int
i = 0; i <
nLevels
; i++) {
47
h_true_fwd_electron_pt
[i] =
Book1D
(
"PtFwd"
+
cLevelLabel
[i],
"P_{T} of "
+
m_sParticleType
+
"; E_{T} (GeV) ;Events"
, 60, 20., 140.);
48
h_true_fwd_electron_eta
[i] =
Book1D
(
"EtaFwd"
+
cLevelLabel
[i],
"#eta of "
+
m_sParticleType
+
";#eta; Events "
, 50, -5., 5.);
49
h_true_fwd_electron_abseta
[i] =
Book1D
(
"EtaAbsFwd"
+
cLevelLabel
[i],
"|#eta| of "
+
m_sParticleType
+
";|#eta|; Events "
, 25, 2.5, 5.);
50
h_true_fwd_electron_phi
[i] =
Book1D
(
"PhiFwd"
+
cLevelLabel
[i],
"#varphi of "
+
m_sParticleType
+
";#varphi;Events "
, 60, -TMath::Pi(), TMath::Pi());
51
}
52
53
for
(
int
i = 0; i <
nLevels
-1; i++) {
54
h_true_fwd_electron_eff_pt
[i] =
BookTProfile
(
"PtFwdEff"
+
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.);
55
h_true_fwd_electron_eff_eta
[i] =
BookTProfile
(
"EtaFwdEff"
+
cLevelLabel
[i+1] +
cLevelLabel
[0],
cLevelLabel
[i+1] +
" Efficiency vs #eta of "
+
m_sParticleType
+
";#eta;"
+
cLevelLabel
[i+1] +
"/"
+
cLevelLabel
[0], 50, -5., 5.);
56
h_true_fwd_electron_eff_abseta
[i] =
BookTProfile
(
"EtaAbsFwdEff"
+
cLevelLabel
[i+1] +
cLevelLabel
[0],
cLevelLabel
[i+1] +
" Efficiency vs |#eta| of "
+
m_sParticleType
+
";|#eta;|"
+
cLevelLabel
[i+1] +
"/"
+
cLevelLabel
[0], 25, 2.5, 5.);
57
h_true_fwd_electron_eff_phi
[i] =
BookTProfile
(
"PhiFwdEff"
+
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());
58
}
59
60
h_fwd_e_response_vs_e
=
BookTProfile
(
"EnergyResponseVsEnergy"
,
"Energy response vs energy; E^{true}; E^{reco}-E^{true}/E^{true}"
, 25, 0., 1000);
61
h_fwd_e_response_vs_eta
=
BookTProfile
(
"EnergyResponseVsEta"
,
"Energy response vs #eta; #eta; E^{reco}-E^{true}/E^{true}"
, 50, -5., 5.);
62
h_fwd_e_response_vs_abseta
=
BookTProfile
(
"EnergyResponseVsAbsEta"
,
"Energy response vs |#eta|; |#eta|; E^{reco}-E^{true}/E^{true}"
, 50, 2.5, 5.);
63
h_fwd_e_response_vs_phi
=
BookTProfile
(
"EnergyResponseVsPhi"
,
"Energy response vs #varphi; #varphi; E^{reco}-E^{true}/E^{true}"
, 30, -TMath::Pi(), TMath::Pi());
64
65
h_fwd_dr_electron
=
Book1D
(
"DeltaRFwdElectron"
,
"#DeltaR(truth particle, electron); #DeltaR; Events"
, 30, 0., 0.2);
66
h_fwd_dphi_electron
=
Book1D
(
"DeltaPhiFwdElectron"
,
"#Delta #phi(truth particle, electron); #Delta #phi; Events"
, 20, -0.06, 0.06);
67
h_fwd_deta_electron
=
Book1D
(
"DeltaEtaFwdElectron"
,
"#Delta #eta(truth particle, electron); #Delta #eta; Events"
, 20, -0.06, 0.06);
68
69
}
70
//-------------------------------------------------
71
void
TrueFwdElectronsPlots::fill
(
const
xAOD::IParticle
* part,
int
level){
72
73
h_true_fwd_electron_pt
[level] -> Fill(part -> pt()*(1./
GeV
));
74
h_true_fwd_electron_eta
[level] -> Fill(part ->
eta
());
75
h_true_fwd_electron_abseta
[level] -> Fill(TMath::Abs(part ->
eta
()));
76
h_true_fwd_electron_phi
[level] -> Fill(part ->
phi
());
77
78
}
79
//-------------------------------------------------
80
void
TrueFwdElectronsPlots::fillResponse
(
const
xAOD::IParticle
* part,
const
xAOD::Electron
* electron) {
81
82
h_fwd_e_response_vs_e
-> Fill( part -> e()*(1./
GeV
), (electron -> e() - part -> e())/part -> e() );
83
h_fwd_e_response_vs_eta
-> Fill( part ->
eta
(), (electron -> e() - part -> e())/part -> e() );
84
h_fwd_e_response_vs_abseta
-> Fill( TMath::Abs(part ->
eta
()), (electron -> e() - part -> e())/part -> e() );
85
h_fwd_e_response_vs_phi
-> Fill( part ->
phi
(), (electron -> e() - part -> e())/part -> e() );
86
87
h_fwd_dr_electron
-> Fill( part -> p4().DeltaR(electron -> p4()));
88
h_fwd_dphi_electron
-> Fill( part -> p4().DeltaPhi(electron -> p4()));
89
h_fwd_deta_electron
-> Fill( electron ->
eta
() - part ->
eta
() );
90
}
91
92
//-------------------------------------------------
93
void
TrueFwdElectronsPlots::makeEfficiencyPlot
(TH1* hDenom, TH1* hNom, TProfile* hEff){
94
95
if
(hDenom->GetNbinsX() != hNom->GetNbinsX())
return
;
96
else
{
97
for
(
int
bin_i = 1; bin_i <= hDenom -> GetNbinsX(); ++bin_i){
98
if
(hDenom -> GetBinContent(bin_i) == 0)
continue
;
99
double
binContent = hNom -> GetBinContent(bin_i) / hDenom -> GetBinContent(bin_i);
100
double
binCenter = hNom -> GetBinCenter(bin_i);
101
102
hEff -> Fill(binCenter, binContent);
103
}
104
}
105
106
}
107
//-------------------------------------------------
108
void
TrueFwdElectronsPlots::finalizePlots
() {
109
110
for
(
int
i = 0; i <
nLevels
-1; i++) {
111
makeEfficiencyPlot
(
h_true_fwd_electron_pt
[0],
h_true_fwd_electron_pt
[i+1],
h_true_fwd_electron_eff_pt
[i]);
112
makeEfficiencyPlot
(
h_true_fwd_electron_eta
[0],
h_true_fwd_electron_eta
[i+1],
h_true_fwd_electron_eff_eta
[i]);
113
makeEfficiencyPlot
(
h_true_fwd_electron_abseta
[0],
h_true_fwd_electron_abseta
[i+1],
h_true_fwd_electron_eff_abseta
[i]);
114
makeEfficiencyPlot
(
h_true_fwd_electron_phi
[0],
h_true_fwd_electron_phi
[i+1],
h_true_fwd_electron_eff_phi
[i]);
115
}
116
117
}
118
}
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
TrueFwdElectronsPlots.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::TrueFwdElectronsPlots::h_fwd_e_response_vs_eta
TProfile * h_fwd_e_response_vs_eta
Definition
TrueFwdElectronsPlots.h:41
ZeeValidation::TrueFwdElectronsPlots::h_true_fwd_electron_eff_pt
TProfile * h_true_fwd_electron_eff_pt[nLevels-1]
Definition
TrueFwdElectronsPlots.h:35
ZeeValidation::TrueFwdElectronsPlots::h_true_fwd_electron_eta
TH1 * h_true_fwd_electron_eta[nLevels]
Definition
TrueFwdElectronsPlots.h:31
ZeeValidation::TrueFwdElectronsPlots::h_true_fwd_electron_pt
TH1 * h_true_fwd_electron_pt[nLevels]
Definition
TrueFwdElectronsPlots.h:30
ZeeValidation::TrueFwdElectronsPlots::h_fwd_dr_electron
TH1 * h_fwd_dr_electron
Definition
TrueFwdElectronsPlots.h:45
ZeeValidation::TrueFwdElectronsPlots::h_true_fwd_electron_eff_abseta
TProfile * h_true_fwd_electron_eff_abseta[nLevels-1]
Definition
TrueFwdElectronsPlots.h:37
ZeeValidation::TrueFwdElectronsPlots::initializePlots
virtual void initializePlots()
Definition
TrueFwdElectronsPlots.cxx:43
ZeeValidation::TrueFwdElectronsPlots::h_true_fwd_electron_abseta
TH1 * h_true_fwd_electron_abseta[nLevels]
Definition
TrueFwdElectronsPlots.h:32
ZeeValidation::TrueFwdElectronsPlots::m_sParticleType
std::string m_sParticleType
Definition
TrueFwdElectronsPlots.h:24
ZeeValidation::TrueFwdElectronsPlots::finalizePlots
virtual void finalizePlots()
Definition
TrueFwdElectronsPlots.cxx:108
ZeeValidation::TrueFwdElectronsPlots::h_fwd_e_response_vs_phi
TProfile * h_fwd_e_response_vs_phi
Definition
TrueFwdElectronsPlots.h:43
ZeeValidation::TrueFwdElectronsPlots::fillResponse
void fillResponse(const xAOD::IParticle *part, const xAOD::Electron *electron)
Definition
TrueFwdElectronsPlots.cxx:80
ZeeValidation::TrueFwdElectronsPlots::h_true_fwd_electron_eff_eta
TProfile * h_true_fwd_electron_eff_eta[nLevels-1]
Definition
TrueFwdElectronsPlots.h:36
ZeeValidation::TrueFwdElectronsPlots::h_true_fwd_electron_phi
TH1 * h_true_fwd_electron_phi[nLevels]
Definition
TrueFwdElectronsPlots.h:33
ZeeValidation::TrueFwdElectronsPlots::h_fwd_deta_electron
TH1 * h_fwd_deta_electron
Definition
TrueFwdElectronsPlots.h:47
ZeeValidation::TrueFwdElectronsPlots::makeEfficiencyPlot
void makeEfficiencyPlot(TH1 *hDenom, TH1 *hNom, TProfile *hEff)
Definition
TrueFwdElectronsPlots.cxx:93
ZeeValidation::TrueFwdElectronsPlots::TrueFwdElectronsPlots
TrueFwdElectronsPlots(PlotBase *pParent, const std::string &sDir, const std::string &sParticleType)
Definition
TrueFwdElectronsPlots.cxx:11
ZeeValidation::TrueFwdElectronsPlots::h_fwd_e_response_vs_e
TProfile * h_fwd_e_response_vs_e
Definition
TrueFwdElectronsPlots.h:40
ZeeValidation::TrueFwdElectronsPlots::h_true_fwd_electron_eff_phi
TProfile * h_true_fwd_electron_eff_phi[nLevels-1]
Definition
TrueFwdElectronsPlots.h:38
ZeeValidation::TrueFwdElectronsPlots::cLevelLabel
static const std::string cLevelLabel[nLevels]
Definition
TrueFwdElectronsPlots.h:28
ZeeValidation::TrueFwdElectronsPlots::h_fwd_dphi_electron
TH1 * h_fwd_dphi_electron
Definition
TrueFwdElectronsPlots.h:46
ZeeValidation::TrueFwdElectronsPlots::h_fwd_e_response_vs_abseta
TProfile * h_fwd_e_response_vs_abseta
Definition
TrueFwdElectronsPlots.h:42
ZeeValidation::TrueFwdElectronsPlots::nLevels
static const int nLevels
Definition
TrueFwdElectronsPlots.h:27
ZeeValidation::TrueFwdElectronsPlots::fill
void fill(const xAOD::IParticle *part, int level)
Definition
TrueFwdElectronsPlots.cxx:71
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::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