ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Utils/src/ElectronTools.cc
Revision: 1.23
Committed: Tue Mar 15 12:02:49 2011 UTC (14 years, 1 month ago) by ceballos
Content type: text/plain
Branch: MAIN
Changes since 1.22: +32 -9 lines
Log Message:
new ip cuts

File Contents

# User Rev Content
1 ceballos 1.23 // $Id: ElectronTools.cc,v 1.22 2011/03/15 08:33:42 ceballos Exp $
2 sixie 1.1
3     #include "MitPhysics/Utils/interface/ElectronTools.h"
4     #include "MitAna/DataTree/interface/StableData.h"
5     #include <TFile.h>
6    
7     ClassImp(mithep::ElectronTools)
8    
9     using namespace mithep;
10    
11     //--------------------------------------------------------------------------------------------------
12     ElectronTools::ElectronTools()
13     {
14     // Constructor.
15     }
16    
17     //--------------------------------------------------------------------------------------------------
18     Bool_t ElectronTools::PassCustomID(const Electron *ele, EElIdType idType) {
19    
20     Double_t fCuts[6][8]; //!custom id cuts
21    
22     Double_t tightcuts[6][8]={
23     {0.086, 0.1, 0.052, 0.0, 0.050, 0.059, 0.061, 0.0}, //hovere
24     {0.011, 0.011, 0.011, 0.0, 0.033, 0.029, 0.030, 0.0}, //sigmaetaeta
25     {0.038, 0.024, 0.045, 0.0, 0.034, 0.017, 0.026, 0.0}, //deltaphiin
26     {0.0081, 0.0029, 0.0051, 0.0, 0.0070, 0.0062, 0.0088, 0.0}, //deltaetain
27     {0.0, 0.9, 0.0, 0.0, 0.0, 0.78, 0.0, 0.0}, //eoverp
28     {0.8,0.2,0.9,0,0,0,0,0}}; //extra cuts fbrem and E_Over_P
29    
30     Double_t loosecuts[6][8]={
31     {0.076, 0.033, 0.07, 0.0, 0.083,0.148, 0.033, 0.0}, //hovere
32     {0.0101, 0.0095, 0.0097, 0.0, 0.03, 0.03, 0.03, 0.0}, //sigmaetaeta
33     {0.053, 0.0189, 0.059, 0.099, 0.0278,0.0157, 0.042, 0.080}, //deltaphiin
34     {0.0078, 0.00259, 0.0062, 0.0, 0.0078,0.0061, 0.0061, 0.0}, //deltaetain
35     {0.3, 0.92, 0.211, 0.0, 0.42, 0.88, 0.68, 0.0}, //eoverp
36     {0.8,0.2,0,0,0,0,0,0}}; //extra cuts fbrem and E_Over_P
37    
38     Double_t VBTFWorkingPoint95[6][8] = {
39 ceballos 1.14 {0.15, 0.15, 0.15, 0.15, 0.07, 0.07, 0.07, 0.07 }, //hovere
40 sixie 1.1 {0.01, 0.01, 0.01, 0.01, 0.03, 0.03, 0.03, 0.03 }, //sigmaetaeta
41     {0.8, 0.8, 0.8, 0.8, 0.7, 0.7, 0.7, 0.7 }, //deltaphiin
42 ceballos 1.5 {0.007, 0.007, 0.007, 0.007, 0.010, 0.010, 0.010, 0.010 }, //deltaetain
43 sixie 1.1 {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, //eoverp
44     {0.0, 0.0, 0, 0, 0, 0, 0, 0 } //extra cuts fbrem and E_Over_P
45     };
46    
47 ceballos 1.5 Double_t VBTFWorkingPoint90[6][8] = {
48     {0.12, 0.12, 0.12, 0.12, 0.05, 0.05, 0.05, 0.05 }, //hovere
49     {0.01, 0.01, 0.01, 0.01, 0.03, 0.03, 0.03, 0.03 }, //sigmaetaeta
50     {0.8, 0.8, 0.8, 0.8, 0.7, 0.7, 0.7, 0.7 }, //deltaphiin
51     {0.007, 0.007, 0.007, 0.007, 0.009, 0.009, 0.009, 0.009 }, //deltaetain
52     {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, //eoverp
53     {0.0, 0.0, 0, 0, 0, 0, 0, 0 } //extra cuts fbrem and E_Over_P
54     };
55 sixie 1.1
56 ceballos 1.5 Double_t VBTFWorkingPoint85[6][8] = {
57     {0.04, 0.04, 0.04, 0.04, 0.025, 0.025, 0.025, 0.025 }, //hovere
58 sixie 1.1 {0.01, 0.01, 0.01, 0.01, 0.03, 0.03, 0.03, 0.03 }, //sigmaetaeta
59 ceballos 1.5 {0.06, 0.06, 0.06, 0.06, 0.04, 0.04, 0.04, 0.04 }, //deltaphiin
60     {0.006, 0.006, 0.006, 0.006, 0.007, 0.007, 0.007, 0.007 }, //deltaetain
61 sixie 1.1 {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, //eoverp
62     {0.0, 0.0, 0, 0, 0, 0, 0, 0 } //extra cuts fbrem and E_Over_P
63     };
64    
65     Double_t VBTFWorkingPoint80[6][8] = {
66 ceballos 1.5 {0.04, 0.04, 0.04, 0.04, 0.025, 0.025, 0.025, 0.025}, //hovere
67 sixie 1.1 {0.01, 0.01, 0.01, 0.01, 0.03, 0.03, 0.03, 0.03 }, //sigmaetaeta
68 ceballos 1.5 {0.06, 0.06, 0.06, 0.06, 0.03, 0.03, 0.03, 0.03 }, //deltaphiin
69     {0.004, 0.004, 0.004, 0.004, 0.007, 0.007, 0.007, 0.007}, //deltaetain
70 sixie 1.1 {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, //eoverp
71     {0.0, 0.0, 0, 0, 0, 0, 0, 0 } //extra cuts fbrem and E_Over_P
72     };
73    
74     Double_t VBTFWorkingPoint70[6][8] = {
75 ceballos 1.5 {0.025, 0.025, 0.025, 0.025, 0.012, 0.012, 0.012, 0.012}, //hovere
76 sixie 1.1 {0.01, 0.01, 0.01, 0.01, 0.03, 0.03, 0.03, 0.03 }, //sigmaetaeta
77 ceballos 1.5 {0.03, 0.03, 0.03, 0.03, 0.02, 0.02, 0.02, 0.02 }, //deltaphiin
78 ceballos 1.11 {0.004, 0.004, 0.004, 0.004, 0.005, 0.005, 0.005, 0.005}, //deltaetain
79 sixie 1.1 {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, //eoverp
80     {0.0, 0.0, 0, 0, 0, 0, 0, 0 } //extra cuts fbrem and E_Over_P
81     };
82    
83     switch (idType) {
84     case kCustomIdTight:
85     memcpy(fCuts,tightcuts,sizeof(fCuts));
86     break;
87     case kCustomIdLoose:
88     memcpy(fCuts,loosecuts,sizeof(fCuts));
89     break;
90     case kVBTFWorkingPoint95Id:
91     memcpy(fCuts,VBTFWorkingPoint95,sizeof(fCuts));
92     break;
93     case kVBTFWorkingPoint90Id:
94     memcpy(fCuts,VBTFWorkingPoint90,sizeof(fCuts));
95     break;
96 ceballos 1.5 case kVBTFWorkingPoint85Id:
97     memcpy(fCuts,VBTFWorkingPoint85,sizeof(fCuts));
98     break;
99 sixie 1.1 case kVBTFWorkingPoint80Id:
100     memcpy(fCuts,VBTFWorkingPoint80,sizeof(fCuts));
101     break;
102 ceballos 1.22 case kVBTFWorkingPoint80LowPtId:
103     memcpy(fCuts,VBTFWorkingPoint80,sizeof(fCuts));
104     break;
105 sixie 1.1 case kVBTFWorkingPoint70Id:
106     memcpy(fCuts,VBTFWorkingPoint70,sizeof(fCuts));
107     break;
108     default:
109     memset(fCuts,0,sizeof(fCuts));
110     break;
111     }
112    
113    
114     // Based on RecoEgamma/ElectronIdentification/src/CutBasedElectronID.cc.
115     Double_t eOverP = ele->ESuperClusterOverP();
116     Double_t fBrem = ele->FBrem();
117    
118 bendavid 1.16 if ( (fCuts[5][0]>0.0) && (eOverP < fCuts[5][0]) && (fCuts[5][1]>0.0) && (fBrem < fCuts[5][1]))
119 sixie 1.1 return kFALSE;
120    
121 bendavid 1.16 if ( (fCuts[5][2]>0.0) && (eOverP < fCuts[5][2]*(1-fBrem)))
122 sixie 1.1 return kFALSE;
123    
124     Int_t cat = 2;
125     if ((ele->IsEB() && fBrem<0.06) || (ele->IsEE() && fBrem<0.1))
126     cat=1;
127     else if (eOverP < 1.2 && eOverP > 0.8)
128     cat=0;
129 ceballos 1.13
130     if(ele->SCluster() == 0)
131     return kFALSE;
132 ceballos 1.21 Double_t eSeedOverPin = ele->ESeedClusterOverPIn();
133 sixie 1.1 Double_t hOverE = ele->HadronicOverEm();
134     Double_t sigmaee = ele->CoviEtaiEta();
135     Double_t deltaPhiIn = TMath::Abs(ele->DeltaPhiSuperClusterTrackAtVtx());
136     Double_t deltaEtaIn = TMath::Abs(ele->DeltaEtaSuperClusterTrackAtVtx());
137    
138     Int_t eb = 1;
139     if (ele->IsEB())
140     eb = 0;
141    
142     if (hOverE>fCuts[0][cat+4*eb])
143     return kFALSE;
144    
145     if (sigmaee>fCuts[1][cat+4*eb])
146     return kFALSE;
147    
148     if (deltaPhiIn>fCuts[2][cat+4*eb])
149     return kFALSE;
150    
151     if(deltaEtaIn>fCuts[3][cat+4*eb])
152     return kFALSE;
153    
154     if(eSeedOverPin<fCuts[4][cat+4*eb])
155     return kFALSE;
156    
157 ceballos 1.22 // Cuts only for pt<20 region and kVBTFWorkingPoint80LowPtId
158     if(ele->Pt() < 20 && idType == kVBTFWorkingPoint80LowPtId) {
159     Bool_t isGoodLowPtEl = fBrem > 0.15 ||
160     (ele->AbsEta() < 1.0 && eOverP > 0.95 &&
161     TMath::Abs(ele->Charge()*ele->DeltaPhiSuperClusterTrackAtVtx()) < 0.006);
162     if(!isGoodLowPtEl) return kFALSE;
163     }
164    
165 sixie 1.1 return kTRUE;
166     }
167    
168     //--------------------------------------------------------------------------------------------------
169 ceballos 1.5 Bool_t ElectronTools::PassCustomIso(const Electron *ele, EElIsoType isoType,
170     Bool_t useCombineIso)
171 sixie 1.1 {
172     Bool_t pass = kTRUE;
173     Double_t fIsoCuts[4][2]; //!custom isolation cuts
174     Double_t VBTFWorkingPoint95[4][2] = {
175 ceballos 1.5 {0.15 , 0.08 }, //TrkIso
176     {2.00 , 0.06 }, //ECALIso
177     {0.12 , 0.05 }, //HCALIso
178     {0.15, 0.10 } //Combined
179 sixie 1.1 };
180    
181     Double_t VBTFWorkingPoint90[4][2] = {
182 ceballos 1.5 {0.12 , 0.05 }, //TrkIso
183     {0.09 , 0.06 }, //ECALIso
184     {0.10 , 0.03 }, //HCALIso
185     {0.10, 0.07 } //Combined
186     };
187    
188     Double_t VBTFWorkingPoint85[4][2] = {
189     {0.09 , 0.05 }, //TrkIso
190     {0.08 , 0.05 }, //ECALIso
191     {0.10 , 0.025 }, //HCALIso
192     {0.09, 0.06 } //Combined
193 sixie 1.1 };
194    
195     Double_t VBTFWorkingPoint80[4][2] = {
196 ceballos 1.5 {0.09 , 0.04 }, //TrkIso
197     {0.07 , 0.05 }, //ECALIso
198     {0.10 , 0.025 }, //HCALIso
199     {0.07, 0.06 } //Combined
200 sixie 1.1 };
201    
202     Double_t VBTFWorkingPoint70[4][2] = {
203 ceballos 1.11 {0.05 , 0.025 }, //TrkIso
204     {0.06 , 0.025 }, //ECALIso
205     {0.03 , 0.020 }, //HCALIso
206     {0.04, 0.030 } //Combined
207 sixie 1.1 };
208    
209     switch (isoType) {
210     case kVBTFWorkingPoint95Iso:
211     memcpy(fIsoCuts,VBTFWorkingPoint95,sizeof(fIsoCuts));
212     break;
213     case kVBTFWorkingPoint90Iso:
214     memcpy(fIsoCuts,VBTFWorkingPoint90,sizeof(fIsoCuts));
215     break;
216 ceballos 1.5 case kVBTFWorkingPoint85Iso:
217     memcpy(fIsoCuts,VBTFWorkingPoint85,sizeof(fIsoCuts));
218     break;
219 sixie 1.1 case kVBTFWorkingPoint80Iso:
220     memcpy(fIsoCuts,VBTFWorkingPoint80,sizeof(fIsoCuts));
221     break;
222     case kVBTFWorkingPoint70Iso:
223     memcpy(fIsoCuts,VBTFWorkingPoint70,sizeof(fIsoCuts));
224     break;
225     default:
226     memset(fIsoCuts,0,sizeof(fIsoCuts));
227     break;
228     }
229    
230 ceballos 1.10 Double_t trkIso = ele->TrackIsolationDr03() / ele->Pt();
231     Double_t ecalIso = ele->EcalRecHitIsoDr03() / ele->Pt();
232     Double_t hcalIso = ele->HcalTowerSumEtDr03() / ele->Pt();
233     Double_t combinedIso = ele->TrackIsolationDr03() + ele->EcalRecHitIsoDr03() + ele->HcalTowerSumEtDr03();
234     if(ele->IsEB()) combinedIso = ele->TrackIsolationDr03() + TMath::Max(ele->EcalRecHitIsoDr03() - 1.0, 0.0) + ele->HcalTowerSumEtDr03();
235 ceballos 1.11 combinedIso = combinedIso / ele->Pt();
236 sixie 1.1
237     Int_t eb = 1;
238     if (ele->IsEB())
239     eb = 0;
240    
241 ceballos 1.5 if(useCombineIso == kFALSE){
242     if (trkIso>fIsoCuts[0][eb])
243     pass = kFALSE;
244     if (ecalIso>fIsoCuts[1][eb])
245     pass = kFALSE;
246     if (hcalIso>fIsoCuts[2][eb])
247     pass = kFALSE;
248     }
249     else {
250     if (combinedIso>fIsoCuts[3][eb])
251     pass = kFALSE;
252     }
253 sixie 1.1
254     return pass;
255     }
256    
257    
258     //--------------------------------------------------------------------------------------------------
259     Bool_t ElectronTools::PassConversionFilter(const Electron *ele,
260 bendavid 1.19 const DecayParticleCol *conversions,
261     const BaseVertex *vtx,
262 bendavid 1.20 UInt_t nWrongHitsMax,
263     Double_t probMin,
264     Double_t lxyMin,
265     Bool_t matchCkf,
266     Bool_t requireArbitratedMerged)
267 sixie 1.1 {
268     Bool_t isGoodConversion = kFALSE;
269    
270     for (UInt_t ifc=0; ifc<conversions->GetEntries(); ifc++) {
271     Bool_t ConversionMatchFound = kFALSE;
272     for (UInt_t d=0; d<conversions->At(ifc)->NDaughters(); d++) {
273     const Track *trk = dynamic_cast<const ChargedParticle*>
274     (conversions->At(ifc)->Daughter(d))->Trk();
275 bendavid 1.20 if (ele->GsfTrk() == trk || (matchCkf && ele->TrackerTrk()==trk) ) {
276 sixie 1.1 ConversionMatchFound = kTRUE;
277     break;
278     }
279     }
280    
281     // if match between the e-track and one of the conversion legs
282     if (ConversionMatchFound == kTRUE){
283 bendavid 1.20 isGoodConversion = (conversions->At(ifc)->Prob() > probMin) &&
284     (!requireArbitratedMerged || conversions->At(ifc)->Quality().Quality(ConversionQuality::arbitratedMerged)) &&
285     (conversions->At(ifc)->LxyCorrected(vtx) > lxyMin);
286 sixie 1.1
287     if (isGoodConversion == kTRUE) {
288     for (UInt_t d=0; d<conversions->At(ifc)->NDaughters(); d++) {
289     const Track *trk = dynamic_cast<const ChargedParticle*>
290     (conversions->At(ifc)->Daughter(d))->Trk();
291     if (trk) {
292     const StableData *sd = dynamic_cast<const StableData*>
293     (conversions->At(ifc)->DaughterDat(d));
294 bendavid 1.19 if (sd->NWrongHits() > nWrongHitsMax)
295 sixie 1.1 isGoodConversion = kFALSE;
296     } else {
297     isGoodConversion = kFALSE;
298     }
299     }
300     }
301     }
302 ceballos 1.13
303 sixie 1.1 if (isGoodConversion == kTRUE) break;
304    
305     } // loop over all conversions
306    
307     return !isGoodConversion;
308     }
309    
310     //--------------------------------------------------------------------------------------------------
311 ceballos 1.23 Bool_t ElectronTools::PassD0Cut(const Electron *ele, const VertexCol *vertices, Double_t fD0Cut, Int_t nVertex)
312 sixie 1.1 {
313     Bool_t d0cut = kFALSE;
314 ceballos 1.23
315     Double_t d0_real = 1e30;
316     if(nVertex >= 0) d0_real = TMath::Abs(ele->GsfTrk()->D0Corrected(*vertices->At(nVertex)));
317     else {
318     Double_t distVtx = 999.0;
319     Int_t closestVtx = 0;
320     for(UInt_t nv=0; nv<vertices->GetEntries(); nv++){
321     double dz = TMath::Abs(ele->GsfTrk()->DzCorrected(*vertices->At(nv)));
322     if(dz < distVtx) {
323     distVtx = dz;
324     closestVtx = nv;
325     }
326 ceballos 1.12 }
327 ceballos 1.23 d0_real = TMath::Abs(ele->GsfTrk()->D0Corrected(*vertices->At(closestVtx)));
328 sixie 1.1 }
329     if(d0_real < fD0Cut) d0cut = kTRUE;
330    
331     return d0cut;
332     }
333    
334     //--------------------------------------------------------------------------------------------------
335 ceballos 1.18 Bool_t ElectronTools::PassD0Cut(const Electron *ele, const BeamSpotCol *beamspots, Double_t fD0Cut)
336 sixie 1.2 {
337     Bool_t d0cut = kFALSE;
338     // d0 cut
339     Double_t d0_real = 99999;
340     for(UInt_t i0 = 0; i0 < beamspots->GetEntries(); i0++) {
341     Double_t pD0 = ele->GsfTrk()->D0Corrected(*beamspots->At(i0));
342     if(TMath::Abs(pD0) < TMath::Abs(d0_real)) d0_real = TMath::Abs(pD0);
343     }
344     if(d0_real < fD0Cut) d0cut = kTRUE;
345    
346     return d0cut;
347     }
348    
349     //--------------------------------------------------------------------------------------------------
350 ceballos 1.23 Bool_t ElectronTools::PassDZCut(const Electron *ele, const VertexCol *vertices, Double_t fDZCut)
351     {
352     Bool_t dzcut = kFALSE;
353    
354     Double_t distVtx = 999.0;
355     for(UInt_t nv=0; nv<vertices->GetEntries(); nv++){
356     double dz = TMath::Abs(ele->GsfTrk()->DzCorrected(*vertices->At(nv)));
357     if(dz < distVtx) {
358     distVtx = dz;
359     }
360     }
361     if(distVtx < fDZCut) dzcut = kTRUE;
362    
363     return dzcut;
364     }
365    
366     //--------------------------------------------------------------------------------------------------
367 sixie 1.1 Bool_t ElectronTools::PassChargeFilter(const Electron *ele)
368     {
369     Bool_t passChargeFilter = kTRUE;
370     if(ele->TrackerTrk() &&
371     ele->TrackerTrk()->Charge() != ele->Charge()) passChargeFilter = kFALSE;
372    
373     return passChargeFilter;
374     }
375    
376     //--------------------------------------------------------------------------------------------------
377     Bool_t ElectronTools::PassSpikeRemovalFilter(const Electron *ele)
378     {
379     Bool_t passSpikeRemovalFilter = kTRUE;
380 ceballos 1.13 if(ele->SCluster() &&
381     ele->SCluster()->Seed()->Energy() > 5.0 &&
382 sixie 1.1 ele->SCluster()->Seed()->EMax() / ele->SCluster()->Seed()->E3x3() > 0.95
383     ) {
384     passSpikeRemovalFilter = kFALSE;
385     }
386    
387     // For Now Only use the EMax/E3x3 prescription.
388     // if(ele->SCluster()->Seed()->Energy() > 5.0 &&
389     // (1 - (ele->SCluster()->Seed()->E1x3() + ele->SCluster()->Seed()->E3x1() - 2*ele->SCluster()->Seed()->EMax())) > 0.95
390     // ) {
391     // passSpikeRemovalFilter = kFALSE;
392     // }
393    
394     return passSpikeRemovalFilter;
395     }
396 ceballos 1.4
397 bendavid 1.9 Bool_t ElectronTools::PassTriggerMatching(const Electron *ele, const TriggerObjectCol *trigobjs)
398     {
399    
400     for (UInt_t i=0; i<trigobjs->GetEntries(); ++i) {
401     const TriggerObject *trigobj = trigobjs->At(i);
402 bendavid 1.15 if (trigobj->TriggerType()==TriggerObject::TriggerCluster || trigobj->TriggerType()==TriggerObject::TriggerElectron || trigobj->TriggerType()==TriggerObject::TriggerPhoton) {
403     if (MathUtils::DeltaR(ele->SCluster(),trigobj)<0.3) {
404 bendavid 1.9 return kTRUE;
405     }
406     }
407     }
408    
409     return kFALSE;
410    
411    
412     }
413    
414 ceballos 1.4 //--------------------------------------------------------------------------------------------------
415     Int_t ElectronTools::Classify(const Electron *ele) {
416    
417 ceballos 1.5 double eta = ele->AbsEta();
418 ceballos 1.4 double eOverP = ele->ESuperClusterOverP();
419     double fBrem = ele->FBrem();
420    
421     int cat = -1;
422     if (ele->IsEB()) {
423 ceballos 1.5 if ((fBrem >= 0.12) and (eOverP > 0.9) and (eOverP < 1.2))
424 ceballos 1.4 cat = 0;
425 ceballos 1.5 else if (((eta > .445 and eta < .45 ) or
426     (eta > .79 and eta < .81 ) or
427     (eta > 1.137 and eta < 1.157 ) or
428     (eta > 1.47285 and eta < 1.4744)))
429     cat = 6;
430     else if (ele->IsTrackerDriven() and !ele->IsEcalDriven())
431 ceballos 1.4 cat = 8;
432     else if (fBrem < 0.12)
433     cat = 1;
434     else
435     cat = 2;
436     } else {
437 ceballos 1.5 if ((fBrem >= 0.2) and (eOverP > 0.82) and (eOverP < 1.22))
438 ceballos 1.4 cat = 3;
439 ceballos 1.5 else if (eta > 1.5 and eta < 1.58)
440     cat = 7;
441     else if (ele->IsTrackerDriven() and !ele->IsEcalDriven())
442 ceballos 1.4 cat = 8;
443     else if (fBrem < 0.2)
444     cat = 4;
445     else
446     cat = 5;
447     }
448    
449     return cat;
450     }
451    
452     //--------------------------------------------------------------------------------------------------
453     Int_t ElectronTools::PassTightId(const Electron *ele, const VertexCol *vertices,
454 ceballos 1.21 const DecayParticleCol *conversions, const Int_t typeCuts,
455     Double_t beta){
456 ceballos 1.4
457 ceballos 1.17 // original code on
458     // http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/RecoEgamma/ElectronIdentification/src/CutBasedElectronID.cc
459 ceballos 1.21 // beta must be computed with a DR cone of 0.4
460 ceballos 1.17
461     Double_t scEt = ele->SCluster()->Et();
462     Double_t scEta = ele->SCluster()->Eta();
463 ceballos 1.4
464     Double_t fBrem = ele->FBrem();
465     Double_t hOverE = ele->HadronicOverEm();
466     Double_t sigmaee = ele->CoviEtaiEta();
467     Double_t deltaPhiIn = TMath::Abs(ele->DeltaPhiSuperClusterTrackAtVtx());
468     Double_t deltaEtaIn = TMath::Abs(ele->DeltaEtaSuperClusterTrackAtVtx());
469     Double_t eSeedOverPin = ele->ESeedClusterOverPIn();
470    
471     Int_t mishits = ele->BestTrk()->NExpectedHitsInner();
472     Double_t tkIso = ele->TrackIsolationDr03();
473 ceballos 1.21 Double_t ecalIso = ele->EcalRecHitIsoDr04()*beta;
474     Double_t hcalIso = ele->HcalTowerSumEtDr04()*beta;
475 ceballos 1.4
476     int cat = Classify(ele);
477     int eb;
478    
479     if (ele->IsEB())
480     eb = 0;
481     else
482     eb = 1;
483    
484 ceballos 1.17 // Medium cuts
485     Double_t cutdcotdistMedium[9] = {
486     3.32e-02, 2.92e-02, 2.49e-02, 3.92e-02, 3.41e-02, 3.96e-02, 2.91e-02, 3.95e-02, 7.71e-03};
487     Double_t cutdetainMedium[9] = {
488     1.33e-02, 4.48e-03, 9.22e-03, 1.54e-02, 7.26e-03, 1.24e-02, 1.29e-02, 3.84e-02, 1.88e-02};
489     Double_t cutdetainlMedium[9] = {
490     1.21e-02, 4.22e-03, 9.18e-03, 1.61e-02, 6.45e-03, 1.16e-02, 1.23e-02, 6.20e-02, 2.43e-02};
491     Double_t cutdphiinMedium[9] = {
492     7.09e-02, 2.43e-01, 2.96e-01, 7.98e-02, 2.35e-01, 2.76e-01, 3.42e-01, 4.04e-01, 2.99e-01};
493     Double_t cutdphiinlMedium[9] = {
494     7.42e-02, 2.43e-01, 2.97e-01, 9.12e-02, 2.26e-01, 2.76e-01, 3.34e-01, 5.58e-01, 2.91e-01};
495     Double_t cuteseedopcorMedium[9] = {
496     6.42e-01, 9.44e-01, 4.53e-01, 7.62e-01, 3.67e-01, 5.57e-01, 1.98e-01, 9.15e-01, 6.28e-02};
497     Double_t cutfmishitsMedium[9] = {
498     4.50e+00, 1.50e+00, 1.50e+00, 1.50e+00, 1.50e+00, 5.00e-01, 1.50e+00, 5.00e-01, 5.00e-01};
499     Double_t cuthoeMedium[9] = {
500     1.96e-01, 6.30e-02, 1.48e-01, 3.66e-01, 5.66e-02, 1.45e-01, 4.29e-01, 4.28e-01, 3.99e-01};
501     Double_t cuthoelMedium[9] = {
502     2.19e-01, 6.19e-02, 1.47e-01, 3.58e-01, 4.61e-02, 1.46e-01, 3.26e-01, 3.81e-01, 3.89e-01};
503     Double_t cutip_gsfMedium[9] = {
504     2.45e-02, 9.74e-02, 1.48e-01, 5.49e-02, 5.65e-01, 3.33e-01, 2.04e-01, 5.41e-01, 1.21e-01};
505     Double_t cutip_gsflMedium[9] = {
506     1.92e-02, 9.81e-02, 1.33e-01, 4.34e-02, 5.65e-01, 3.24e-01, 2.33e-01, 4.30e-01, 6.44e-02};
507     Double_t cutiso_sumMedium[9] = {
508     1.44e+01, 1.12e+01, 1.09e+01, 1.08e+01, 6.35e+00, 9.78e+00, 1.30e+01, 1.62e+01, 1.96e+00};
509     Double_t cutiso_sumoetMedium[9] = {
510     1.01e+01, 6.41e+00, 6.00e+00, 8.14e+00, 3.90e+00, 4.76e+00, 6.86e+00, 6.48e+00, 1.74e+01};
511     Double_t cutiso_sumoetlMedium[9] = {
512     9.44e+00, 7.67e+00, 7.15e+00, 7.34e+00, 3.35e+00, 4.70e+00, 8.32e+00, 7.55e+00, 6.25e+00};
513     Double_t cutseeMedium[9] = {
514     1.30e-02, 1.09e-02, 1.18e-02, 3.94e-02, 3.04e-02, 3.28e-02, 1.00e-02, 3.73e-02, 6.69e-02};
515     Double_t cutseelMedium[9] = {
516     1.42e-02, 1.11e-02, 1.29e-02, 4.32e-02, 2.96e-02, 3.82e-02, 1.01e-02, 4.45e-02, 1.19e-01};
517    
518     // Tight cuts
519     Double_t cutdcotdistTight[9] = {
520     2.68e-02, 2.36e-02, 2.21e-02, 3.72e-02, 3.17e-02, 3.61e-02, 2.55e-02, 3.75e-02, 2.16e-04};
521     Double_t cutdetainTight[9] = {
522     8.92e-03, 3.96e-03, 8.50e-03, 1.34e-02, 6.27e-03, 1.05e-02, 1.12e-02, 3.09e-02, 1.88e-02};
523     Double_t cutdetainlTight[9] = {
524     9.23e-03, 3.77e-03, 8.70e-03, 1.39e-02, 5.60e-03, 9.40e-03, 1.07e-02, 6.20e-02, 4.10e-03};
525     Double_t cutdphiinTight[9] = {
526     6.37e-02, 1.53e-01, 2.90e-01, 7.69e-02, 1.81e-01, 2.34e-01, 3.42e-01, 3.93e-01, 2.84e-01};
527     Double_t cutdphiinlTight[9] = {
528     6.92e-02, 2.33e-01, 2.96e-01, 8.65e-02, 1.85e-01, 2.76e-01, 3.34e-01, 3.53e-01, 2.90e-01};
529     Double_t cuteseedopcorTight[9] = {
530     6.52e-01, 9.69e-01, 9.12e-01, 7.79e-01, 3.67e-01, 6.99e-01, 3.28e-01, 9.67e-01, 5.89e-01};
531     Double_t cutfmishitsTight[9] = {
532     4.50e+00, 1.50e+00, 5.00e-01, 1.50e+00, 1.50e+00, 5.00e-01, 5.00e-01, 5.00e-01, 5.00e-01};
533     Double_t cuthoeTight[9] = {
534     1.74e-01, 4.88e-02, 1.46e-01, 3.64e-01, 4.93e-02, 1.45e-01, 4.29e-01, 4.20e-01, 3.99e-01};
535     Double_t cuthoelTight[9] = {
536     2.19e-01, 5.25e-02, 1.47e-01, 3.57e-01, 4.25e-02, 1.45e-01, 3.26e-01, 3.80e-01, 1.32e-01};
537     Double_t cutip_gsfTight[9] = {
538     1.58e-02, 8.25e-02, 1.15e-01, 4.05e-02, 5.40e-01, 1.51e-01, 7.74e-02, 4.17e-01, 7.80e-02};
539     Double_t cutip_gsflTight[9] = {
540     1.27e-02, 6.26e-02, 9.68e-02, 3.02e-02, 5.65e-01, 1.46e-01, 7.90e-02, 4.10e-01, 4.79e-02};
541     Double_t cutiso_sumTight[9] = {
542     1.23e+01, 9.77e+00, 1.01e+01, 9.77e+00, 6.13e+00, 7.55e+00, 1.30e+01, 1.62e+01, 1.78e+00};
543     Double_t cutiso_sumoetTight[9] = {
544     7.75e+00, 5.45e+00, 5.67e+00, 5.97e+00, 3.17e+00, 3.86e+00, 6.06e+00, 5.31e+00, 1.05e+01};
545     Double_t cutiso_sumoetlTight[9] = {
546     7.56e+00, 5.08e+00, 5.77e+00, 5.74e+00, 2.37e+00, 3.32e+00, 4.97e+00, 5.46e+00, 3.82e+00};
547     Double_t cutseeTight[9] = {
548     1.16e-02, 1.07e-02, 1.08e-02, 3.49e-02, 2.89e-02, 3.08e-02, 9.87e-03, 3.37e-02, 4.40e-02};
549     Double_t cutseelTight[9] = {
550     1.27e-02, 1.08e-02, 1.13e-02, 4.19e-02, 2.81e-02, 3.02e-02, 9.76e-03, 4.28e-02, 2.98e-02};
551    
552 ceballos 1.21 // SuperTight cuts
553 ceballos 1.17 Double_t cutdcotdistSuperTight[9] = {
554     2.11e-02, 1.86e-02, 1.55e-02, 3.40e-02, 2.85e-02, 3.32e-02, 1.64e-02, 3.75e-02, 1.30e-04};
555     Double_t cutdetainSuperTight[9] = {
556     7.84e-03, 3.67e-03, 7.00e-03, 1.28e-02, 5.65e-03, 9.53e-03, 1.08e-02, 2.97e-02, 7.24e-03};
557     Double_t cutdetainlSuperTight[9] = {
558     7.61e-03, 3.28e-03, 6.57e-03, 1.03e-02, 5.05e-03, 8.55e-03, 1.07e-02, 2.94e-02, 4.10e-03};
559     Double_t cutdphiinSuperTight[9] = {
560     4.83e-02, 7.39e-02, 2.38e-01, 5.74e-02, 1.29e-01, 2.13e-01, 3.31e-01, 3.93e-01, 2.84e-01};
561     Double_t cutdphiinlSuperTight[9] = {
562     5.79e-02, 7.21e-02, 2.18e-01, 7.70e-02, 1.41e-01, 2.11e-01, 2.43e-01, 3.53e-01, 2.89e-01};
563     Double_t cuteseedopcorSuperTight[9] = {
564     7.32e-01, 9.77e-01, 9.83e-01, 8.55e-01, 4.31e-01, 7.35e-01, 4.18e-01, 9.99e-01, 5.89e-01};
565     Double_t cutfmishitsSuperTight[9] = {
566     3.50e+00, 1.50e+00, 5.00e-01, 5.00e-01, 5.00e-01, 5.00e-01, 5.00e-01, 5.00e-01, 5.00e-01};
567     Double_t cuthoeSuperTight[9] = {
568     9.19e-02, 4.11e-02, 1.42e-01, 3.35e-01, 3.82e-02, 1.41e-01, 4.29e-01, 4.01e-01, 3.99e-01};
569     Double_t cuthoelSuperTight[9] = {
570     7.51e-02, 3.81e-02, 1.41e-01, 3.32e-01, 3.10e-02, 1.43e-01, 2.35e-01, 3.80e-01, 1.32e-01};
571     Double_t cutip_gsfSuperTight[9] = {
572     1.42e-02, 2.66e-02, 1.06e-01, 3.38e-02, 3.23e-01, 1.07e-01, 7.74e-02, 2.32e-01, 7.80e-02};
573     Double_t cutip_gsflSuperTight[9] = {
574     1.15e-02, 2.72e-02, 8.41e-02, 2.49e-02, 4.17e-01, 1.02e-01, 7.90e-02, 1.69e-01, 4.79e-02};
575     Double_t cutiso_sumSuperTight[9] = {
576     8.95e+00, 8.18e+00, 8.75e+00, 7.47e+00, 5.43e+00, 5.87e+00, 8.16e+00, 1.02e+01, 1.78e+00};
577     Double_t cutiso_sumoetSuperTight[9] = {
578     6.45e+00, 5.14e+00, 4.99e+00, 5.21e+00, 2.65e+00, 3.12e+00, 4.52e+00, 4.72e+00, 3.68e+00};
579     Double_t cutiso_sumoetlSuperTight[9] = {
580     6.02e+00, 3.96e+00, 4.23e+00, 4.73e+00, 1.99e+00, 2.64e+00, 3.72e+00, 3.81e+00, 1.44e+00};
581     Double_t cutseeSuperTight[9] = {
582     1.09e-02, 1.05e-02, 1.05e-02, 3.24e-02, 2.81e-02, 2.95e-02, 9.77e-03, 2.75e-02, 2.95e-02};
583     Double_t cutseelSuperTight[9] = {
584     1.12e-02, 1.05e-02, 1.07e-02, 3.51e-02, 2.75e-02, 2.87e-02, 9.59e-03, 2.67e-02, 2.98e-02};
585    
586 ceballos 1.21 // HyperTight1 cuts
587     Double_t cutdcotdistHyperTight1[9] = {
588     1.48e-02, 1.50e-02, 8.25e-03, 3.16e-02, 2.85e-02, 3.15e-02, 6.62e-03, 3.48e-02, 3.63e-06};
589     Double_t cutdetainHyperTight1[9] = {
590     6.51e-03, 3.51e-03, 5.53e-03, 9.16e-03, 5.30e-03, 8.28e-03, 1.08e-02, 2.97e-02, 7.24e-03};
591     Double_t cutdetainlHyperTight1[9] = {
592     6.05e-03, 3.23e-03, 4.93e-03, 8.01e-03, 4.93e-03, 7.91e-03, 1.03e-02, 2.94e-02, 4.10e-03};
593     Double_t cutdphiinHyperTight1[9] = {
594     4.83e-02, 4.91e-02, 2.30e-01, 3.48e-02, 7.44e-02, 2.04e-01, 9.95e-02, 3.93e-01, 2.84e-01};
595     Double_t cutdphiinlHyperTight1[9] = {
596     4.74e-02, 4.51e-02, 2.18e-01, 2.99e-02, 7.37e-02, 2.11e-01, 9.99e-02, 3.53e-01, 2.89e-01};
597     Double_t cuteseedopcorHyperTight1[9] = {
598     7.72e-01, 9.90e-01, 1.01e+00, 8.55e-01, 9.11e-01, 7.72e-01, 9.17e-01, 1.06e+00, 7.63e-01};
599     Double_t cutfmishitsHyperTight1[9] = {
600     3.50e+00, 1.50e+00, 5.00e-01, 5.00e-01, 5.00e-01, 5.00e-01, 5.00e-01, 5.00e-01, 5.00e-01};
601     Double_t cuthoeHyperTight1[9] = {
602     6.17e-02, 3.70e-02, 1.41e-01, 2.91e-01, 3.82e-02, 1.34e-01, 4.19e-01, 3.87e-01, 3.93e-01};
603     Double_t cuthoelHyperTight1[9] = {
604     4.43e-02, 3.57e-02, 1.41e-01, 2.81e-01, 3.07e-02, 1.28e-01, 2.27e-01, 3.80e-01, 1.32e-01};
605     Double_t cutip_gsfHyperTight1[9] = {
606     1.21e-02, 1.76e-02, 6.01e-02, 2.96e-02, 1.74e-01, 9.70e-02, 7.74e-02, 1.33e-01, 7.80e-02};
607     Double_t cutip_gsflHyperTight1[9] = {
608     1.01e-02, 1.56e-02, 6.87e-02, 2.13e-02, 1.25e-01, 8.16e-02, 7.90e-02, 1.30e-01, 4.79e-02};
609     Double_t cutiso_sumHyperTight1[9] = {
610     7.92e+00, 6.85e+00, 7.87e+00, 6.77e+00, 4.47e+00, 5.28e+00, 6.57e+00, 1.02e+01, 1.78e+00};
611     Double_t cutiso_sumoetHyperTight1[9] = {
612     5.20e+00, 3.93e+00, 3.88e+00, 4.10e+00, 2.40e+00, 2.43e+00, 3.49e+00, 3.94e+00, 3.01e+00};
613     Double_t cutiso_sumoetlHyperTight1[9] = {
614     4.18e+00, 3.12e+00, 3.44e+00, 3.25e+00, 1.77e+00, 2.06e+00, 2.83e+00, 3.12e+00, 1.43e+00};
615     Double_t cutseeHyperTight1[9] = {
616     1.05e-02, 1.04e-02, 1.01e-02, 3.24e-02, 2.80e-02, 2.85e-02, 9.67e-03, 2.61e-02, 2.95e-02};
617     Double_t cutseelHyperTight1[9] = {
618     1.04e-02, 1.03e-02, 1.01e-02, 3.04e-02, 2.74e-02, 2.78e-02, 9.58e-03, 2.54e-02, 2.83e-02};
619    
620     // HyperTight2 cuts
621     Double_t cutdcotdistHyperTight2[9] = {
622     1.15e-02, 1.07e-02, 4.01e-03, 2.97e-02, 2.85e-02, 3.10e-02, 9.34e-04, 3.40e-02, 2.82e-07};
623     Double_t cutdetainHyperTight2[9] = {
624     5.29e-03, 2.56e-03, 4.89e-03, 7.89e-03, 5.30e-03, 7.37e-03, 8.91e-03, 9.36e-03, 5.94e-03};
625     Double_t cutdetainlHyperTight2[9] = {
626     4.48e-03, 2.59e-03, 4.42e-03, 6.54e-03, 4.93e-03, 6.98e-03, 8.49e-03, 9.06e-03, -4.81e-03};
627     Double_t cutdphiinHyperTight2[9] = {
628     2.41e-02, 3.83e-02, 1.48e-01, 2.91e-02, 3.15e-02, 1.57e-01, 8.90e-02, 1.02e-01, 2.81e-01};
629     Double_t cutdphiinlHyperTight2[9] = {
630     2.13e-02, 3.79e-02, 1.25e-01, 2.24e-02, 3.69e-02, 1.64e-01, 9.99e-02, 9.23e-02, 2.37e-01};
631     Double_t cuteseedopcorHyperTight2[9] = {
632     1.03e+00, 9.95e-01, 1.03e+00, 1.01e+00, 9.46e-01, 9.03e-01, 9.97e-01, 1.14e+00, 8.00e-01};
633     Double_t cutfmishitsHyperTight2[9] = {
634     1.50e+00, 1.50e+00, 5.00e-01, 5.00e-01, 5.00e-01, 5.00e-01, 5.00e-01, 5.00e-01, -5.00e-01};
635     Double_t cuthoeHyperTight2[9] = {
636     4.94e-02, 3.45e-02, 1.40e-01, 2.02e-01, 3.82e-02, 1.19e-01, 1.23e-01, 3.82e-01, 2.50e-01};
637     Double_t cuthoelHyperTight2[9] = {
638     4.04e-02, 3.42e-02, 1.31e-01, 1.85e-01, 3.01e-02, 1.27e-01, 2.27e-01, 3.80e-01, 1.32e-01};
639     Double_t cutip_gsfHyperTight2[9] = {
640     1.14e-02, 1.38e-02, 5.29e-02, 1.87e-02, 1.31e-01, 8.63e-02, 7.74e-02, 1.04e-01, 2.42e-02};
641     Double_t cutip_gsflHyperTight2[9] = {
642     9.83e-03, 1.35e-02, 4.27e-02, 1.72e-02, 1.25e-01, 7.92e-02, 7.90e-02, 1.30e-01, 3.40e-02};
643     Double_t cutiso_sumHyperTight2[9] = {
644     6.40e+00, 5.77e+00, 6.54e+00, 5.22e+00, 3.86e+00, 4.63e+00, 6.31e+00, 1.02e+01, 1.78e+00};
645     Double_t cutiso_sumoetHyperTight2[9] = {
646     4.03e+00, 3.03e+00, 3.24e+00, 3.13e+00, 2.05e+00, 2.01e+00, 2.99e+00, 3.44e+00, 2.76e+00};
647     Double_t cutiso_sumoetlHyperTight2[9] = {
648     3.08e+00, 2.31e+00, 2.84e+00, 2.53e+00, 1.65e+00, 1.72e+00, 2.34e+00, 3.11e+00, 1.35e+00};
649     Double_t cutseeHyperTight2[9] = {
650     1.03e-02, 1.03e-02, 9.88e-03, 3.03e-02, 2.79e-02, 2.79e-02, 9.67e-03, 2.52e-02, 2.58e-02};
651     Double_t cutseelHyperTight2[9] = {
652     1.02e-02, 1.02e-02, 9.80e-03, 2.90e-02, 2.74e-02, 2.75e-02, 9.58e-03, 2.49e-02, 2.50e-02};
653    
654     // HyperTight3 cuts
655     Double_t cutdcotdistHyperTight3[9] = {
656     9.63e-03, 5.11e-03, 1.95e-04, 2.97e-02, 2.85e-02, 2.18e-02, 2.61e-05, 2.57e-02, 2.82e-07};
657     Double_t cutdetainHyperTight3[9] = {
658     4.86e-03, 2.29e-03, 4.40e-03, 7.79e-03, 4.07e-03, 6.33e-03, 7.70e-03, 7.93e-03, 5.94e-03};
659     Double_t cutdetainlHyperTight3[9] = {
660     4.48e-03, 2.30e-03, 4.14e-03, 6.04e-03, 3.87e-03, 6.09e-03, 7.97e-03, 8.04e-03, -4.81e-03};
661     Double_t cutdphiinHyperTight3[9] = {
662     2.41e-02, 2.88e-02, 7.39e-02, 2.91e-02, 1.91e-02, 1.14e-01, 3.61e-02, 8.92e-02, 2.81e-01};
663     Double_t cutdphiinlHyperTight3[9] = {
664     1.95e-02, 3.42e-02, 8.06e-02, 2.22e-02, 2.26e-02, 9.73e-02, 4.51e-02, 9.23e-02, 2.37e-01};
665     Double_t cuteseedopcorHyperTight3[9] = {
666     1.07e+00, 1.01e+00, 1.08e+00, 1.01e+00, 9.69e-01, 9.10e-01, 1.04e+00, 1.20e+00, 8.00e-01};
667     Double_t cutfmishitsHyperTight3[9] = {
668     5.00e-01, 1.50e+00, 5.00e-01, 5.00e-01, 5.00e-01, 5.00e-01, 5.00e-01, 5.00e-01, -5.00e-01};
669     Double_t cuthoeHyperTight3[9] = {
670     3.52e-02, 3.45e-02, 1.33e-01, 1.88e-01, 2.72e-02, 1.19e-01, 9.28e-02, 2.46e-01, 2.50e-01};
671     Double_t cuthoelHyperTight3[9] = {
672     4.04e-02, 3.40e-02, 1.31e-01, 1.84e-01, 2.64e-02, 1.18e-01, 9.76e-02, 2.53e-01, 1.32e-01};
673     Double_t cutip_gsfHyperTight3[9] = {
674     1.14e-02, 1.26e-02, 3.79e-02, 1.68e-02, 1.21e-01, 5.29e-02, 7.74e-02, 3.35e-02, 2.42e-02};
675     Double_t cutip_gsflHyperTight3[9] = {
676     9.83e-03, 1.18e-02, 3.59e-02, 1.56e-02, 1.20e-01, 5.36e-02, 7.90e-02, 2.88e-02, 3.40e-02};
677     Double_t cutiso_sumHyperTight3[9] = {
678     5.40e+00, 5.41e+00, 5.88e+00, 4.32e+00, 3.86e+00, 4.33e+00, 5.87e+00, 9.05e+00, 1.78e+00};
679     Double_t cutiso_sumoetHyperTight3[9] = {
680     3.03e+00, 2.50e+00, 2.58e+00, 2.44e+00, 1.91e+00, 1.76e+00, 2.92e+00, 3.13e+00, 2.76e+00};
681     Double_t cutiso_sumoetlHyperTight3[9] = {
682     2.36e+00, 2.02e+00, 2.29e+00, 1.89e+00, 1.65e+00, 1.69e+00, 2.03e+00, 2.79e+00, 1.35e+00};
683     Double_t cutseeHyperTight3[9] = {
684     1.03e-02, 1.01e-02, 9.84e-03, 2.89e-02, 2.74e-02, 2.73e-02, 9.47e-03, 2.44e-02, 2.58e-02};
685     Double_t cutseelHyperTight3[9] = {
686     1.02e-02, 1.00e-02, 9.73e-03, 2.79e-02, 2.73e-02, 2.69e-02, 9.40e-03, 2.46e-02, 2.50e-02};
687    
688     // HyperTight4 cuts
689     Double_t cutdcotdistHyperTight4[9] = {
690     2.70e-04, 1.43e-04, 1.95e-04, 2.64e-03, 2.82e-02, 1.64e-02, 2.61e-05, 2.57e-02, 2.82e-07};
691     Double_t cutdetainHyperTight4[9] = {
692     2.44e-03, 1.67e-03, 2.26e-03, 3.43e-03, 3.51e-03, 3.52e-03, 2.98e-03, 4.79e-03, 5.94e-03};
693     Double_t cutdetainlHyperTight4[9] = {
694     2.34e-03, 1.29e-03, 2.30e-03, 3.30e-03, 3.61e-03, 3.84e-03, 2.53e-03, 3.66e-03, -4.81e-03};
695     Double_t cutdphiinHyperTight4[9] = {
696     8.44e-03, 5.21e-03, 2.18e-02, 1.39e-02, 7.82e-03, 1.52e-02, 2.59e-02, 3.87e-02, 2.81e-01};
697     Double_t cutdphiinlHyperTight4[9] = {
698     5.77e-03, 3.20e-03, 2.85e-02, 2.22e-02, 7.00e-03, 1.84e-02, 2.91e-02, 4.40e-02, 2.37e-01};
699     Double_t cuteseedopcorHyperTight4[9] = {
700     1.15e+00, 1.01e+00, 1.21e+00, 1.07e+00, 9.69e-01, 9.10e-01, 1.08e+00, 1.36e+00, 8.00e-01};
701     Double_t cutfmishitsHyperTight4[9] = {
702     5.00e-01, 5.00e-01, 5.00e-01, 5.00e-01, 5.00e-01, 5.00e-01, 5.00e-01, 5.00e-01, -5.00e-01};
703     Double_t cuthoeHyperTight4[9] = {
704     2.39e-02, 2.68e-02, 2.12e-02, 1.03e-01, 9.92e-03, 7.07e-02, 7.12e-02, 1.48e-01, 2.50e-01};
705     Double_t cuthoelHyperTight4[9] = {
706     2.87e-02, 1.94e-02, 2.16e-02, 5.68e-02, 1.35e-02, 4.04e-02, 7.98e-02, 1.50e-01, 1.32e-01};
707     Double_t cutip_gsfHyperTight4[9] = {
708     7.61e-03, 5.22e-03, 3.79e-02, 1.02e-02, 4.62e-02, 1.82e-02, 7.74e-02, 3.35e-02, 2.42e-02};
709     Double_t cutip_gsflHyperTight4[9] = {
710     7.81e-03, 4.25e-03, 3.08e-02, 1.04e-02, 2.35e-02, 2.45e-02, 7.90e-02, 2.88e-02, 3.40e-02};
711     Double_t cutiso_sumHyperTight4[9] = {
712     5.40e+00, 5.41e+00, 5.88e+00, 4.32e+00, 3.86e+00, 4.33e+00, 5.86e+00, 9.05e+00, 1.78e+00};
713     Double_t cutiso_sumoetHyperTight4[9] = {
714     2.53e+00, 2.10e+00, 1.87e+00, 1.84e+00, 1.79e+00, 1.61e+00, 2.53e+00, 1.98e+00, 2.76e+00};
715     Double_t cutiso_sumoetlHyperTight4[9] = {
716     2.28e+00, 2.02e+00, 2.04e+00, 1.69e+00, 1.65e+00, 1.61e+00, 2.03e+00, 1.82e+00, 1.35e+00};
717     Double_t cutseeHyperTight4[9] = {
718     9.99e-03, 9.61e-03, 9.65e-03, 2.75e-02, 2.61e-02, 2.64e-02, 9.18e-03, 2.44e-02, 2.58e-02};
719     Double_t cutseelHyperTight4[9] = {
720     9.66e-03, 9.69e-03, 9.58e-03, 2.73e-02, 2.66e-02, 2.66e-02, 8.64e-03, 2.46e-02, 2.50e-02};
721    
722 ceballos 1.17 Double_t cutdcotdist[9];
723     Double_t cutdetain[9];
724     Double_t cutdetainl[9];
725     Double_t cutdphiin[9];
726     Double_t cutdphiinl[9];
727     Double_t cuteseedopcor[9];
728     Double_t cutfmishits[9];
729     Double_t cuthoe[9];
730     Double_t cuthoel[9];
731     Double_t cutip_gsf[9];
732     Double_t cutip_gsfl[9];
733     Double_t cutiso_sum[9];
734     Double_t cutiso_sumoet[9];
735     Double_t cutiso_sumoetl[9];
736     Double_t cutsee[9];
737     Double_t cutseel[9];
738     if (typeCuts == 0) {
739     memcpy(cutdcotdist ,cutdcotdistMedium ,sizeof(cutdcotdistMedium));
740     memcpy(cutdetain ,cutdetainMedium ,sizeof(cutdetainMedium));
741     memcpy(cutdetainl ,cutdetainlMedium ,sizeof(cutdetainlMedium));
742     memcpy(cutdphiin ,cutdphiinMedium ,sizeof(cutdphiinMedium));
743     memcpy(cutdphiinl ,cutdphiinlMedium ,sizeof(cutdphiinlMedium));
744     memcpy(cuteseedopcor ,cuteseedopcorMedium ,sizeof(cuteseedopcorMedium));
745     memcpy(cutfmishits ,cutfmishitsMedium ,sizeof(cutfmishitsMedium));
746     memcpy(cuthoe ,cuthoeMedium ,sizeof(cuthoeMedium));
747     memcpy(cuthoel ,cuthoelMedium ,sizeof(cuthoelMedium));
748     memcpy(cutip_gsf ,cutip_gsfMedium ,sizeof(cutip_gsfMedium));
749     memcpy(cutip_gsfl ,cutip_gsflMedium ,sizeof(cutip_gsflMedium));
750     memcpy(cutiso_sum ,cutiso_sumMedium ,sizeof(cutiso_sumMedium));
751     memcpy(cutiso_sumoet ,cutiso_sumoetMedium ,sizeof(cutiso_sumoetMedium));
752     memcpy(cutiso_sumoetl,cutiso_sumoetlMedium,sizeof(cutiso_sumoetlMedium));
753     memcpy(cutsee ,cutseeMedium ,sizeof(cutseeMedium));
754     memcpy(cutseel ,cutseelMedium ,sizeof(cutseelMedium));
755     }
756     else if(typeCuts == 1) {
757     memcpy(cutdcotdist ,cutdcotdistTight ,sizeof(cutdcotdistTight));
758     memcpy(cutdetain ,cutdetainTight ,sizeof(cutdetainTight));
759     memcpy(cutdetainl ,cutdetainlTight ,sizeof(cutdetainlTight));
760     memcpy(cutdphiin ,cutdphiinTight ,sizeof(cutdphiinTight));
761     memcpy(cutdphiinl ,cutdphiinlTight ,sizeof(cutdphiinlTight));
762     memcpy(cuteseedopcor ,cuteseedopcorTight ,sizeof(cuteseedopcorTight));
763     memcpy(cutfmishits ,cutfmishitsTight ,sizeof(cutfmishitsTight));
764     memcpy(cuthoe ,cuthoeTight ,sizeof(cuthoeTight));
765     memcpy(cuthoel ,cuthoelTight ,sizeof(cuthoelTight));
766     memcpy(cutip_gsf ,cutip_gsfTight ,sizeof(cutip_gsfTight));
767     memcpy(cutip_gsfl ,cutip_gsflTight ,sizeof(cutip_gsflTight));
768     memcpy(cutiso_sum ,cutiso_sumTight ,sizeof(cutiso_sumTight));
769     memcpy(cutiso_sumoet ,cutiso_sumoetTight ,sizeof(cutiso_sumoetTight));
770     memcpy(cutiso_sumoetl,cutiso_sumoetlTight,sizeof(cutiso_sumoetlTight));
771     memcpy(cutsee ,cutseeTight ,sizeof(cutseeTight));
772     memcpy(cutseel ,cutseelTight ,sizeof(cutseelTight));
773 ceballos 1.5 }
774 ceballos 1.21 else if(typeCuts == 2) {
775 ceballos 1.17 memcpy(cutdcotdist ,cutdcotdistSuperTight ,sizeof(cutdcotdistSuperTight));
776     memcpy(cutdetain ,cutdetainSuperTight ,sizeof(cutdetainSuperTight));
777     memcpy(cutdetainl ,cutdetainlSuperTight ,sizeof(cutdetainlSuperTight));
778     memcpy(cutdphiin ,cutdphiinSuperTight ,sizeof(cutdphiinSuperTight));
779     memcpy(cutdphiinl ,cutdphiinlSuperTight ,sizeof(cutdphiinlSuperTight));
780     memcpy(cuteseedopcor ,cuteseedopcorSuperTight ,sizeof(cuteseedopcorSuperTight));
781     memcpy(cutfmishits ,cutfmishitsSuperTight ,sizeof(cutfmishitsSuperTight));
782     memcpy(cuthoe ,cuthoeSuperTight ,sizeof(cuthoeSuperTight));
783     memcpy(cuthoel ,cuthoelSuperTight ,sizeof(cuthoelSuperTight));
784     memcpy(cutip_gsf ,cutip_gsfSuperTight ,sizeof(cutip_gsfSuperTight));
785     memcpy(cutip_gsfl ,cutip_gsflSuperTight ,sizeof(cutip_gsflSuperTight));
786     memcpy(cutiso_sum ,cutiso_sumSuperTight ,sizeof(cutiso_sumSuperTight));
787     memcpy(cutiso_sumoet ,cutiso_sumoetSuperTight ,sizeof(cutiso_sumoetSuperTight));
788     memcpy(cutiso_sumoetl,cutiso_sumoetlSuperTight,sizeof(cutiso_sumoetlSuperTight));
789     memcpy(cutsee ,cutseeSuperTight ,sizeof(cutseeSuperTight));
790     memcpy(cutseel ,cutseelSuperTight ,sizeof(cutseelSuperTight));
791     }
792 ceballos 1.21 else if(typeCuts == 3) {
793     memcpy(cutdcotdist ,cutdcotdistHyperTight1 ,sizeof(cutdcotdistHyperTight1));
794     memcpy(cutdetain ,cutdetainHyperTight1 ,sizeof(cutdetainHyperTight1));
795     memcpy(cutdetainl ,cutdetainlHyperTight1 ,sizeof(cutdetainlHyperTight1));
796     memcpy(cutdphiin ,cutdphiinHyperTight1 ,sizeof(cutdphiinHyperTight1));
797     memcpy(cutdphiinl ,cutdphiinlHyperTight1 ,sizeof(cutdphiinlHyperTight1));
798     memcpy(cuteseedopcor ,cuteseedopcorHyperTight1 ,sizeof(cuteseedopcorHyperTight1));
799     memcpy(cutfmishits ,cutfmishitsHyperTight1 ,sizeof(cutfmishitsHyperTight1));
800     memcpy(cuthoe ,cuthoeHyperTight1 ,sizeof(cuthoeHyperTight1));
801     memcpy(cuthoel ,cuthoelHyperTight1 ,sizeof(cuthoelHyperTight1));
802     memcpy(cutip_gsf ,cutip_gsfHyperTight1 ,sizeof(cutip_gsfHyperTight1));
803     memcpy(cutip_gsfl ,cutip_gsflHyperTight1 ,sizeof(cutip_gsflHyperTight1));
804     memcpy(cutiso_sum ,cutiso_sumHyperTight1 ,sizeof(cutiso_sumHyperTight1));
805     memcpy(cutiso_sumoet ,cutiso_sumoetHyperTight1 ,sizeof(cutiso_sumoetHyperTight1));
806     memcpy(cutiso_sumoetl,cutiso_sumoetlHyperTight1,sizeof(cutiso_sumoetlHyperTight1));
807     memcpy(cutsee ,cutseeHyperTight1 ,sizeof(cutseeHyperTight1));
808     memcpy(cutseel ,cutseelHyperTight1 ,sizeof(cutseelHyperTight1));
809     }
810     else if(typeCuts == 4) {
811     memcpy(cutdcotdist ,cutdcotdistHyperTight2 ,sizeof(cutdcotdistHyperTight2));
812     memcpy(cutdetain ,cutdetainHyperTight2 ,sizeof(cutdetainHyperTight2));
813     memcpy(cutdetainl ,cutdetainlHyperTight2 ,sizeof(cutdetainlHyperTight2));
814     memcpy(cutdphiin ,cutdphiinHyperTight2 ,sizeof(cutdphiinHyperTight2));
815     memcpy(cutdphiinl ,cutdphiinlHyperTight2 ,sizeof(cutdphiinlHyperTight2));
816     memcpy(cuteseedopcor ,cuteseedopcorHyperTight2 ,sizeof(cuteseedopcorHyperTight2));
817     memcpy(cutfmishits ,cutfmishitsHyperTight2 ,sizeof(cutfmishitsHyperTight2));
818     memcpy(cuthoe ,cuthoeHyperTight2 ,sizeof(cuthoeHyperTight2));
819     memcpy(cuthoel ,cuthoelHyperTight2 ,sizeof(cuthoelHyperTight2));
820     memcpy(cutip_gsf ,cutip_gsfHyperTight2 ,sizeof(cutip_gsfHyperTight2));
821     memcpy(cutip_gsfl ,cutip_gsflHyperTight2 ,sizeof(cutip_gsflHyperTight2));
822     memcpy(cutiso_sum ,cutiso_sumHyperTight2 ,sizeof(cutiso_sumHyperTight2));
823     memcpy(cutiso_sumoet ,cutiso_sumoetHyperTight2 ,sizeof(cutiso_sumoetHyperTight2));
824     memcpy(cutiso_sumoetl,cutiso_sumoetlHyperTight2,sizeof(cutiso_sumoetlHyperTight2));
825     memcpy(cutsee ,cutseeHyperTight2 ,sizeof(cutseeHyperTight2));
826     memcpy(cutseel ,cutseelHyperTight2 ,sizeof(cutseelHyperTight2));
827     }
828     else if(typeCuts == 5) {
829     memcpy(cutdcotdist ,cutdcotdistHyperTight3 ,sizeof(cutdcotdistHyperTight3));
830     memcpy(cutdetain ,cutdetainHyperTight3 ,sizeof(cutdetainHyperTight3));
831     memcpy(cutdetainl ,cutdetainlHyperTight3 ,sizeof(cutdetainlHyperTight3));
832     memcpy(cutdphiin ,cutdphiinHyperTight3 ,sizeof(cutdphiinHyperTight3));
833     memcpy(cutdphiinl ,cutdphiinlHyperTight3 ,sizeof(cutdphiinlHyperTight3));
834     memcpy(cuteseedopcor ,cuteseedopcorHyperTight3 ,sizeof(cuteseedopcorHyperTight3));
835     memcpy(cutfmishits ,cutfmishitsHyperTight3 ,sizeof(cutfmishitsHyperTight3));
836     memcpy(cuthoe ,cuthoeHyperTight3 ,sizeof(cuthoeHyperTight3));
837     memcpy(cuthoel ,cuthoelHyperTight3 ,sizeof(cuthoelHyperTight3));
838     memcpy(cutip_gsf ,cutip_gsfHyperTight3 ,sizeof(cutip_gsfHyperTight3));
839     memcpy(cutip_gsfl ,cutip_gsflHyperTight3 ,sizeof(cutip_gsflHyperTight3));
840     memcpy(cutiso_sum ,cutiso_sumHyperTight3 ,sizeof(cutiso_sumHyperTight3));
841     memcpy(cutiso_sumoet ,cutiso_sumoetHyperTight3 ,sizeof(cutiso_sumoetHyperTight3));
842     memcpy(cutiso_sumoetl,cutiso_sumoetlHyperTight3,sizeof(cutiso_sumoetlHyperTight3));
843     memcpy(cutsee ,cutseeHyperTight3 ,sizeof(cutseeHyperTight3));
844     memcpy(cutseel ,cutseelHyperTight3 ,sizeof(cutseelHyperTight3));
845     }
846     else if(typeCuts == 6) {
847     memcpy(cutdcotdist ,cutdcotdistHyperTight4 ,sizeof(cutdcotdistHyperTight4));
848     memcpy(cutdetain ,cutdetainHyperTight4 ,sizeof(cutdetainHyperTight4));
849     memcpy(cutdetainl ,cutdetainlHyperTight4 ,sizeof(cutdetainlHyperTight4));
850     memcpy(cutdphiin ,cutdphiinHyperTight4 ,sizeof(cutdphiinHyperTight4));
851     memcpy(cutdphiinl ,cutdphiinlHyperTight4 ,sizeof(cutdphiinlHyperTight4));
852     memcpy(cuteseedopcor ,cuteseedopcorHyperTight4 ,sizeof(cuteseedopcorHyperTight4));
853     memcpy(cutfmishits ,cutfmishitsHyperTight4 ,sizeof(cutfmishitsHyperTight4));
854     memcpy(cuthoe ,cuthoeHyperTight4 ,sizeof(cuthoeHyperTight4));
855     memcpy(cuthoel ,cuthoelHyperTight4 ,sizeof(cuthoelHyperTight4));
856     memcpy(cutip_gsf ,cutip_gsfHyperTight4 ,sizeof(cutip_gsfHyperTight4));
857     memcpy(cutip_gsfl ,cutip_gsflHyperTight4 ,sizeof(cutip_gsflHyperTight4));
858     memcpy(cutiso_sum ,cutiso_sumHyperTight4 ,sizeof(cutiso_sumHyperTight4));
859     memcpy(cutiso_sumoet ,cutiso_sumoetHyperTight4 ,sizeof(cutiso_sumoetHyperTight4));
860     memcpy(cutiso_sumoetl,cutiso_sumoetlHyperTight4,sizeof(cutiso_sumoetlHyperTight4));
861     memcpy(cutsee ,cutseeHyperTight4 ,sizeof(cutseeHyperTight4));
862     memcpy(cutseel ,cutseelHyperTight4 ,sizeof(cutseelHyperTight4));
863     }
864     else {
865     return 0;
866     }
867 ceballos 1.17 int result = 0;
868    
869     const int ncuts = 10;
870     std::vector<bool> cut_results(ncuts, false);
871    
872     float iso_sum = tkIso + ecalIso + hcalIso;
873     if(fabs(scEta)>1.5)
874     iso_sum += (fabs(scEta)-1.5)*1.09;
875    
876     float iso_sumoet = iso_sum*(40./scEt);
877    
878     float eseedopincor = eSeedOverPin + fBrem;
879     if(fBrem < 0)
880     eseedopincor = eSeedOverPin;
881 ceballos 1.4
882 ceballos 1.17 float dist = (TMath::Abs(ele->ConvPartnerDist()) == -9999.? 9999:TMath::Abs(ele->ConvPartnerDist()));
883     float dcot = (TMath::Abs(ele->ConvPartnerDCotTheta()) == -9999.? 9999:TMath::Abs(ele->ConvPartnerDCotTheta()));
884 ceballos 1.4
885 ceballos 1.17 float dcotdistcomb = ((0.04 - std::max(dist, dcot)) > 0?(0.04 - std::max(dist, dcot)):0);
886    
887     Double_t ip = 99999;
888     for(UInt_t i0 = 0; i0 < vertices->GetEntries(); i0++) {
889     if(vertices->At(i0)->NTracks() > 0){
890     Double_t pD0 = ele->GsfTrk()->D0Corrected(*vertices->At(i0));
891     ip = TMath::Abs(pD0);
892     break;
893 ceballos 1.4 }
894 ceballos 1.17 }
895    
896     for (int cut=0; cut<ncuts; cut++) {
897     switch (cut) {
898     case 0:
899     cut_results[cut] = compute_cut(fabs(deltaEtaIn), scEt, cutdetainl[cat], cutdetain[cat]);
900     break;
901     case 1:
902     cut_results[cut] = compute_cut(fabs(deltaPhiIn), scEt, cutdphiinl[cat], cutdphiin[cat]);
903     break;
904     case 2:
905     cut_results[cut] = (eseedopincor > cuteseedopcor[cat]);
906     break;
907     case 3:
908     cut_results[cut] = compute_cut(hOverE, scEt, cuthoel[cat], cuthoe[cat]);
909     break;
910     case 4:
911     cut_results[cut] = compute_cut(sigmaee, scEt, cutseel[cat], cutsee[cat]);
912     break;
913     case 5:
914     cut_results[cut] = compute_cut(iso_sumoet, scEt, cutiso_sumoetl[cat], cutiso_sumoet[cat]);
915     break;
916     case 6:
917     cut_results[cut] = (iso_sum < cutiso_sum[cat]);
918     break;
919     case 7:
920     cut_results[cut] = compute_cut(fabs(ip), scEt, cutip_gsfl[cat], cutip_gsf[cat]);
921     break;
922     case 8:
923     cut_results[cut] = (mishits < cutfmishits[cat]);
924     break;
925     case 9:
926     cut_results[cut] = (dcotdistcomb < cutdcotdist[cat]);
927     break;
928 ceballos 1.4 }
929 ceballos 1.17 }
930    
931     // ID part
932     if (cut_results[0] & cut_results[1] & cut_results[2] & cut_results[3] & cut_results[4])
933     result = result + 1;
934    
935     // ISO part
936     if (cut_results[5] & cut_results[6])
937     result = result + 2;
938    
939     // IP part
940     if (cut_results[7])
941     result = result + 8;
942    
943     // Conversion part
944     if (cut_results[8] and cut_results[9])
945     result = result + 4;
946    
947     return result;
948     }
949 ceballos 1.4
950 ceballos 1.17 //--------------------------------------------------------------------------------------------------
951     bool ElectronTools::compute_cut(double x, double et, double cut_min, double cut_max, bool gtn) {
952 ceballos 1.4
953 ceballos 1.17 float et_min = 10;
954     float et_max = 40;
955 ceballos 1.4
956 ceballos 1.17 bool accept = false;
957     float cut = cut_max; // the cut at et=40 GeV
958 ceballos 1.4
959 ceballos 1.17 if(et < et_max) {
960     cut = cut_min + (1/et_min - 1/et)*(cut_max - cut_min)/(1/et_min - 1/et_max);
961     }
962    
963     if(et < et_min) {
964     cut = cut_min;
965     }
966 ceballos 1.4
967 ceballos 1.17 if(gtn) { // useful for e/p cut which is gt
968     accept = (x >= cut);
969     }
970     else {
971     accept = (x <= cut);
972     }
973 ceballos 1.4
974 ceballos 1.17 return accept;
975 ceballos 1.4 }