1 |
|
#include <iostream> |
2 |
|
#include <fstream> |
3 |
|
|
4 |
– |
//#include "DataFormats/EgammaReco/interface/Electron.h" |
5 |
– |
|
6 |
– |
|
4 |
|
#include "FWCore/MessageLogger/interface/MessageLogger.h" |
5 |
|
|
6 |
|
#include "UserCode/HbbAnalysis/interface/HistosElecs.hh" |
14 |
|
|
15 |
|
p_nElectrons = aDir.make<TH1F>("p_nElectrons",";N_{electrons};N_{entries}",20,0,20); |
16 |
|
|
17 |
< |
p_nChambers = aDir.make<TH1F>("p_nChambers",";n_{chambers};n_{entries}",20,0,20); |
17 |
> |
p_electronID = aDir.make<TH1F>("p_electronID",";electronID;N_{entries}",10,0,10); |
18 |
> |
|
19 |
> |
p_scSigmaEtaEta = aDir.make<TH1F>("p_scSigmaEtaEta",";;N_{entries}",100,0,0.1); |
20 |
> |
p_scSigmaIEtaIEta = aDir.make<TH1F>("p_scSigmaIEtaIEta",";;N_{entries}",100,0,0.1); |
21 |
> |
p_scE1x5 = aDir.make<TH1F>("p_scE1x5",";;N_{entries}",500,0,500); |
22 |
> |
p_scE2x5Max = aDir.make<TH1F>("p_scE2x5Max",";;N_{entries}",500,0,500); |
23 |
> |
p_scE5x5 = aDir.make<TH1F>("p_scE5x5",";;N_{entries}",500,0,500); |
24 |
> |
p_scE1x5OverscE5x5 = aDir.make<TH1F>("p_scE1x5OverscE5x5",";;N_{entries}",500,0,1); |
25 |
> |
p_scE2x5MaxOverscE5x5 = aDir.make<TH1F>("p_scE2x5MaxOverscE5x5",";;N_{entries}",500,0,1); |
26 |
> |
|
27 |
> |
p_trackIso = aDir.make<TH1F>("p_trackIso",";;N_{entries}",400,0,20); |
28 |
> |
p_caloIso = aDir.make<TH1F>("p_caloIso",";;N_{entries}",400,0,20); |
29 |
> |
p_ecalIso = aDir.make<TH1F>("p_ecalIso",";;N_{entries}",400,0,20); |
30 |
> |
p_hcalIso = aDir.make<TH1F>("p_hcalIso",";;N_{entries}",400,0,20); |
31 |
> |
|
32 |
> |
p_gsfTrk_pT = aDir.make<TH1F>("p_gsfTrk_pT",";;N_{entries}",200,0,200); |
33 |
> |
p_gsfTrk_IPxy = aDir.make<TH1F>("p_gsfTrk_IPxy",";;N_{entries}",100,-0.1,0.1); |
34 |
> |
p_gsfTrk_IPz = aDir.make<TH1F>("p_gsfTrk_IPz",";;N_{entries}",100,-1,1); |
35 |
> |
|
36 |
|
|
37 |
|
} |
38 |
|
|
52 |
|
|
53 |
|
} |
54 |
|
|
55 |
< |
void HistosElecs::FillHistograms(const pat::Electron & aElec, bool isLead){//FillHistograms |
55 |
> |
void HistosElecs::FillHistograms(const pat::Electron & aElec, edm::Handle<std::vector<reco::Vertex> > aRecoVertices, bool isLead){//FillHistograms |
56 |
|
|
57 |
|
bool lIsGenMatched = !doGenMatched_ || (doGenMatched_ && MatchesGenElectron(aElec)); |
58 |
|
if (lIsGenMatched) {//genMatched |
59 |
|
if (isLead) {//isLead |
60 |
|
FillBaseHistograms(aElec.pt(),aElec.eta(),aElec.phi()); |
61 |
|
|
62 |
+ |
if ( aElec.gsfTrack().isAvailable() && !aElec.gsfTrack().isNull() ) { |
63 |
+ |
p_gsfTrk_pT->Fill(aElec.gsfTrack()->pt()); |
64 |
+ |
if ( aRecoVertices->size() >= 1 ) { |
65 |
+ |
const reco::Vertex & thePrimaryEventVertex = (*aRecoVertices->begin()); |
66 |
+ |
p_gsfTrk_IPxy->Fill(aElec.gsfTrack()->dxy(thePrimaryEventVertex.position())); |
67 |
+ |
p_gsfTrk_IPz->Fill(aElec.gsfTrack()->dz(thePrimaryEventVertex.position())); |
68 |
+ |
} |
69 |
+ |
} |
70 |
+ |
|
71 |
+ |
std::vector<std::pair<std::string,float> > lIds = aElec.electronIDs(); |
72 |
+ |
if (lIds.size() > 5) std::cout << "--- WARNING: histo will be out-of-range, number of electron IDs = " << lIds.size() << std::endl; |
73 |
+ |
for (unsigned int iId(0); iId<lIds.size(); iId++){ |
74 |
+ |
const std::string & lName = lIds.at(iId).first; |
75 |
+ |
//std::cout << "--- ElectronID : Bin " << iId << ", id name = " << lName << std::endl; |
76 |
+ |
if (aElec.isElectronIDAvailable(lName)){ |
77 |
+ |
p_electronID->Fill(2*iId+aElec.electronID(lName)); |
78 |
+ |
assert (aElec.electronID(lName) == lIds.at(iId).second); |
79 |
+ |
} |
80 |
+ |
} |
81 |
+ |
|
82 |
+ |
p_scSigmaEtaEta->Fill(aElec.scSigmaEtaEta()); |
83 |
+ |
p_scSigmaIEtaIEta->Fill(aElec.scSigmaIEtaIEta()); |
84 |
+ |
p_scE1x5->Fill(aElec.scE1x5()); |
85 |
+ |
p_scE2x5Max->Fill(aElec.scE2x5Max()); |
86 |
+ |
p_scE5x5->Fill(aElec.scE5x5()); |
87 |
+ |
|
88 |
+ |
if (aElec.scE5x5() > 0) { |
89 |
+ |
p_scE1x5OverscE5x5->Fill(aElec.scE1x5()/aElec.scE5x5()); |
90 |
+ |
p_scE2x5MaxOverscE5x5->Fill(aElec.scE2x5Max()/aElec.scE5x5()); |
91 |
+ |
} |
92 |
+ |
|
93 |
+ |
p_trackIso->Fill(aElec.trackIso()); |
94 |
+ |
p_caloIso->Fill(aElec.caloIso()); |
95 |
+ |
p_ecalIso->Fill(aElec.ecalIso()); |
96 |
+ |
p_hcalIso->Fill(aElec.hcalIso()); |
97 |
+ |
|
98 |
+ |
|
99 |
|
}//isLead |
100 |
|
}//genMatched |
101 |
|
|