ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitHzz4l/LeptonSelection/interface/IsolationSelection.h
Revision: 1.17
Committed: Tue Oct 23 10:21:54 2012 UTC (12 years, 6 months ago) by dkralph
Content type: text/plain
Branch: MAIN
Changes since 1.16: +3 -39 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 khahn 1.15 #include "Array.h"
2 khahn 1.4 #include "Electron.h"
3     #include "Muon.h"
4     #include "Vertex.h"
5     #include "PFCandidate.h"
6     #include "PFCandidateCol.h"
7     #include "PileupEnergyDensity.h"
8    
9 khahn 1.15 #include "TLorentzVector.h"
10    
11 khahn 1.4 #include "MuonTools.h"
12     #include "ElectronTools.h"
13 khahn 1.1
14     #include "ParseArgs.h"
15     #include "SelectionStatus.h"
16 khahn 1.2 #include "SimpleLepton.h"
17 khahn 1.1
18 dkralph 1.17 using namespace std;
19     using namespace mithep;
20    
21 khahn 1.4 #define MUON_ISOMVA_CUT_BIN0 -0.615
22 khahn 1.5 #define MUON_ISOMVA_CUT_BIN1 0.235
23     #define MUON_ISOMVA_CUT_BIN2 -0.825
24     #define MUON_ISOMVA_CUT_BIN3 0.155
25     #define MUON_ISOMVA_CUT_BIN4 -0.965
26     #define MUON_ISOMVA_CUT_BIN5 -0.989
27 khahn 1.4
28 khahn 1.6 #define MUON_ISOMVA_FORPFID_CUT_BIN0 -0.5934
29     #define MUON_ISOMVA_FORPFID_CUT_BIN1 0.3374
30     #define MUON_ISOMVA_FORPFID_CUT_BIN2 -0.7666
31     #define MUON_ISOMVA_FORPFID_CUT_BIN3 0.4102
32     #define MUON_ISOMVA_FORPFID_CUT_BIN4 -0.989
33     #define MUON_ISOMVA_FORPFID_CUT_BIN5 -0.9946
34    
35 khahn 1.7 #define MUON_ISOMVA_LOOSE_FORPFID_CUT_BIN0 -0.5934
36     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_BIN1 0.3374
37     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_BIN2 -0.7666
38     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_BIN3 0.4102
39     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_BIN4 -0.989
40     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_BIN5 -0.9946
41    
42     #define MUON_ISOMVA_TIGHT_FORPFID_CUT_BIN0 -0.5934
43     #define MUON_ISOMVA_TIGHT_FORPFID_CUT_BIN1 0.3374
44     #define MUON_ISOMVA_TIGHT_FORPFID_CUT_BIN2 -0.7666
45     #define MUON_ISOMVA_TIGHT_FORPFID_CUT_BIN3 0.4102
46     #define MUON_ISOMVA_TIGHT_FORPFID_CUT_BIN4 -0.989
47     #define MUON_ISOMVA_TIGHT_FORPFID_CUT_BIN5 -0.9946
48    
49     #define ELECTRON_LOOSE_ISOMVA_CUT_BIN0 0.385
50     #define ELECTRON_LOOSE_ISOMVA_CUT_BIN1 -0.083
51     #define ELECTRON_LOOSE_ISOMVA_CUT_BIN2 -0.573
52     #define ELECTRON_LOOSE_ISOMVA_CUT_BIN3 0.413
53     #define ELECTRON_LOOSE_ISOMVA_CUT_BIN4 0.271
54     #define ELECTRON_LOOSE_ISOMVA_CUT_BIN5 0.135
55    
56     #define ELECTRON_TIGHT_ISOMVA_CUT_BIN0 0.533
57     #define ELECTRON_TIGHT_ISOMVA_CUT_BIN1 -0.237
58     #define ELECTRON_TIGHT_ISOMVA_CUT_BIN2 -0.573
59     #define ELECTRON_TIGHT_ISOMVA_CUT_BIN3 0.521
60     #define ELECTRON_TIGHT_ISOMVA_CUT_BIN4 0.531
61     #define ELECTRON_TIGHT_ISOMVA_CUT_BIN5 0.493
62    
63 khahn 1.11
64     //
65     // optimization test
66     //
67     #define ELECTRON_LOOSE_ISOMVA_CUT_OPT_BIN0 0.385
68     #define ELECTRON_LOOSE_ISOMVA_CUT_OPT_BIN1 -0.083
69     #define ELECTRON_LOOSE_ISOMVA_CUT_OPT_BIN2 -0.573
70     #define ELECTRON_LOOSE_ISOMVA_CUT_OPT_BIN3 0.413
71     #define ELECTRON_LOOSE_ISOMVA_CUT_OPT_BIN4 0.271
72     #define ELECTRON_LOOSE_ISOMVA_CUT_OPT_BIN5 0.135
73    
74     #ifdef MUONISO_WP0
75     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN0 0.03735
76     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN1 0.86195
77     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN2 -0.15025
78     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN3 0.87945
79     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN4 -0.88455
80     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN5 -0.90835
81     #elif MUONISO_WP1
82     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN0 -0.19505
83     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN1 0.77445
84     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN2 -0.46945
85     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN3 0.64635
86     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN4 -0.93635
87     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN5 -0.96505
88     #elif MUONISO_WP2
89     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN0 -0.33995
90     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN1 0.60785
91     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN2 -0.52125
92     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN3 0.54135
93     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN4 -0.97765
94     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN5 -0.97485
95     #elif MUONISO_WP3
96     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN0 -0.42045
97     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN1 0.37195
98     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN2 -0.59335
99     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN3 0.41045
100     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN4 -0.98465
101     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN5 -0.98185
102     #elif MUONISO_WP4
103     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN0 -0.48065
104     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN1 0.26765
105     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN2 -0.64095
106     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN3 0.14865
107     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN4 -0.98675
108     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN5 -0.98815
109     #elif MUONISO_WP5
110     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN0 -0.52195
111     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN1 0.12905
112     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN2 -0.68715
113     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN3 0.00305
114     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN4 -0.99165
115     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN5 -0.99235
116     #elif MUONISO_WP6
117     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN0 -0.60315
118     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN1 -0.13415
119     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN2 -0.75855
120     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN3 -0.18805
121     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN4 -0.99235
122     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN5 -0.99445
123     #elif MUONISO_WP7
124     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN0 -0.65565
125     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN1 -0.34345
126     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN2 -0.79985
127     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN3 -0.31475
128     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN4 -0.99445
129     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN5 -0.99655
130     #elif MUONISO_WP8
131     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN0 -0.70535
132     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN1 -0.39945
133     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN2 -0.82645
134     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN3 -0.64865
135     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN4 -0.99515
136     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN5 -0.99795
137     #elif MUONISO_WP9
138     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN0 -0.79145
139     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN1 -0.74245
140     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN2 -0.89085
141     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN3 -0.78585
142     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN4 -0.99725
143     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN5 -0.99865
144 khahn 1.12 #else
145     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN0 -0.5934
146     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN1 0.3374
147     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN2 -0.7666
148     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN3 0.4102
149     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN4 -0.989
150     #define MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN5 -0.9946
151 khahn 1.11 #endif
152    
153 anlevin 1.14 /* #define ELECTRON_REFERENCE_PFISO_CUT 0.25 */
154     /* #define MUON_REFERENCE_PFISO_CUT 0.25 */
155     #define ELECTRON_REFERENCE_PFISO_CUT 0.4
156     #define MUON_REFERENCE_PFISO_CUT 0.4
157 khahn 1.4
158     Float_t computePFMuonIso(const mithep::Muon *muon,
159 anlevin 1.14 const mithep::Vertex * vtx,
160 khahn 1.4 const mithep::Array<mithep::PFCandidate> * fPFCandidates,
161     const Double_t dRMax);
162    
163     Float_t computePFEleIso(const mithep::Electron *electron,
164 anlevin 1.14 const mithep::Vertex * fVertex,
165 khahn 1.4 const mithep::Array<mithep::PFCandidate> * fPFCandidates,
166     const Double_t dRMax);
167    
168     SelectionStatus electronIsoSelection(ControlFlags &, const mithep::Electron *, const mithep::Vertex &, const mithep::Array<mithep::PFCandidate> * fPFCandidateCol );
169 anlevin 1.14 SelectionStatus muonIsoSelection(ControlFlags &, const mithep::Muon *, const mithep::Vertex *, const mithep::Array<mithep::PFCandidate> * fPFCandidateCol );
170 anlevin 1.3 bool noIso(ControlFlags &, vector<SimpleLepton> &, float rho);
171 khahn 1.4
172     void initMuonIsoMVA();
173     SelectionStatus muonIsoMVASelection(ControlFlags &ctrl,
174     const mithep::Muon * mu,
175 anlevin 1.14 const mithep::Vertex * vtx,
176 khahn 1.4 const mithep::Array<mithep::PFCandidate> * fPFCandidates,
177     const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity,
178     mithep::MuonTools::EMuonEffectiveAreaTarget EffectiveAreaVersion,
179     vector<const mithep::Muon*> muonsToVeto,
180     vector<const mithep::Electron*> electronsToVeto);
181 khahn 1.10 //hacked version
182     SelectionStatus muonIsoMVASelection(ControlFlags &ctrl,
183     const mithep::Muon * mu,
184 anlevin 1.14 const mithep::Vertex * vtx,
185 khahn 1.10 const mithep::Array<mithep::PFCandidate> * fPFCandidates,
186     float rho,
187     mithep::MuonTools::EMuonEffectiveAreaTarget EffectiveAreaVersion,
188     vector<const mithep::Muon*> muonsToVeto,
189     vector<const mithep::Electron*> electronsToVeto);
190 khahn 1.7 double muonPFIso04(ControlFlags &ctrl,
191     const mithep::Muon * mu,
192 anlevin 1.14 const mithep::Vertex * vtx,
193 khahn 1.7 const mithep::Array<mithep::PFCandidate> * fPFCandidates,
194     const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity,
195     mithep::MuonTools::EMuonEffectiveAreaTarget EffectiveAreaVersion,
196 khahn 1.16 vector<const mithep::PFCandidate*> photonsToVeto);
197    
198 khahn 1.8 SelectionStatus muonReferenceIsoSelection(ControlFlags &ctrl,
199 khahn 1.7 const mithep::Muon * mu,
200 anlevin 1.14 const mithep::Vertex * vtx,
201 khahn 1.7 const mithep::Array<mithep::PFCandidate> * fPFCandidates,
202     const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity,
203     mithep::MuonTools::EMuonEffectiveAreaTarget EffectiveAreaVersion,
204 khahn 1.16 vector<const mithep::PFCandidate*> photonsToVeto);
205 khahn 1.4
206     void initElectronIsoMVA();
207     SelectionStatus electronIsoMVASelection(ControlFlags &ctrl,
208     const mithep::Electron * ele,
209 anlevin 1.14 const mithep::Vertex * vtx,
210 khahn 1.4 const mithep::Array<mithep::PFCandidate> * fPFCandidates,
211     const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity,
212     mithep::ElectronTools::EElectronEffectiveAreaTarget EffectiveAreaVersion,
213     vector<const mithep::Muon*> muonsToVeto,
214     vector<const mithep::Electron*> electronsToVeto);
215 khahn 1.10 //hacked version
216     SelectionStatus electronIsoMVASelection(ControlFlags &ctrl,
217     const mithep::Electron * ele,
218 anlevin 1.14 const mithep::Vertex * vtx,
219 khahn 1.10 const mithep::Array<mithep::PFCandidate> * fPFCandidates,
220     float rho,
221     mithep::ElectronTools::EElectronEffectiveAreaTarget EffectiveAreaVersion,
222     vector<const mithep::Muon*> muonsToVeto,
223     vector<const mithep::Electron*> electronsToVeto);
224 khahn 1.7 float electronPFIso04(ControlFlags &ctrl,
225     const mithep::Electron * ele,
226     const mithep::Vertex & vtx,
227     const mithep::Array<mithep::PFCandidate> * fPFCandidates,
228     const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity,
229     mithep::ElectronTools::EElectronEffectiveAreaTarget EffectiveAreaVersion,
230 khahn 1.16 vector<const mithep::PFCandidate*> photonsToVeto);
231    
232 khahn 1.8 SelectionStatus electronReferenceIsoSelection(ControlFlags &ctrl,
233 khahn 1.7 const mithep::Electron * ele,
234 anlevin 1.14 const mithep::Vertex * vtx,
235 khahn 1.7 const mithep::Array<mithep::PFCandidate> * fPFCandidates,
236     const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity,
237     mithep::ElectronTools::EElectronEffectiveAreaTarget EffectiveAreaVersion,
238 khahn 1.16 vector<const mithep::PFCandidate*> photonsToVeto);
239 khahn 1.15
240     double dbetaCorrectedIsoDr03(ControlFlags & ctrl,
241     const mithep::PFCandidate * photon,
242     const mithep::Muon * mu, // need to veto
243     const mithep::Array<mithep::PFCandidate> * fPFCandidates);
244    
245     double dbetaCorrectedIsoDr03(ControlFlags & ctrl,
246     const mithep::PFCandidate * photon,
247     const mithep::Electron * el, // need to veto
248     const mithep::Array<mithep::PFCandidate> * fPFCandidates);
249    
250 khahn 1.16 double nonCorrectedIsoDr03(ControlFlags & ctrl,
251     const mithep::PFCandidate * photon,
252     const mithep::Muon * mu, // need to veto
253     const mithep::Array<mithep::PFCandidate> * fPFCandidates);
254    
255     double nonCorrectedIsoDr03(ControlFlags & ctrl,
256     const mithep::PFCandidate * photon,
257     const mithep::Electron * el, // need to veto
258     const mithep::Array<mithep::PFCandidate> * fPFCandidates);
259