ATLAS Offline Software
Loading...
Searching...
No Matches
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
6
7using CLHEP::GeV;
8
9namespace ZeeValidation{
10
11 TrueElectronsPlots::TrueElectronsPlots(PlotBase* pParent, const std::string& sDir, const std::string& sParticleType):
12 PlotBase(pParent, sDir),
13 m_sParticleType(sParticleType),
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 //-------------------------------------------------
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 //-------------------------------------------------
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 //-------------------------------------------------
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 //-------------------------------------------------
135}
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
void fill(const xAOD::IParticle *part, int level)
void makeEfficiencyPlot(TH1 *hDenom, TH1 *hNom, TProfile *hEff)
TProfile * h_electron_eff_eta[nLevels-1]
TProfile * h_electron_eff_pt[nLevels-1]
TrueElectronsPlots(PlotBase *pParent, const std::string &sDir, const std::string &sParticleType)
void fillResponseCluster(const xAOD::IParticle *part, const xAOD::CaloCluster *cluster)
void fillResponse(const xAOD::IParticle *part, const xAOD::Electron *electron)
static const std::string cLevelLabel[nLevels]
void fillinAcc(const xAOD::IParticle *part, int level)
TProfile * h_electron_eff_phi[nLevels-1]
Class providing the definition of the 4-vector interface.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Electron_v1 Electron
Definition of the current "egamma version".