ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/HbbAnalysis/src/HistosElecs.cc
(Generate patch)

Comparing UserCode/HbbAnalysis/src/HistosElecs.cc (file contents):
Revision 1.3 by amagnan, Mon May 18 14:59:04 2009 UTC vs.
Revision 1.7 by amagnan, Fri Oct 2 11:05:53 2009 UTC

# Line 1 | Line 1
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  
8 <  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}",20,0,20);
16 <
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 <
37 <  void HistosElecs::FillEventHistograms(edm::Handle<std::vector<pat::Electron> > aCol){
8 >  void HistosElecs::FillEventHistograms(const edm::Handle<std::vector<pat::Electron> > & aCol){
9  
10      if (doGenMatched_) {
11        unsigned int nMatched = 0;
# Line 50 | Line 21 | namespace HbbAnalysis {//namespace
21  
22    }
23  
24 <  void HistosElecs::FillHistograms(const pat::Electron & aElec, edm::Handle<std::vector<reco::Vertex> > aRecoVertices, bool isLead){//FillHistograms
24 >  void HistosElecs::FillHistograms(const pat::Electron & aElec, const edm::Handle<std::vector<reco::Vertex> >& aRecoVertices, bool isLead){//FillHistograms
25  
26      bool lIsGenMatched = !doGenMatched_ || (doGenMatched_ && MatchesGenElectron(aElec));
27      if (lIsGenMatched) {//genMatched
28        if (isLead) {//isLead
29 <        FillBaseHistograms(aElec.pt(),aElec.eta(),aElec.phi());
29 >        FillBaseHistograms(aElec.pt(),aElec.eta(),aElec.phi(),aElec.charge());
30  
31          if ( aElec.gsfTrack().isAvailable() && !aElec.gsfTrack().isNull() ) {
32            p_gsfTrk_pT->Fill(aElec.gsfTrack()->pt());
# Line 70 | Line 41 | namespace HbbAnalysis {//namespace
41          if (lIds.size() > 5) std::cout << "--- WARNING: histo will be out-of-range, number of electron IDs = " << lIds.size() << std::endl;
42          for (unsigned int iId(0); iId<lIds.size(); iId++){
43            const std::string & lName =  lIds.at(iId).first;
44 +          //std::cout << "--- ElectronID : Bin " << iId << ", id name = " << lName << std::endl;
45            if (aElec.isElectronIDAvailable(lName)){
46              p_electronID->Fill(2*iId+aElec.electronID(lName));
47              assert (aElec.electronID(lName) ==  lIds.at(iId).second);
# Line 82 | Line 54 | namespace HbbAnalysis {//namespace
54          p_scE2x5Max->Fill(aElec.scE2x5Max());
55          p_scE5x5->Fill(aElec.scE5x5());
56  
57 <        p_trackIso->Fill(aElec.trackIso());
57 >        p_eSuperClusterOverP->Fill(aElec.eSuperClusterOverP());
58 >
59 >        p_HoverE->Fill(aElec.hadronicOverEm());
60 >        p_deltaPhiIn->Fill(aElec.deltaPhiSuperClusterTrackAtVtx());
61 >        p_deltaEtaIn->Fill(aElec.deltaEtaSuperClusterTrackAtVtx());
62 >
63 >        if (aElec.scE5x5() > 0) {
64 >          p_scE1x5OverscE5x5->Fill(aElec.scE1x5()/aElec.scE5x5());
65 >          p_scE2x5MaxOverscE5x5->Fill(aElec.scE2x5Max()/aElec.scE5x5());
66 >        }
67 >
68          p_caloIso->Fill(aElec.caloIso());
87        p_ecalIso->Fill(aElec.ecalIso());
69          p_hcalIso->Fill(aElec.hcalIso());
70  
71 +        double lIsoVar[6] = {
72 +          aElec.trackIso(),
73 +          aElec.trackIso()/aElec.et(),
74 +          aElec.ecalIso(),
75 +          aElec.ecalIso()/aElec.et(),
76 +          aElec.trackIso()+aElec.ecalIso()+aElec.hcalIso(),
77 +          (aElec.trackIso()+aElec.ecalIso()+aElec.hcalIso())/aElec.et()
78 +        };
79 +
80 +        p_trackIso->Fill(lIsoVar[0]);
81 +        p_trackIsoOverEt->Fill(lIsoVar[1]);
82 +        p_ecalIso->Fill(lIsoVar[2]);
83 +        p_ecalIsoOverEt->Fill(lIsoVar[3]);
84 +        p_combIso->Fill(lIsoVar[4]);
85 +        p_combIsoOverEt->Fill(lIsoVar[5]);
86 +
87 +        double lIsoCut[6] = {1.,0.1,4.,0.1,5.,0.2};
88 +
89 +        for (unsigned int i(0); i<6; i++){//loop on iso variables
90 +
91 +          for (unsigned int lBin(0); lBin<isoEff_[i].numberOfBins(); lBin++){
92 +            double lCut = isoEff_[i].xMin()+isoEff_[i].stepSize()*lBin;
93 +
94 +            isoEff_[i].incrementTotal(lBin);
95 +            if (lIsoVar[i] <= lCut){
96 +              isoEff_[i].incrementPass(lBin);
97 +            }
98 +          }
99 +  
100 +          //eff vs pT
101 +          for (unsigned int lBin(0); lBin<isoEffEt_[i].numberOfBins(); lBin++){
102 +            double lCutMin = isoEffEt_[i].xMin()+isoEffEt_[i].stepSize()*lBin;
103 +            double lCutMax = isoEffEt_[i].xMin()+isoEffEt_[i].stepSize()*(lBin+1);
104 +
105 +            if (aElec.et() >= lCutMin && aElec.et() < lCutMax){
106 +              isoEffEt_[i].incrementTotal(lBin);
107 +
108 +              if (lIsoVar[i] <= lIsoCut[i]){
109 +                isoEffEt_[i].incrementPass(lBin);
110 +              }
111 +            }
112 +          }
113 +
114 +          //eff vs eta
115 +          for (unsigned int lBin(0); lBin<isoEffEta_[i].numberOfBins(); lBin++){
116 +            double lCutMin = isoEffEta_[i].xMin()+isoEffEta_[i].stepSize()*lBin;
117 +            double lCutMax = isoEffEta_[i].xMin()+isoEffEta_[i].stepSize()*(lBin+1);
118 +
119 +            if (aElec.eta() >= lCutMin && aElec.eta() < lCutMax){
120 +              isoEffEta_[i].incrementTotal(lBin);
121 +
122 +              if (lIsoVar[i] <= lIsoCut[i]){
123 +                isoEffEta_[i].incrementPass(lBin);
124 +              }
125 +            }
126 +          }
127 +
128 +
129 +        }//loop on iso variables
130 +
131 +
132  
133        }//isLead
134      }//genMatched

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines