ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitHzz4l/LeptonSelection/interface/IsolationSelection.h
(Generate patch)

Comparing UserCode/MitHzz4l/LeptonSelection/interface/IsolationSelection.h (file contents):
Revision 1.4 by khahn, Thu Apr 26 06:56:18 2012 UTC vs.
Revision 1.15 by khahn, Sun Jun 3 15:51:56 2012 UTC

# Line 1 | Line 1
1 + #include "Array.h"
2   #include "Electron.h"
3   #include "Muon.h"
4   #include "Vertex.h"
# Line 5 | Line 6
6   #include "PFCandidateCol.h"
7   #include "PileupEnergyDensity.h"
8  
9 + #include "TLorentzVector.h"
10 +
11   #include "MuonTools.h"
12   #include "ElectronTools.h"
13  
# Line 12 | Line 15
15   #include "SelectionStatus.h"
16   #include "SimpleLepton.h"
17  
15
16
18   #define MUON_ISOMVA_CUT_BIN0  -0.615
19 < #define MUON_ISOMVA_CUT_BIN1   0.215
20 < #define MUON_ISOMVA_CUT_BIN2  -0.845
21 < #define MUON_ISOMVA_CUT_BIN3   0.075
22 < #define MUON_ISOMVA_CUT_BIN4  -0.999575
23 < #define MUON_ISOMVA_CUT_BIN5  -0.997775
24 <
25 < #define ELECTRON_ISOMVA_CUT_BIN0  0.385
26 < #define ELECTRON_ISOMVA_CUT_BIN1  -0.083
27 < #define ELECTRON_ISOMVA_CUT_BIN2  -0.573
28 < #define ELECTRON_ISOMVA_CUT_BIN3  0.413
29 < #define ELECTRON_ISOMVA_CUT_BIN4  0.271
30 < #define ELECTRON_ISOMVA_CUT_BIN5  0.135
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,
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,
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   );
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,
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::Muon*> muonsToVeto,
195 +                   vector<const mithep::Electron*> electronsToVeto);
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::Muon*> muonsToVeto,
213 +                                          vector<const mithep::Electron*> electronsToVeto);
214 + // hacked version
215 + SelectionStatus muonReferenceIsoSelection(ControlFlags &ctrl,
216 +                                          const mithep::Muon * mu,
217 +                                          const mithep::Vertex * vtx,
218 +                                          const mithep::Array<mithep::PFCandidate> * fPFCandidates,
219 +                                          float,
220 +                                          mithep::MuonTools::EMuonEffectiveAreaTarget EffectiveAreaVersion,
221 +                                          vector<const mithep::Muon*> muonsToVeto,
222 +                                          vector<const mithep::Electron*> electronsToVeto);
223  
224   void initElectronIsoMVA();
225   SelectionStatus electronIsoMVASelection(ControlFlags &ctrl,
226                                      const mithep::Electron * ele,
227 <                                    const mithep::Vertex & vtx,
227 >                                    const mithep::Vertex * vtx,
228                                      const mithep::Array<mithep::PFCandidate> * fPFCandidates,
229                                      const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity,
230                                      mithep::ElectronTools::EElectronEffectiveAreaTarget EffectiveAreaVersion,
231                                      vector<const mithep::Muon*> muonsToVeto,
232                                      vector<const mithep::Electron*> electronsToVeto);
233 <
233 > //hacked version
234 > SelectionStatus electronIsoMVASelection(ControlFlags &ctrl,
235 >                                    const mithep::Electron * ele,
236 >                                    const mithep::Vertex * vtx,
237 >                                    const mithep::Array<mithep::PFCandidate> * fPFCandidates,
238 >                                        float rho,
239 >                                    mithep::ElectronTools::EElectronEffectiveAreaTarget EffectiveAreaVersion,
240 >                                    vector<const mithep::Muon*> muonsToVeto,
241 >                                    vector<const mithep::Electron*> electronsToVeto);
242 > float electronPFIso04(ControlFlags &ctrl,
243 >                      const mithep::Electron * ele,
244 >                      const mithep::Vertex & vtx,
245 >                      const mithep::Array<mithep::PFCandidate> * fPFCandidates,
246 >                      const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity,
247 >                      mithep::ElectronTools::EElectronEffectiveAreaTarget EffectiveAreaVersion,
248 >                      vector<const mithep::Muon*> muonsToVeto,
249 >                      vector<const mithep::Electron*> electronsToVeto) ;
250 > // hacked version
251 > float electronPFIso04(ControlFlags &ctrl,
252 >                      const mithep::Electron * ele,
253 >                      const mithep::Vertex * vtx,
254 >                      const mithep::Array<mithep::PFCandidate> * fPFCandidates,
255 >                      float rho, // the hack
256 >                      mithep::ElectronTools::EElectronEffectiveAreaTarget EffectiveAreaVersion,
257 >                      vector<const mithep::Muon*> muonsToVeto,
258 >                      vector<const mithep::Electron*> electronsToVeto) ;
259 > //
260 > SelectionStatus electronReferenceIsoSelection(ControlFlags &ctrl,
261 >                                              const mithep::Electron * ele,
262 >                                              const mithep::Vertex * vtx,
263 >                                              const mithep::Array<mithep::PFCandidate> * fPFCandidates,
264 >                                              const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity,
265 >                                              mithep::ElectronTools::EElectronEffectiveAreaTarget EffectiveAreaVersion,
266 >                                              vector<const mithep::Muon*> muonsToVeto,
267 >                                              vector<const mithep::Electron*> electronsToVeto);
268 > // hacked version
269 > SelectionStatus electronReferenceIsoSelection(ControlFlags &ctrl,
270 >                                              const mithep::Electron * ele,
271 >                                              const mithep::Vertex * vtx,
272 >                                              const mithep::Array<mithep::PFCandidate> * fPFCandidates,
273 >                                              float,
274 >                                              mithep::ElectronTools::EElectronEffectiveAreaTarget EffectiveAreaVersion,
275 >                                              vector<const mithep::Muon*> muonsToVeto,
276 >                                              vector<const mithep::Electron*> electronsToVeto);
277 >
278 > double  dbetaCorrectedIsoDr03(ControlFlags & ctrl,
279 >                              const mithep::PFCandidate * photon,
280 >                              const mithep::Muon * mu, // need to veto          
281 >                              const mithep::Array<mithep::PFCandidate> * fPFCandidates);
282 >
283 > double  dbetaCorrectedIsoDr03(ControlFlags & ctrl,
284 >                              const mithep::PFCandidate * photon,
285 >                              const mithep::Electron * el, // need to veto              
286 >                              const mithep::Array<mithep::PFCandidate> * fPFCandidates);
287 >
288 > double  betaCorrectedIsoDr03(ControlFlags & ctrl,
289 >                             const mithep::PFCandidate * photon,
290 >                             const mithep::Muon * mu, // need to veto          
291 >                             const mithep::Array<mithep::PFCandidate> * fPFCandidates);
292 >
293 > double  betaCorrectedIsoDr03(ControlFlags & ctrl,
294 >                             const mithep::PFCandidate * photon,
295 >                             const mithep::Electron * el, // need to veto              
296 >                             const mithep::Array<mithep::PFCandidate> * fPFCandidates);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines