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}",200,0,200); |
22 |
> |
p_scE2x5Max = aDir.make<TH1F>("p_scE2x5Max",";;N_{entries}",200,0,200); |
23 |
> |
p_scE5x5 = aDir.make<TH1F>("p_scE5x5",";;N_{entries}",500,0,500); |
24 |
> |
|
25 |
> |
p_trackIso = aDir.make<TH1F>("p_trackIso",";;N_{entries}",400,0,20); |
26 |
> |
p_caloIso = aDir.make<TH1F>("p_caloIso",";;N_{entries}",400,0,20); |
27 |
> |
p_ecalIso = aDir.make<TH1F>("p_ecalIso",";;N_{entries}",400,0,20); |
28 |
> |
p_hcalIso = aDir.make<TH1F>("p_hcalIso",";;N_{entries}",400,0,20); |
29 |
> |
|
30 |
> |
p_gsfTrk_pT = aDir.make<TH1F>("p_gsfTrk_pT",";;N_{entries}",200,0,200); |
31 |
> |
p_gsfTrk_IPxy = aDir.make<TH1F>("p_gsfTrk_IPxy",";;N_{entries}",100,-0.1,0.1); |
32 |
> |
p_gsfTrk_IPz = aDir.make<TH1F>("p_gsfTrk_IPz",";;N_{entries}",100,-1,1); |
33 |
> |
|
34 |
|
|
35 |
|
} |
36 |
|
|
50 |
|
|
51 |
|
} |
52 |
|
|
53 |
< |
void HistosElecs::FillHistograms(const pat::Electron & aElec, bool isLead){//FillHistograms |
53 |
> |
void HistosElecs::FillHistograms(const pat::Electron & aElec, edm::Handle<std::vector<reco::Vertex> > aRecoVertices, bool isLead){//FillHistograms |
54 |
|
|
55 |
|
bool lIsGenMatched = !doGenMatched_ || (doGenMatched_ && MatchesGenElectron(aElec)); |
56 |
|
if (lIsGenMatched) {//genMatched |
57 |
|
if (isLead) {//isLead |
58 |
|
FillBaseHistograms(aElec.pt(),aElec.eta(),aElec.phi()); |
59 |
|
|
60 |
+ |
if ( aElec.gsfTrack().isAvailable() && !aElec.gsfTrack().isNull() ) { |
61 |
+ |
p_gsfTrk_pT->Fill(aElec.gsfTrack()->pt()); |
62 |
+ |
if ( aRecoVertices->size() >= 1 ) { |
63 |
+ |
const reco::Vertex & thePrimaryEventVertex = (*aRecoVertices->begin()); |
64 |
+ |
p_gsfTrk_IPxy->Fill(aElec.gsfTrack()->dxy(thePrimaryEventVertex.position())); |
65 |
+ |
p_gsfTrk_IPz->Fill(aElec.gsfTrack()->dz(thePrimaryEventVertex.position())); |
66 |
+ |
} |
67 |
+ |
} |
68 |
+ |
|
69 |
+ |
std::vector<std::pair<std::string,float> > lIds = aElec.electronIDs(); |
70 |
+ |
if (lIds.size() > 5) std::cout << "--- WARNING: histo will be out-of-range, number of electron IDs = " << lIds.size() << std::endl; |
71 |
+ |
for (unsigned int iId(0); iId<lIds.size(); iId++){ |
72 |
+ |
const std::string & lName = lIds.at(iId).first; |
73 |
+ |
if (aElec.isElectronIDAvailable(lName)){ |
74 |
+ |
p_electronID->Fill(2*iId+aElec.electronID(lName)); |
75 |
+ |
assert (aElec.electronID(lName) == lIds.at(iId).second); |
76 |
+ |
} |
77 |
+ |
} |
78 |
+ |
|
79 |
+ |
p_scSigmaEtaEta->Fill(aElec.scSigmaEtaEta()); |
80 |
+ |
p_scSigmaIEtaIEta->Fill(aElec.scSigmaIEtaIEta()); |
81 |
+ |
p_scE1x5->Fill(aElec.scE1x5()); |
82 |
+ |
p_scE2x5Max->Fill(aElec.scE2x5Max()); |
83 |
+ |
p_scE5x5->Fill(aElec.scE5x5()); |
84 |
+ |
|
85 |
+ |
p_trackIso->Fill(aElec.trackIso()); |
86 |
+ |
p_caloIso->Fill(aElec.caloIso()); |
87 |
+ |
p_ecalIso->Fill(aElec.ecalIso()); |
88 |
+ |
p_hcalIso->Fill(aElec.hcalIso()); |
89 |
+ |
|
90 |
+ |
|
91 |
|
}//isLead |
92 |
|
}//genMatched |
93 |
|
|