ATLAS Offline Software
TrueFwdElectronsPlots.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  TrueFwdElectronsPlots::TrueFwdElectronsPlots(PlotBase* pParent, std::string sDir, 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;
26  h_true_fwd_electron_phi[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  //-------------------------------------------------
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  //-------------------------------------------------
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  //-------------------------------------------------
109 
110  for (int i = 0; i < nLevels-1; i++) {
115  }
116 
117  }
118 }
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
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::TrueFwdElectronsPlots::h_true_fwd_electron_eff_phi
TProfile * h_true_fwd_electron_eff_phi[nLevels-1]
Definition: TrueFwdElectronsPlots.h:38
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
PlotBase
Definition: PlotBase.h:33
ZeeValidation::TrueFwdElectronsPlots::h_true_fwd_electron_eff_abseta
TProfile * h_true_fwd_electron_eff_abseta[nLevels-1]
Definition: TrueFwdElectronsPlots.h:37
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::TrueFwdElectronsPlots::h_true_fwd_electron_abseta
TH1 * h_true_fwd_electron_abseta[nLevels]
Definition: TrueFwdElectronsPlots.h:32
ZeeValidation::TrueFwdElectronsPlots::h_true_fwd_electron_pt
TH1 * h_true_fwd_electron_pt[nLevels]
Definition: TrueFwdElectronsPlots.h:30
test_pyathena.pt
pt
Definition: test_pyathena.py:11
ZeeValidation::TrueFwdElectronsPlots::h_fwd_e_response_vs_abseta
TProfile * h_fwd_e_response_vs_abseta
Definition: TrueFwdElectronsPlots.h:42
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:40
ZeeValidation::TrueFwdElectronsPlots::h_true_fwd_electron_phi
TH1 * h_true_fwd_electron_phi[nLevels]
Definition: TrueFwdElectronsPlots.h:33
ZeeValidation::TrueFwdElectronsPlots::h_fwd_e_response_vs_phi
TProfile * h_fwd_e_response_vs_phi
Definition: TrueFwdElectronsPlots.h:43
ZeeValidation::TrueFwdElectronsPlots::cLevelLabel
static const std::string cLevelLabel[nLevels]
Definition: TrueFwdElectronsPlots.h:28
ZeeValidation::TrueFwdElectronsPlots::initializePlots
virtual void initializePlots()
Definition: TrueFwdElectronsPlots.cxx:43
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
ZeeValidation::TrueFwdElectronsPlots::h_true_fwd_electron_eff_pt
TProfile * h_true_fwd_electron_eff_pt[nLevels-1]
Definition: TrueFwdElectronsPlots.h:35
ZeeValidation::TrueFwdElectronsPlots::h_fwd_deta_electron
TH1 * h_fwd_deta_electron
Definition: TrueFwdElectronsPlots.h:47
ZeeValidation::TrueFwdElectronsPlots::fill
void fill(const xAOD::IParticle *part, int level)
Definition: TrueFwdElectronsPlots.cxx:71
ZeeValidation::TrueFwdElectronsPlots::h_fwd_e_response_vs_eta
TProfile * h_fwd_e_response_vs_eta
Definition: TrueFwdElectronsPlots.h:41
lumiFormat.i
int i
Definition: lumiFormat.py:92
ZeeValidation
Definition: FWDZeePlots.cxx:9
ZeeValidation::TrueFwdElectronsPlots::h_true_fwd_electron_eff_eta
TProfile * h_true_fwd_electron_eff_eta[nLevels-1]
Definition: TrueFwdElectronsPlots.h:36
ZeeValidation::TrueFwdElectronsPlots::h_fwd_e_response_vs_e
TProfile * h_fwd_e_response_vs_e
Definition: TrueFwdElectronsPlots.h:40
ZeeValidation::TrueFwdElectronsPlots::h_fwd_dr_electron
TH1 * h_fwd_dr_electron
Definition: TrueFwdElectronsPlots.h:45
ZeeValidation::TrueFwdElectronsPlots::nLevels
static const int nLevels
Definition: TrueFwdElectronsPlots.h:27
ZeeValidation::TrueFwdElectronsPlots::makeEfficiencyPlot
void makeEfficiencyPlot(TH1 *hDenom, TH1 *hNom, TProfile *hEff)
Definition: TrueFwdElectronsPlots.cxx:93
ZeeValidation::TrueFwdElectronsPlots::h_true_fwd_electron_eta
TH1 * h_true_fwd_electron_eta[nLevels]
Definition: TrueFwdElectronsPlots.h:31
TProfile
Definition: rootspy.cxx:515
xAOD::Electron_v1
Definition: Electron_v1.h:34
ZeeValidation::TrueFwdElectronsPlots::fillResponse
void fillResponse(const xAOD::IParticle *part, const xAOD::Electron *electron)
Definition: TrueFwdElectronsPlots.cxx:80
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
TH1
Definition: rootspy.cxx:268
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::TrueFwdElectronsPlots::h_fwd_dphi_electron
TH1 * h_fwd_dphi_electron
Definition: TrueFwdElectronsPlots.h:46
ZeeValidation::TrueFwdElectronsPlots::finalizePlots
virtual void finalizePlots()
Definition: TrueFwdElectronsPlots.cxx:108
ZeeValidation::TrueFwdElectronsPlots::TrueFwdElectronsPlots
TrueFwdElectronsPlots(PlotBase *pParent, std::string sDir, std::string sParticleType)
Definition: TrueFwdElectronsPlots.cxx:11
ZeeValidation::TrueFwdElectronsPlots::m_sParticleType
std::string m_sParticleType
Definition: TrueFwdElectronsPlots.h:24
GeV
#define GeV
Definition: CaloTransverseBalanceVecMon.cxx:30
TrueFwdElectronsPlots.h