1 |
|
#include <iostream> |
2 |
|
#include <fstream> |
3 |
|
|
4 |
– |
#include "FWCore/MessageLogger/interface/MessageLogger.h" |
5 |
– |
|
4 |
|
#include "UserCode/HbbAnalysis/interface/HistosElecs.hh" |
5 |
|
|
6 |
|
namespace HbbAnalysis {//namespace |
7 |
|
|
10 |
– |
void HistosElecs::Initialise(TFileDirectory & aDir, std::string aName, bool aDoGenMatched){ |
11 |
– |
|
12 |
– |
doGenMatched_ = aDoGenMatched; |
13 |
– |
CreateHistos(aName,aDir); |
14 |
– |
|
15 |
– |
p_nElectrons = aDir.make<TH1F>("p_nElectrons",";N_{electrons};N_{entries}",10,0,10); |
16 |
– |
|
17 |
– |
p_electronID = aDir.make<TH1F>("p_electronID",";electronID;N_{entries}",8,0,8); |
18 |
– |
|
19 |
– |
p_scSigmaEtaEta = aDir.make<TH1F>("p_scSigmaEtaEta",";#sigma_{#eta,#eta};N_{entries}",500,0,0.1); |
20 |
– |
p_scSigmaIEtaIEta = aDir.make<TH1F>("p_scSigmaIEtaIEta",";#sigma_{i#eta,i#eta};N_{entries}",500,0,0.1); |
21 |
– |
p_scE1x5 = aDir.make<TH1F>("p_scE1x5",";E_{sc}^{1#times 5} (GeV);N_{entries}",500,0,500); |
22 |
– |
p_scE2x5Max = aDir.make<TH1F>("p_scE2x5Max",";E_{sc}^{2#times 5} (GeV);N_{entries}",500,0,500); |
23 |
– |
p_scE5x5 = aDir.make<TH1F>("p_scE5x5",";E_{sc}^{5#times 5} (GeV);N_{entries}",500,0,500); |
24 |
– |
p_scE1x5OverscE5x5 = aDir.make<TH1F>("p_scE1x5OverscE5x5",";E_{sc}^{1#times 5}/E_{sc}^{5#times 5};N_{entries}",500,0,2); |
25 |
– |
p_scE2x5MaxOverscE5x5 = aDir.make<TH1F>("p_scE2x5MaxOverscE5x5",";E_{sc}^{2#times 5}/E_{sc}^{5#times 5};N_{entries}",500,0,2); |
26 |
– |
|
27 |
– |
p_eSuperClusterOverP = aDir.make<TH1F>("p_eSuperClusterOverP",";E_{sc}/p_{track};N_{entries}",100,0.5,2); |
28 |
– |
|
29 |
– |
p_HoverE = aDir.make<TH1F>("p_HoverE",";E_{had}/E_{em};N_{entries}",150,0,0.15); |
30 |
– |
p_deltaPhiIn = aDir.make<TH1F>("p_deltaPhiIn",";#Delta#phi_{in};N_{entries}",150,0,0.15); |
31 |
– |
p_deltaEtaIn = aDir.make<TH1F>("p_deltaEtaIn",";#Delta#eta_{in};N_{entries}",150,0,0.03); |
32 |
– |
|
33 |
– |
p_caloIso = aDir.make<TH1F>("p_caloIso",";caloIso;N_{entries}",400,0,20); |
34 |
– |
p_hcalIso = aDir.make<TH1F>("p_hcalIso",";hcalIso;N_{entries}",400,0,20); |
35 |
– |
|
36 |
– |
p_trackIso = aDir.make<TH1F>("p_trackIso",";trackIso (GeV);N_{entries}",400,0,20); |
37 |
– |
p_trackIsoOverEt = aDir.make<TH1F>("p_trackIsoOverEt",";trackIso/E_{T};N_{entries}",400,0,1); |
38 |
– |
p_ecalIso = aDir.make<TH1F>("p_ecalIso",";ecalIso (GeV);N_{entries}",400,0,20); |
39 |
– |
p_ecalIsoOverEt = aDir.make<TH1F>("p_ecalIsoOverEt",";ecalIso/E_{T};N_{entries}",400,0,1); |
40 |
– |
p_combIso = aDir.make<TH1F>("p_combIso",";combIso (GeV);N_{entries}",400,0,40); |
41 |
– |
p_combIsoOverEt = aDir.make<TH1F>("p_combIsoOverEt",";combIso/E_{T};N_{entries}",400,0,1); |
42 |
– |
|
43 |
– |
p_gsfTrk_pT = aDir.make<TH1F>("p_gsfTrk_pT",";p_{T}^{trk} (GeV);N_{entries}",200,0,200); |
44 |
– |
p_gsfTrk_IPxy = aDir.make<TH1F>("p_gsfTrk_IPxy",";IP_{xy}^{trk};N_{entries}",100,-0.1,0.1); |
45 |
– |
p_gsfTrk_IPz = aDir.make<TH1F>("p_gsfTrk_IPz",";IP_{z}^{trk};N_{entries}",100,-1,1); |
46 |
– |
|
47 |
– |
//efficiency curves vs cut value |
48 |
– |
peff_eIso[0] = aDir.make<TH1F>("peff_eIso_trkIso",";trkIso (GeV);N_{sel}/N_{tot}",50,0,5); |
49 |
– |
peff_eIso[1] = aDir.make<TH1F>("peff_eIso_trkIsoOverEt",";trkIso/E_{T};N_{sel}/N_{tot}",50,0,1); |
50 |
– |
peff_eIso[2] = aDir.make<TH1F>("peff_eIso_ecalIso",";ecalIso (GeV);N_{sel}/N_{tot}",50,0,5); |
51 |
– |
peff_eIso[3] = aDir.make<TH1F>("peff_eIso_ecalIsoOverEt",";ecalIso/E_{T};N_{sel}/N_{tot}",50,0,1); |
52 |
– |
peff_eIso[4] = aDir.make<TH1F>("peff_eIso_combIso",";combIso (GeV);N_{sel}/N_{tot}",50,0,10); |
53 |
– |
peff_eIso[5] = aDir.make<TH1F>("peff_eIso_combIsoOverEt",";combIso/E_{T};N_{sel}/N_{tot}",50,0,1); |
54 |
– |
|
55 |
– |
//efficiency curves vs pT muon |
56 |
– |
peff_eEt[0] = aDir.make<TH1F>("peff_eEt_trkIso",";E_{T} (GeV);N_{sel}/N_{tot}",18,10,100); |
57 |
– |
const unsigned int lNBinsPt = peff_eEt[0]->GetNbinsX(); |
58 |
– |
const double lMinPt = peff_eEt[0]->GetXaxis()->GetXmin(); |
59 |
– |
const double lMaxPt = peff_eEt[0]->GetXaxis()->GetXmax(); |
60 |
– |
peff_eEt[1] = aDir.make<TH1F>("peff_eEt_trkIsoOverEt",";E_{T} (GeV);N_{sel}/N_{tot}",lNBinsPt,lMinPt,lMaxPt); |
61 |
– |
peff_eEt[2] = aDir.make<TH1F>("peff_eEt_ecalIso",";E_{T} (GeV);N_{sel}/N_{tot}",lNBinsPt,lMinPt,lMaxPt); |
62 |
– |
peff_eEt[3] = aDir.make<TH1F>("peff_eEt_ecalIsoOverEt",";E_{T} (GeV);N_{sel}/N_{tot}",lNBinsPt,lMinPt,lMaxPt); |
63 |
– |
peff_eEt[4] = aDir.make<TH1F>("peff_eEt_combIso",";E_{T} (GeV);N_{sel}/N_{tot}",lNBinsPt,lMinPt,lMaxPt); |
64 |
– |
peff_eEt[5] = aDir.make<TH1F>("peff_eEt_combIsoOverEt",";E_{T} (GeV);N_{sel}/N_{tot}",lNBinsPt,lMinPt,lMaxPt); |
65 |
– |
|
66 |
– |
|
67 |
– |
//efficiency curves vs eta muon |
68 |
– |
peff_eEta[0] = aDir.make<TH1F>("peff_eEta_trkIso",";#eta;N_{sel}/N_{tot}",42,-2.1,2.1); |
69 |
– |
const unsigned int lNBinsEta = peff_eEta[0]->GetNbinsX(); |
70 |
– |
const double lMinEta = peff_eEta[0]->GetXaxis()->GetXmin(); |
71 |
– |
const double lMaxEta = peff_eEta[0]->GetXaxis()->GetXmax(); |
72 |
– |
peff_eEta[1] = aDir.make<TH1F>("peff_eEta_trkIsoOverEt",";#eta;N_{sel}/N_{tot}",lNBinsEta,lMinEta,lMaxEta); |
73 |
– |
peff_eEta[2] = aDir.make<TH1F>("peff_eEta_ecalIso",";#eta;N_{sel}/N_{tot}",lNBinsEta,lMinEta,lMaxEta); |
74 |
– |
peff_eEta[3] = aDir.make<TH1F>("peff_eEta_ecalIsoOverEt",";#eta;N_{sel}/N_{tot}",lNBinsEta,lMinEta,lMaxEta); |
75 |
– |
peff_eEta[4] = aDir.make<TH1F>("peff_eEta_combIso",";#eta;N_{sel}/N_{tot}",lNBinsEta,lMinEta,lMaxEta); |
76 |
– |
peff_eEta[5] = aDir.make<TH1F>("peff_eEta_combIsoOverEt",";#eta;N_{sel}/N_{tot}",lNBinsEta,lMinEta,lMaxEta); |
77 |
– |
|
78 |
– |
//efficiency calculation tool |
79 |
– |
for (unsigned int i(0); i<6; i++){ |
80 |
– |
const unsigned int lNBins = peff_eIso[i]->GetNbinsX(); |
81 |
– |
const double lMin = peff_eIso[i]->GetXaxis()->GetXmin(); |
82 |
– |
const double lMax = peff_eIso[i]->GetXaxis()->GetXmax(); |
83 |
– |
isoEff_[i].initialise(lNBins,lMin,lMax); |
84 |
– |
isoEffEt_[i].initialise(lNBinsPt,lMinPt,lMaxPt); |
85 |
– |
isoEffEta_[i].initialise(lNBinsEta,lMinEta,lMaxEta); |
86 |
– |
} |
87 |
– |
|
88 |
– |
|
89 |
– |
} |
90 |
– |
|
8 |
|
void HistosElecs::FillEventHistograms(const edm::Handle<std::vector<pat::Electron> > & aCol){ |
9 |
|
|
10 |
|
if (doGenMatched_) { |
135 |
|
|
136 |
|
}//FillHistograms |
137 |
|
|
221 |
– |
|
222 |
– |
|
223 |
– |
void HistosElecs::FillEffHistograms(){//FillEffHistograms |
224 |
– |
|
225 |
– |
for (unsigned int i(0); i<6; i++){//loop on iso variables |
226 |
– |
|
227 |
– |
for (unsigned int lBin(0); lBin<isoEff_[i].numberOfBins(); lBin++){ |
228 |
– |
peff_eIso[i]->SetBinContent(lBin+1,isoEff_[i].getRatio(lBin)); |
229 |
– |
peff_eIso[i]->SetBinError(lBin+1,isoEff_[i].getRatioError(lBin)); |
230 |
– |
} |
231 |
– |
//eff vs pT |
232 |
– |
for (unsigned int lBin(0); lBin<isoEffEt_[i].numberOfBins(); lBin++){ |
233 |
– |
peff_eEt[i]->SetBinContent(lBin+1,isoEffEt_[i].getRatio(lBin)); |
234 |
– |
peff_eEt[i]->SetBinError(lBin+1,isoEffEt_[i].getRatioError(lBin)); |
235 |
– |
} |
236 |
– |
|
237 |
– |
//eff vs eta |
238 |
– |
for (unsigned int lBin(0); lBin<isoEffEta_[i].numberOfBins(); lBin++){ |
239 |
– |
peff_eEta[i]->SetBinContent(lBin+1,isoEffEta_[i].getRatio(lBin)); |
240 |
– |
peff_eEta[i]->SetBinError(lBin+1,isoEffEta_[i].getRatioError(lBin)); |
241 |
– |
} |
242 |
– |
|
243 |
– |
}//loop on iso variables |
244 |
– |
|
245 |
– |
}//FillEffHistograms |
246 |
– |
|
247 |
– |
|
138 |
|
bool HistosElecs::MatchesGenElectron(const pat::Electron& aPatElec) |
139 |
|
{ |
140 |
|
|