ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Utils/src/ElectronTools.cc
(Generate patch)

Comparing UserCode/MitPhysics/Utils/src/ElectronTools.cc (file contents):
Revision 1.6 by ceballos, Thu May 27 09:24:50 2010 UTC vs.
Revision 1.33 by sixie, Sat Dec 31 23:17:40 2011 UTC

# Line 3 | Line 3
3   #include "MitPhysics/Utils/interface/ElectronTools.h"
4   #include "MitAna/DataTree/interface/StableData.h"
5   #include <TFile.h>
6 + #include "MitPhysics/ElectronLikelihood/interface/ElectronLikelihood.h"
7 + #include "MitPhysics/ElectronLikelihood/interface/LikelihoodSwitches.h"
8 + #include "MitPhysics/ElectronLikelihood/interface/LikelihoodMeasurements.h"
9  
10   ClassImp(mithep::ElectronTools)
11  
# Line 35 | Line 38 | Bool_t ElectronTools::PassCustomID(const
38      {0.3, 0.92, 0.211, 0.0, 0.42, 0.88, 0.68, 0.0},             //eoverp
39      {0.8,0.2,0,0,0,0,0,0}};                                     //extra cuts fbrem and E_Over_P
40  
41 +  Double_t VBTFWorkingPointFakeable[6][8] = {
42 +    {0.12,  0.12,  0.12,  0.12,  0.10,   0.10,   0.10,   0.10  }, //hovere
43 +    {0.01,  0.01,  0.01,  0.01,  0.03,   0.03,   0.03,   0.03  }, //sigmaetaeta
44 +    {0.15,  0.15,  0.15,  0.15,  0.10,   0.10,   0.10,   0.10  }, //deltaphiin
45 +    {0.007, 0.007, 0.007, 0.007, 0.009,  0.009,  0.009,  0.009 }, //deltaetain
46 +    {0.0,   0.0,   0.0,   0.0,   0.0,    0.0,    0.0,    0.0   }, //eoverp
47 +    {0.0,   0.0,   0,     0,     0,      0,      0,      0     }  //extra cuts fbrem and E_Over_P
48 +  };            
49 +
50    Double_t VBTFWorkingPoint95[6][8] = {
51 <    {0.5,   0.5,   0.5,   0.5,   0.07,   0.07,   0.07,   0.07  }, //hovere
51 >    {0.15,  0.15,  0.15,  0.15,  0.07,   0.07,   0.07,   0.07  }, //hovere
52      {0.01,  0.01,  0.01,  0.01,  0.03,   0.03,   0.03,   0.03  }, //sigmaetaeta
53      {0.8,   0.8,   0.8,   0.8,   0.7,    0.7,    0.7,    0.7   }, //deltaphiin
54      {0.007, 0.007, 0.007, 0.007, 0.010,  0.010,  0.010,  0.010 }, //deltaetain
# Line 63 | Line 75 | Bool_t ElectronTools::PassCustomID(const
75    };            
76  
77    Double_t VBTFWorkingPoint80[6][8] = {
78 <    {0.04,  0.04,  0.04,  0.04,  0.025,  0.025,  0.025,  0.025}, //hovere
78 >    {0.04,  0.04,  0.04,  0.04,  0.10,   0.10,   0.10,   0.10 }, //hovere
79      {0.01,  0.01,  0.01,  0.01,  0.03,   0.03,   0.03,   0.03 }, //sigmaetaeta
80      {0.06,  0.06,  0.06,  0.06,  0.03,   0.03,   0.03,   0.03 }, //deltaphiin
81      {0.004, 0.004, 0.004, 0.004, 0.007,  0.007,  0.007,  0.007}, //deltaetain
# Line 75 | Line 87 | Bool_t ElectronTools::PassCustomID(const
87      {0.025, 0.025, 0.025, 0.025, 0.012,  0.012,  0.012,  0.012}, //hovere
88      {0.01,  0.01,  0.01,  0.01,  0.03,   0.03,   0.03,   0.03 }, //sigmaetaeta
89      {0.03,  0.03,  0.03,  0.03,  0.02,   0.02,   0.02,   0.02 }, //deltaphiin
90 <    {0.003, 0.003, 0.003, 0.003, 0.005,  0.005,  0.005,  0.005}, //deltaetain
90 >    {0.004, 0.004, 0.004, 0.004, 0.005,  0.005,  0.005,  0.005}, //deltaetain
91 >    {0.0,   0.0,   0.0,   0.0,   0.0,    0.0,    0.0,    0.0  }, //eoverp
92 >    {0.0,   0.0,   0,     0,     0,      0,      0,      0    }  //extra cuts fbrem and E_Over_P
93 >  };            
94 >
95 >  Double_t VBTFWorkingPoint80NoHOverEE[6][8] = {
96 >    {0.04,  0.04,  0.04,  0.04,  0.10,   0.10,   0.10,   0.10 }, //hovere
97 >    {0.01,  0.01,  0.01,  0.01,  0.03,   0.03,   0.03,   0.03 }, //sigmaetaeta
98 >    {0.06,  0.06,  0.06,  0.06,  0.03,   0.03,   0.03,   0.03 }, //deltaphiin
99 >    {0.004, 0.004, 0.004, 0.004, 0.007,  0.007,  0.007,  0.007}, //deltaetain
100 >    {0.0,   0.0,   0.0,   0.0,   0.0,    0.0,    0.0,    0.0  }, //eoverp
101 >    {0.0,   0.0,   0,     0,     0,      0,      0,      0    }  //extra cuts fbrem and E_Over_P
102 >  };            
103 >
104 >  Double_t VBTFWorkingPoint70NoHOverEE[6][8] = {
105 >    {0.025, 0.025, 0.025, 0.025, 0.10,   0.10,   0.10,   0.10 }, //hovere
106 >    {0.01,  0.01,  0.01,  0.01,  0.03,   0.03,   0.03,   0.03 }, //sigmaetaeta
107 >    {0.03,  0.03,  0.03,  0.03,  0.02,   0.02,   0.02,   0.02 }, //deltaphiin
108 >    {0.004, 0.004, 0.004, 0.004, 0.005,  0.005,  0.005,  0.005}, //deltaetain
109      {0.0,   0.0,   0.0,   0.0,   0.0,    0.0,    0.0,    0.0  }, //eoverp
110      {0.0,   0.0,   0,     0,     0,      0,      0,      0    }  //extra cuts fbrem and E_Over_P
111    };            
# Line 87 | Line 117 | Bool_t ElectronTools::PassCustomID(const
117      case kCustomIdLoose:
118        memcpy(fCuts,loosecuts,sizeof(fCuts));
119        break;
120 +    case kVBTFWorkingPointFakeableId:
121 +      memcpy(fCuts,VBTFWorkingPointFakeable,sizeof(fCuts));
122 +      break;
123      case kVBTFWorkingPoint95Id:
124        memcpy(fCuts,VBTFWorkingPoint95,sizeof(fCuts));
125        break;
# Line 99 | Line 132 | Bool_t ElectronTools::PassCustomID(const
132      case kVBTFWorkingPoint80Id:
133        memcpy(fCuts,VBTFWorkingPoint80,sizeof(fCuts));
134        break;
135 +    case kVBTFWorkingPointLowPtId:
136 +      if(ele->Pt() < 20)
137 +        memcpy(fCuts,VBTFWorkingPoint70NoHOverEE,sizeof(fCuts));
138 +      else
139 +        memcpy(fCuts,VBTFWorkingPoint80NoHOverEE,sizeof(fCuts));
140 +      break;
141      case kVBTFWorkingPoint70Id:
142        memcpy(fCuts,VBTFWorkingPoint70,sizeof(fCuts));
143        break;
# Line 107 | Line 146 | Bool_t ElectronTools::PassCustomID(const
146        break;
147    }
148  
110
149    // Based on RecoEgamma/ElectronIdentification/src/CutBasedElectronID.cc.
150    Double_t eOverP = ele->ESuperClusterOverP();
151    Double_t fBrem  = ele->FBrem();
152  
153 <  if ((eOverP < fCuts[5][0]) && (fBrem < fCuts[5][1]))
153 >  if ( (fCuts[5][0]>0.0) && (eOverP < fCuts[5][0]) && (fCuts[5][1]>0.0) && (fBrem < fCuts[5][1]))
154      return kFALSE;
155  
156 <  if (eOverP < fCuts[5][2]*(1-fBrem))
156 >  if ( (fCuts[5][2]>0.0) && (eOverP < fCuts[5][2]*(1-fBrem)))
157      return kFALSE;
158  
159    Int_t cat = 2;
# Line 123 | Line 161 | Bool_t ElectronTools::PassCustomID(const
161      cat=1;
162    else if (eOverP < 1.2 && eOverP > 0.8)
163      cat=0;
164 <
165 <  Double_t eSeedOverPin = ele->ESeedClusterOverPIn();
164 >  
165 >  if(ele->SCluster() == 0)
166 >    return kFALSE;
167 >  Double_t eSeedOverPin = ele->ESeedClusterOverPIn();
168    Double_t hOverE       = ele->HadronicOverEm();
169    Double_t sigmaee      = ele->CoviEtaiEta();
170    Double_t deltaPhiIn   = TMath::Abs(ele->DeltaPhiSuperClusterTrackAtVtx());
# Line 133 | Line 173 | Bool_t ElectronTools::PassCustomID(const
173    Int_t eb = 1;
174    if (ele->IsEB())
175      eb = 0;
176 <
176 >
177    if (hOverE>fCuts[0][cat+4*eb])
178      return kFALSE;
179  
# Line 149 | Line 189 | Bool_t ElectronTools::PassCustomID(const
189    if(eSeedOverPin<fCuts[4][cat+4*eb])
190      return kFALSE;
191  
192 +  // Cuts only for pt<20 region and kVBTFWorkingPointLowPtId
193 +  if(ele->Pt() < 20 && idType == kVBTFWorkingPointLowPtId) {
194 +    Bool_t isGoodLowPtEl = fBrem > 0.15 ||
195 +                          (ele->SCluster()->AbsEta() < 1.0 && eOverP > 0.95);
196 +    if(!isGoodLowPtEl) return kFALSE;
197 +  }
198 +  
199    return kTRUE;
200   }
201  
# Line 187 | Line 234 | Bool_t ElectronTools::PassCustomIso(cons
234    };            
235  
236    Double_t VBTFWorkingPoint70[4][2] = {
237 <    {0.06 , 0.03   },   //TrkIso
238 <    {0.06 , 0.03   },   //ECALIso
239 <    {0.05 , 0.015  },   //HCALIso
240 <    {0.05,  0.04   }   //Combined    
237 >    {0.05 , 0.025  },   //TrkIso
238 >    {0.06 , 0.025  },   //ECALIso
239 >    {0.03 , 0.020  },   //HCALIso
240 >    {0.04,  0.030  }   //Combined
241    };            
242  
243    switch (isoType) {
# Line 214 | Line 261 | Bool_t ElectronTools::PassCustomIso(cons
261        break;
262    }
263  
264 <  Double_t trkIso  = ele->TrackIsolationDr03();
265 <  Double_t ecalIso = ele->EcalRecHitIsoDr03();
266 <  Double_t hcalIso = ele->HcalTowerSumEtDr03();
267 <  Double_t combinedIso = trkIso + ecalIso + hcalIso;
268 <  if(ele->IsEB()) combinedIso = combinedIso - 1.0;
264 >  Double_t trkIso  = ele->TrackIsolationDr03() / ele->Pt();
265 >  Double_t ecalIso = ele->EcalRecHitIsoDr03() / ele->Pt();
266 >  Double_t hcalIso = ele->HcalTowerSumEtDr03() / ele->Pt();
267 >  Double_t combinedIso = ele->TrackIsolationDr03() + ele->EcalRecHitIsoDr03() + ele->HcalTowerSumEtDr03();
268 >  if(ele->IsEB()) combinedIso = ele->TrackIsolationDr03() + TMath::Max(ele->EcalRecHitIsoDr03() - 1.0, 0.0) + ele->HcalTowerSumEtDr03();
269    combinedIso = combinedIso / ele->Pt();
270  
271    Int_t eb = 1;
# Line 244 | Line 291 | Bool_t ElectronTools::PassCustomIso(cons
291  
292   //--------------------------------------------------------------------------------------------------
293   Bool_t ElectronTools::PassConversionFilter(const Electron *ele,
294 <                                           const DecayParticleCol *conversions,
295 <                                           Bool_t WrongHitsRequirement)
294 >                                           const DecayParticleCol *conversions,
295 >                                           const BaseVertex *vtx,
296 >                                           UInt_t nWrongHitsMax,
297 >                                           Double_t probMin,
298 >                                           Double_t lxyMin,
299 >                                           Bool_t matchCkf,
300 >                                           Bool_t requireArbitratedMerged,
301 >                                           Double_t trkptMin)
302   {
303    Bool_t isGoodConversion = kFALSE;
304  
# Line 254 | Line 307 | Bool_t ElectronTools::PassConversionFilt
307      for (UInt_t d=0; d<conversions->At(ifc)->NDaughters(); d++) {
308        const Track *trk = dynamic_cast<const ChargedParticle*>
309          (conversions->At(ifc)->Daughter(d))->Trk();
310 <      if (ele->GsfTrk() == trk) {
310 >      if (ele->GsfTrk() == trk || (matchCkf && ele->TrackerTrk()==trk) ) {
311          ConversionMatchFound = kTRUE;
312          break;
313        }
# Line 262 | Line 315 | Bool_t ElectronTools::PassConversionFilt
315  
316      // if match between the e-track and one of the conversion legs
317      if (ConversionMatchFound == kTRUE){
318 <      isGoodConversion =  (conversions->At(ifc)->Prob() > 1e-6) &&
319 <        (conversions->At(ifc)->Lxy() > 0) &&
320 <        (conversions->At(ifc)->Lz() > 0) &&
268 <        (conversions->At(ifc)->Position().Rho() > 2.0);
318 >      isGoodConversion =  (conversions->At(ifc)->Prob() > probMin) &&
319 >        (!requireArbitratedMerged || conversions->At(ifc)->Quality().Quality(ConversionQuality::arbitratedMerged)) &&
320 >        (conversions->At(ifc)->LxyCorrected(vtx) > lxyMin);
321  
322        if (isGoodConversion == kTRUE) {
323          for (UInt_t d=0; d<conversions->At(ifc)->NDaughters(); d++) {
324            const Track *trk = dynamic_cast<const ChargedParticle*>
325              (conversions->At(ifc)->Daughter(d))->Trk();
326            if (trk) {
327 <            // These requirements are not used for the GSF track
276 <            if (!(trk->NHits() >= 3 && trk->Prob() > 1e-6) && trk!=ele->GsfTrk())
277 <              isGoodConversion = kFALSE;
327 >            if (trk->Pt()<trkptMin) isGoodConversion = kFALSE;
328              const StableData *sd = dynamic_cast<const StableData*>
329                (conversions->At(ifc)->DaughterDat(d));
330 <            if (WrongHitsRequirement && sd->NWrongHits() != 0)
330 >            if (sd->NWrongHits() > nWrongHitsMax)
331                isGoodConversion = kFALSE;
332            } else {
333              isGoodConversion = kFALSE;
# Line 285 | Line 335 | Bool_t ElectronTools::PassConversionFilt
335          }
336        }
337      }
338 +
339      if (isGoodConversion == kTRUE) break;
340      
341    } // loop over all conversions
# Line 293 | Line 344 | Bool_t ElectronTools::PassConversionFilt
344   }
345  
346   //--------------------------------------------------------------------------------------------------
347 < Bool_t ElectronTools::PassD0Cut(const Electron *ele, const VertexCol *vertices, Double_t fD0Cut,
297 <                                Bool_t fReverseD0Cut)
347 > Bool_t ElectronTools::PassD0Cut(const Electron *ele, const VertexCol *vertices, Double_t fD0Cut, Int_t nVertex)
348   {
349    Bool_t d0cut = kFALSE;
350 <  // d0 cut
351 <  Double_t d0_real = 99999;
352 <  for(UInt_t i0 = 0; i0 < vertices->GetEntries(); i0++) {
353 <    Double_t pD0 = ele->GsfTrk()->D0Corrected(*vertices->At(i0));
354 <    if(TMath::Abs(pD0) < TMath::Abs(d0_real)) d0_real = TMath::Abs(pD0);
350 >
351 >  Double_t d0_real = 1e30;
352 >  if(nVertex >= 0) d0_real = TMath::Abs(ele->GsfTrk()->D0Corrected(*vertices->At(nVertex)));
353 >  else            {
354 >    Double_t distVtx = 999.0;
355 >    Int_t closestVtx = 0;
356 >    for(UInt_t nv=0; nv<vertices->GetEntries(); nv++){
357 >      double dz = TMath::Abs(ele->GsfTrk()->DzCorrected(*vertices->At(nv)));
358 >      if(dz < distVtx) {
359 >        distVtx    = dz;
360 >        closestVtx = nv;
361 >      }
362 >    }
363 >    d0_real = TMath::Abs(ele->GsfTrk()->D0Corrected(*vertices->At(closestVtx)));
364    }
365    if(d0_real < fD0Cut) d0cut = kTRUE;
366    
308  if     (fReverseD0Cut == kTRUE &&
309          d0cut == kFALSE && d0_real < 0.05)
310    d0cut = kTRUE;
311  else if(fReverseD0Cut == kTRUE)
312    d0cut = kFALSE;
313  
367    return d0cut;
368   }
369  
370   //--------------------------------------------------------------------------------------------------
371 < Bool_t ElectronTools::PassD0Cut(const Electron *ele, const BeamSpotCol *beamspots, Double_t fD0Cut,
319 <                                Bool_t fReverseD0Cut)
371 > Bool_t ElectronTools::PassD0Cut(const Electron *ele, const BeamSpotCol *beamspots, Double_t fD0Cut)
372   {
373    Bool_t d0cut = kFALSE;
374    // d0 cut
# Line 327 | Line 379 | Bool_t ElectronTools::PassD0Cut(const El
379    }
380    if(d0_real < fD0Cut) d0cut = kTRUE;
381    
330  if     (fReverseD0Cut == kTRUE &&
331          d0cut == kFALSE && d0_real < 0.05)
332    d0cut = kTRUE;
333  else if(fReverseD0Cut == kTRUE)
334    d0cut = kFALSE;
335  
382    return d0cut;
383   }
384  
385   //--------------------------------------------------------------------------------------------------
386 + Bool_t ElectronTools::PassDZCut(const Electron *ele, const VertexCol *vertices, Double_t fDZCut, Int_t nVertex)
387 + {
388 +  Bool_t dzcut = kFALSE;
389 +
390 +  Double_t distVtx = 999.0;
391 +  if(nVertex >= 0) distVtx = TMath::Abs(ele->GsfTrk()->DzCorrected(*vertices->At(nVertex)));
392 +  else {
393 +    for(UInt_t nv=0; nv<vertices->GetEntries(); nv++){
394 +      double dz = TMath::Abs(ele->GsfTrk()->DzCorrected(*vertices->At(nv)));
395 +      if(dz < distVtx) {
396 +        distVtx  = dz;
397 +      }
398 +    }
399 +  }
400 +
401 +  if(distVtx < fDZCut) dzcut = kTRUE;
402 +  
403 +  return dzcut;
404 + }
405 +
406 + //--------------------------------------------------------------------------------------------------
407   Bool_t ElectronTools::PassChargeFilter(const Electron *ele)
408   {
409    Bool_t passChargeFilter = kTRUE;
# Line 350 | Line 417 | Bool_t ElectronTools::PassChargeFilter(c
417   Bool_t ElectronTools::PassSpikeRemovalFilter(const Electron *ele)
418   {
419    Bool_t passSpikeRemovalFilter = kTRUE;
420 <  if(ele->SCluster()->Seed()->Energy() > 5.0 &&
420 >  if(ele->SCluster() &&
421 >     ele->SCluster()->Seed()->Energy() > 5.0 &&
422       ele->SCluster()->Seed()->EMax() / ele->SCluster()->Seed()->E3x3() > 0.95
423      ) {
424      passSpikeRemovalFilter = kFALSE;
# Line 366 | Line 434 | Bool_t ElectronTools::PassSpikeRemovalFi
434    return passSpikeRemovalFilter;
435   }
436  
437 + Bool_t ElectronTools::PassTriggerMatching(const Electron *ele, const TriggerObjectCol *trigobjs)
438 + {
439 +  
440 +  for (UInt_t i=0; i<trigobjs->GetEntries(); ++i) {
441 +    const TriggerObject *trigobj = trigobjs->At(i);
442 +    if (trigobj->TriggerType()==TriggerObject::TriggerCluster || trigobj->TriggerType()==TriggerObject::TriggerElectron || trigobj->TriggerType()==TriggerObject::TriggerPhoton) {
443 +      if (MathUtils::DeltaR(ele->SCluster(),trigobj)<0.3) {
444 +        return kTRUE;
445 +      }
446 +    }
447 +  }
448 +  
449 +  return kFALSE;
450 +  
451 +  
452 + }
453 +
454   //--------------------------------------------------------------------------------------------------
455   Int_t ElectronTools::Classify(const Electron *ele) {
456    
# Line 406 | Line 491 | Int_t ElectronTools::Classify(const Elec
491  
492   //--------------------------------------------------------------------------------------------------
493   Int_t ElectronTools::PassTightId(const Electron *ele, const VertexCol *vertices,
494 <                                 const DecayParticleCol *conversions, const Int_t typeCuts){
494 >                                 const DecayParticleCol *conversions, const Int_t typeCuts,
495 >                                 Double_t beta){
496  
497 <  Double_t scEt   = ele->SCluster()->Et();
498 <  Double_t eOverP = ele->ESuperClusterOverP();
497 > // original code on
498 > // http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/RecoEgamma/ElectronIdentification/src/CutBasedElectronID.cc
499 > // beta must be computed with a DR cone of 0.4
500 >
501 >  Double_t scEt   = ele->SCluster()->Et();
502 >  Double_t scEta  = ele->SCluster()->Eta();
503  
504    Double_t fBrem = ele->FBrem();
505    Double_t hOverE = ele->HadronicOverEm();
# Line 420 | Line 510 | Int_t ElectronTools::PassTightId(const E
510  
511    Int_t mishits = ele->BestTrk()->NExpectedHitsInner();
512    Double_t tkIso   = ele->TrackIsolationDr03();
513 <  Double_t ecalIso = ele->EcalRecHitIsoDr04();
514 <  Double_t ecalIsoPed = (ele->IsEB())?std::max(0.,ecalIso-1.):ecalIso;
425 <  Double_t hcalIso  = ele->HcalTowerSumEtDr04();
426 <  Double_t hcalIso1 = ele->HcalDepth1TowerSumEtDr04();
427 <  Double_t hcalIso2 = ele->HcalDepth2TowerSumEtDr04();
428 <  Double_t e25Max = ele->E25Max();
429 <  Double_t e15 = ele->E15();
430 <  Double_t e55 = ele->E55();
431 <  Double_t e25Maxoe55 = e25Max/e55;
432 <  Double_t e15oe55 = e15/e55;
513 >  Double_t ecalIso = ele->EcalRecHitIsoDr04()*beta;
514 >  Double_t hcalIso  = ele->HcalTowerSumEtDr04()*beta;
515  
516    int cat = Classify(ele);
517    int eb;
# Line 439 | Line 521 | Int_t ElectronTools::PassTightId(const E
521    else
522      eb = 1;
523  
524 <  Int_t result = 0.;
524 >  // Medium cuts
525 >  Double_t cutdcotdistMedium[9] = {
526 >  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};
527 >  Double_t cutdetainMedium[9] = {
528 >  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};
529 >  Double_t cutdetainlMedium[9] = {
530 >  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};
531 >  Double_t cutdphiinMedium[9] = {
532 >  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};
533 >  Double_t cutdphiinlMedium[9] = {
534 >  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};
535 >  Double_t cuteseedopcorMedium[9] = {
536 >  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};
537 >  Double_t cutfmishitsMedium[9] = {
538 >  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};
539 >  Double_t cuthoeMedium[9] = {
540 >  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};
541 >  Double_t cuthoelMedium[9] = {
542 >  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};
543 >  Double_t cutip_gsfMedium[9] = {
544 >  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};
545 >  Double_t cutip_gsflMedium[9] = {
546 >  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};
547 >  Double_t cutiso_sumMedium[9] = {
548 >  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};
549 >  Double_t cutiso_sumoetMedium[9] = {
550 >  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};
551 >  Double_t cutiso_sumoetlMedium[9] = {
552 >  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};
553 >  Double_t cutseeMedium[9] = {
554 >  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};
555 >  Double_t cutseelMedium[9] = {
556 >  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};
557 >
558 >  // Tight cuts
559 >  Double_t cutdcotdistTight[9] = {
560 >  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};
561 >  Double_t cutdetainTight[9] = {
562 >  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};
563 >  Double_t cutdetainlTight[9] = {
564 >  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};
565 >  Double_t cutdphiinTight[9] = {
566 >  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};
567 >  Double_t cutdphiinlTight[9] = {
568 >  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};
569 >  Double_t cuteseedopcorTight[9] = {
570 >  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};
571 >  Double_t cutfmishitsTight[9] = {
572 >  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};
573 >  Double_t cuthoeTight[9] = {
574 >  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};
575 >  Double_t cuthoelTight[9] = {
576 >  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};
577 >  Double_t cutip_gsfTight[9] = {
578 >  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};
579 >  Double_t cutip_gsflTight[9] = {
580 >  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};
581 >  Double_t cutiso_sumTight[9] = {
582 >  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};
583 >  Double_t cutiso_sumoetTight[9] = {
584 >  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};
585 >  Double_t cutiso_sumoetlTight[9] = {
586 >  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};
587 >  Double_t cutseeTight[9] = {
588 >  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};
589 >  Double_t cutseelTight[9] = {
590 >  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};
591    
592 <  Int_t bin = 0;
593 <  
594 <  Double_t WantBin = kFALSE;
595 <  if(WantBin) {
596 <    if (scEt < 20.)
597 <      bin = 2;
598 <    else if (scEt > 30.)
599 <      bin = 0;
600 <    else
601 <      bin = 1;
592 >  // SuperTight cuts
593 >  Double_t cutdcotdistSuperTight[9] = {
594 >  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};
595 >  Double_t cutdetainSuperTight[9] = {
596 >  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};
597 >  Double_t cutdetainlSuperTight[9] = {
598 >  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};
599 >  Double_t cutdphiinSuperTight[9] = {
600 >  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};
601 >  Double_t cutdphiinlSuperTight[9] = {
602 >  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};
603 >  Double_t cuteseedopcorSuperTight[9] = {
604 >  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};
605 >  Double_t cutfmishitsSuperTight[9] = {
606 >  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};
607 >  Double_t cuthoeSuperTight[9] = {
608 >  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};
609 >  Double_t cuthoelSuperTight[9] = {
610 >  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};
611 >  Double_t cutip_gsfSuperTight[9] = {
612 >  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};
613 >  Double_t cutip_gsflSuperTight[9] = {
614 >  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};
615 >  Double_t cutiso_sumSuperTight[9] = {
616 >  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};
617 >  Double_t cutiso_sumoetSuperTight[9] = {
618 >  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};
619 >  Double_t cutiso_sumoetlSuperTight[9] = {
620 >  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};
621 >  Double_t cutseeSuperTight[9] = {
622 >  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};
623 >  Double_t cutseelSuperTight[9] = {
624 >  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};
625 >
626 >  // HyperTight1 cuts
627 >  Double_t cutdcotdistHyperTight1[9] = {
628 >  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};
629 >  Double_t cutdetainHyperTight1[9] = {
630 >  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};
631 >  Double_t cutdetainlHyperTight1[9] = {
632 >  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};
633 >  Double_t cutdphiinHyperTight1[9] = {
634 >  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};
635 >  Double_t cutdphiinlHyperTight1[9] = {
636 >  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};
637 >  Double_t cuteseedopcorHyperTight1[9] = {
638 >  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};
639 >  Double_t cutfmishitsHyperTight1[9] = {
640 >  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};
641 >  Double_t cuthoeHyperTight1[9] = {
642 >  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};
643 >  Double_t cuthoelHyperTight1[9] = {
644 >  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};
645 >  Double_t cutip_gsfHyperTight1[9] = {
646 >  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};
647 >  Double_t cutip_gsflHyperTight1[9] = {
648 >  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};
649 >  Double_t cutiso_sumHyperTight1[9] = {
650 >  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};
651 >  Double_t cutiso_sumoetHyperTight1[9] = {
652 >  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};
653 >  Double_t cutiso_sumoetlHyperTight1[9] = {
654 >  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};
655 >  Double_t cutseeHyperTight1[9] = {
656 >  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};
657 >  Double_t cutseelHyperTight1[9] = {
658 >  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};
659 >
660 >  // HyperTight2 cuts
661 >  Double_t cutdcotdistHyperTight2[9] = {
662 >  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};
663 >  Double_t cutdetainHyperTight2[9] = {
664 >  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};
665 >  Double_t cutdetainlHyperTight2[9] = {
666 >  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};
667 >  Double_t cutdphiinHyperTight2[9] = {
668 >  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};
669 >  Double_t cutdphiinlHyperTight2[9] = {
670 >  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};
671 >  Double_t cuteseedopcorHyperTight2[9] = {
672 >  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};
673 >  Double_t cutfmishitsHyperTight2[9] = {
674 >  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};
675 >  Double_t cuthoeHyperTight2[9] = {
676 >  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};
677 >  Double_t cuthoelHyperTight2[9] = {
678 >  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};
679 >  Double_t cutip_gsfHyperTight2[9] = {
680 >  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};
681 >  Double_t cutip_gsflHyperTight2[9] = {
682 >  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};
683 >  Double_t cutiso_sumHyperTight2[9] = {
684 >  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};
685 >  Double_t cutiso_sumoetHyperTight2[9] = {
686 >  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};
687 >  Double_t cutiso_sumoetlHyperTight2[9] = {
688 >  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};
689 >  Double_t cutseeHyperTight2[9] = {
690 >  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};
691 >  Double_t cutseelHyperTight2[9] = {
692 >  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};
693 >
694 >  // HyperTight3 cuts
695 >  Double_t cutdcotdistHyperTight3[9] = {
696 >  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};
697 >  Double_t cutdetainHyperTight3[9] = {
698 >  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};
699 >  Double_t cutdetainlHyperTight3[9] = {
700 >  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};
701 >  Double_t cutdphiinHyperTight3[9] = {
702 >  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};
703 >  Double_t cutdphiinlHyperTight3[9] = {
704 >  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};
705 >  Double_t cuteseedopcorHyperTight3[9] = {
706 >  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};
707 >  Double_t cutfmishitsHyperTight3[9] = {
708 >  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};
709 >  Double_t cuthoeHyperTight3[9] = {
710 >  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};
711 >  Double_t cuthoelHyperTight3[9] = {
712 >  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};
713 >  Double_t cutip_gsfHyperTight3[9] = {
714 >  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};
715 >  Double_t cutip_gsflHyperTight3[9] = {
716 >  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};
717 >  Double_t cutiso_sumHyperTight3[9] = {
718 >  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};
719 >  Double_t cutiso_sumoetHyperTight3[9] = {
720 >  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};
721 >  Double_t cutiso_sumoetlHyperTight3[9] = {
722 >  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};
723 >  Double_t cutseeHyperTight3[9] = {
724 >  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};
725 >  Double_t cutseelHyperTight3[9] = {
726 >  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};
727 >
728 >  // HyperTight4 cuts
729 >  Double_t cutdcotdistHyperTight4[9] = {
730 >  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};
731 >  Double_t cutdetainHyperTight4[9] = {
732 >  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};
733 >  Double_t cutdetainlHyperTight4[9] = {
734 >  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};
735 >  Double_t cutdphiinHyperTight4[9] = {
736 >  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};
737 >  Double_t cutdphiinlHyperTight4[9] = {
738 >  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};
739 >  Double_t cuteseedopcorHyperTight4[9] = {
740 >  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};
741 >  Double_t cutfmishitsHyperTight4[9] = {
742 >  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};
743 >  Double_t cuthoeHyperTight4[9] = {
744 >  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};
745 >  Double_t cuthoelHyperTight4[9] = {
746 >  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};
747 >  Double_t cutip_gsfHyperTight4[9] = {
748 >  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};
749 >  Double_t cutip_gsflHyperTight4[9] = {
750 >  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};
751 >  Double_t cutiso_sumHyperTight4[9] = {
752 >  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};
753 >  Double_t cutiso_sumoetHyperTight4[9] = {
754 >  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};
755 >  Double_t cutiso_sumoetlHyperTight4[9] = {
756 >  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};
757 >  Double_t cutseeHyperTight4[9] = {
758 >  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};
759 >  Double_t cutseelHyperTight4[9] = {
760 >  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};
761 >
762 >  Double_t cutdcotdist[9];
763 >  Double_t cutdetain[9];
764 >  Double_t cutdetainl[9];
765 >  Double_t cutdphiin[9];
766 >  Double_t cutdphiinl[9];
767 >  Double_t cuteseedopcor[9];
768 >  Double_t cutfmishits[9];
769 >  Double_t cuthoe[9];
770 >  Double_t cuthoel[9];
771 >  Double_t cutip_gsf[9];
772 >  Double_t cutip_gsfl[9];
773 >  Double_t cutiso_sum[9];
774 >  Double_t cutiso_sumoet[9];
775 >  Double_t cutiso_sumoetl[9];
776 >  Double_t cutsee[9];
777 >  Double_t cutseel[9];
778 >  if     (typeCuts == 0) {
779 >    memcpy(cutdcotdist   ,cutdcotdistMedium   ,sizeof(cutdcotdistMedium));
780 >    memcpy(cutdetain     ,cutdetainMedium     ,sizeof(cutdetainMedium));
781 >    memcpy(cutdetainl    ,cutdetainlMedium    ,sizeof(cutdetainlMedium));
782 >    memcpy(cutdphiin     ,cutdphiinMedium     ,sizeof(cutdphiinMedium));
783 >    memcpy(cutdphiinl    ,cutdphiinlMedium    ,sizeof(cutdphiinlMedium));
784 >    memcpy(cuteseedopcor ,cuteseedopcorMedium ,sizeof(cuteseedopcorMedium));
785 >    memcpy(cutfmishits   ,cutfmishitsMedium   ,sizeof(cutfmishitsMedium));
786 >    memcpy(cuthoe        ,cuthoeMedium        ,sizeof(cuthoeMedium));
787 >    memcpy(cuthoel       ,cuthoelMedium       ,sizeof(cuthoelMedium));
788 >    memcpy(cutip_gsf     ,cutip_gsfMedium     ,sizeof(cutip_gsfMedium));
789 >    memcpy(cutip_gsfl    ,cutip_gsflMedium    ,sizeof(cutip_gsflMedium));
790 >    memcpy(cutiso_sum    ,cutiso_sumMedium    ,sizeof(cutiso_sumMedium));
791 >    memcpy(cutiso_sumoet ,cutiso_sumoetMedium ,sizeof(cutiso_sumoetMedium));
792 >    memcpy(cutiso_sumoetl,cutiso_sumoetlMedium,sizeof(cutiso_sumoetlMedium));
793 >    memcpy(cutsee        ,cutseeMedium        ,sizeof(cutseeMedium));
794 >    memcpy(cutseel       ,cutseelMedium       ,sizeof(cutseelMedium));
795    }
796 +  else if(typeCuts == 1) {
797 +    memcpy(cutdcotdist   ,cutdcotdistTight   ,sizeof(cutdcotdistTight));
798 +    memcpy(cutdetain     ,cutdetainTight     ,sizeof(cutdetainTight));
799 +    memcpy(cutdetainl    ,cutdetainlTight    ,sizeof(cutdetainlTight));
800 +    memcpy(cutdphiin     ,cutdphiinTight     ,sizeof(cutdphiinTight));
801 +    memcpy(cutdphiinl    ,cutdphiinlTight    ,sizeof(cutdphiinlTight));
802 +    memcpy(cuteseedopcor ,cuteseedopcorTight ,sizeof(cuteseedopcorTight));
803 +    memcpy(cutfmishits   ,cutfmishitsTight   ,sizeof(cutfmishitsTight));
804 +    memcpy(cuthoe        ,cuthoeTight        ,sizeof(cuthoeTight));
805 +    memcpy(cuthoel       ,cuthoelTight       ,sizeof(cuthoelTight));
806 +    memcpy(cutip_gsf     ,cutip_gsfTight     ,sizeof(cutip_gsfTight));
807 +    memcpy(cutip_gsfl    ,cutip_gsflTight    ,sizeof(cutip_gsflTight));
808 +    memcpy(cutiso_sum    ,cutiso_sumTight    ,sizeof(cutiso_sumTight));
809 +    memcpy(cutiso_sumoet ,cutiso_sumoetTight ,sizeof(cutiso_sumoetTight));
810 +    memcpy(cutiso_sumoetl,cutiso_sumoetlTight,sizeof(cutiso_sumoetlTight));
811 +    memcpy(cutsee        ,cutseeTight        ,sizeof(cutseeTight));
812 +    memcpy(cutseel       ,cutseelTight       ,sizeof(cutseelTight));
813 +  }
814 +  else if(typeCuts == 2) {
815 +    memcpy(cutdcotdist   ,cutdcotdistSuperTight   ,sizeof(cutdcotdistSuperTight));
816 +    memcpy(cutdetain     ,cutdetainSuperTight     ,sizeof(cutdetainSuperTight));
817 +    memcpy(cutdetainl    ,cutdetainlSuperTight    ,sizeof(cutdetainlSuperTight));
818 +    memcpy(cutdphiin     ,cutdphiinSuperTight     ,sizeof(cutdphiinSuperTight));
819 +    memcpy(cutdphiinl    ,cutdphiinlSuperTight    ,sizeof(cutdphiinlSuperTight));
820 +    memcpy(cuteseedopcor ,cuteseedopcorSuperTight ,sizeof(cuteseedopcorSuperTight));
821 +    memcpy(cutfmishits   ,cutfmishitsSuperTight   ,sizeof(cutfmishitsSuperTight));
822 +    memcpy(cuthoe        ,cuthoeSuperTight        ,sizeof(cuthoeSuperTight));
823 +    memcpy(cuthoel       ,cuthoelSuperTight       ,sizeof(cuthoelSuperTight));
824 +    memcpy(cutip_gsf     ,cutip_gsfSuperTight     ,sizeof(cutip_gsfSuperTight));
825 +    memcpy(cutip_gsfl    ,cutip_gsflSuperTight    ,sizeof(cutip_gsflSuperTight));
826 +    memcpy(cutiso_sum    ,cutiso_sumSuperTight    ,sizeof(cutiso_sumSuperTight));
827 +    memcpy(cutiso_sumoet ,cutiso_sumoetSuperTight ,sizeof(cutiso_sumoetSuperTight));
828 +    memcpy(cutiso_sumoetl,cutiso_sumoetlSuperTight,sizeof(cutiso_sumoetlSuperTight));
829 +    memcpy(cutsee        ,cutseeSuperTight        ,sizeof(cutseeSuperTight));
830 +    memcpy(cutseel       ,cutseelSuperTight       ,sizeof(cutseelSuperTight));
831 +  }
832 +  else if(typeCuts == 3) {
833 +    memcpy(cutdcotdist   ,cutdcotdistHyperTight1   ,sizeof(cutdcotdistHyperTight1));
834 +    memcpy(cutdetain     ,cutdetainHyperTight1     ,sizeof(cutdetainHyperTight1));
835 +    memcpy(cutdetainl    ,cutdetainlHyperTight1    ,sizeof(cutdetainlHyperTight1));
836 +    memcpy(cutdphiin     ,cutdphiinHyperTight1     ,sizeof(cutdphiinHyperTight1));
837 +    memcpy(cutdphiinl    ,cutdphiinlHyperTight1    ,sizeof(cutdphiinlHyperTight1));
838 +    memcpy(cuteseedopcor ,cuteseedopcorHyperTight1 ,sizeof(cuteseedopcorHyperTight1));
839 +    memcpy(cutfmishits   ,cutfmishitsHyperTight1   ,sizeof(cutfmishitsHyperTight1));
840 +    memcpy(cuthoe        ,cuthoeHyperTight1       ,sizeof(cuthoeHyperTight1));
841 +    memcpy(cuthoel       ,cuthoelHyperTight1      ,sizeof(cuthoelHyperTight1));
842 +    memcpy(cutip_gsf     ,cutip_gsfHyperTight1     ,sizeof(cutip_gsfHyperTight1));
843 +    memcpy(cutip_gsfl    ,cutip_gsflHyperTight1    ,sizeof(cutip_gsflHyperTight1));
844 +    memcpy(cutiso_sum    ,cutiso_sumHyperTight1    ,sizeof(cutiso_sumHyperTight1));
845 +    memcpy(cutiso_sumoet ,cutiso_sumoetHyperTight1 ,sizeof(cutiso_sumoetHyperTight1));
846 +    memcpy(cutiso_sumoetl,cutiso_sumoetlHyperTight1,sizeof(cutiso_sumoetlHyperTight1));
847 +    memcpy(cutsee        ,cutseeHyperTight1       ,sizeof(cutseeHyperTight1));
848 +    memcpy(cutseel       ,cutseelHyperTight1      ,sizeof(cutseelHyperTight1));
849 +  }
850 +  else if(typeCuts == 4) {
851 +    memcpy(cutdcotdist   ,cutdcotdistHyperTight2   ,sizeof(cutdcotdistHyperTight2));
852 +    memcpy(cutdetain     ,cutdetainHyperTight2     ,sizeof(cutdetainHyperTight2));
853 +    memcpy(cutdetainl    ,cutdetainlHyperTight2    ,sizeof(cutdetainlHyperTight2));
854 +    memcpy(cutdphiin     ,cutdphiinHyperTight2     ,sizeof(cutdphiinHyperTight2));
855 +    memcpy(cutdphiinl    ,cutdphiinlHyperTight2    ,sizeof(cutdphiinlHyperTight2));
856 +    memcpy(cuteseedopcor ,cuteseedopcorHyperTight2 ,sizeof(cuteseedopcorHyperTight2));
857 +    memcpy(cutfmishits   ,cutfmishitsHyperTight2   ,sizeof(cutfmishitsHyperTight2));
858 +    memcpy(cuthoe        ,cuthoeHyperTight2       ,sizeof(cuthoeHyperTight2));
859 +    memcpy(cuthoel       ,cuthoelHyperTight2      ,sizeof(cuthoelHyperTight2));
860 +    memcpy(cutip_gsf     ,cutip_gsfHyperTight2     ,sizeof(cutip_gsfHyperTight2));
861 +    memcpy(cutip_gsfl    ,cutip_gsflHyperTight2    ,sizeof(cutip_gsflHyperTight2));
862 +    memcpy(cutiso_sum    ,cutiso_sumHyperTight2    ,sizeof(cutiso_sumHyperTight2));
863 +    memcpy(cutiso_sumoet ,cutiso_sumoetHyperTight2 ,sizeof(cutiso_sumoetHyperTight2));
864 +    memcpy(cutiso_sumoetl,cutiso_sumoetlHyperTight2,sizeof(cutiso_sumoetlHyperTight2));
865 +    memcpy(cutsee        ,cutseeHyperTight2       ,sizeof(cutseeHyperTight2));
866 +    memcpy(cutseel       ,cutseelHyperTight2      ,sizeof(cutseelHyperTight2));
867 +  }
868 +  else if(typeCuts == 5) {
869 +    memcpy(cutdcotdist   ,cutdcotdistHyperTight3   ,sizeof(cutdcotdistHyperTight3));
870 +    memcpy(cutdetain     ,cutdetainHyperTight3     ,sizeof(cutdetainHyperTight3));
871 +    memcpy(cutdetainl    ,cutdetainlHyperTight3    ,sizeof(cutdetainlHyperTight3));
872 +    memcpy(cutdphiin     ,cutdphiinHyperTight3     ,sizeof(cutdphiinHyperTight3));
873 +    memcpy(cutdphiinl    ,cutdphiinlHyperTight3    ,sizeof(cutdphiinlHyperTight3));
874 +    memcpy(cuteseedopcor ,cuteseedopcorHyperTight3 ,sizeof(cuteseedopcorHyperTight3));
875 +    memcpy(cutfmishits   ,cutfmishitsHyperTight3   ,sizeof(cutfmishitsHyperTight3));
876 +    memcpy(cuthoe        ,cuthoeHyperTight3       ,sizeof(cuthoeHyperTight3));
877 +    memcpy(cuthoel       ,cuthoelHyperTight3      ,sizeof(cuthoelHyperTight3));
878 +    memcpy(cutip_gsf     ,cutip_gsfHyperTight3     ,sizeof(cutip_gsfHyperTight3));
879 +    memcpy(cutip_gsfl    ,cutip_gsflHyperTight3    ,sizeof(cutip_gsflHyperTight3));
880 +    memcpy(cutiso_sum    ,cutiso_sumHyperTight3    ,sizeof(cutiso_sumHyperTight3));
881 +    memcpy(cutiso_sumoet ,cutiso_sumoetHyperTight3 ,sizeof(cutiso_sumoetHyperTight3));
882 +    memcpy(cutiso_sumoetl,cutiso_sumoetlHyperTight3,sizeof(cutiso_sumoetlHyperTight3));
883 +    memcpy(cutsee        ,cutseeHyperTight3       ,sizeof(cutseeHyperTight3));
884 +    memcpy(cutseel       ,cutseelHyperTight3      ,sizeof(cutseelHyperTight3));
885 +  }
886 +  else if(typeCuts == 6) {
887 +    memcpy(cutdcotdist   ,cutdcotdistHyperTight4   ,sizeof(cutdcotdistHyperTight4));
888 +    memcpy(cutdetain     ,cutdetainHyperTight4     ,sizeof(cutdetainHyperTight4));
889 +    memcpy(cutdetainl    ,cutdetainlHyperTight4    ,sizeof(cutdetainlHyperTight4));
890 +    memcpy(cutdphiin     ,cutdphiinHyperTight4     ,sizeof(cutdphiinHyperTight4));
891 +    memcpy(cutdphiinl    ,cutdphiinlHyperTight4    ,sizeof(cutdphiinlHyperTight4));
892 +    memcpy(cuteseedopcor ,cuteseedopcorHyperTight4 ,sizeof(cuteseedopcorHyperTight4));
893 +    memcpy(cutfmishits   ,cutfmishitsHyperTight4   ,sizeof(cutfmishitsHyperTight4));
894 +    memcpy(cuthoe        ,cuthoeHyperTight4       ,sizeof(cuthoeHyperTight4));
895 +    memcpy(cuthoel       ,cuthoelHyperTight4      ,sizeof(cuthoelHyperTight4));
896 +    memcpy(cutip_gsf     ,cutip_gsfHyperTight4     ,sizeof(cutip_gsfHyperTight4));
897 +    memcpy(cutip_gsfl    ,cutip_gsflHyperTight4    ,sizeof(cutip_gsflHyperTight4));
898 +    memcpy(cutiso_sum    ,cutiso_sumHyperTight4    ,sizeof(cutiso_sumHyperTight4));
899 +    memcpy(cutiso_sumoet ,cutiso_sumoetHyperTight4 ,sizeof(cutiso_sumoetHyperTight4));
900 +    memcpy(cutiso_sumoetl,cutiso_sumoetlHyperTight4,sizeof(cutiso_sumoetlHyperTight4));
901 +    memcpy(cutsee        ,cutseeHyperTight4       ,sizeof(cutseeHyperTight4));
902 +    memcpy(cutseel       ,cutseelHyperTight4      ,sizeof(cutseelHyperTight4));
903 +  }
904 +  else {
905 +    return 0;
906 +  }
907 +  int result = 0;
908 +  
909 +  const int ncuts = 10;
910 +  std::vector<bool> cut_results(ncuts, false);
911 +  
912 +  float iso_sum = tkIso + ecalIso + hcalIso;
913 +  if(fabs(scEta)>1.5)
914 +    iso_sum += (fabs(scEta)-1.5)*1.09;
915 +  
916 +  float iso_sumoet = iso_sum*(40./scEt);
917 +  
918 +  float eseedopincor = eSeedOverPin + fBrem;
919 +  if(fBrem < 0)
920 +    eseedopincor = eSeedOverPin;
921  
922 <  if (fBrem > 0)
923 <    eSeedOverPin = eSeedOverPin + fBrem;
922 >  float dist = (TMath::Abs(ele->ConvPartnerDist())      == -9999.? 9999:TMath::Abs(ele->ConvPartnerDist()));
923 >  float dcot = (TMath::Abs(ele->ConvPartnerDCotTheta()) == -9999.? 9999:TMath::Abs(ele->ConvPartnerDCotTheta()));
924  
925 <  if(typeCuts == 3 || typeCuts == 4){
926 <  // Loose robust cuts
927 <    Double_t robustlooseEleIDCuts[52] = {
928 <       0.05,  0.0103,  0.8, 0.00688, -1, -1, 7.33, 4.68, 9999., 9999., 9999.,9999., 9999.,9999., 9999., 9999.,9999., 9999., 0.000, -9999., 9999., 9999., 9999, -1, 0, 0,
929 <       0.0389, 0.0307, 0.7, 0.00944, -1, -1, 7.76, 3.09,  2.23, 9999., 9999.,9999., 9999.,9999., 9999., 9999.,9999., 9999., 0.000, -9999., 9999., 9999., 9999, -1, 0, 0
930 <    };
931 <  // Tight robust cuts
932 <    Double_t robusttightEleIDCuts[52] = {
467 <        0.0201, 0.0102, 0.0211, 0.00606, -1, -1, 2.34, 3.24, 4.51, 9999., 9999.,9999., 9999.,9999., 9999., 9999.,9999., 9999., 0.000, -9999., 9999., 9999., 9999, -1, 0, 0,
468 <        0.00253, 0.0291, 0.022, 0.0032, -1, -1, 0.826, 2.7, 0.255, 9999., 9999.,9999., 9999.,9999., 9999., 9999.,9999., 9999., 0.000, -9999., 9999., 9999., 9999, -1, 0, 0
469 <    };                            
470 <    Double_t cut[52];
471 <    if     (typeCuts == 3) {
472 <      memcpy(cut  ,robustlooseEleIDCuts  ,sizeof(cut));
473 <    }
474 <    else {
475 <      memcpy(cut  ,robusttightEleIDCuts  ,sizeof(cut));
925 >  float dcotdistcomb = ((0.04 - std::max(dist, dcot)) > 0?(0.04 - std::max(dist, dcot)):0);
926 >
927 >  Double_t ip = 99999;
928 >  for(UInt_t i0 = 0; i0 < vertices->GetEntries(); i0++) {
929 >    if(vertices->At(i0)->NTracks() > 0){
930 >      Double_t pD0 = ele->GsfTrk()->D0Corrected(*vertices->At(i0));
931 >      ip = TMath::Abs(pD0);
932 >      break;
933      }
934 +  }
935  
936 <    if ((tkIso > cut[26*eb+6]) || (ecalIso > cut[26*eb+7]) || (hcalIso > cut[26*eb+8]) || (hcalIso1 > cut[26*eb+9]) || (hcalIso2 > cut[26*eb+10]) ||
937 <        (tkIso/ele->Pt() > cut[26*eb+11]) || (ecalIso/ele->Pt() > cut[26*eb+12]) || (hcalIso/ele->Pt() > cut[26*eb+13]) ||
938 <        ((tkIso+ecalIso+hcalIso)>cut[26*eb+14]) || (((tkIso+ecalIso+hcalIso)/ ele->Pt()) > cut[26*eb+15]) ||
939 <        ((tkIso+ecalIsoPed+hcalIso)>cut[26*eb+16]) || (((tkIso+ecalIsoPed+hcalIso)/ ele->Pt()) > cut[26*eb+17])  )
940 <      result = 0.;
941 <    else
942 <      result = 2.;
936 >  for (int cut=0; cut<ncuts; cut++) {
937 >    switch (cut) {
938 >    case 0:
939 >      cut_results[cut] = compute_cut(fabs(deltaEtaIn), scEt, cutdetainl[cat], cutdetain[cat]);
940 >      break;
941 >    case 1:
942 >      cut_results[cut] = compute_cut(fabs(deltaPhiIn), scEt, cutdphiinl[cat], cutdphiin[cat]);
943 >      break;
944 >    case 2:
945 >      cut_results[cut] = (eseedopincor > cuteseedopcor[cat]);
946 >      break;
947 >    case 3:
948 >      cut_results[cut] = compute_cut(hOverE, scEt, cuthoel[cat], cuthoe[cat]);
949 >      break;
950 >    case 4:
951 >      cut_results[cut] = compute_cut(sigmaee, scEt, cutseel[cat], cutsee[cat]);
952 >      break;
953 >    case 5:
954 >      cut_results[cut] = compute_cut(iso_sumoet, scEt, cutiso_sumoetl[cat], cutiso_sumoet[cat]);
955 >      break;
956 >    case 6:
957 >      cut_results[cut] = (iso_sum < cutiso_sum[cat]);
958 >      break;
959 >    case 7:
960 >      cut_results[cut] = compute_cut(fabs(ip), scEt, cutip_gsfl[cat], cutip_gsf[cat]);
961 >      break;
962 >    case 8:
963 >      cut_results[cut] = (mishits < cutfmishits[cat]);
964 >      break;
965 >    case 9:
966 >      cut_results[cut] = (dcotdistcomb < cutdcotdist[cat]);
967 >      break;
968 >    }
969 >  }
970 >  
971 >  // ID part
972 >  if (cut_results[0] & cut_results[1] & cut_results[2] & cut_results[3] & cut_results[4])
973 >    result = result + 1;
974 >  
975 >  // ISO part
976 >  if (cut_results[5] & cut_results[6])
977 >    result = result + 2;
978 >  
979 >  // IP part
980 >  if (cut_results[7])
981 >    result = result + 8;
982 >  
983 >  // Conversion part
984 >  if (cut_results[8] and cut_results[9])
985 >    result = result + 4;
986 >  
987 >  return result;
988 > }
989  
990 <    if (hOverE > cut[26*eb+0])
991 <      return result;    
990 > //--------------------------------------------------------------------------------------------------
991 > bool ElectronTools::compute_cut(double x, double et, double cut_min, double cut_max, bool gtn) {
992  
993 <    if (sigmaee > cut[26*eb+1])
994 <      return result;    
993 >  float et_min = 10;
994 >  float et_max = 40;
995  
996 <    if (fabs(deltaPhiIn) > cut[26*eb+2])
997 <      return result;    
996 >  bool accept = false;
997 >  float cut = cut_max; //  the cut at et=40 GeV
998  
999 <    if (fabs(deltaEtaIn) > cut[26*eb+3])
1000 <      return result;    
1001 <    
1002 <    if (e25Maxoe55 < cut[26*eb+4] && e15oe55 < cut[26*eb+5])
1003 <      return result;
1004 <    // some extra electron id cuts
1005 <    if (sigmaee < cut[26*eb+18]) // inverted sigmaee cut - spike removal related
1006 <      return result;
999 >  if(et < et_max) {
1000 >    cut = cut_min + (1/et_min - 1/et)*(cut_max - cut_min)/(1/et_min - 1/et_max);
1001 >  }
1002 >  
1003 >  if(et < et_min) {
1004 >    cut = cut_min;
1005 >  }
1006 >
1007 >  if(gtn) {   // useful for e/p cut which is gt
1008 >    accept = (x >= cut);
1009 >  }
1010 >  else {
1011 >    accept = (x <= cut);
1012 >  }
1013  
1014 <    if (  eOverP < cut[26*eb+19] ||  eOverP > cut[26*eb+20]) // lower and upper cut in E/P
1015 <      return result;
506 <    
507 <    result = result + 1;
1014 >  return accept;
1015 > }
1016  
1017 <    Double_t d0_real = 99999;
1018 <    for(UInt_t i0 = 0; i0 < vertices->GetEntries(); i0++) {
1019 <      Double_t pD0 = ele->GsfTrk()->D0Corrected(*vertices->At(i0));
1020 <      if(TMath::Abs(pD0) < TMath::Abs(d0_real)) d0_real = TMath::Abs(pD0);
1021 <    }
1022 <    if (d0_real > cut[26*eb+21])
1023 <      return result;
1017 > //--------------------------------------------------------------------------------------------------
1018 > Double_t ElectronTools::Likelihood(ElectronLikelihood *LH, const Electron *ele)
1019 > {
1020 >  if (!LH) {
1021 >    std::cout << "Error: Likelihood not properly initialized\n";
1022 >    return -9999;
1023 >  }
1024  
1025 <    if (mishits > cut[26*eb+22]) // expected missing hits
1026 <      return result;
1025 >  LikelihoodMeasurements measurements;
1026 >  measurements.pt = ele->Pt();
1027 >  if (ele->IsEB() && ele->AbsEta()<1.0) measurements.subdet = 0;
1028 >  else if (ele->IsEB())                 measurements.subdet = 1;
1029 >  else                                  measurements.subdet = 2;
1030 >  measurements.deltaPhi = TMath::Abs(ele->DeltaPhiSuperClusterTrackAtVtx());
1031 >  measurements.deltaEta = TMath::Abs(ele->DeltaEtaSuperClusterTrackAtVtx());
1032 >  measurements.eSeedClusterOverPout = ele->ESeedClusterOverPout();
1033 >  measurements.eSuperClusterOverP = ele->ESuperClusterOverP();
1034 >  measurements.hadronicOverEm = ele->HadronicOverEm();
1035 >  measurements.sigmaIEtaIEta = ele->CoviEtaiEta();
1036 >  measurements.sigmaIPhiIPhi = TMath::Sqrt(ele->SCluster()->Seed()->CoviPhiiPhi());
1037 >  measurements.fBrem = ele->FBrem();
1038 >  measurements.nBremClusters = ele->NumberOfClusters() - 1;
1039 >  //measurements.OneOverEMinusOneOverP = (1.0 / ele->SCluster()->Energy()) - (1.0 / ele->BestTrk()->P());
1040 >  measurements.OneOverEMinusOneOverP = (1.0 / ele->ESuperClusterOverP() / ele->BestTrk()->P()) - (1.0 / ele->BestTrk()->P());
1041 >  double likelihood = LH->result(measurements);
1042 >
1043 >  double newLik = 0.0;
1044 >  if     (likelihood<=0) newLik = -20.0;
1045 >  else if(likelihood>=1) newLik =  20.0;
1046 >  else                   newLik = log(likelihood/(1.0-likelihood));
1047 >
1048 >  Bool_t isDebug = kFALSE;
1049 >  if(isDebug == kTRUE){
1050 >    printf("LIKELIHOOD: %f %d %f %f %f %f %f %f %f %f %d %f %f %f - %f %f\n",measurements.pt,measurements.subdet,
1051 >    measurements.deltaPhi          ,measurements.deltaEta      ,measurements.eSeedClusterOverPout,
1052 >    measurements.eSuperClusterOverP,measurements.hadronicOverEm,measurements.sigmaIEtaIEta,
1053 >    measurements.sigmaIPhiIPhi     ,measurements.fBrem         ,measurements.nBremClusters,
1054 >    measurements.OneOverEMinusOneOverP,ele->SCluster()->Energy(),ele->BestTrk()->P(),
1055 >    likelihood,newLik);
1056 >  }
1057  
1058 <    Bool_t passConvVeto = PassConversionFilter(ele, conversions, kTRUE);
521 <    if (passConvVeto == kFALSE)
522 <      return result;
523 <      
524 <    result += 4;
525 <  }
526 <  else if(typeCuts == 0 || typeCuts == 1 || typeCuts == 2){
527 <    // Loose cuts
528 <  Double_t cutdcotdistLoose[9] = {9999., 9999., 9999., 9999., 9999., 9999., 9999., 9999., 9999.
529 <  };
530 <  Double_t cutdetainLoose[9] = {1.30e-02, 5.95e-03, 3.10e-02, 1.68e-02, 8.44e-03, 1.70e-02, 1.55e-02, 5.13e-02, 1.61e-02
531 <  };
532 <  Double_t cutdphiinLoose[9] = {7.51e-02, 3.30e-01, 4.20e-01, 9.86e-02, 2.84e-01, 3.28e-01, 3.77e-01, 4.32e-01, 3.74e-01
533 <  };
534 <  Double_t cuteseedopcorLoose[9] = {6.31e-01, 3.02e-01, 3.04e-01, 8.10e-01, 2.23e-01, 5.03e-01, 2.78e-01, 3.10e-01, 4.69e-01
535 <  };
536 <  Double_t cutetLoose[9] = {0., 0., 0., 0., 0., 0., 0., 0., 0.
537 <  };
538 <  Double_t cutfmishitsLoose[9] = {4.50e+00, 1.50e+00, 1.50e+00, 2.50e+00, 2.50e+00, 1.50e+00, 2.50e+00, 4.50e+00, 5.00e-01
539 <  };
540 <  Double_t cuthoeLoose[9] = {2.47e-01, 7.78e-02, 1.49e-01, 3.82e-01, 4.70e-02, 1.12e-01, 1.16e+00, 5.04e+00, 1.35e+00
541 <  };
542 <  Double_t cutip_gsfLoose[9] = {0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02
543 <  };
544 <  Double_t cutiso_sumLoose[9] = {0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1
545 <  };
546 <  Double_t cutiso_sumoetLoose[9] = {9999., 9999., 9999., 9999., 9999., 9999., 9999., 9999., 9999.
547 <  };
548 <  Double_t cutseeLoose[9] = {1.92e-02, 1.31e-02, 2.53e-02, 5.27e-02, 3.29e-02, 4.19e-02, 2.65e-02, 6.58e-02, 1.38e-01
549 <  };
550 <
551 <    // Medium cuts
552 <  Double_t cutdcotdistMedium[9] = {9999., 9999., 9999., 9999., 9999., 9999., 9999., 9999., 9999.
553 <  };
554 <  Double_t cutdetainMedium[9] = {1.19e-02, 4.20e-03, 1.07e-02, 1.49e-02, 6.56e-03, 1.19e-02, 1.16e-02, 5.13e-02, 6.37e-03
555 <  };
556 <  Double_t cutdphiinMedium[9] = {7.51e-02, 2.93e-01, 3.58e-01, 9.53e-02, 1.62e-01, 2.99e-01, 2.76e-01, 4.32e-01, 2.57e-01
557 <  };
558 <  Double_t cuteseedopcorMedium[9] = {6.31e-01, 8.14e-01, 7.60e-01, 8.18e-01, 7.56e-01, 5.35e-01, 6.20e-01, 7.88e-01, 8.85e-01
559 <  };
560 <  Double_t cutetMedium[9] = {0., 0., 0., 0., 0., 0., 0., 0., 0.
561 <  };
562 <  Double_t cutfmishitsMedium[9] = {1.50e+00, 1.50e+00, 1.50e+00, 1.50e+00, 1.50e+00, 1.50e+00, 2.50e+00, 1.50e+00, 5.00e-01
563 <  };
564 <  Double_t cuthoeMedium[9] = {2.46e-01, 6.80e-02, 1.35e-01, 3.73e-01, 2.33e-02, 5.58e-02, 8.80e-01, 5.04e+00, 3.78e-02
565 <  };
566 <  Double_t cutip_gsfMedium[9] = {0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02
567 <  };
568 <  Double_t cutiso_sumMedium[9] = {0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1
569 <  };
570 <  Double_t cutiso_sumoetMedium[9] = {9999., 9999., 9999., 9999., 9999., 9999., 9999., 9999., 9999.
571 <  };
572 <  Double_t cutseeMedium[9] = {1.92e-02, 1.13e-02, 1.47e-02, 3.84e-02, 3.05e-02, 3.36e-02, 1.35e-02, 5.05e-02, 2.79e-02
573 <  };
574 <
575 <    // Tight cuts
576 <  Double_t cutdcotdistTight[9] = {9999., 9999., 9999., 9999., 9999., 9999., 9999., 9999., 9999.
577 <  };
578 <  Double_t cutdetainTight[9] = {9.28e-03, 3.56e-03, 7.16e-03, 1.31e-02, 5.81e-03, 9.79e-03, 1.15e-02, 1.66e-02, 3.19e-03
579 <  };
580 <  Double_t cutdphiinTight[9] = {4.66e-02, 7.80e-02, 2.64e-01, 4.42e-02, 3.20e-02, 2.37e-01, 8.25e-02, 2.07e-01, 5.39e-02
581 <  };
582 <  Double_t cuteseedopcorTight[9] = {6.48e-01, 8.97e-01, 8.91e-01, 8.39e-01, 8.35e-01, 6.49e-01, 6.76e-01, 8.70e-01, 9.91e-01
583 <  };
584 <  Double_t cutetTight[9] = {0., 0., 0., 0., 0., 0., 0., 0., 0.
585 <  };
586 <  Double_t cutfmishitsTight[9] = {1.50e+00, 1.50e+00, 1.50e+00, 1.50e+00, 1.50e+00, 5.00e-01, 2.50e+00, 5.00e-01, 5.00e-01
587 <  };
588 <  Double_t cuthoeTight[9] = {9.94e-02, 5.61e-02, 1.05e-01, 9.73e-02, 1.81e-02, 3.06e-02, 5.57e-01, 5.04e+00, 1.06e-03
589 <  };
590 <  Double_t cutip_gsfTight[9] = {0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02
591 <  };
592 <  Double_t cutiso_sumTight[9] = {0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1
593 <  };
594 <  Double_t cutiso_sumoetTight[9] = {9999., 9999., 9999., 9999., 9999., 9999., 9999., 9999., 9999.
595 <  };
596 <  Double_t cutseeTight[9] = {1.56e-02, 1.07e-02, 1.23e-02, 3.35e-02, 2.98e-02, 3.06e-02, 1.07e-02, 3.79e-02, 1.01e-02
597 <  };
598 <
599 <    Double_t cutdcotdist[9];
600 <    Double_t cutdetain[9];
601 <    Double_t cutdphiin[9];
602 <    Double_t cuteseedopcor[9];
603 <    Double_t cutet[9];
604 <    Double_t cutfmishits[9];
605 <    Double_t cuthoe[9];
606 <    Double_t cutip_gsf[9];
607 <    Double_t cutiso_sum[9];
608 <    Double_t cutiso_sumoet[9];
609 <    Double_t cutsee[9];
610 <    if     (typeCuts == 0) {
611 <      memcpy(cutdcotdist  ,cutdcotdistLoose  ,sizeof(cutdcotdistLoose));
612 <      memcpy(cutdetain    ,cutdetainLoose       ,sizeof(cutdetainLoose));
613 <      memcpy(cutdphiin    ,cutdphiinLoose       ,sizeof(cutdphiinLoose));
614 <      memcpy(cuteseedopcor,cuteseedopcorLoose,sizeof(cuteseedopcorLoose));
615 <      memcpy(cutet        ,cutetLoose   ,sizeof(cutetLoose));
616 <      memcpy(cutfmishits  ,cutfmishitsLoose  ,sizeof(cutfmishitsLoose));
617 <      memcpy(cuthoe       ,cuthoeLoose  ,sizeof(cuthoeLoose));
618 <      memcpy(cutip_gsf    ,cutip_gsfLoose       ,sizeof(cutip_gsfLoose));
619 <      memcpy(cutiso_sum   ,cutiso_sumLoose      ,sizeof(cutiso_sumLoose));
620 <      memcpy(cutiso_sumoet,cutiso_sumoetLoose,sizeof(cutiso_sumoetLoose));
621 <      memcpy(cutsee       ,cutseeLoose  ,sizeof(cutseeLoose));
622 <    }
623 <    else if(typeCuts == 1) {
624 <      memcpy(cutdcotdist  ,cutdcotdistMedium  ,sizeof(cutdcotdistMedium));
625 <      memcpy(cutdetain    ,cutdetainMedium      ,sizeof(cutdetainMedium));
626 <      memcpy(cutdphiin    ,cutdphiinMedium      ,sizeof(cutdphiinMedium));
627 <      memcpy(cuteseedopcor,cuteseedopcorMedium,sizeof(cuteseedopcorMedium));
628 <      memcpy(cutet        ,cutetMedium  ,sizeof(cutetMedium));
629 <      memcpy(cutfmishits  ,cutfmishitsMedium  ,sizeof(cutfmishitsMedium));
630 <      memcpy(cuthoe       ,cuthoeMedium ,sizeof(cuthoeMedium));
631 <      memcpy(cutip_gsf    ,cutip_gsfMedium      ,sizeof(cutip_gsfMedium));
632 <      memcpy(cutiso_sum   ,cutiso_sumMedium     ,sizeof(cutiso_sumMedium));
633 <      memcpy(cutiso_sumoet,cutiso_sumoetMedium,sizeof(cutiso_sumoetMedium));
634 <      memcpy(cutsee       ,cutseeMedium ,sizeof(cutseeMedium));
635 <    }
636 <    else {
637 <      memcpy(cutdcotdist  ,cutdcotdistTight  ,sizeof(cutdcotdistTight));
638 <      memcpy(cutdetain    ,cutdetainTight       ,sizeof(cutdetainTight));
639 <      memcpy(cutdphiin    ,cutdphiinTight       ,sizeof(cutdphiinTight));
640 <      memcpy(cuteseedopcor,cuteseedopcorTight,sizeof(cuteseedopcorTight));
641 <      memcpy(cutet        ,cutetTight   ,sizeof(cutetTight));
642 <      memcpy(cutfmishits  ,cutfmishitsTight  ,sizeof(cutfmishitsTight));
643 <      memcpy(cuthoe       ,cuthoeTight  ,sizeof(cuthoeTight));
644 <      memcpy(cutip_gsf    ,cutip_gsfTight       ,sizeof(cutip_gsfTight));
645 <      memcpy(cutiso_sum   ,cutiso_sumTight      ,sizeof(cutiso_sumTight));
646 <      memcpy(cutiso_sumoet,cutiso_sumoetTight,sizeof(cutiso_sumoetTight));
647 <      memcpy(cutsee       ,cutseeTight  ,sizeof(cutseeTight));
648 <    }
1058 >  return newLik;
1059  
1060 <    // CAREFUL, I HAVE COMMENTED OUT WHAT SANI IS DOING
651 <    //Double_t iso_sum = tkIso + ecalIso + hcalIso;
652 <    Double_t iso_sum = (ele->TrackIsolationDr03() + ele->EcalRecHitIsoDr03() +
653 <                        ele->HcalTowerSumEtDr03() - 1.0) / ele->Pt();
654 <    Double_t iso_sum_corrected = iso_sum*pow(40./scEt, 2);
655 <    if ((iso_sum < cutiso_sum[cat+bin*9]) &&
656 <        (iso_sum_corrected < cutiso_sumoet[cat+bin*9]))
657 <      result += 2;
658 <
659 <    if (fBrem > -2) {
660 <      if ((hOverE < cuthoe[cat+bin*9]) and
661 <          (sigmaee < cutsee[cat+bin*9]) and
662 <          (fabs(deltaPhiIn) < cutdphiin[cat+bin*9]) and
663 <          (fabs(deltaEtaIn) < cutdetain[cat+bin*9]) and
664 <          (eSeedOverPin > cuteseedopcor[cat+bin*9]) and
665 <          (scEt > cutet[cat+bin*9]))
666 <        result += 1.;
667 <    }
1060 > }
1061  
1062 <    Double_t d0_real = 99999;
670 <    for(UInt_t i0 = 0; i0 < vertices->GetEntries(); i0++) {
671 <      Double_t pD0 = ele->GsfTrk()->D0Corrected(*vertices->At(i0));
672 <      if(TMath::Abs(pD0) < TMath::Abs(d0_real)) d0_real = TMath::Abs(pD0);
673 <    }
674 <    if (d0_real < cutip_gsf[cat+bin*9])
675 <      result += 4;
1062 > Double_t ElectronTools::ElectronEffectiveArea(EElectronEffectiveAreaType type, Double_t Eta) {
1063  
1064 <    Bool_t passConvVeto = PassConversionFilter(ele, conversions, kTRUE);
678 <    if (mishits < cutfmishits[cat+bin*9] &&
679 <        passConvVeto)
680 <      result += 8;
681 <  } // classbased
1064 >  Double_t EffectiveArea = 0;
1065  
1066 <  return result;
1066 >  if (fabs(Eta) < 1.0) {
1067 >    if (type == kEleChargedIso03) EffectiveArea = 0.000;
1068 >    if (type == kEleNeutralHadronIso03) EffectiveArea = 0.017;
1069 >    if (type == kEleGammaIso03) EffectiveArea = 0.045;
1070 >    if (type == kEleGammaIsoVetoEtaStrip03) EffectiveArea = 0.014;
1071 >    if (type == kEleChargedIso04) EffectiveArea = 0.000;
1072 >    if (type == kEleNeutralHadronIso04) EffectiveArea = 0.034;
1073 >    if (type == kEleGammaIso04) EffectiveArea = 0.079;
1074 >    if (type == kEleGammaIsoVetoEtaStrip04) EffectiveArea = 0.014;
1075 >    if (type == kEleNeutralHadronIso007) EffectiveArea = 0.000;
1076 >    if (type == kEleHoverE) EffectiveArea = 0.00016;
1077 >    if (type == kEleHcalDepth1OverEcal) EffectiveArea = 0.00016;
1078 >    if (type == kEleHcalDepth2OverEcal) EffectiveArea = 0.00000;    
1079 >  } else if (fabs(Eta) >= 1.0 && fabs(Eta) < 1.479 ) {
1080 >    if (type == kEleChargedIso03) EffectiveArea = 0.000;
1081 >    if (type == kEleNeutralHadronIso03) EffectiveArea = 0.025;
1082 >    if (type == kEleGammaIso03) EffectiveArea = 0.052;
1083 >    if (type == kEleGammaIsoVetoEtaStrip03) EffectiveArea = 0.030;
1084 >    if (type == kEleChargedIso04) EffectiveArea = 0.000;
1085 >    if (type == kEleNeutralHadronIso04) EffectiveArea = 0.050;
1086 >    if (type == kEleGammaIso04) EffectiveArea = 0.073;
1087 >    if (type == kEleGammaIsoVetoEtaStrip04) EffectiveArea = 0.030;
1088 >    if (type == kEleNeutralHadronIso007) EffectiveArea = 0.000;
1089 >    if (type == kEleHoverE) EffectiveArea = 0.00022;
1090 >    if (type == kEleHcalDepth1OverEcal) EffectiveArea = 0.00022;
1091 >    if (type == kEleHcalDepth2OverEcal) EffectiveArea = 0.00000;    
1092 >  } else if (fabs(Eta) >= 1.479 && fabs(Eta) < 2.0 ) {
1093 >    if (type == kEleChargedIso03) EffectiveArea = 0.000;
1094 >    if (type == kEleNeutralHadronIso03) EffectiveArea = 0.030;
1095 >    if (type == kEleGammaIso03) EffectiveArea = 0.170;
1096 >    if (type == kEleGammaIsoVetoEtaStrip03) EffectiveArea = 0.134;
1097 >    if (type == kEleChargedIso04) EffectiveArea = 0.000;
1098 >    if (type == kEleNeutralHadronIso04) EffectiveArea = 0.060;
1099 >    if (type == kEleGammaIso04) EffectiveArea = 0.187;
1100 >    if (type == kEleGammaIsoVetoEtaStrip04) EffectiveArea = 0.134;
1101 >    if (type == kEleNeutralHadronIso007) EffectiveArea = 0.000;
1102 >    if (type == kEleHoverE) EffectiveArea = 0.00030;
1103 >    if (type == kEleHcalDepth1OverEcal) EffectiveArea = 0.00026;
1104 >    if (type == kEleHcalDepth2OverEcal) EffectiveArea = 0.00002;        
1105 >  } else if (fabs(Eta) >= 2.0 && fabs(Eta) < 2.25 ) {
1106 >    if (type == kEleChargedIso03) EffectiveArea = 0.000;
1107 >    if (type == kEleNeutralHadronIso03) EffectiveArea = 0.022;
1108 >    if (type == kEleGammaIso03) EffectiveArea = 0.623;
1109 >    if (type == kEleGammaIsoVetoEtaStrip03) EffectiveArea = 0.516;
1110 >    if (type == kEleChargedIso04) EffectiveArea = 0.000;
1111 >    if (type == kEleNeutralHadronIso04) EffectiveArea = 0.055;
1112 >    if (type == kEleGammaIso04) EffectiveArea = 0.659;
1113 >    if (type == kEleGammaIsoVetoEtaStrip04) EffectiveArea = 0.517;
1114 >    if (type == kEleNeutralHadronIso007) EffectiveArea = 0.000;
1115 >    if (type == kEleHoverE) EffectiveArea = 0.00054;
1116 >    if (type == kEleHcalDepth1OverEcal) EffectiveArea = 0.00045;
1117 >    if (type == kEleHcalDepth2OverEcal) EffectiveArea = 0.00003;
1118 >  } else if (fabs(Eta) >= 2.25 && fabs(Eta) < 2.5 ) {
1119 >    if (type == kEleChargedIso03) EffectiveArea = 0.000;
1120 >    if (type == kEleNeutralHadronIso03) EffectiveArea = 0.018;
1121 >    if (type == kEleGammaIso03) EffectiveArea = 1.198;
1122 >    if (type == kEleGammaIsoVetoEtaStrip03) EffectiveArea = 1.049;
1123 >    if (type == kEleChargedIso04) EffectiveArea = 0.000;
1124 >    if (type == kEleNeutralHadronIso04) EffectiveArea = 0.073;
1125 >    if (type == kEleGammaIso04) EffectiveArea = 1.258;
1126 >    if (type == kEleGammaIsoVetoEtaStrip04) EffectiveArea = 1.051;
1127 >    if (type == kEleNeutralHadronIso007) EffectiveArea = 0.000;
1128 >    if (type == kEleHoverE) EffectiveArea = 0.00082;
1129 >    if (type == kEleHcalDepth1OverEcal) EffectiveArea = 0.00066;
1130 >    if (type == kEleHcalDepth2OverEcal) EffectiveArea = 0.00004;
1131 >  }
1132 >    
1133 >  return EffectiveArea;  
1134   }
1135 +
1136 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines