ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/Rebeca/TopTreesCode/Selection.h
Revision: 1.1
Committed: Thu Apr 28 18:55:26 2011 UTC (14 years ago) by rebeca
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Log Message:
TopTrees code working in CMSSW 4X

File Contents

# Content
1 /*
2
3 An example of how to use this class for e+jets and mu+jets selection (SelV4)
4
5 http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/UserCode/NewPhysicsBrussels/TopTreeAnalysis/macros/SyncRefSel.cc?view=log&pathrev=CMSSW_38X#rev1.1.2.1
6
7 */
8
9 #ifndef Selection_h
10 #define Selection_h
11
12 #include "../../../TopBrussels/TopTreeProducer/interface/TRootVertex.h"
13 #include "../../../TopBrussels/TopTreeProducer/interface/TRootMuon.h"
14 #include "../../../TopBrussels/TopTreeProducer/interface/TRootJet.h"
15 #include "../../../TopBrussels/TopTreeProducer/interface/TRootCaloJet.h"
16 #include "../../../TopBrussels/TopTreeProducer/interface/TRootPFJet.h"
17 #include "../../../TopBrussels/TopTreeProducer/interface/TRootJPTJet.h"
18 #include "../../../TopBrussels/TopTreeProducer/interface/TRootElectron.h"
19 #include "../../../TopBrussels/TopTreeProducer/interface/TRootMET.h"
20 #include "../../../TopBrussels/TopTreeProducer/interface/TRootMCParticle.h"
21
22
23 // system include files
24 #include <memory>
25 #include <vector>
26
27 // PAT object definition
28
29 //#include "../../../TopBrussels/TopTreeProducer/interface/
30 //#include "AnalysisDataFormats/TopObjects/interface/TtGenEvent.h"
31
32 //#include "TopQuarkAnalysis/TopTools/interface/JetPartonMatching.h"
33 #include "../../Reconstruction/interface/Combination.h"
34 #include "../../Content/interface/AnalysisEnvironment.h"
35
36 using namespace std;
37 using namespace TopTree;
38
39
40 struct HighestPt{
41 bool operator()( TRootJet* j1, TRootJet* j2 ) const{
42 return j1->Pt() > j2->Pt() ;
43 }
44 bool operator()( TRootMuon* j1, TRootMuon* j2 ) const{
45 return j1->Pt() > j2->Pt() ;
46 }
47 bool operator()( TRootElectron* j1, TRootElectron* j2 ) const{
48 return j1->Pt() > j2->Pt() ;
49 }
50 bool operator()( TRootMCParticle* j1, TRootMCParticle* j2 ) const{
51 return j1->Pt() > j2->Pt() ;
52 }
53 bool operator()( TLorentzVector* j1, TLorentzVector* j2 ) const{
54 return j1->Pt() > j2->Pt() ;
55 }
56 };
57 struct HighestBtag{
58 bool operator()( TRootJet j1, TRootJet j2 ) const{
59 return j1.btag_trackCountingHighEffBJetTags() > j2.btag_trackCountingHighEffBJetTags();
60 }
61 };
62
63
64 class Selection{
65
66 public:
67 Selection();
68 Selection(const std::vector<TRootJet*>&, const std::vector<TRootMuon*>&, const std::vector<TRootMET*>&);
69 Selection(const std::vector<TRootJet*>&, const std::vector<TRootMuon*>&, const std::vector<TRootElectron*>&,const std::vector<TRootMET*>&);
70 Selection(const Selection &);
71 ~Selection();
72
73 void SetConfiguration(float PtThrJets, float EtaThrJets, float EMFThrJets, float PtThrMuons, float EtaThrMuons, float MuonRelIso, float MuonVetoEM, float MuonVetoHad);
74
75 bool isPVSelected(const std::vector<TRootVertex*>& vertex, int NdofCut, float Zcut, float RhoCut);
76
77 //bool passVBTFID(TRootElectron* electron, std::map<std::string,float> cuts);
78
79 // CUTVALUES INITIALISATION
80
81 void setJetCuts();
82 void setJetCuts(float Pt, float Eta, float EMF, float n90Hits, float fHPD, float dRJetElectron, float dRJetMuon);
83 void setElectronCuts();
84 void setElectronCuts(float Et, float Eta, float RelIso, float d0, float DistVzPVz);
85 void setLooseElectronCuts();
86 void setLooseElectronCuts(float Et, float Eta, float RelIso);
87 void setPlainElectronCuts();
88 void setPlainElectronCuts(float Et, float Eta);
89 void setMuonCuts();
90 void setMuonCuts(float Pt, float Eta, float RelIso, int NValidHits, float d0, float DRJets, int NMatches, float DistVzPVz, int NPixelLayersWithMeas);
91 void setDiMuonCuts();
92 void setDiMuonCuts(float Pt, float Eta, float RelIso, int NValidHits, float d0, float DRJets);
93 void setLooseMuonCuts();
94 void setLooseMuonCuts(float Pt, float Eta, float RelIso);
95
96 // JET GETTERS
97 std::vector<TRootJet*> GetSelectedJets(bool applyJetID = false) const;
98 std::vector<TRootJet*> GetSelectedJets(vector<TRootMuon*> muons, bool applyJetID = false) const;
99 std::vector<TRootJet*> GetSelectedJets(vector<TRootElectron*> electrons, bool applyJetID = false) const;
100 std::vector<TRootJet*> GetSelectedJets(float PtThr, float EtaThr, bool applyJetID = false) const;
101 std::vector<TRootJet*> GetSelectedJets(float PtThr, float EtaThr, vector<TLorentzVector*> lepton, float dRLeptonJet, bool applyJetID = false) const;
102 std::vector<TRootJet*> GetSelectedJets(float PtThr, float EtaThr, vector<TRootMuon*> muons, float dRLeptonJet, bool applyJetID = false) const;
103 std::vector<TRootJet*> GetSelectedJets(float PtThr, float EtaThr, vector<TRootElectron*> electrons, float dRLeptonJet, bool applyJetID = false) const;
104 std::vector<TRootJet*> GetSelectedBJets(const std::vector<TRootJet*>& seljets, Int_t& btagAlgo, Float_t& btagCut) const;
105
106 // ELECTRON GETTERS
107 std::vector<TRootElectron*> GetSelectedElectrons() const;
108 std::vector<TRootElectron*> GetSelectedElectrons(TRootVertex* vertex) const;
109 std::vector<TRootElectron*> GetSelectedElectrons(float EtThr, float EtaThr, float ElectronRelIso) const;
110 std::vector<TRootElectron*> GetSelectedElectrons(float EtThr, float EtaThr, float ElectronRelIso, TRootVertex* vertex) const;
111
112 std::vector<TRootElectron*> GetSelectedLooseElectrons(bool vbtfid = false) const;
113 std::vector<TRootElectron*> GetSelectedLooseElectrons(float EtThr, float EtaThr, float ElectronRelIso, bool vbtfid = false) const;
114 std::vector<TRootElectron*> GetSelectedPlainElectrons(float EtThr, float EtaThr) const;
115
116 // MUON GETTERS
117 std::vector<TRootMuon*> GetSelectedMuons() const;
118 std::vector<TRootMuon*> GetSelectedMuons(TRootVertex* vertex) const;
119 std::vector<TRootMuon*> GetSelectedMuons(TRootVertex* vertex, vector<TRootJet*> selJets) const;
120 std::vector<TRootMuon*> GetSelectedMuons(float PtThr, float EtaThr, float MuonRelIso) const;
121 std::vector<TRootMuon*> GetSelectedMuons(float PtThr, float EtaThr, float MuonRelIso, vector<TRootJet*> selJets) const;
122 std::vector<TRootMuon*> GetSelectedMuons(float PtThr, float EtaThr, float MuonRelIso, TRootVertex* vertex, vector<TRootJet*> selJets) const;
123 std::vector<TRootMuon*> GetSelectedDiMuons() const;
124 std::vector<TRootMuon*> GetSelectedDiMuons(float PtThr, float EtaThr, float MuonRelIso) const;
125 std::vector<TRootMuon*> GetSelectedDiMuons(float PtThr, float EtaThr, float MuonRelIso, vector<TRootJet*> selJets) const;
126 std::vector<TRootMuon*> GetSelectedLooseMuons() const;
127 std::vector<TRootMuon*> GetSelectedLooseMuons(float PtThr, float EtaThr, float MuonRelIso) const;
128
129 std::vector<TRootMuon*> GetSelectedMuonsNonIso() const;
130 std::vector<TRootMuon*> GetSelectedMuonsNonIso(float PtThr, float EtaThr, vector<TRootJet*> selJets) const;
131 std::vector<TRootMuon*> GetSelectedMuonsNoID(float PtThr, float EtaThr,float MuonRelIso) const;
132 std::vector<TRootMuon*> GetSelectedMuonsInvIso(float PtThr, float EtaThr, float MuonRelIso) const;
133 std::vector<TRootMuon*> GetSelectedMuonsInvIso(float PtThr, float EtaThr, float MuonRelIso, vector<TRootJet*> selJets ) const;
134 std::vector<TRootMuon*> GetSelectedMuonsIsoRange(float PtThr, float EtaThr, float MuonRelIsoMin, float MuonRelIsoMax, vector<TRootJet*> selJets) const;
135
136
137 // SELECTION BOOLEANS
138 bool isThere1Muon() const { if( GetSelectedMuons().size()>0) return true; return false; };
139 bool isThere1MuonIso() const { if( GetSelectedMuonsNonIso().size()>0) return true; return false; };
140 bool isThere4Jets() const { if( GetSelectedJets().size()>3) return true; return false; };
141 bool isSelected(unsigned int Njets = 4, bool Veto2ndLepton = false) const;
142 bool isSelected(float JetPtThr, unsigned int Njets = 4, bool Veto2ndLepton = false) const;
143 //bool isSelected (float PtThrJets, float EtaThrJets, float PtThrMuons, float EtaThrMuons, float MuonRelIso, float MuonVetoEM, float MuonVetoHad) const;
144 bool isSelected (float PtThrJets, float EtaThrJets, float PtThrMuons, float EtaThrMuons, float MuonRelIso,float PtThrElectrons, float EtaThrElectrons, float ElectronRelIso, unsigned int Njets = 4, bool Veto2ndLepton = false) const;
145
146 private:
147 //int JetType;
148 std::vector<TRootJet*> jets;
149 std::vector<TRootElectron*> electrons;
150 std::vector<TRootMuon*> muons;
151 std::vector<TRootMET*> mets;
152
153 //jets
154 int Njets_;
155 float JetPtThreshold_;
156 float JetEtaThreshold_;
157 float JetEMFThreshold_;
158 float n90HitsThreshold_;
159 float fHPDThreshold_;
160 float DRJetElectron_;
161
162 //muon
163 float MuonPtThreshold_;
164 float MuonEtaThreshold_;
165 float MuonRelIso_;
166 float MuonLoosePtThreshold_;
167 float MuonLooseEtaThreshold_;
168 float MuonLooseRelIso_;
169 float MuonNofValidHits_;
170 float Muond0Cut_;
171 float MuonDRJetsCut_;
172 float MuonNormChi2_;
173 float MuonNMatches_;
174 float MuonDistVzPVz_;
175 float MuonNPixelLayersWithMeasurement_;
176
177 float DRJetMuon_; // for pflow mu-jet cleaning
178
179 //electron
180 float ElectronEtThreshold_;
181 float ElectronEtaThreshold_;
182 float ElectronRelIso_;
183 float ElectronLooseEtThreshold_;
184 float ElectronLooseEtaThreshold_;
185 float ElectronLooseRelIso_;
186 float Electrond0Cut_;
187 float ElectronDistVzPVz_;
188
189 std::map<std::string,float> cutsVBTFWP70;
190 std::map<std::string,float> cutsVBTFWP95;
191
192 //met
193 float METThreshold_;
194 };
195
196 #endif