ATLAS Offline Software
Loading...
Searching...
No Matches
ChargeDepParamPlots.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#include <utility>
8
9namespace Muon {
10
12 const std::string& sDir,
13 std::string sType)
14 : PlotBase(pParent, sDir), m_sType(std::move(sType)) {}
15
18 Book1D("qTimesEta_" + m_sType,
19 "qTimesEta_" + m_sType + ";charge*Pseudo-Rapidity;Entries", 128,
20 -3.2, 3.2);
21 q_over_pt =
22 Book1D("qOverPt_" + m_sType,
23 "qOverPt_" + m_sType +
24 ";charge over Transverse Momentum [GeV^{-1}];Entries",
25 200, -0.5, 0.5);
26 q_over_p =
27 Book1D("qOverP_" + m_sType,
28 "qOverP_" + m_sType + ";charge over Momentum [GeV^{-1}];Entries",
29 200, -0.5, 0.5);
30
31 // charge comparison of ID, MS, ME tracks
33 Book1D("qMS_times_qCB_" + m_sType,
34 "qMS_times_qCB_" + m_sType + ";qMS*qCB;Entries", 3, -1.5, 1.5);
36 Book1D("qID_times_qCB_" + m_sType,
37 "qID_times_qCB_" + m_sType + ";qID*qCB;Entries", 3, -1.5, 1.5);
38}
39
40void ChargeDepParamPlots::fill(const xAOD::Muon& mu, float weight) {
41 const xAOD::TrackParticle* trkprt = mu.trackParticle(xAOD::Muon::Primary);
42 if (!trkprt) {
43 return;
44 }
45
46 q_times_eta->Fill(trkprt->charge() * trkprt->eta(), weight);
47 q_over_pt->Fill(trkprt->charge() / trkprt->pt() / 0.001, weight);
48 q_over_p->Fill(trkprt->qOverP() / 0.001, weight);
49
50 const xAOD::TrackParticle* trkprtID =
51 mu.trackParticle(xAOD::Muon::InnerDetectorTrackParticle);
52 const xAOD::TrackParticle* trkprtMS =
53 mu.trackParticle(xAOD::Muon::MuonSpectrometerTrackParticle);
54
55 if (trkprtID) {
56 qID_times_qCB->Fill(trkprtID->charge() * trkprt->charge(), weight);
57 }
58
59 if (trkprtMS) {
60 qMS_times_qCB->Fill(trkprtMS->charge() * trkprt->charge(), weight);
61 }
62}
63
64} // namespace Muon
ChargeDepParamPlots(PlotBase *pParent, const std::string &sDir, std::string sType)
void fill(const xAOD::Muon &mu, float weight=1.0)
TH1D * Book1D(std::string_view name, std::string_view labels, int nBins, float start, float end, bool prependDir=true)
Book a TH1D histogram.
Definition PlotBase.cxx:94
PlotBase(PlotBase *parent, std::string_view sDir)
Definition PlotBase.cxx:29
float qOverP() const
Returns the parameter.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
float charge() const
Returns the charge.
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
STL namespace.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Muon_v1 Muon
Reference the current persistent version: