ATLAS Offline Software
Loading...
Searching...
No Matches
MuonResolutionPlots.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
9using namespace xAOD::P4Helpers;
10namespace Muon {
11
13 const std::string& sDir,
14 const std::string& sType,
15 bool doBinnedResolutionPlots)
16 : PlotBase(pParent, sDir),
17 m_oResolutionPlots(this, "", sType),
18 m_sType(sType),
19 m_doBinnedResolutionPlots(doBinnedResolutionPlots) {
20 const int sizeOf_ptBins = 7;
21 Double_t ptBins[sizeOf_ptBins] = {5, 15, 30, 45, 60, 100, 200};
22 const int sizeOf_etaBins = 10;
23 Double_t etaBins[sizeOf_etaBins] = {-2.7, -2.5, -1.7, -1.05, -0.1,
24 0.1, 1.05, 1.7, 2.5, 2.7};
25 const int sizeOf_phiBins = 9;
26 Double_t phiBins[sizeOf_phiBins] = {-3.15, -2.4, -1.6, -0.8, 0,
27 0.8, 1.6, 2.4, 3.15};
28
29 // book 2D hists
32 "Res" + m_sType + "_pT_vs_lowpT",
33 "Res" + m_sType + "_pT vs low pT;pT [GeV];(pT-pTtruth)/pTtruth", 16,
34 2., 10., 100, -0.5, 0.5);
36 "Res" + m_sType + "_pT_vs_highpT",
37 "Res" + m_sType + "_pT vs high pT;pT [GeV];(pT-pTtruth)/pTtruth",
38 10, 100., 1000., 100, -0.5, 0.5);
39
41 Book2D("Res" + m_sType + "_pT_vs_pT",
42 "Res" + m_sType + "_pT vs pT;pT [GeV];(pT-pTtruth)/pTtruth",
43 sizeOf_ptBins - 1, &ptBins[0], 100, -0.5, 0.5);
44 Res_pT_vs_eta = Book2D("Res" + m_sType + "_pT_vs_eta",
45 "Res" + m_sType + "_pT vs eta;eta,eta-etatruth",
46 sizeOf_etaBins - 1, &etaBins[0], 100, -0.5, 0.5);
47 Res_pT_vs_phi = Book2D("Res" + m_sType + "_pT_vs_phi",
48 "Res" + m_sType + "_pT vs phi;phi,phi-phitruth",
49 sizeOf_phiBins - 1, &phiBins[0], 100, -0.5, 0.5);
50
52 Book2D("Res" + m_sType + "_eta_vs_pT",
53 "Res" + m_sType + "_eta vs pT;pT [GeV];eta-etatruth",
54 sizeOf_ptBins - 1, &ptBins[0], 100, -0.5, 0.5);
56 Book2D("Res" + m_sType + "_phi_vs_pT",
57 "Res" + m_sType + "_phi vs pT;pT [GeV];phi-phitruth",
58 sizeOf_ptBins - 1, &ptBins[0], 100, -0.5, 0.5);
59 }
60}
61
63 const xAOD::TruthParticle& truthMu,
64 float weight) {
65 // fill plots Res_pt,eta,phi
66 m_oResolutionPlots.fill(muPrimaryTrk, truthMu, weight);
67
68 // fill plots Res_pt_vs_pt,eta,phi
69 float pt = 0.001 * truthMu.pt();
70 float eta = truthMu.eta();
71 float phi = truthMu.phi();
72 float respt = (muPrimaryTrk.pt() - truthMu.pt()) / truthMu.pt();
73
75 if (pt < Res_pT_vs_lowpT->GetXaxis()->GetXmax()) {
76 Res_pT_vs_lowpT->Fill(pt, respt, weight);
77 }
78 if (pt > Res_pT_vs_highpT->GetXaxis()->GetXmin()) {
79 Res_pT_vs_highpT->Fill(pt, respt, weight);
80 }
81
82 Res_pT_vs_pT->Fill(pt, respt, weight);
83 Res_pT_vs_eta->Fill(eta, respt, weight);
84 Res_pT_vs_phi->Fill(phi, respt, weight);
85
86 Res_eta_vs_pT->Fill(pt, muPrimaryTrk.eta() - eta, weight);
87 Res_phi_vs_pT->Fill(pt, deltaPhi(muPrimaryTrk.phi(), phi), weight);
88 }
89}
90
91} // namespace Muon
Scalar eta() const
pseudorapidity method
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
Scalar phi() const
phi method
MuonResolutionPlots(PlotBase *pParent, const std::string &sDir, const std::string &sType="", bool doBinnedResolutions=false)
Trk::ResolutionPlots m_oResolutionPlots
void fill(const xAOD::TrackParticle &muontp, const xAOD::TruthParticle &truthprt, float weight=1.0)
PlotBase(PlotBase *parent, std::string_view sDir)
Definition PlotBase.cxx:29
TH2F * Book2D(std::string_view name, std::string_view labels, int nBinsX, float startX, float endX, int nBinsY, float startY, float endY, bool prependDir=true)
Book a TH2F histogram.
Definition PlotBase.cxx:123
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .).
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
virtual double phi() const override final
The azimuthal angle ( ) of the particle.
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
setRcore setEtHad setFside pt
TrackParticle_v1 TrackParticle
Reference the current persistent version:
TruthParticle_v1 TruthParticle
Typedef to implementation.