ATLAS Offline Software
TrueElectronsPlots.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 using CLHEP::GeV;
8 
9 namespace ZeeValidation{
10 
11  TrueElectronsPlots::TrueElectronsPlots(PlotBase* pParent, std::string sDir, 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  //-------------------------------------------------
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  //-------------------------------------------------
82  h_electron_eta[level] -> Fill(part -> eta());
83  }
84  //-------------------------------------------------
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  //-------------------------------------------------
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  //-------------------------------------------------
127 
128  for (int i = 0; i < nLevels-1; i++) {
132  }
133 
134  }
135 }
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
TrueElectronsPlots.h
ZeeValidation::TrueElectronsPlots::h_e_cluster_response_vs_phi
TProfile * h_e_cluster_response_vs_phi
Definition: TrueElectronsPlots.h:46
PlotBase::Book1D
TH1F * 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:88
ZeeValidation::TrueElectronsPlots::h_electron_eta
TH1 * h_electron_eta[nLevels]
Definition: TrueElectronsPlots.h:34
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
PlotBase
Definition: PlotBase.h:33
ZeeValidation::TrueElectronsPlots::h_dr_photon
TH1 * h_dr_photon
Definition: TrueElectronsPlots.h:52
ZeeValidation::TrueElectronsPlots::h_deta_electron
TH1 * h_deta_electron
Definition: TrueElectronsPlots.h:50
ZeeValidation::TrueElectronsPlots::h_dphi_electron
TH1 * h_dphi_electron
Definition: TrueElectronsPlots.h:49
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
python.copyTCTOutput.sDir
sDir
Definition: copyTCTOutput.py:60
met::DeltaR
@ DeltaR
Definition: METRecoCommon.h:11
ZeeValidation::TrueElectronsPlots::fillResponseCluster
void fillResponseCluster(const xAOD::IParticle *part, const xAOD::CaloCluster *cluster)
Definition: TrueElectronsPlots.cxx:103
test_pyathena.pt
pt
Definition: test_pyathena.py:11
ZeeValidation::TrueElectronsPlots::h_e_response_vs_e
TProfile * h_e_response_vs_e
Definition: TrueElectronsPlots.h:41
ZeeValidation::TrueElectronsPlots::h_e_cluster_response_vs_e
TProfile * h_e_cluster_response_vs_e
Definition: TrueElectronsPlots.h:42
ZeeValidation::TrueElectronsPlots::fillinAcc
void fillinAcc(const xAOD::IParticle *part, int level)
Definition: TrueElectronsPlots.cxx:85
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:40
ZeeValidation::TrueElectronsPlots::h_electron_phi
TH1 * h_electron_phi[nLevels]
Definition: TrueElectronsPlots.h:35
ZeeValidation::TrueElectronsPlots::h_e_response_vs_eta
TProfile * h_e_response_vs_eta
Definition: TrueElectronsPlots.h:43
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
ZeeValidation::TrueElectronsPlots::fill
void fill(const xAOD::IParticle *part, int level)
Definition: TrueElectronsPlots.cxx:81
ZeeValidation::TrueElectronsPlots::initializePlots
virtual void initializePlots()
Definition: TrueElectronsPlots.cxx:50
lumiFormat.i
int i
Definition: lumiFormat.py:92
ZeeValidation
Definition: FWDZeePlots.cxx:9
ZeeValidation::TrueElectronsPlots::finalizePlots
virtual void finalizePlots()
Definition: TrueElectronsPlots.cxx:126
ZeeValidation::TrueElectronsPlots::h_e_response_vs_phi
TProfile * h_e_response_vs_phi
Definition: TrueElectronsPlots.h:45
ZeeValidation::TrueElectronsPlots::h_electron_eff_phi
TProfile * h_electron_eff_phi[nLevels-1]
Definition: TrueElectronsPlots.h:39
ZeeValidation::TrueElectronsPlots::h_electron_eff_pt
TProfile * h_electron_eff_pt[nLevels-1]
Definition: TrueElectronsPlots.h:37
ZeeValidation::TrueElectronsPlots::fillResponse
void fillResponse(const xAOD::IParticle *part, const xAOD::Electron *electron)
Definition: TrueElectronsPlots.cxx:91
ZeeValidation::TrueElectronsPlots::m_sParticleType
std::string m_sParticleType
Definition: TrueElectronsPlots.h:27
TProfile
Definition: rootspy.cxx:515
xAOD::Electron_v1
Definition: Electron_v1.h:34
ZeeValidation::TrueElectronsPlots::h_dr_electron
TH1 * h_dr_electron
Definition: TrueElectronsPlots.h:48
ZeeValidation::TrueElectronsPlots::cLevelLabel
static const std::string cLevelLabel[nLevels]
Definition: TrueElectronsPlots.h:31
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
ZeeValidation::TrueElectronsPlots::makeEfficiencyPlot
void makeEfficiencyPlot(TH1 *hDenom, TH1 *hNom, TProfile *hEff)
Definition: TrueElectronsPlots.cxx:111
ZeeValidation::TrueElectronsPlots::TrueElectronsPlots
TrueElectronsPlots(PlotBase *pParent, std::string sDir, std::string sParticleType)
Definition: TrueElectronsPlots.cxx:11
TH1
Definition: rootspy.cxx:268
ZeeValidation::TrueElectronsPlots::nLevels
static const int nLevels
Definition: TrueElectronsPlots.h:30
xAOD::EgammaParameters::electron
@ electron
Definition: EgammaEnums.h:18
PlotBase::BookTProfile
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:180
ZeeValidation::TrueElectronsPlots::h_electron_pt
TH1 * h_electron_pt[nLevels]
Definition: TrueElectronsPlots.h:33
GeV
#define GeV
Definition: CaloTransverseBalanceVecMon.cxx:30
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