ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitHzz4l/LeptonSelection/interface/IsolationSelection.h
Revision: 1.16
Committed: Tue Jun 5 19:35:47 2012 UTC (12 years, 11 months ago) by khahn
Content type: text/plain
Branch: MAIN
CVS Tags: synced_FSR_2, synced_FSR
Changes since 1.15: +16 -17 lines
Log Message:
final sync for FSR

File Contents

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