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