ATLAS Offline Software
Loading...
Searching...
No Matches
MuonIsolationPlots.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 : PlotBase(pParent, sDir),
14 // iso variables
15 m_oPtCone20(this, "", "ptcone20"),
16 m_oPtCone30(this, "", "ptcone30"),
17 m_oPtCone40(this, "", "ptcone40"),
18
19 m_oTopoEtCone20(this, "", "topoetcone20"),
20 m_oTopoEtCone30(this, "", "topoetcone30"),
21 m_oTopoEtCone40(this, "", "topoetcone40"),
22
23 m_oNEFlowIso20(this, "", "neflowisol20"),
24 m_oNEFlowIso30(this, "", "neflowisol30"),
25 m_oNEFlowIso40(this, "", "neflowisol40"),
26
27 m_oPtVarCone20(this, "", "ptvarcone20"),
28 m_oPtVarCone30(this, "", "ptvarcone30"),
29 m_oPtVarCone40(this, "", "ptvarcone40")
30 // iso corrections
31 ,
32 m_oTopoEtCone_coreCone(this, "", "topoetcone_coreCone"),
33 m_oNEFlowIso_coreCone(this, "", "neflowisol_coreCone") {}
34
61
62IsoPlots::IsoPlots(PlotBase* pParent, const std::string& sDir,
63 std::string sConeSize)
64 : PlotBase(pParent, sDir),
65 m_sConeSize(std::move(sConeSize)),
66 cone(nullptr),
67 conerel(nullptr) {}
68
70 cone = Book1D(m_sConeSize, m_sConeSize + ";" + m_sConeSize + ";Entries", 60,
71 -5., 25.);
72 conerel =
73 Book1D(m_sConeSize + "rel",
74 m_sConeSize + "rel;" + m_sConeSize + "rel;Entries", 40, 0., 2.);
75}
76
77void IsoPlots::fill(const xAOD::Muon& muon,
78 const xAOD::Iso::IsolationType& isoType, float weight) {
79 float fIso = 0;
80 try {
81 muon.isolation(fIso, isoType);
82 } catch (SG::ExcBadAuxVar&) {
83 return;
84 }
85 if (fIso) {
86 fill(fIso, muon.pt(), weight);
87 }
88}
89void IsoPlots::fill(float fIso, float fPt, float weight) {
90 cone->Fill(fIso * 0.001, weight);
91 conerel->Fill(fIso / fPt, weight);
92}
93
94#ifndef XAOD_ANALYSIS
95IsoCorrPlots::IsoCorrPlots(PlotBase* pParent, const std::string& sDir,
96 std::string sCorrType)
97 : PlotBase(pParent, sDir),
98 m_sCorrType(std::move(sCorrType)),
99 isocorr(nullptr),
100 isocorr_relPt(nullptr),
101 isocorr_relIsocone20(nullptr),
102 isocorr_relIsocone30(nullptr),
103 isocorr_relIsocone40(nullptr) {}
104
106 isocorr = Book1D(m_sCorrType, m_sCorrType + ";" + m_sCorrType + ";Entries",
107 60, -5., 25.);
109 m_sCorrType + "_relPt",
110 m_sCorrType + "_relPt;" + m_sCorrType + "_relPt;Entries", 40, 0., 2.);
112 m_sCorrType + "_relIsocone20",
113 m_sCorrType + "_relIsocone20;" + m_sCorrType + "_relIsocone20;Entries",
114 150, -25., 25.);
116 m_sCorrType + "_relIsocone30",
117 m_sCorrType + "_relIsocone30;" + m_sCorrType + "_relIsocone30;Entries",
118 150, -25., 25.);
120 m_sCorrType + "_relIsocone40",
121 m_sCorrType + "_relIsocone40;" + m_sCorrType + "_relIsocone40;Entries",
122 150, -25., 25.);
123}
124
126 const xAOD::Muon& muon, const xAOD::Iso::IsolationType& isoType_cone20,
127 const xAOD::Iso::IsolationType& isoType_cone30,
128 const xAOD::Iso::IsolationType& isoType_cone40,
129 const xAOD::Iso::IsolationFlavour& flavour,
130 const xAOD::Iso::IsolationCaloCorrection& isoCorrType,
131 const xAOD::Iso::IsolationCorrectionParameter& isoCorrParam, float weight) {
132 float fIso20 = 0;
133 float fIso30 = 0;
134 float fIso40 = 0;
135 float fIsoCorr = 0;
136
137 try {
138 muon.isolation(fIso20, isoType_cone20);
139 muon.isolation(fIso30, isoType_cone30);
140 muon.isolation(fIso40, isoType_cone40);
141 muon.isolationCaloCorrection(fIsoCorr, flavour, isoCorrType,
142 isoCorrParam);
143 } catch (SG::ExcBadAuxVar&) {
144 return;
145 }
146 if (fIso20 && fIso30 && fIso40) {
147 fill(fIso20, fIso30, fIso40, muon.pt(), fIsoCorr, weight);
148 }
149}
150
151void IsoCorrPlots::fill(float fIso20, float fIso30, float fIso40, float fPt,
152 float fIsoCorr, float weight) {
153 isocorr->Fill(fIsoCorr * 0.001, weight);
154 isocorr_relPt->Fill(fIsoCorr / fPt, weight);
155 isocorr_relIsocone20->Fill(fIsoCorr / fIso20, weight);
156 isocorr_relIsocone30->Fill(fIsoCorr / fIso30, weight);
157 isocorr_relIsocone40->Fill(fIsoCorr / fIso40, weight);
158}
159#endif // not XAOD_ANALYSIS
160
161} // namespace Muon
void fill(const xAOD::Muon &muon, const xAOD::Iso::IsolationType &isoType_cone20, const xAOD::Iso::IsolationType &isoType_cone30, const xAOD::Iso::IsolationType &isoType_cone40, const xAOD::Iso::IsolationFlavour &flavour, const xAOD::Iso::IsolationCaloCorrection &isoCorrType, const xAOD::Iso::IsolationCorrectionParameter &isoCorrParam, float weight=1.0)
IsoCorrPlots(PlotBase *pParent, const std::string &sDir, std::string sCorrType)
IsoPlots(PlotBase *pParent, const std::string &sDir, std::string sConeSize)
void fill(const xAOD::Muon &muon, const xAOD::Iso::IsolationType &isoType, float weight=1.0)
std::string m_sConeSize
void fill(const xAOD::Muon &muon, float weight=1.0)
MuonIsolationPlots(PlotBase *pParent, const std::string &sDir)
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
Exception — Attempt to retrieve nonexistent aux data item.
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
STL namespace.
IsolationType
Overall enumeration for isolation types in xAOD files.
@ neflowisol20
Neutral eflow isolation.
@ topoetcone20
Topo-cluster ET-sum.
@ ptcone20
Track isolation.
@ ptvarcone20
Mini-Isolation http://arxiv.org/abs/1007.2221.
IsolationFlavour
Enumeration for different ways of calculating isolation in xAOD files.
@ topoetcone
Topo-cluster ET-sum.
@ neflowisol
neutral eflow
IsolationCaloCorrection
Enumeration for different ways of correcting isolation in xAOD files.
Muon_v1 Muon
Reference the current persistent version: