ATLAS Offline Software
Loading...
Searching...
No Matches
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
6
7using CLHEP::GeV;
8
9namespace ZeeValidation{
10
11 TrueFwdElectronsPlots::TrueFwdElectronsPlots(PlotBase* pParent, const std::string& sDir, const std::string& sParticleType):
12 PlotBase(pParent, sDir),
13 m_sParticleType(sParticleType),
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;
27 }
28 for (int i = 0; i < nLevels-1; i++) {
33 }
34 }
35
36 const std::string TrueFwdElectronsPlots::cLevelLabel[nLevels] = {
37 "True",
38 "Matched",
39 "Loose",
40 "Tight"
41 };
42 //-------------------------------------------------
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 //-------------------------------------------------
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 //-------------------------------------------------
118}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
TH1D * Book1D(const std::string &name, const std::string &labels, int nBins, float start, float end, bool prependDir=true)
Book a TH1D histogram.
Definition PlotBase.cxx:94
PlotBase(PlotBase *parent, const std::string &sDir)
Definition PlotBase.cxx:29
TProfile * BookTProfile(const std::string &name, const std::string &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
TProfile * h_true_fwd_electron_eff_abseta[nLevels-1]
void fillResponse(const xAOD::IParticle *part, const xAOD::Electron *electron)
void makeEfficiencyPlot(TH1 *hDenom, TH1 *hNom, TProfile *hEff)
TrueFwdElectronsPlots(PlotBase *pParent, const std::string &sDir, const std::string &sParticleType)
static const std::string cLevelLabel[nLevels]
void fill(const xAOD::IParticle *part, int level)
Class providing the definition of the 4-vector interface.
Electron_v1 Electron
Definition of the current "egamma version".