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
5#include <utility>
6
8
9namespace Muon{
10
11MuonIsolationPlots::MuonIsolationPlots(PlotBase* pParent, const std::string& sDir):PlotBase(pParent, sDir),
12//iso variables
13m_oPtCone20(this,"", "ptcone20"),
14m_oPtCone30(this,"", "ptcone30"),
15m_oPtCone40(this,"", "ptcone40"),
16
17m_oTopoEtCone20(this,"", "topoetcone20"),
18m_oTopoEtCone30(this,"", "topoetcone30"),
19m_oTopoEtCone40(this,"", "topoetcone40"),
20
21m_oNEFlowIso20(this,"", "neflowisol20"),
22m_oNEFlowIso30(this,"", "neflowisol30"),
23m_oNEFlowIso40(this,"", "neflowisol40"),
24
25m_oPtVarCone20(this,"", "ptvarcone20"),
26m_oPtVarCone30(this,"", "ptvarcone30"),
27m_oPtVarCone40(this,"", "ptvarcone40")
28 //iso corrections
29, m_oTopoEtCone_coreCone(this,"","topoetcone_coreCone")
30, m_oNEFlowIso_coreCone(this,"","neflowisol_coreCone")
31{}
32
54
55
56IsoPlots::IsoPlots(PlotBase* pParent, const std::string& sDir, std::string sConeSize):PlotBase(pParent, sDir),
57m_sConeSize(std::move(sConeSize)), cone(nullptr), conerel(nullptr)
58{}
59
61{
62 cone = Book1D(m_sConeSize, m_sConeSize + ";" + m_sConeSize + ";Entries", 60, -5., 25.);
63 conerel = Book1D(m_sConeSize + "rel", m_sConeSize + "rel;" + m_sConeSize + "rel;Entries", 40, 0., 2.);
64}
65
66 void IsoPlots::fill(const xAOD::Muon& muon, const xAOD::Iso::IsolationType &isoType, float weight)
67{
68 float fIso = 0;
69 try{
70 muon.isolation(fIso, isoType);
71 }
72 catch(SG::ExcBadAuxVar&){
73 return;
74 }
75 if (fIso) fill(fIso, muon.pt(),weight);
76}
77 void IsoPlots::fill(float fIso, float fPt,float weight)
78{
79 cone->Fill(fIso*0.001, weight);
80 conerel->Fill(fIso/fPt, weight);
81}
82
83
84#ifndef XAOD_ANALYSIS
85IsoCorrPlots::IsoCorrPlots(PlotBase* pParent, const std::string& sDir, std::string sCorrType):PlotBase(pParent, sDir),
86m_sCorrType(std::move(sCorrType)), isocorr(nullptr), isocorr_relPt(nullptr), isocorr_relIsocone20(nullptr), isocorr_relIsocone30(nullptr), isocorr_relIsocone40(nullptr)
87{}
88
90{
91 isocorr = Book1D(m_sCorrType, m_sCorrType + ";" + m_sCorrType + ";Entries", 60, -5., 25.);
92 isocorr_relPt = Book1D(m_sCorrType + "_relPt", m_sCorrType + "_relPt;" + m_sCorrType+ "_relPt;Entries", 40, 0., 2.);
93 isocorr_relIsocone20 = Book1D(m_sCorrType + "_relIsocone20", m_sCorrType + "_relIsocone20;" + m_sCorrType+ "_relIsocone20;Entries", 150, -25., 25.);
94 isocorr_relIsocone30 = Book1D(m_sCorrType + "_relIsocone30", m_sCorrType + "_relIsocone30;" + m_sCorrType+ "_relIsocone30;Entries", 150, -25., 25.);
95 isocorr_relIsocone40 = Book1D(m_sCorrType + "_relIsocone40", m_sCorrType + "_relIsocone40;" + m_sCorrType+ "_relIsocone40;Entries", 150, -25., 25.);
96}
97
98
100 const xAOD::Iso::IsolationType &isoType_cone20,
101 const xAOD::Iso::IsolationType &isoType_cone30,
102 const xAOD::Iso::IsolationType &isoType_cone40,
103 const xAOD::Iso::IsolationFlavour& flavour,
104 const xAOD::Iso::IsolationCaloCorrection &isoCorrType,
105 const xAOD::Iso::IsolationCorrectionParameter& isoCorrParam,
106 float weight)
107{
108 float fIso20 = 0;
109 float fIso30 = 0;
110 float fIso40 = 0;
111 float fIsoCorr = 0;
112
113 try{
114 muon.isolation(fIso20, isoType_cone20);
115 muon.isolation(fIso30, isoType_cone30);
116 muon.isolation(fIso40, isoType_cone40);
117 muon.isolationCaloCorrection(fIsoCorr, flavour, isoCorrType, isoCorrParam);
118 }
119 catch(SG::ExcBadAuxVar&){
120 return;
121 }
122 if (fIso20 && fIso30 && fIso40)
123 fill(fIso20, fIso30, fIso40, muon.pt(), fIsoCorr, weight);
124}
125
126 void IsoCorrPlots::fill(float fIso20, float fIso30, float fIso40, float fPt, float fIsoCorr,float weight)
127{
128 isocorr->Fill(fIsoCorr*0.001,weight);
129 isocorr_relPt->Fill(fIsoCorr/fPt,weight);
130 isocorr_relIsocone20->Fill(fIsoCorr/fIso20,weight);
131 isocorr_relIsocone30->Fill(fIsoCorr/fIso30,weight);
132 isocorr_relIsocone40->Fill(fIsoCorr/fIso40,weight);
133}
134#endif // not XAOD_ANALYSIS
135
136}//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(const std::string &name, const std::string &labels, int nBins, float start, float end, bool prependDir=true)
Book a TH1D histogram.
Definition PlotBase.cxx:94
PlotBase(PlotBase *parent, const std::string &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: