1 |
amagnan |
1.1 |
#include <iostream>
|
2 |
|
|
#include <fstream>
|
3 |
|
|
#include <sstream>
|
4 |
|
|
#include <cassert>
|
5 |
|
|
#include <cmath>
|
6 |
|
|
#include <algorithm>
|
7 |
|
|
|
8 |
|
|
#include "UserCode/HbbAnalysis/interface/HistosMuonsBase.hh"
|
9 |
|
|
|
10 |
|
|
namespace HbbAnalysis {//namespace
|
11 |
|
|
|
12 |
|
|
void HistosMuonsBase::Initialise(TFileDirectory & aDir, std::string aName, bool aDoGenMatched){
|
13 |
|
|
|
14 |
|
|
doGenMatched_ = aDoGenMatched;
|
15 |
|
|
CreateHistos(aName,aDir);
|
16 |
|
|
|
17 |
|
|
p_recoOverGen = aDir.make<TH1F>("p_recoOverGen",";p_{T}^{reco}/p_{T}^{gen};N_{entries}",300,0,3);
|
18 |
|
|
|
19 |
|
|
for (unsigned int bin(0); bin<20; bin++){//loop on eta bins
|
20 |
|
|
std::ostringstream retatitle;
|
21 |
|
|
retatitle << "p_recoOverGen_vsEta_" << bin ;
|
22 |
|
|
p_recoOverGen_vsEta[bin] = aDir.make<TH1F>(retatitle.str().c_str(),";p_{T}^{reco}/p_{T}^{gen};N_{entries}",300,0,3);
|
23 |
|
|
}//loop on eta bins
|
24 |
|
|
|
25 |
|
|
for (unsigned int bin(0); bin<10; bin++){//loop on pt bins
|
26 |
|
|
std::ostringstream rpttitle;
|
27 |
|
|
rpttitle << "p_recoOverGen_vsPt_" << bin;
|
28 |
|
|
p_recoOverGen_vsPt[bin] = aDir.make<TH1F>(rpttitle.str().c_str(),";p_{T}^{reco}/p_{T}^{gen};N_{entries}",300,0,3);
|
29 |
|
|
}//loop on pt bins
|
30 |
|
|
|
31 |
|
|
p_nMuons = aDir.make<TH1F>("p_nMuons",";N_{muons};N_{entries}",20,0,20);
|
32 |
|
|
|
33 |
|
|
p_caloCompat = aDir.make<TH1F>("p_caloCompat",";caloCompatibility;N_{entries}/0.01",100,0,1);
|
34 |
|
|
p_segCompat = aDir.make<TH1F>("p_segCompat",";segmentCompatibility;N_{entries}/0.01",100,0,1);
|
35 |
|
|
p_nChambers = aDir.make<TH1F>("p_nChambers",";N_{chambers};N_{entries}",50,0,50);
|
36 |
|
|
p_nMatchesLoose = aDir.make<TH1F>("p_nMatchesLoose",";N_{matches} (NoArbitration);N_{entries}",50,0,50);
|
37 |
|
|
p_nMatchesMedium = aDir.make<TH1F>("p_nMatchesMedium",";N_{matches} (SegmentArbitration);N_{entries}",50,0,50);
|
38 |
|
|
p_nMatchesTight = aDir.make<TH1F>("p_nMatchesTight",";N_{matches} (SegmentAndTrackArbitration);N_{entries}",50,0,50);
|
39 |
|
|
p_type = aDir.make<TH1F>("p_type",";type;N_{good}/type",15,0,15);
|
40 |
|
|
p_muonType = aDir.make<TH1F>("p_muonType",";muon type;N_{muons}/type",5,0,5);
|
41 |
amagnan |
1.4 |
p_muonID = aDir.make<TH1F>("p_muonID",";muon ID;N_{good}/ID",24,0,24);
|
42 |
amagnan |
1.1 |
|
43 |
amagnan |
1.2 |
|
44 |
|
|
p_trkIPd0 = aDir.make<TH1F>("p_trkIPd0",";d0 (from IP, mm);N_{entries}",100,0,20);
|
45 |
|
|
p_trkIPdz = aDir.make<TH1F>("p_trkIPdz",";dz (from IP, mm);N_{entries}",150,0,50);
|
46 |
|
|
p_trknHits = aDir.make<TH1F>("p_trknHits",";n_{hits};N_{entries}",50,0,50);
|
47 |
|
|
|
48 |
amagnan |
1.1 |
p_caloCompatvsPt = aDir.make<TH2F>("p_caloCompatvsPt",";p_{T} (GeV);caloCompatibility",20,0,100,100,0,1);
|
49 |
|
|
p_segCompatvsPt = aDir.make<TH2F>("p_segCompatvsPt",";p_{T} (GeV);segmentCompatibility",20,0,100,100,0,1);
|
50 |
|
|
p_nChambersvsPt = aDir.make<TH2F>("p_nChambersvsPt",";p_{T} (GeV);N_{chambers}",20,0,100,50,0,50);
|
51 |
|
|
p_nMatchesvsPt = aDir.make<TH2F>("p_nMatchesvsPt",";p_{T} (GeV);N_{matches} (SegmentArbitration)",20,0,100,50,0,50);
|
52 |
|
|
p_muonTypevsPt = aDir.make<TH2F>("p_muonTypevsPt",";p_{T} (GeV);muon type",20,0,100,5,0,5);
|
53 |
amagnan |
1.4 |
p_muonIDvsPt = aDir.make<TH2F>("p_muonIDvsPt",";p_{T} (GeV);muon ID",20,0,100,24,0,24);
|
54 |
amagnan |
1.1 |
|
55 |
|
|
p_caloCompatvsEta = aDir.make<TH2F>("p_caloCompatvsEta",";#eta;caloCompatibility",50,-2.5,2.5,100,0,1);
|
56 |
|
|
p_segCompatvsEta = aDir.make<TH2F>("p_segCompatvsEta",";#eta;segmentCompatibility",50,-2.5,2.5,100,0,1);
|
57 |
|
|
p_nChambersvsEta = aDir.make<TH2F>("p_nChambersvsEta",";#eta;N_{chambers}",50,-2.5,2.5,50,0,50);
|
58 |
|
|
p_nMatchesvsEta = aDir.make<TH2F>("p_nMatchesvsEta",";#eta;N_{matches} (SegmentArbitration)",50,-2.5,2.5,50,0,50);
|
59 |
|
|
p_muonTypevsEta = aDir.make<TH2F>("p_muonTypevsEta",";#eta;muon type",50,-2.5,2.5,5,0,5);
|
60 |
amagnan |
1.4 |
p_muonIDvsEta = aDir.make<TH2F>("p_muonIDvsEta",";#eta;muon ID",50,-2.5,2.5,24,0,24);
|
61 |
amagnan |
1.1 |
|
62 |
|
|
//efficiency of ID cut
|
63 |
amagnan |
1.4 |
peff_muID = aDir.make<TH1F>("peff_muID",";muon ID;N_{ID}/N_{tot}",24,0,24);
|
64 |
|
|
peff_muIDvsEta = aDir.make<TH2F>("peff_muIDvsEta",";#eta;muon ID;N_{ID}/N_{tot}",50,-2.5,2.5,24,0,24);
|
65 |
amagnan |
1.1 |
idEff_.initialise(peff_muID->GetNbinsX(),peff_muID->GetXaxis()->GetXmin(),peff_muID->GetXaxis()->GetXmax());
|
66 |
amagnan |
1.4 |
for (unsigned id(0); id<24;id++){
|
67 |
amagnan |
1.1 |
idEffEta_[id].initialise(peff_muIDvsEta->GetNbinsX(),peff_muIDvsEta->GetXaxis()->GetXmin(),peff_muIDvsEta->GetXaxis()->GetXmax());
|
68 |
|
|
}
|
69 |
|
|
|
70 |
|
|
|
71 |
|
|
p_isoR03_emEt = aDir.make<TH1F>("p_isoR03_emEt",";emEt (#DeltaR=0.3, GeV);N_{entries}/0.05 GeV",500,0,25);
|
72 |
|
|
p_isoR05_emEt = aDir.make<TH1F>("p_isoR05_emEt",";emEt (#DeltaR=0.5, GeV);N_{entries}/0.05 GeV",500,0,25);
|
73 |
|
|
p_isoR03_hadEt = aDir.make<TH1F>("p_isoR03_hadEt",";hadEt (#DeltaR=0.3, GeV);N_{entries}/0.05 GeV",500,0,25);
|
74 |
|
|
p_isoR05_hadEt = aDir.make<TH1F>("p_isoR05_hadEt",";hadEt (#DeltaR=0.5, GeV);N_{entries}/0.05 GeV",500,0,25);
|
75 |
|
|
p_isoR03_nTracks = aDir.make<TH1F>("p_isoR03_nTracks",";N_{tracks} (#DeltaR=0.3);N_{entries}",20,0,20);
|
76 |
|
|
p_isoR05_nTracks = aDir.make<TH1F>("p_isoR05_nTracks",";N_{tracks} (#DeltaR=0.5);N_{entries}",20,0,20);
|
77 |
|
|
p_isoR03_nJets = aDir.make<TH1F>("p_isoR03_nJets",";N_{Jets} (#DeltaR=0.3);N_{entries}",10,0,10);
|
78 |
|
|
p_isoR05_nJets = aDir.make<TH1F>("p_isoR05_nJets",";N_{Jets} (#DeltaR=0.5);N_{entries}",10,0,10);
|
79 |
|
|
|
80 |
|
|
|
81 |
|
|
//TString lIsoVar[4] = {"sumPt","sumPtOverPt","combIso","combIsoOverPt"};
|
82 |
|
|
assert (getNVar() == 4);
|
83 |
|
|
p_isoR03[0] = aDir.make<TH1F>("p_isoR03_sumPt",";sumPt (#DeltaR=0.3, GeV);N_{entries}/0.05 GeV",300,0,30);
|
84 |
|
|
p_isoR03[1] = aDir.make<TH1F>("p_isoR03_sumPtOverPt",";sumPt/Pt (#DeltaR=0.3);N_{entries}",100,0,1);
|
85 |
|
|
p_isoR03[2] = aDir.make<TH1F>("p_isoR03_combIso",";combIso (#DeltaR=0.3, GeV);N_{entries}/0.05 GeV",300,0,30);
|
86 |
|
|
p_isoR03[3] = aDir.make<TH1F>("p_isoR03_combIsoOverPt",";combIso/Pt (#DeltaR=0.3);N_{entries}",100,0,1);
|
87 |
|
|
|
88 |
|
|
p_isoR05[0] = aDir.make<TH1F>("p_isoR05_sumPt",";sumPt (#DeltaR=0.5, GeV);N_{entries}/0.05 GeV",300,0,30);
|
89 |
|
|
p_isoR05[1] = aDir.make<TH1F>("p_isoR05_sumPtOverPt",";sumPt/Pt (#DeltaR=0.5);N_{entries}",100,0,1);
|
90 |
|
|
p_isoR05[2] = aDir.make<TH1F>("p_isoR05_combIso",";combIso (#DeltaR=0.5, GeV);N_{entries}/0.05 GeV",300,0,30);
|
91 |
|
|
p_isoR05[3] = aDir.make<TH1F>("p_isoR05_combIsoOverPt",";combIso/Pt (#DeltaR=0.5);N_{entries}",100,0,1);
|
92 |
|
|
|
93 |
|
|
//efficiency curves vs cut value
|
94 |
|
|
peff_muIsoR03[0] = aDir.make<TH1F>("peff_muIsoR03_sumPt",";sumPt (#DeltaR=0.3, GeV);N_{sel}/N_{tot}",50,0,5);
|
95 |
|
|
peff_muIsoR03[1] = aDir.make<TH1F>("peff_muIsoR03_sumPtOverPt",";sumPt/Pt (#DeltaR=0.3);N_{sel}/N_{tot}",50,0,1);
|
96 |
|
|
peff_muIsoR03[2] = aDir.make<TH1F>("peff_muIsoR03_combIso",";combIso (#DeltaR=0.3, GeV);N_{sel}/N_{tot}",50,0,10);
|
97 |
|
|
peff_muIsoR03[3] = aDir.make<TH1F>("peff_muIsoR03_combIsoOverPt",";combIso/Pt (#DeltaR=0.3);N_{sel}/N_{tot}",50,0,1);
|
98 |
|
|
|
99 |
|
|
peff_muIsoR05[0] = aDir.make<TH1F>("peff_muIsoR05_sumPt",";sumPt (#DeltaR=0.5, GeV);N_{sel}/N_{tot}",50,0,5);
|
100 |
|
|
peff_muIsoR05[1] = aDir.make<TH1F>("peff_muIsoR05_sumPtOverPt",";sumPt/Pt (#DeltaR=0.5);N_{sel}/N_{tot}",50,0,1);
|
101 |
|
|
peff_muIsoR05[2] = aDir.make<TH1F>("peff_muIsoR05_combIso",";combIso (#DeltaR=0.5, GeV);N_{sel}/N_{tot}",50,0,10);
|
102 |
|
|
peff_muIsoR05[3] = aDir.make<TH1F>("peff_muIsoR05_combIsoOverPt",";combIso/Pt (#DeltaR=0.5);N_{sel}/N_{tot}",50,0,1);
|
103 |
|
|
|
104 |
|
|
//efficiency curves vs pT muon
|
105 |
|
|
peff_muPt[0] = aDir.make<TH1F>("peff_muPt_sumPt",";p_{T} (GeV);N_{sel}/N_{tot}",18,10,100);
|
106 |
|
|
const unsigned int lNBinsPt = peff_muPt[0]->GetNbinsX();
|
107 |
|
|
const double lMinPt = peff_muPt[0]->GetXaxis()->GetXmin();
|
108 |
|
|
const double lMaxPt = peff_muPt[0]->GetXaxis()->GetXmax();
|
109 |
|
|
peff_muPt[1] = aDir.make<TH1F>("peff_muPt_sumPtOverPt",";p_{T} (GeV);N_{sel}/N_{tot}",lNBinsPt,lMinPt,lMaxPt);
|
110 |
|
|
peff_muPt[2] = aDir.make<TH1F>("peff_muPt_combIso",";p_{T} (GeV);N_{sel}/N_{tot}",lNBinsPt,lMinPt,lMaxPt);
|
111 |
|
|
peff_muPt[3] = aDir.make<TH1F>("peff_muPt_combIsoOverPt",";p_{T} (GeV);N_{sel}/N_{tot}",lNBinsPt,lMinPt,lMaxPt);
|
112 |
|
|
|
113 |
|
|
|
114 |
|
|
//efficiency curves vs eta muon
|
115 |
|
|
peff_muEta[0] = aDir.make<TH1F>("peff_muEta_sumPt",";#eta;N_{sel}/N_{tot}",42,-2.1,2.1);
|
116 |
|
|
const unsigned int lNBinsEta = peff_muEta[0]->GetNbinsX();
|
117 |
|
|
const double lMinEta = peff_muEta[0]->GetXaxis()->GetXmin();
|
118 |
|
|
const double lMaxEta = peff_muEta[0]->GetXaxis()->GetXmax();
|
119 |
|
|
peff_muEta[1] = aDir.make<TH1F>("peff_muEta_sumPtOverPt",";#eta;N_{sel}/N_{tot}",lNBinsEta,lMinEta,lMaxEta);
|
120 |
|
|
peff_muEta[2] = aDir.make<TH1F>("peff_muEta_combIso",";#eta;N_{sel}/N_{tot}",lNBinsEta,lMinEta,lMaxEta);
|
121 |
|
|
peff_muEta[3] = aDir.make<TH1F>("peff_muEta_combIsoOverPt",";#eta;N_{sel}/N_{tot}",lNBinsEta,lMinEta,lMaxEta);
|
122 |
|
|
|
123 |
|
|
//efficiency calculation tool
|
124 |
|
|
for (unsigned int i(0); i<getNVar(); i++){
|
125 |
|
|
const unsigned int lNBinsR03 = peff_muIsoR03[i]->GetNbinsX();
|
126 |
|
|
const double lMinR03 = peff_muIsoR03[i]->GetXaxis()->GetXmin();
|
127 |
|
|
const double lMaxR03 = peff_muIsoR03[i]->GetXaxis()->GetXmax();
|
128 |
|
|
const unsigned int lNBinsR05 = peff_muIsoR05[i]->GetNbinsX();
|
129 |
|
|
const double lMinR05 = peff_muIsoR05[i]->GetXaxis()->GetXmin();
|
130 |
|
|
const double lMaxR05 = peff_muIsoR05[i]->GetXaxis()->GetXmax();
|
131 |
|
|
isoR03Eff_[i].initialise(lNBinsR03,lMinR03,lMaxR03);
|
132 |
|
|
isoR05Eff_[i].initialise(lNBinsR05,lMinR05,lMaxR05);
|
133 |
|
|
isoEffPt_[i].initialise(lNBinsPt,lMinPt,lMaxPt);
|
134 |
|
|
isoEffEta_[i].initialise(lNBinsEta,lMinEta,lMaxEta);
|
135 |
|
|
}
|
136 |
|
|
|
137 |
|
|
|
138 |
|
|
}//Initialise
|
139 |
|
|
|
140 |
|
|
void HistosMuonsBase::FillEventHistograms(const std::vector<HbbAnalysis::Muon> & aCol){
|
141 |
|
|
|
142 |
|
|
if (doGenMatched_) {
|
143 |
|
|
unsigned int nMatched = 0;
|
144 |
|
|
for (std::vector<HbbAnalysis::Muon>::const_iterator iMuon = aCol.begin();
|
145 |
|
|
iMuon != aCol.end();
|
146 |
|
|
iMuon++)
|
147 |
|
|
{
|
148 |
|
|
if (MatchesGenMuon(*iMuon)) nMatched++;
|
149 |
|
|
}
|
150 |
|
|
p_nMuons->Fill(nMatched);
|
151 |
|
|
}
|
152 |
|
|
else p_nMuons->Fill(aCol.size());
|
153 |
|
|
|
154 |
|
|
}
|
155 |
|
|
|
156 |
|
|
void HistosMuonsBase::FillHistograms(const HbbAnalysis::Muon & aMuon, bool isLead){//FillHistograms
|
157 |
|
|
|
158 |
|
|
bool lIsGenMatched = !doGenMatched_ || (doGenMatched_ && MatchesGenMuon(aMuon));
|
159 |
|
|
if (lIsGenMatched) {
|
160 |
|
|
if (isLead) {
|
161 |
|
|
FillBaseHistograms(aMuon.recoVars().pT,aMuon.recoVars().eta,aMuon.recoVars().phi,aMuon.recoVars().charge);
|
162 |
|
|
|
163 |
|
|
if (aMuon.genVars().valid && fabs(aMuon.genVars().eta)<2.1 && aMuon.genVars().pT>10) {
|
164 |
|
|
int binEta = static_cast<int>((aMuon.genVars().eta+2.1)/0.21);
|
165 |
|
|
int binpt;
|
166 |
|
|
if (aMuon.genVars().pT < 100) binpt = static_cast<int>((aMuon.genVars().pT-10)/11.25);
|
167 |
|
|
else if (aMuon.genVars().pT < 120) binpt = 8;
|
168 |
|
|
else binpt = 9;
|
169 |
|
|
|
170 |
|
|
p_recoOverGen_vsEta[binEta]->Fill(aMuon.recoVars().pT/aMuon.genVars().pT);
|
171 |
|
|
p_recoOverGen_vsPt[binpt]->Fill(aMuon.recoVars().pT/aMuon.genVars().pT);
|
172 |
amagnan |
1.2 |
p_recoOverGen->Fill(aMuon.recoVars().pT/aMuon.genVars().pT);
|
173 |
amagnan |
1.1 |
}
|
174 |
|
|
|
175 |
|
|
p_caloCompat->Fill(aMuon.idVars().caloCompat);
|
176 |
|
|
p_segCompat->Fill(aMuon.idVars().segCompat);
|
177 |
|
|
p_nChambers->Fill(aMuon.idVars().nChambers);
|
178 |
|
|
p_nMatchesLoose->Fill(aMuon.idVars().nMatchesLoose);
|
179 |
|
|
p_nMatchesMedium->Fill(aMuon.idVars().nMatchesMedium);
|
180 |
|
|
p_nMatchesTight->Fill(aMuon.idVars().nMatchesTight);
|
181 |
|
|
|
182 |
|
|
p_caloCompatvsPt->Fill(aMuon.recoVars().pT,aMuon.idVars().caloCompat);
|
183 |
|
|
p_segCompatvsPt->Fill(aMuon.recoVars().pT,aMuon.idVars().segCompat);
|
184 |
|
|
p_nChambersvsPt->Fill(aMuon.recoVars().pT,aMuon.idVars().nChambers);
|
185 |
|
|
p_nMatchesvsPt->Fill(aMuon.recoVars().pT,aMuon.idVars().nMatchesLoose);
|
186 |
|
|
|
187 |
|
|
p_caloCompatvsEta->Fill(aMuon.recoVars().eta,aMuon.idVars().caloCompat);
|
188 |
|
|
p_segCompatvsEta->Fill(aMuon.recoVars().eta,aMuon.idVars().segCompat);
|
189 |
|
|
p_nChambersvsEta->Fill(aMuon.recoVars().eta,aMuon.idVars().nChambers);
|
190 |
|
|
p_nMatchesvsEta->Fill(aMuon.recoVars().eta,aMuon.idVars().nMatchesLoose);
|
191 |
|
|
|
192 |
|
|
//p_type->Fill(aMuon->type());
|
193 |
|
|
p_muonType->Fill(aMuon.idVars().type);
|
194 |
|
|
p_muonTypevsPt->Fill(aMuon.recoVars().pT,aMuon.idVars().type);
|
195 |
|
|
p_muonTypevsEta->Fill(aMuon.recoVars().eta,aMuon.idVars().type);
|
196 |
|
|
|
197 |
amagnan |
1.2 |
p_trkIPd0->Fill(aMuon.trkVars().IPd0);
|
198 |
|
|
p_trkIPdz->Fill(aMuon.trkVars().IPdz);
|
199 |
|
|
p_trknHits->Fill(aMuon.trkVars().nHits);
|
200 |
amagnan |
1.1 |
|
201 |
|
|
for (unsigned int id(0); id<idEff_.numberOfBins(); id++){
|
202 |
|
|
idEff_.incrementTotal(id);
|
203 |
|
|
for (unsigned ieta(0); ieta<idEffEta_[id].numberOfBins(); ieta++){
|
204 |
|
|
double lCutMin = idEffEta_[id].xMin()+idEffEta_[id].stepSize()*ieta;
|
205 |
|
|
double lCutMax = idEffEta_[id].xMin()+idEffEta_[id].stepSize()*(ieta+1);
|
206 |
|
|
|
207 |
|
|
if (aMuon.recoVars().eta >= lCutMin && aMuon.recoVars().eta < lCutMax){
|
208 |
|
|
idEffEta_[id].incrementTotal(ieta);
|
209 |
|
|
}
|
210 |
|
|
}
|
211 |
|
|
}
|
212 |
|
|
|
213 |
|
|
for (unsigned ieta(0); ieta<idEffEta_[0].numberOfBins(); ieta++){
|
214 |
|
|
double lCutMin = idEffEta_[0].xMin()+idEffEta_[0].stepSize()*ieta;
|
215 |
|
|
double lCutMax = idEffEta_[0].xMin()+idEffEta_[0].stepSize()*(ieta+1);
|
216 |
|
|
|
217 |
|
|
|
218 |
|
|
for (unsigned iIds(0); iIds<aMuon.idVars().ids.size(); iIds++){
|
219 |
|
|
unsigned short lValue = aMuon.idVars().ids.at(iIds);
|
220 |
amagnan |
1.3 |
assert(lValue < 24);
|
221 |
amagnan |
1.1 |
if (ieta == 0) {
|
222 |
|
|
p_muonID->Fill(lValue);
|
223 |
|
|
p_muonIDvsPt->Fill(aMuon.recoVars().pT,lValue);
|
224 |
|
|
p_muonIDvsEta->Fill(aMuon.recoVars().eta,lValue);
|
225 |
|
|
idEff_.incrementPass(lValue);
|
226 |
|
|
}
|
227 |
|
|
if (aMuon.recoVars().eta >= lCutMin && aMuon.recoVars().eta < lCutMax){
|
228 |
|
|
idEffEta_[lValue].incrementPass(ieta);
|
229 |
|
|
}
|
230 |
|
|
}
|
231 |
|
|
|
232 |
|
|
}
|
233 |
|
|
|
234 |
|
|
}
|
235 |
|
|
|
236 |
|
|
p_isoR03_emEt->Fill(aMuon.isoR03Vars().emEt);
|
237 |
|
|
p_isoR05_emEt->Fill(aMuon.isoR05Vars().emEt);
|
238 |
|
|
p_isoR03_hadEt->Fill(aMuon.isoR03Vars().hadEt);
|
239 |
|
|
p_isoR05_hadEt->Fill(aMuon.isoR05Vars().hadEt);
|
240 |
|
|
p_isoR03_nTracks->Fill(aMuon.isoR03Vars().nTracks);
|
241 |
|
|
p_isoR05_nTracks->Fill(aMuon.isoR05Vars().nTracks);
|
242 |
|
|
p_isoR03_nJets->Fill(aMuon.isoR03Vars().nJets);
|
243 |
|
|
p_isoR05_nJets->Fill(aMuon.isoR05Vars().nJets);
|
244 |
|
|
|
245 |
|
|
double lIsoR03Var[4] = {
|
246 |
|
|
aMuon.isoR03Vars().sumPt,
|
247 |
|
|
aMuon.isoR03Vars().sumPt/aMuon.recoVars().pT,
|
248 |
|
|
aMuon.isoR03Vars().sumPt+aMuon.isoR03Vars().emEt,
|
249 |
|
|
(aMuon.isoR03Vars().sumPt+aMuon.isoR03Vars().emEt)/aMuon.recoVars().pT
|
250 |
|
|
};
|
251 |
|
|
double lIsoR05Var[4] = {
|
252 |
|
|
aMuon.isoR05Vars().sumPt,
|
253 |
|
|
aMuon.isoR05Vars().sumPt/aMuon.recoVars().pT,
|
254 |
|
|
aMuon.isoR05Vars().sumPt+aMuon.isoR05Vars().emEt,
|
255 |
|
|
(aMuon.isoR05Vars().sumPt+aMuon.isoR05Vars().emEt)/aMuon.recoVars().pT
|
256 |
|
|
};
|
257 |
|
|
|
258 |
|
|
double lIsoR03Cut[4] = {3.,0.09,6.,0.18};
|
259 |
|
|
|
260 |
|
|
for (unsigned int i(0); i<getNVar(); i++){//loop on iso variables
|
261 |
|
|
p_isoR03[i]->Fill(lIsoR03Var[i]);
|
262 |
|
|
p_isoR05[i]->Fill(lIsoR05Var[i]);
|
263 |
|
|
|
264 |
|
|
//R03
|
265 |
|
|
for (unsigned int lBin(0); lBin<isoR03Eff_[i].numberOfBins(); lBin++){
|
266 |
|
|
double lCut = isoR03Eff_[i].xMin()+isoR03Eff_[i].stepSize()*lBin;
|
267 |
|
|
|
268 |
|
|
//std::cout << "******** var R03 #" << i << ", bin " << lBin << " isolation = " << lIsoR03Var[i] << ", cut = " << lCut << std::endl;
|
269 |
|
|
|
270 |
|
|
isoR03Eff_[i].incrementTotal(lBin);
|
271 |
|
|
if (lIsoR03Var[i] <= lCut){
|
272 |
|
|
isoR03Eff_[i].incrementPass(lBin);
|
273 |
|
|
}
|
274 |
|
|
}
|
275 |
|
|
|
276 |
|
|
//R05
|
277 |
|
|
for (unsigned int lBin(0); lBin<isoR05Eff_[i].numberOfBins(); lBin++){
|
278 |
|
|
double lCut = isoR05Eff_[i].xMin()+isoR05Eff_[i].stepSize()*lBin;
|
279 |
|
|
|
280 |
|
|
//std::cout << "******** var R05 #" << i << ", bin " << lBin << " isolation = " << lIsoR03Var[i] << ", cut = " << lCut << std::endl;
|
281 |
|
|
|
282 |
|
|
isoR05Eff_[i].incrementTotal(lBin);
|
283 |
|
|
if (lIsoR05Var[i] <= lCut){
|
284 |
|
|
isoR05Eff_[i].incrementPass(lBin);
|
285 |
|
|
}
|
286 |
|
|
}
|
287 |
|
|
|
288 |
|
|
//eff vs pT
|
289 |
|
|
for (unsigned int lBin(0); lBin<isoEffPt_[i].numberOfBins(); lBin++){
|
290 |
|
|
double lCutMin = isoEffPt_[i].xMin()+isoEffPt_[i].stepSize()*lBin;
|
291 |
|
|
double lCutMax = isoEffPt_[i].xMin()+isoEffPt_[i].stepSize()*(lBin+1);
|
292 |
|
|
|
293 |
|
|
if (aMuon.recoVars().pT >= lCutMin && aMuon.recoVars().pT < lCutMax){
|
294 |
|
|
isoEffPt_[i].incrementTotal(lBin);
|
295 |
|
|
|
296 |
|
|
if (lIsoR03Var[i] <= lIsoR03Cut[i]){
|
297 |
|
|
isoEffPt_[i].incrementPass(lBin);
|
298 |
|
|
}
|
299 |
|
|
}
|
300 |
|
|
}
|
301 |
|
|
|
302 |
|
|
//eff vs eta
|
303 |
|
|
for (unsigned int lBin(0); lBin<isoEffEta_[i].numberOfBins(); lBin++){
|
304 |
|
|
double lCutMin = isoEffEta_[i].xMin()+isoEffEta_[i].stepSize()*lBin;
|
305 |
|
|
double lCutMax = isoEffEta_[i].xMin()+isoEffEta_[i].stepSize()*(lBin+1);
|
306 |
|
|
|
307 |
|
|
if (aMuon.recoVars().eta >= lCutMin && aMuon.recoVars().eta < lCutMax){
|
308 |
|
|
isoEffEta_[i].incrementTotal(lBin);
|
309 |
|
|
|
310 |
|
|
if (lIsoR03Var[i] <= lIsoR03Cut[i]){
|
311 |
|
|
isoEffEta_[i].incrementPass(lBin);
|
312 |
|
|
}
|
313 |
|
|
}
|
314 |
|
|
}
|
315 |
|
|
|
316 |
|
|
}//loop on iso variables
|
317 |
|
|
}//lIsGenMatched
|
318 |
|
|
|
319 |
|
|
}//FillHistograms
|
320 |
|
|
|
321 |
|
|
|
322 |
|
|
void HistosMuonsBase::FillEffHistograms(){//FillEffHistograms
|
323 |
|
|
|
324 |
|
|
|
325 |
|
|
for (unsigned int id(0); id<idEff_.numberOfBins(); id++){
|
326 |
|
|
peff_muID->SetBinContent(id+1,idEff_.getRatio(id));
|
327 |
|
|
peff_muID->SetBinError(id+1,idEff_.getRatioError(id));
|
328 |
|
|
|
329 |
|
|
for (unsigned int lBin(0); lBin<idEffEta_[id].numberOfBins(); lBin++){
|
330 |
|
|
peff_muIDvsEta->SetBinContent(lBin+1,id+1,idEffEta_[id].getRatio(lBin));
|
331 |
|
|
peff_muIDvsEta->SetBinError(lBin+1,id+1,idEffEta_[id].getRatioError(lBin));
|
332 |
|
|
}
|
333 |
|
|
|
334 |
|
|
}
|
335 |
|
|
|
336 |
|
|
for (unsigned int i(0); i<getNVar(); i++){//loop on iso variables
|
337 |
|
|
|
338 |
|
|
for (unsigned int lBin(0); lBin<isoR03Eff_[i].numberOfBins(); lBin++){
|
339 |
|
|
peff_muIsoR03[i]->SetBinContent(lBin+1,isoR03Eff_[i].getRatio(lBin));
|
340 |
|
|
peff_muIsoR03[i]->SetBinError(lBin+1,isoR03Eff_[i].getRatioError(lBin));
|
341 |
|
|
}
|
342 |
|
|
for (unsigned int lBin(0); lBin<isoR05Eff_[i].numberOfBins(); lBin++){
|
343 |
|
|
peff_muIsoR05[i]->SetBinContent(lBin+1,isoR05Eff_[i].getRatio(lBin));
|
344 |
|
|
peff_muIsoR05[i]->SetBinError(lBin+1,isoR05Eff_[i].getRatioError(lBin));
|
345 |
|
|
}
|
346 |
|
|
|
347 |
|
|
//eff vs pT
|
348 |
|
|
for (unsigned int lBin(0); lBin<isoEffPt_[i].numberOfBins(); lBin++){
|
349 |
|
|
peff_muPt[i]->SetBinContent(lBin+1,isoEffPt_[i].getRatio(lBin));
|
350 |
|
|
peff_muPt[i]->SetBinError(lBin+1,isoEffPt_[i].getRatioError(lBin));
|
351 |
|
|
}
|
352 |
|
|
|
353 |
|
|
//eff vs eta
|
354 |
|
|
for (unsigned int lBin(0); lBin<isoEffEta_[i].numberOfBins(); lBin++){
|
355 |
|
|
peff_muEta[i]->SetBinContent(lBin+1,isoEffEta_[i].getRatio(lBin));
|
356 |
|
|
peff_muEta[i]->SetBinError(lBin+1,isoEffEta_[i].getRatioError(lBin));
|
357 |
|
|
}
|
358 |
|
|
|
359 |
|
|
}//loop on iso variables
|
360 |
|
|
|
361 |
|
|
}//FillEffHistograms
|
362 |
|
|
|
363 |
|
|
|
364 |
|
|
bool HistosMuonsBase::MatchesGenMuon(const HbbAnalysis::Muon& aMuon)
|
365 |
|
|
{
|
366 |
|
|
return (aMuon.genVars().valid && abs(aMuon.genVars().pdgId) == 13);
|
367 |
|
|
}
|
368 |
|
|
|
369 |
|
|
}//namespace
|
370 |
|
|
|
371 |
|
|
|