1 |
#include "TFile.h"
|
2 |
|
3 |
#include "ElectronSelection.h"
|
4 |
#include "ParseArgs.h"
|
5 |
#include "SelectionStatus.h"
|
6 |
|
7 |
#include "ElectronIDMVA.h" // for V2 MVA
|
8 |
#include "EGammaMvaEleEstimator.h" // for V1 MVA
|
9 |
|
10 |
#include "PileupEnergyDensity.h"
|
11 |
|
12 |
#include <string>
|
13 |
|
14 |
using namespace std;
|
15 |
|
16 |
EGammaMvaEleEstimator * eleIDMVA_V1;
|
17 |
|
18 |
extern vector<bool> PFnoPUflag;
|
19 |
|
20 |
//from the egamma pog https://twiki.cern.ch/twiki/bin/viewauth/CMS/EgammaCutBasedIdentification
|
21 |
//note: this includes an isolation cut
|
22 |
bool electronPOG2012CutBasedIDMedium(const mithep::Electron *ele, const mithep::Vertex * vtx, const mithep::Array<mithep::PFCandidate> * fPFCandidates, const mithep::DecayParticleCol *conversions, const mithep::Array<mithep::PileupEnergyDensity> * puEnergyDensity)
|
23 |
{
|
24 |
|
25 |
mithep::ElectronTools eleT;
|
26 |
|
27 |
|
28 |
Float_t charged_iso = 0;
|
29 |
Float_t neutral_iso = 0;
|
30 |
Float_t gamma_iso = 0;
|
31 |
|
32 |
for(int k=0; k<fPFCandidates->GetEntries(); ++k) {
|
33 |
|
34 |
if( !(PFnoPUflag[k]) ) continue;
|
35 |
const mithep::PFCandidate *pf = (mithep::PFCandidate*)((*fPFCandidates)[k]);
|
36 |
|
37 |
Double_t dr = mithep::MathUtils::DeltaR(ele->Phi(),ele->Eta(), pf->Phi(), pf->Eta());
|
38 |
if (dr > 0.3) continue;
|
39 |
|
40 |
if (pf->Charge() != 0 && (pf->HasTrackerTrk()||pf->HasGsfTrk()) ) {
|
41 |
|
42 |
if (abs(pf->PFType()) == mithep::PFCandidate::eElectron || abs(pf->PFType()) == mithep::PFCandidate::eMuon) continue;
|
43 |
|
44 |
if (fabs(ele->SCluster()->Eta()) > 1.479 && dr < 0.015) continue;
|
45 |
|
46 |
charged_iso += pf->Pt();
|
47 |
}
|
48 |
|
49 |
else if (abs(pf->PFType()) == mithep::PFCandidate::eGamma) {
|
50 |
|
51 |
if (fabs(ele->SCluster()->Eta()) > 1.479 && mithep::MathUtils::DeltaR(ele->Phi(),ele->Eta(), pf->Phi(), pf->Eta()) < 0.08) continue;
|
52 |
|
53 |
gamma_iso += pf->Pt();
|
54 |
}
|
55 |
|
56 |
else {
|
57 |
neutral_iso += pf->Pt();
|
58 |
}
|
59 |
}
|
60 |
|
61 |
//there are no 2012 effective areas for kEleGammaAndNeutralHadronIso03
|
62 |
mithep::ElectronTools::EElectronEffectiveAreaTarget EffectiveAreaVersion = mithep::ElectronTools::kEleEAData2011;
|
63 |
float rho = puEnergyDensity->At(0)->RhoKt6PFJetsCentralNeutral();
|
64 |
|
65 |
double iso_sum = charged_iso + fmax(0.0,(gamma_iso + neutral_iso
|
66 |
-rho*eleT.ElectronEffectiveArea(eleT.kEleGammaAndNeutralHadronIso03,
|
67 |
ele->Eta(),EffectiveAreaVersion)));
|
68 |
|
69 |
Bool_t pass = kTRUE;
|
70 |
//barrel
|
71 |
if(fabs(ele->Eta()) < 1.5 ) {
|
72 |
if(fabs(ele->DeltaEtaSuperClusterTrackAtVtx()) > 0.004) pass = kFALSE;
|
73 |
if(fabs(ele->DeltaPhiSuperClusterTrackAtVtx()) > 0.06) pass = kFALSE;
|
74 |
if(ele->CoviEtaiEta() > 0.01) pass = kFALSE;
|
75 |
if(ele->HadronicOverEm() > 0.12) pass = kFALSE;
|
76 |
if(fabs(ele->BestTrk()->D0Corrected(*vtx)) > 0.02) pass = kFALSE;
|
77 |
if(fabs(ele->BestTrk()->DzCorrected(*vtx)) > 0.1) pass = kFALSE;
|
78 |
if(fabs(1 - ele->ESuperClusterOverP())/(ele->SCluster()->Et()*TMath::CosH(ele->SCluster()->Eta())) > 0.05 ) pass = kFALSE;
|
79 |
if(iso_sum/ele->Pt() > 0.15) pass = kFALSE;
|
80 |
if(!mithep::ElectronTools::PassConversionFilter(ele, conversions, vtx, 0, 1e-6, 2.0, kTRUE, kFALSE)) pass = kFALSE;
|
81 |
if(ele->CorrectedNExpectedHitsInner() > 1) pass = kFALSE;
|
82 |
}
|
83 |
else if(fabs(ele->Eta()) < 2.5){
|
84 |
|
85 |
//endcap
|
86 |
if(fabs(ele->DeltaEtaSuperClusterTrackAtVtx()) >0.007) pass = kFALSE;
|
87 |
if(fabs(ele->DeltaPhiSuperClusterTrackAtVtx()) > 0.03) pass = kFALSE;
|
88 |
if(ele->CoviEtaiEta() > 0.03) pass = kFALSE;
|
89 |
if(ele->HadronicOverEm() > 0.10) pass = kFALSE;
|
90 |
if(fabs(ele->BestTrk()->D0Corrected(*vtx)) > 0.02) pass = kFALSE;
|
91 |
if(fabs(ele->BestTrk()->DzCorrected(*vtx)) > 0.1) pass = kFALSE;
|
92 |
if(fabs(1 - ele->ESuperClusterOverP())/(ele->SCluster()->Et()*TMath::CosH(ele->SCluster()->Eta())) > 0.05) pass = kFALSE;
|
93 |
if(ele->Pt() > 20 && iso_sum/ele->Pt() > 0.15) pass = kFALSE;
|
94 |
if(ele->Pt() < 20 && iso_sum/ele->Pt() > 0.10) pass = kFALSE;
|
95 |
if(!mithep::ElectronTools::PassConversionFilter(ele, conversions, vtx, 0, 1e-6, 2.0, kTRUE, kFALSE)) pass = kFALSE;
|
96 |
if(ele->CorrectedNExpectedHitsInner() > 1) pass = kFALSE;
|
97 |
}
|
98 |
else
|
99 |
pass = kFALSE;
|
100 |
|
101 |
return pass;
|
102 |
}
|
103 |
//----------------------------------------------------------------------------------------
|
104 |
bool electron2012CutBasedIDMediumVersionThatWorksOn2011(ControlFlags &ctrl, const mithep::Electron *ele, const mithep::Vertex * vtx, const mithep::Array<mithep::PFCandidate> * fPFCandidates,
|
105 |
const mithep::DecayParticleCol *conversions, const mithep::Array<mithep::PileupEnergyDensity> * puEnergyDensity,
|
106 |
mithep::ElectronTools::EElectronEffectiveAreaTarget EffectiveAreaVersion
|
107 |
)
|
108 |
{
|
109 |
|
110 |
mithep::ElectronTools eleT;
|
111 |
|
112 |
|
113 |
Float_t charged_iso = 0;
|
114 |
Float_t neutral_iso = 0;
|
115 |
Float_t gamma_iso = 0;
|
116 |
|
117 |
for(int k=0; k<fPFCandidates->GetEntries(); ++k) {
|
118 |
|
119 |
if( !(PFnoPUflag[k]) ) continue;
|
120 |
const mithep::PFCandidate *pf = (mithep::PFCandidate*)((*fPFCandidates)[k]);
|
121 |
|
122 |
Double_t dr = mithep::MathUtils::DeltaR(ele->Phi(),ele->Eta(), pf->Phi(), pf->Eta());
|
123 |
if (dr > 0.3) continue;
|
124 |
|
125 |
if (pf->Charge() != 0 && (pf->HasTrackerTrk()||pf->HasGsfTrk()) ) {
|
126 |
|
127 |
if (abs(pf->PFType()) == mithep::PFCandidate::eElectron || abs(pf->PFType()) == mithep::PFCandidate::eMuon) continue;
|
128 |
|
129 |
if (fabs(ele->SCluster()->Eta()) > 1.479 && dr < 0.015) continue;
|
130 |
|
131 |
charged_iso += pf->Pt();
|
132 |
}
|
133 |
|
134 |
else if (abs(pf->PFType()) == mithep::PFCandidate::eGamma) {
|
135 |
|
136 |
if (fabs(ele->SCluster()->Eta()) > 1.479 && mithep::MathUtils::DeltaR(ele->Phi(),ele->Eta(), pf->Phi(), pf->Eta()) < 0.08) continue;
|
137 |
|
138 |
gamma_iso += pf->Pt();
|
139 |
}
|
140 |
|
141 |
else {
|
142 |
neutral_iso += pf->Pt();
|
143 |
}
|
144 |
}
|
145 |
|
146 |
double iso_sum=999;
|
147 |
double rho;
|
148 |
if(ctrl.era == 2012) {
|
149 |
//there are no 2012 effective areas for kEleGammaAndNeutralHadronIso03
|
150 |
EffectiveAreaVersion = mithep::ElectronTools::kEleEAData2011;
|
151 |
rho = puEnergyDensity->At(0)->RhoKt6PFJetsCentralNeutral();
|
152 |
|
153 |
iso_sum = charged_iso + fmax(0.0,(gamma_iso + neutral_iso
|
154 |
-rho*eleT.ElectronEffectiveArea(eleT.kEleGammaAndNeutralHadronIso03,
|
155 |
ele->Eta(),EffectiveAreaVersion)));
|
156 |
} else if(ctrl.era == 2011) {
|
157 |
setElectronRhoAndEaVersion(rho,EffectiveAreaVersion,puEnergyDensity);
|
158 |
iso_sum = charged_iso + fmax(0.0,(gamma_iso + neutral_iso
|
159 |
-rho*eleT.ElectronEffectiveArea(eleT.kEleGammaAndNeutralHadronIso03,
|
160 |
ele->Eta(),EffectiveAreaVersion)));
|
161 |
} else assert(0);
|
162 |
|
163 |
Bool_t pass = kTRUE;
|
164 |
//barrel
|
165 |
if(fabs(ele->Eta()) < 1.5 ) {
|
166 |
if(fabs(ele->DeltaEtaSuperClusterTrackAtVtx()) > 0.004) pass = kFALSE;
|
167 |
if(fabs(ele->DeltaPhiSuperClusterTrackAtVtx()) > 0.06) pass = kFALSE;
|
168 |
if(ele->CoviEtaiEta() > 0.01) pass = kFALSE;
|
169 |
if(ele->HadronicOverEm() > 0.12) pass = kFALSE;
|
170 |
if(fabs(ele->BestTrk()->D0Corrected(*vtx)) > 0.02) pass = kFALSE;
|
171 |
if(fabs(ele->BestTrk()->DzCorrected(*vtx)) > 0.1) pass = kFALSE;
|
172 |
if(fabs(1 - ele->ESuperClusterOverP())/(ele->SCluster()->Et()*TMath::CosH(ele->SCluster()->Eta())) > 0.05 ) pass = kFALSE;
|
173 |
if(iso_sum/ele->Pt() > 0.15) pass = kFALSE;
|
174 |
if(!mithep::ElectronTools::PassConversionFilter(ele, conversions, vtx, 0, 1e-6, 2.0, kTRUE, kFALSE)) pass = kFALSE;
|
175 |
if(ele->CorrectedNExpectedHitsInner() > 1) pass = kFALSE;
|
176 |
}
|
177 |
else if(fabs(ele->Eta()) < 2.5){
|
178 |
|
179 |
//endcap
|
180 |
if(fabs(ele->DeltaEtaSuperClusterTrackAtVtx()) >0.007) pass = kFALSE;
|
181 |
if(fabs(ele->DeltaPhiSuperClusterTrackAtVtx()) > 0.03) pass = kFALSE;
|
182 |
if(ele->CoviEtaiEta() > 0.03) pass = kFALSE;
|
183 |
if(ele->HadronicOverEm() > 0.10) pass = kFALSE;
|
184 |
if(fabs(ele->BestTrk()->D0Corrected(*vtx)) > 0.02) pass = kFALSE;
|
185 |
if(fabs(ele->BestTrk()->DzCorrected(*vtx)) > 0.1) pass = kFALSE;
|
186 |
if(fabs(1 - ele->ESuperClusterOverP())/(ele->SCluster()->Et()*TMath::CosH(ele->SCluster()->Eta())) > 0.05) pass = kFALSE;
|
187 |
if(ele->Pt() > 20 && iso_sum/ele->Pt() > 0.15) pass = kFALSE;
|
188 |
if(ele->Pt() < 20 && iso_sum/ele->Pt() > 0.10) pass = kFALSE;
|
189 |
if(!mithep::ElectronTools::PassConversionFilter(ele, conversions, vtx, 0, 1e-6, 2.0, kTRUE, kFALSE)) pass = kFALSE;
|
190 |
if(ele->CorrectedNExpectedHitsInner() > 1) pass = kFALSE;
|
191 |
}
|
192 |
else
|
193 |
pass = kFALSE;
|
194 |
|
195 |
return pass;
|
196 |
}
|
197 |
//--------------------------------------------------------------------------------------------------
|
198 |
SelectionStatus electronReferencePreSelection(ControlFlags &ctrl,
|
199 |
const mithep::Electron *electron,
|
200 |
const mithep::Vertex * vtx)
|
201 |
//--------------------------------------------------------------------------------------------------
|
202 |
{
|
203 |
bool ret = true;
|
204 |
|
205 |
ret &= ( fabs(electron->Ip3dPVSignificance()) < 100 );
|
206 |
// if( ctrl.debug ) cout << "elepresel : ret after IPsig: " << ret << endl;
|
207 |
ret &= ( electron->Pt() >= 7 );
|
208 |
// if( ctrl.debug ) cout << "elepresel : ret after scPt: " << ret << endl;
|
209 |
ret &= ( fabs(electron->Eta()) < 2.5 );
|
210 |
// if( ctrl.debug ) cout << "elepresel : ret after scEta: " << ret << endl;
|
211 |
ret &= ( electron->CorrectedNExpectedHitsInner() <= 1 );
|
212 |
// ret &= ( electron->Trk()->NExpectedHitsInner() <= 1 );
|
213 |
// if( ctrl.debug ) cout << "elepresel : ret after missing hits: " << ret << endl;
|
214 |
ret &= ( fabs(electron->BestTrk()->D0Corrected(*vtx)) < 0.5 &&
|
215 |
fabs(electron->BestTrk()->DzCorrected(*vtx)) < 1.0 );
|
216 |
// if( ctrl.debug ) cout << "elepresel : ret after d0 and dz: " << ret << endl;
|
217 |
|
218 |
SelectionStatus status;
|
219 |
if( ret ) status.setStatus(SelectionStatus::PRESELECTION);
|
220 |
return status;
|
221 |
}
|
222 |
//--------------------------------------------------------------------------------------------------
|
223 |
SelectionStatus electronPreSelectionNoD0DzIP(ControlFlags &ctrl,
|
224 |
const mithep::Electron *electron,
|
225 |
const mithep::Vertex * vtx)
|
226 |
//--------------------------------------------------------------------------------------------------
|
227 |
{
|
228 |
bool ret = true;
|
229 |
|
230 |
ret &= ( electron->Pt() >= 7 );
|
231 |
if( ctrl.debug ) cout << "elepresel : ret after scPt: " << ret << endl;
|
232 |
ret &= ( fabs(electron->Eta()) < 2.5 );
|
233 |
if( ctrl.debug ) cout << "elepresel : ret after scEta: " << ret << endl;
|
234 |
ret &= ( electron->CorrectedNExpectedHitsInner() <= 1 );
|
235 |
// ret &= ( electron->Trk()->NExpectedHitsInner() <= 1 );
|
236 |
if( ctrl.debug ) cout << "elepresel : ret after missing hits: " << ret << endl;
|
237 |
|
238 |
SelectionStatus status;
|
239 |
if( ret ) status.setStatus(SelectionStatus::PRESELECTION);
|
240 |
return status;
|
241 |
}
|
242 |
//--------------------------------------------------------------------------------------------------
|
243 |
SelectionStatus electronPreSelectionNoD0IP(ControlFlags &ctrl,
|
244 |
const mithep::Electron *electron,
|
245 |
const mithep::Vertex * vtx)
|
246 |
//--------------------------------------------------------------------------------------------------
|
247 |
{
|
248 |
bool ret = true;
|
249 |
|
250 |
ret &= ( electron->Pt() >= 7 );
|
251 |
ret &= ( fabs(electron->Eta()) < 2.5 );
|
252 |
ret &= ( electron->CorrectedNExpectedHitsInner() <= 1 );
|
253 |
// ret &= ( fabs(electron->BestTrk()->D0Corrected(*vtx)) < 0.5 &&
|
254 |
// fabs(electron->BestTrk()->DzCorrected(*vtx)) < 1.0 );
|
255 |
ret &= ( fabs(electron->BestTrk()->DzCorrected(*vtx)) < 1.0 );
|
256 |
|
257 |
SelectionStatus status;
|
258 |
if( ret ) status.setStatus(SelectionStatus::PRESELECTION);
|
259 |
return status;
|
260 |
}
|
261 |
|
262 |
//--------------------------------------------------------------------------------------------------
|
263 |
SelectionStatus electronReferenceIDMVASelectionV1(ControlFlags &ctrl,
|
264 |
const mithep::Electron *ele,
|
265 |
const mithep::Vertex * vtx )
|
266 |
//--------------------------------------------------------------------------------------------------
|
267 |
{
|
268 |
|
269 |
double mvaVal = getElectronIDMVAval(ctrl, ele, vtx);
|
270 |
return passElectronIDMVA(ctrl, mvaVal, ele);
|
271 |
}
|
272 |
//----------------------------------------------------------------------------------------
|
273 |
double getElectronIDMVAval(ControlFlags &ctrl,
|
274 |
const mithep::Electron *ele,
|
275 |
const mithep::Vertex * vtx )
|
276 |
//----------------------------------------------------------------------------------------
|
277 |
{
|
278 |
double _fbrem = (ele->FBrem() < -1. ) ? -1. : ele->FBrem();
|
279 |
double _kftrk_chisq =
|
280 |
(ele->HasTrackerTrk()) ? ele->TrackerTrk()->RChi2() : 0;
|
281 |
if( _kftrk_chisq > 10. ) _kftrk_chisq = 10.;
|
282 |
double _kftrk_nhits = (ele->HasTrackerTrk()) ? (double)ele->CTFTrkNLayersWithMeasurement() : -1;
|
283 |
|
284 |
double _gsftrk_chisq = ele->BestTrk()->RChi2();
|
285 |
if( _gsftrk_chisq > 200. ) _gsftrk_chisq = 200.;
|
286 |
|
287 |
double _deta = fabs(ele->DeltaEtaSuperClusterTrackAtVtx());
|
288 |
if( _deta > 0.06 ) _deta = 0.06;
|
289 |
double _dphi = fabs(ele->DeltaPhiSuperClusterTrackAtVtx());
|
290 |
if( _dphi > 0.6 ) _dphi = 0.6;
|
291 |
double _detacalo = fabs(ele->DeltaEtaSeedClusterTrackAtCalo());
|
292 |
if( _detacalo > 0.2 ) _detacalo = 0.2;
|
293 |
|
294 |
double _sigieie = ele->CoviEtaiEta();
|
295 |
double _sigiphiiphi = sqrt(ele->SCluster()->Seed()->CoviPhiiPhi());
|
296 |
if( isnan(_sigiphiiphi ) ) _sigiphiiphi = 0.;
|
297 |
|
298 |
double _etawidth = ele->SCluster()->EtaWidth();
|
299 |
double _phiwidth = ele->SCluster()->PhiWidth();
|
300 |
double _seedE1x5OverE = ele->SCluster()->Seed()->E1x5() / ele->SCluster()->Seed()->Energy();
|
301 |
double _seedE5x5OverE = ele->SCluster()->Seed()->E5x5() / ele->SCluster()->Seed()->Energy();
|
302 |
double _e1x5e5x5 = ele->E55() > 0 ? 1 - ele-> E15()/ele->E55() : -1;
|
303 |
double _r9 = (ele->SCluster()->R9() > 5 ) ? 5 : ele->SCluster()->R9();
|
304 |
double _h_o_e = ele->HadronicOverEm();
|
305 |
double _e_o_p = (ele->ESuperClusterOverP() > 20. ) ? 20 : ele->ESuperClusterOverP();
|
306 |
// double _eseed_o_pout = (ele->ESeedClusterOverPout() > 20. ) ? 20. : ele->ESeedClusterOverPout();
|
307 |
double _eeleclu_o_pout = (ele->EEleClusterOverPout() > 20. ) ? 20. : ele->EEleClusterOverPout();
|
308 |
// double _IoEmIoP = (double)(1. - ele->ESuperClusterOverP())/(ele->SCluster()->Et()*TMath::CosH(ele->SCluster()->Eta()));
|
309 |
double _IoEmIoP = (double)(1./ele->EcalEnergy()) - (double)(1./ele->P());
|
310 |
double _epreoraw = (double)ele->SCluster()->PreshowerEnergy() / ele->SCluster()->RawEnergy();
|
311 |
|
312 |
|
313 |
return eleIDMVA_V1->mvaValue( _fbrem,
|
314 |
_kftrk_chisq,
|
315 |
_kftrk_nhits,
|
316 |
_gsftrk_chisq,
|
317 |
_deta,
|
318 |
_dphi,
|
319 |
_detacalo,
|
320 |
_sigieie,
|
321 |
_sigiphiiphi,
|
322 |
_etawidth,
|
323 |
_phiwidth,
|
324 |
_e1x5e5x5,
|
325 |
_r9,
|
326 |
_h_o_e,
|
327 |
_e_o_p,
|
328 |
_IoEmIoP,
|
329 |
_eeleclu_o_pout,
|
330 |
_epreoraw,
|
331 |
ele->SCluster()->Eta(),
|
332 |
ele->Pt(),
|
333 |
ctrl.debug );
|
334 |
}
|
335 |
//----------------------------------------------------------------------------------------
|
336 |
SelectionStatus passElectronIDMVA(ControlFlags &ctrl,
|
337 |
double mvaVal,
|
338 |
const mithep::Electron *ele)
|
339 |
//----------------------------------------------------------------------------------------
|
340 |
{
|
341 |
SelectionStatus status;
|
342 |
status.idMVA = mvaVal;
|
343 |
bool pass = false;
|
344 |
|
345 |
Int_t subdet = 0;
|
346 |
if (fabs(ele->SCluster()->Eta()) < 0.8) subdet = 0;
|
347 |
else if (fabs(ele->SCluster()->Eta()) < 1.479) subdet = 1;
|
348 |
else subdet = 2;
|
349 |
Int_t ptBin = 0;
|
350 |
if (ele->Pt() > 10) ptBin = 1;
|
351 |
|
352 |
Int_t MVABin = -1;
|
353 |
if (subdet == 0 && ptBin == 0) MVABin = 0; // eta<0.8, pt<10
|
354 |
if (subdet == 1 && ptBin == 0) MVABin = 1; // 0.8<eta<1.479, pt<10
|
355 |
if (subdet == 2 && ptBin == 0) MVABin = 2; // eta>1.478, pt<10
|
356 |
if (subdet == 0 && ptBin == 1) MVABin = 3; // eta<0.8, pt>10
|
357 |
if (subdet == 1 && ptBin == 1) MVABin = 4; // 0.8<eta<1.479, pt>10
|
358 |
if (subdet == 2 && ptBin == 1) MVABin = 5; // eta>1.478, pt>10
|
359 |
|
360 |
if( MVABin == 0 && mvaVal > ELE_REFERENCE_IDMVA_CUT_BIN0 ) pass = true;
|
361 |
if( MVABin == 1 && mvaVal > ELE_REFERENCE_IDMVA_CUT_BIN1 ) pass = true;
|
362 |
if( MVABin == 2 && mvaVal > ELE_REFERENCE_IDMVA_CUT_BIN2 ) pass = true;
|
363 |
if( MVABin == 3 && mvaVal > ELE_REFERENCE_IDMVA_CUT_BIN3 ) pass = true;
|
364 |
if( MVABin == 4 && mvaVal > ELE_REFERENCE_IDMVA_CUT_BIN4 ) pass = true;
|
365 |
if( MVABin == 5 && mvaVal > ELE_REFERENCE_IDMVA_CUT_BIN5 ) pass = true;
|
366 |
|
367 |
if( pass ) {
|
368 |
status.orStatus(SelectionStatus::LOOSEID);
|
369 |
status.orStatus(SelectionStatus::TIGHTID);
|
370 |
}
|
371 |
|
372 |
return status;
|
373 |
}
|
374 |
//--------------------------------------------------------------------------------------------------
|
375 |
void initElectronIDMVAV1()
|
376 |
//--------------------------------------------------------------------------------------------------
|
377 |
{
|
378 |
eleIDMVA_V1 = new EGammaMvaEleEstimator();
|
379 |
vector<string> weightFiles;
|
380 |
|
381 |
weightFiles.push_back((string(getenv("CMSSW_BASE"))+string("/src/MitHzz4l/data/ID_weights_from_afs/Electrons_BDTG_NonTrigV0_Cat1.weights.xml")).c_str());
|
382 |
weightFiles.push_back((string(getenv("CMSSW_BASE"))+string("/src/MitHzz4l/data/ID_weights_from_afs/Electrons_BDTG_NonTrigV0_Cat2.weights.xml")).c_str());
|
383 |
weightFiles.push_back((string(getenv("CMSSW_BASE"))+string("/src/MitHzz4l/data/ID_weights_from_afs/Electrons_BDTG_NonTrigV0_Cat3.weights.xml")).c_str());
|
384 |
weightFiles.push_back((string(getenv("CMSSW_BASE"))+string("/src/MitHzz4l/data/ID_weights_from_afs/Electrons_BDTG_NonTrigV0_Cat4.weights.xml")).c_str());
|
385 |
weightFiles.push_back((string(getenv("CMSSW_BASE"))+string("/src/MitHzz4l/data/ID_weights_from_afs/Electrons_BDTG_NonTrigV0_Cat5.weights.xml")).c_str());
|
386 |
weightFiles.push_back((string(getenv("CMSSW_BASE"))+string("/src/MitHzz4l/data/ID_weights_from_afs/Electrons_BDTG_NonTrigV0_Cat6.weights.xml")).c_str());
|
387 |
|
388 |
eleIDMVA_V1->initialize( "BDT",
|
389 |
EGammaMvaEleEstimator::kNonTrig,
|
390 |
kTRUE, weightFiles);
|
391 |
|
392 |
}
|
393 |
//--------------------------------------------------------------------------------------------------
|
394 |
SelectionStatus electronTagSelection(const mithep::Electron *ele,
|
395 |
const mithep::Vertex *vtx,
|
396 |
const mithep::Array<mithep::PFCandidate> *pfCandidates
|
397 |
)
|
398 |
{
|
399 |
|
400 |
bool passID=true,passIso=true;
|
401 |
|
402 |
double scet = ele->SCluster()->Et();
|
403 |
double sceta = ele->SCluster()->Eta();
|
404 |
if(scet < 5) passID = false;
|
405 |
if(fabs(sceta) > 2.5) passID = false;
|
406 |
|
407 |
double d0 = ele->BestTrk()->D0Corrected(*vtx);
|
408 |
if(fabs(d0) > 0.02) passID = false;
|
409 |
double dz = ele->BestTrk()->DzCorrected(*vtx);
|
410 |
if(fabs(dz) > 0.1) passID = false;
|
411 |
|
412 |
// conversion rejection
|
413 |
double misshits = ele->CorrectedNExpectedHitsInner();
|
414 |
if(misshits > 0) passID = false;
|
415 |
// not implemented for bambu, so leave it out for the moment...
|
416 |
// if(ele->isConv) passID = false;
|
417 |
|
418 |
// barrel/endcap dependent requirments
|
419 |
double pfiso = computePFEleIso(ele,vtx,pfCandidates,0.4);
|
420 |
double sieie = ele->CoviEtaiEta();
|
421 |
double dphiin = ele->DeltaPhiSuperClusterTrackAtVtx();
|
422 |
double detain = ele->DeltaPhiSuperClusterTrackAtVtx();
|
423 |
double hoe = ele->HadronicOverEm();
|
424 |
if(fabs(sceta)<1.479) {
|
425 |
// barrel
|
426 |
if(pfiso > 0.13*scet) passIso = false;
|
427 |
|
428 |
if(sieie > 0.01) passID = false;
|
429 |
if(fabs(dphiin) > 0.06) passID = false;
|
430 |
if(fabs(detain) > 0.004) passID = false;
|
431 |
if(hoe > 0.04) passID = false;
|
432 |
} else {
|
433 |
// endcap
|
434 |
if(pfiso > 0.09*(scet)) passIso = false;
|
435 |
|
436 |
if(sieie > 0.03) passID = false;
|
437 |
if(fabs(dphiin) > 0.03) passID = false;
|
438 |
if(fabs(detain) > 0.007) passID = false;
|
439 |
if(hoe > 0.10) passID = false;
|
440 |
}
|
441 |
|
442 |
SelectionStatus status;
|
443 |
if(passID) status |= SelectionStatus::TIGHTIDANDPRE;
|
444 |
if(passIso) status |= SelectionStatus::TIGHTISOANDPRE;
|
445 |
|
446 |
return status;
|
447 |
}
|