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.4 by ceballos, Wed May 12 19:06:22 2010 UTC vs.
Revision 1.51 by pharris, Wed Jan 9 18:22:07 2013 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.05,  0.05,  0.05,  0.05,  0.04,   0.04,   0.04,   0.04  }, //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.006, 0.006, 0.006, 0.006, 0.008,  0.008,  0.008,  0.008 }, //deltaetain
54 >    {0.007, 0.007, 0.007, 0.007, 0.010,  0.010,  0.010,  0.010 }, //deltaetain
55      {0.0,   0.0,   0.0,   0.0,   0.0,    0.0,    0.0,    0.0   }, //eoverp
56      {0.0,   0.0,   0,     0,     0,      0,      0,      0     }  //extra cuts fbrem and E_Over_P
57    };            
58  
47
59    Double_t VBTFWorkingPoint90[6][8] = {
60 <    {0.05,  0.05,  0.05,  0.05,  0.025,  0.025,  0.025,  0.025 }, //hovere
60 >    {0.12,  0.12,  0.12,  0.12,  0.05,   0.05,   0.05,   0.05  }, //hovere
61 >    {0.01,  0.01,  0.01,  0.01,  0.03,   0.03,   0.03,   0.03  }, //sigmaetaeta
62 >    {0.8,   0.8,   0.8,   0.8,   0.7,    0.7,    0.7,    0.7   }, //deltaphiin
63 >    {0.007, 0.007, 0.007, 0.007, 0.009,  0.009,  0.009,  0.009 }, //deltaetain
64 >    {0.0,   0.0,   0.0,   0.0,   0.0,    0.0,    0.0,    0.0   }, //eoverp
65 >    {0.0,   0.0,   0,     0,     0,      0,      0,      0     }  //extra cuts fbrem and E_Over_P
66 >  };            
67 >
68 >  Double_t VBTFWorkingPoint85[6][8] = {
69 >    {0.04,  0.04,  0.04,  0.04,  0.025,  0.025,  0.025,  0.025 }, //hovere
70      {0.01,  0.01,  0.01,  0.01,  0.03,   0.03,   0.03,   0.03  }, //sigmaetaeta
71 <    {0.04,  0.04,  0.04,  0.04,  0.025,  0.025,  0.025,  0.025 }, //deltaphiin
72 <    {0.006, 0.006, 0.006, 0.006, 0.008,  0.008,  0.008,  0.008 }, //deltaetain
71 >    {0.06,  0.06,  0.06,  0.06,  0.04,   0.04,   0.04,   0.04  }, //deltaphiin
72 >    {0.006, 0.006, 0.006, 0.006, 0.007,  0.007,  0.007,  0.007 }, //deltaetain
73      {0.0,   0.0,   0.0,   0.0,   0.0,    0.0,    0.0,    0.0   }, //eoverp
74      {0.0,   0.0,   0,     0,     0,      0,      0,      0     }  //extra cuts fbrem and E_Over_P
75    };            
76  
77    Double_t VBTFWorkingPoint80[6][8] = {
78 <    {0.05,  0.05,  0.05,  0.05,  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.02,  0.02,  0.02,  0.02,  0.02,   0.02,   0.02,   0.02 }, //deltaphiin
81 <    {0.006, 0.006, 0.006, 0.006, 0.006,  0.006,  0.006,  0.006}, //deltaetain
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
82      {0.0,   0.0,   0.0,   0.0,   0.0,    0.0,    0.0,    0.0  }, //eoverp
83      {0.0,   0.0,   0,     0,     0,      0,      0,      0    }  //extra cuts fbrem and E_Over_P
84    };            
85  
86    Double_t VBTFWorkingPoint70[6][8] = {
87 <    {0.02,  0.02,  0.02,  0.02,  0.025,  0.025,  0.025,  0.025}, //hovere
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.02,  0.02,  0.02,  0.02,  0.02,   0.02,   0.02,   0.02 }, //deltaphiin
90 <    {0.006, 0.006, 0.006, 0.006, 0.003,  0.003,  0.003,  0.003}, //deltaetain
89 >    {0.03,  0.03,  0.03,  0.03,  0.02,   0.02,   0.02,   0.02 }, //deltaphiin
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 79 | 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;
126      case kVBTFWorkingPoint90Id:
127        memcpy(fCuts,VBTFWorkingPoint90,sizeof(fCuts));
128        break;
129 +    case kVBTFWorkingPoint85Id:
130 +      memcpy(fCuts,VBTFWorkingPoint85,sizeof(fCuts));
131 +      break;
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 96 | Line 146 | Bool_t ElectronTools::PassCustomID(const
146        break;
147    }
148  
99
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 112 | 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 122 | 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 138 | Line 189 | Bool_t ElectronTools::PassCustomID(const
189    if(eSeedOverPin<fCuts[4][cat+4*eb])
190      return kFALSE;
191  
192 +  // Apply detector isolation at high pt only
193 +  Bool_t isoCut = kTRUE;
194 +  if(idType == kVBTFWorkingPointFakeableId){
195 +    double isoEcal = ele->EcalRecHitIsoDr03();
196 +    if(ele->IsEB()) isoEcal = isoEcal - 1.0;
197 +    isoCut = (ele->TrackIsolationDr03() < ele->Pt()*0.2) &&
198 +             (isoEcal                   < ele->Pt()*0.2) &&
199 +             (ele->HcalTowerSumEtDr03() < ele->Pt()*0.2);
200 +  }
201 +  if(isoCut == kFALSE) return kFALSE;
202 +
203 +  // Cuts only for pt<20 region and kVBTFWorkingPointLowPtId
204 +  if(ele->Pt() < 20 && idType == kVBTFWorkingPointLowPtId) {
205 +    Bool_t isGoodLowPtEl = fBrem > 0.15 ||
206 +                          (ele->SCluster()->AbsEta() < 1.0 && eOverP > 0.95);
207 +    if(!isGoodLowPtEl) return kFALSE;
208 +  }
209 +  
210    return kTRUE;
211   }
212  
213   //--------------------------------------------------------------------------------------------------
214 < Bool_t ElectronTools::PassCustomIso(const Electron *ele, EElIsoType isoType)
214 > Bool_t ElectronTools::PassCustomIso(const Electron *ele, EElIsoType isoType,
215 >                                    Bool_t useCombineIso)
216   {
217    Bool_t pass = kTRUE;
218    Double_t fIsoCuts[4][2];          //!custom isolation cuts
149
219    Double_t VBTFWorkingPoint95[4][2] = {
220 <    {7.0 ,  8.0   },   //TrkIso
221 <    {5.0 ,  3.0   },   //ECALIso
222 <    {5.0 ,  2.0   },   //HCALIso
223 <    {9999,  9999  }   //Combined    
220 >    {0.15 , 0.08   },   //TrkIso
221 >    {2.00 , 0.06   },   //ECALIso
222 >    {0.12 , 0.05   },   //HCALIso
223 >    {0.15,  0.10   }   //Combined    
224    };            
225  
226    Double_t VBTFWorkingPoint90[4][2] = {
227 <    {6.0 ,  6.0   },   //TrkIso
228 <    {5.0 ,  2.5   },   //ECALIso
229 <    {5.0 ,  1.5   },   //HCALIso
230 <    {9999,  9999  }   //Combined    
227 >    {0.12 , 0.05   },   //TrkIso
228 >    {0.09 , 0.06   },   //ECALIso
229 >    {0.10 , 0.03   },   //HCALIso
230 >    {0.10,  0.07   }   //Combined    
231 >  };            
232 >
233 >  Double_t VBTFWorkingPoint85[4][2] = {
234 >    {0.09 , 0.05   },   //TrkIso
235 >    {0.08 , 0.05   },   //ECALIso
236 >    {0.10 , 0.025  },   //HCALIso
237 >    {0.09,  0.06   }   //Combined    
238    };            
239  
240    Double_t VBTFWorkingPoint80[4][2] = {
241 <    {3.0 ,  1.5   },   //TrkIso
242 <    {4.0 ,  2.5   },   //ECALIso
243 <    {5.0 ,  0.7   },   //HCALIso
244 <    {9999,  9999  }   //Combined    
241 >    {0.09 , 0.04   },   //TrkIso
242 >    {0.07 , 0.05   },   //ECALIso
243 >    {0.10 , 0.025  },   //HCALIso
244 >    {0.07,  0.06   }   //Combined    
245    };            
246  
247    Double_t VBTFWorkingPoint70[4][2] = {
248 <    {2.5 ,  0.8   },   //TrkIso
249 <    {3.0 ,  2.5   },   //ECALIso
250 <    {5.0 ,  0.25  },   //HCALIso
251 <    {9999,  9999  }   //Combined    
248 >    {0.05 , 0.025  },   //TrkIso
249 >    {0.06 , 0.025  },   //ECALIso
250 >    {0.03 , 0.020  },   //HCALIso
251 >    {0.04,  0.030  }   //Combined
252    };            
253  
254    switch (isoType) {
# Line 182 | Line 258 | Bool_t ElectronTools::PassCustomIso(cons
258      case kVBTFWorkingPoint90Iso:
259        memcpy(fIsoCuts,VBTFWorkingPoint90,sizeof(fIsoCuts));
260        break;
261 +    case kVBTFWorkingPoint85Iso:
262 +      memcpy(fIsoCuts,VBTFWorkingPoint85,sizeof(fIsoCuts));
263 +      break;
264      case kVBTFWorkingPoint80Iso:
265        memcpy(fIsoCuts,VBTFWorkingPoint80,sizeof(fIsoCuts));
266        break;
# Line 193 | Line 272 | Bool_t ElectronTools::PassCustomIso(cons
272        break;
273    }
274  
275 <  Double_t trkIso  = ele->TrackIsolationDr03();
276 <  Double_t ecalIso = ele->EcalRecHitIsoDr04();
277 <  Double_t hcalIso = ele->HcalIsolation();
278 <  Double_t combinedIso = ele->TrackIsolationDr03() + ele->EcalRecHitIsoDr04() - 1.5;
275 >  Double_t trkIso  = ele->TrackIsolationDr03() / ele->Pt();
276 >  Double_t ecalIso = ele->EcalRecHitIsoDr03() / ele->Pt();
277 >  Double_t hcalIso = ele->HcalTowerSumEtDr03() / ele->Pt();
278 >  Double_t combinedIso = ele->TrackIsolationDr03() + ele->EcalRecHitIsoDr03() + ele->HcalTowerSumEtDr03();
279 >  if(ele->IsEB()) combinedIso = ele->TrackIsolationDr03() + TMath::Max(ele->EcalRecHitIsoDr03() - 1.0, 0.0) + ele->HcalTowerSumEtDr03();
280 >  combinedIso = combinedIso / ele->Pt();
281  
282    Int_t eb = 1;
283    if (ele->IsEB())
284      eb = 0;
285  
286 <  if (trkIso>fIsoCuts[0][eb])
287 <    pass = kFALSE;
288 <  if (ecalIso>fIsoCuts[1][eb])
289 <    pass = kFALSE;
290 <  if (hcalIso>fIsoCuts[2][eb])
291 <    pass = kFALSE;
292 <  if (combinedIso>fIsoCuts[3][eb])
293 <    pass = kFALSE;
294 <
286 >  if(useCombineIso == kFALSE){
287 >    if (trkIso>fIsoCuts[0][eb])
288 >      pass = kFALSE;
289 >    if (ecalIso>fIsoCuts[1][eb])
290 >      pass = kFALSE;
291 >    if (hcalIso>fIsoCuts[2][eb])
292 >      pass = kFALSE;
293 >  }
294 >  else {
295 >    if (combinedIso>fIsoCuts[3][eb])
296 >      pass = kFALSE;
297 >  }
298  
299    return pass;
300   }
# Line 218 | Line 302 | Bool_t ElectronTools::PassCustomIso(cons
302  
303   //--------------------------------------------------------------------------------------------------
304   Bool_t ElectronTools::PassConversionFilter(const Electron *ele,
305 <                                           const DecayParticleCol *conversions,
306 <                                           Bool_t WrongHitsRequirement)
305 >                                           const DecayParticleCol *conversions,
306 >                                           const BaseVertex *vtx,
307 >                                           UInt_t nWrongHitsMax,
308 >                                           Double_t probMin,
309 >                                           Double_t lxyMin,
310 >                                           Bool_t matchCkf,
311 >                                           Bool_t requireArbitratedMerged,
312 >                                           Double_t trkptMin)
313   {
314    Bool_t isGoodConversion = kFALSE;
315  
# Line 228 | Line 318 | Bool_t ElectronTools::PassConversionFilt
318      for (UInt_t d=0; d<conversions->At(ifc)->NDaughters(); d++) {
319        const Track *trk = dynamic_cast<const ChargedParticle*>
320          (conversions->At(ifc)->Daughter(d))->Trk();
321 <      if (ele->GsfTrk() == trk) {
321 >      if (ele->GsfTrk() == trk || (matchCkf && ele->TrackerTrk()==trk) ) {
322          ConversionMatchFound = kTRUE;
323          break;
324        }
# Line 236 | Line 326 | Bool_t ElectronTools::PassConversionFilt
326  
327      // if match between the e-track and one of the conversion legs
328      if (ConversionMatchFound == kTRUE){
329 <      isGoodConversion =  (conversions->At(ifc)->Prob() > 1e-6) &&
330 <        (conversions->At(ifc)->Lxy() > 0) &&
331 <        (conversions->At(ifc)->Lz() > 0) &&
242 <        (conversions->At(ifc)->Position().Rho() > 2.0);
329 >      isGoodConversion =  (conversions->At(ifc)->Prob() > probMin) &&
330 >        (!requireArbitratedMerged || conversions->At(ifc)->Quality().Quality(ConversionQuality::arbitratedMerged)) &&
331 >        (conversions->At(ifc)->LxyCorrected(vtx) > lxyMin);
332  
333        if (isGoodConversion == kTRUE) {
334          for (UInt_t d=0; d<conversions->At(ifc)->NDaughters(); d++) {
335            const Track *trk = dynamic_cast<const ChargedParticle*>
336              (conversions->At(ifc)->Daughter(d))->Trk();
337            if (trk) {
338 <            // These requirements are not used for the GSF track
250 <            if (!(trk->NHits() >= 3 && trk->Prob() > 1e-6) && trk!=ele->GsfTrk())
251 <              isGoodConversion = kFALSE;
338 >            if (trk->Pt()<trkptMin) isGoodConversion = kFALSE;
339              const StableData *sd = dynamic_cast<const StableData*>
340                (conversions->At(ifc)->DaughterDat(d));
341 <            if (WrongHitsRequirement && sd->NWrongHits() != 0)
341 >            if (sd->NWrongHits() > nWrongHitsMax)
342                isGoodConversion = kFALSE;
343            } else {
344              isGoodConversion = kFALSE;
# Line 259 | Line 346 | Bool_t ElectronTools::PassConversionFilt
346          }
347        }
348      }
349 +
350      if (isGoodConversion == kTRUE) break;
351      
352    } // loop over all conversions
# Line 267 | Line 355 | Bool_t ElectronTools::PassConversionFilt
355   }
356  
357   //--------------------------------------------------------------------------------------------------
358 < Bool_t ElectronTools::PassD0Cut(const Electron *ele, const VertexCol *vertices, Double_t fD0Cut,
359 <                                Bool_t fReverseD0Cut)
358 > Bool_t ElectronTools::PassConversionFilterPFAOD(const Electron *ele,
359 >                                           const DecayParticleCol *conversions,
360 >                                           const BaseVertex *vtx,
361 >                                           UInt_t nWrongHitsMax,
362 >                                           Double_t probMin,
363 >                                           Double_t lxyMin,
364 >                                           Bool_t matchCkf,
365 >                                           Bool_t requireArbitratedMerged,
366 >                                           Double_t trkptMin)
367 > {
368 >
369 >  Bool_t isGoodConversion              = false;
370 >  for(unsigned int ifc=0; ifc<conversions->GetEntries(); ++ifc){
371 >    if(!(conversions->At(ifc)->Prob() > probMin) && (!requireArbitratedMerged || conversions->At(ifc)->Quality().Quality(ConversionQuality::arbitratedMerged)) && (conversions->At(ifc)->LxyCorrected((BaseVertex*)vtx) > lxyMin)) continue;
372 >    bool conversionMatchFound = false;
373 >    for(unsigned int d=0; d<conversions->At(ifc)->NDaughters(); ++d){
374 >      const ChargedParticle *pParticle = 0;
375 >      pParticle = dynamic_cast<const ChargedParticle*>(conversions->At(ifc)->Daughter(d));
376 >      if(pParticle == 0) continue;
377 >      const Track* trk = 0;
378 >      trk = pParticle->Trk();
379 >      if(trk == 0) continue;
380 >      if( ele->GsfTrk() == trk || (matchCkf && ele->TrackerTrk()==trk) ){ conversionMatchFound = true; break; }
381 >      const StableData* sd = dynamic_cast<const StableData*> (conversions->At(ifc)->DaughterDat(d));
382 >      isGoodConversion = true;
383 >      if( sd->NWrongHits() > nWrongHitsMax ){ isGoodConversion = false; }
384 >    }
385 >    if(isGoodConversion) break;
386 >  }
387 >  return !isGoodConversion;
388 > }
389 >
390 > //--------------------------------------------------------------------------------------------------
391 > Bool_t ElectronTools::PassD0Cut(const Electron *ele, const VertexCol *vertices, Double_t fD0Cut, Int_t nVertex)
392   {
393    Bool_t d0cut = kFALSE;
394 <  // d0 cut
395 <  Double_t d0_real = 99999;
396 <  for(UInt_t i0 = 0; i0 < vertices->GetEntries(); i0++) {
397 <    Double_t pD0 = ele->GsfTrk()->D0Corrected(*vertices->At(i0));
398 <    if(TMath::Abs(pD0) < TMath::Abs(d0_real)) d0_real = TMath::Abs(pD0);
394 >
395 >  Double_t d0_real = 1e30;
396 >
397 >  if( nVertex >= (int) vertices->GetEntries() )
398 >    nVertex = vertices->GetEntries() - 1;
399 >  
400 >  if(nVertex >= 0) d0_real = TMath::Abs(ele->GsfTrk()->D0Corrected(*vertices->At(nVertex)));
401 >  else            {
402 >    Double_t distVtx = 999.0;
403 >    Int_t closestVtx = 0;
404 >    for(UInt_t nv=0; nv<vertices->GetEntries(); nv++){
405 >      double dz = TMath::Abs(ele->GsfTrk()->DzCorrected(*vertices->At(nv)));
406 >      if(dz < distVtx) {
407 >        distVtx    = dz;
408 >        closestVtx = nv;
409 >      }
410 >    }
411 >    d0_real = TMath::Abs(ele->GsfTrk()->D0Corrected(*vertices->At(closestVtx)));
412    }
413    if(d0_real < fD0Cut) d0cut = kTRUE;
414    
282  if     (fReverseD0Cut == kTRUE &&
283          d0cut == kFALSE && d0_real < 0.05)
284    d0cut = kTRUE;
285  else if(fReverseD0Cut == kTRUE)
286    d0cut = kFALSE;
287  
415    return d0cut;
416   }
417  
418   //--------------------------------------------------------------------------------------------------
419 < Bool_t ElectronTools::PassD0Cut(const Electron *ele, const BeamSpotCol *beamspots, Double_t fD0Cut,
293 <                                Bool_t fReverseD0Cut)
419 > Bool_t ElectronTools::PassD0Cut(const Electron *ele, const BeamSpotCol *beamspots, Double_t fD0Cut)
420   {
421    Bool_t d0cut = kFALSE;
422    // d0 cut
# Line 301 | Line 427 | Bool_t ElectronTools::PassD0Cut(const El
427    }
428    if(d0_real < fD0Cut) d0cut = kTRUE;
429    
304  if     (fReverseD0Cut == kTRUE &&
305          d0cut == kFALSE && d0_real < 0.05)
306    d0cut = kTRUE;
307  else if(fReverseD0Cut == kTRUE)
308    d0cut = kFALSE;
309  
430    return d0cut;
431   }
432  
433   //--------------------------------------------------------------------------------------------------
434 + Bool_t ElectronTools::PassDZCut(const Electron *ele, const VertexCol *vertices, Double_t fDZCut, Int_t nVertex)
435 + {
436 +  Bool_t dzcut = kFALSE;
437 +
438 +  Double_t distVtx = 999.0;
439 +
440 +  if( nVertex >= (int) vertices->GetEntries() )
441 +    nVertex = vertices->GetEntries()-1;
442 +  
443 +  if(nVertex >= 0) distVtx = TMath::Abs(ele->GsfTrk()->DzCorrected(*vertices->At(nVertex)));
444 +  else {
445 +    for(UInt_t nv=0; nv<vertices->GetEntries(); nv++){
446 +      double dz = TMath::Abs(ele->GsfTrk()->DzCorrected(*vertices->At(nv)));
447 +      if(dz < distVtx) {
448 +        distVtx  = dz;
449 +      }
450 +    }
451 +  }
452 +  
453 +  if(distVtx < fDZCut) dzcut = kTRUE;
454 +  
455 +  return dzcut;
456 + }
457 +
458 + //--------------------------------------------------------------------------------------------------
459   Bool_t ElectronTools::PassChargeFilter(const Electron *ele)
460   {
461    Bool_t passChargeFilter = kTRUE;
# Line 324 | Line 469 | Bool_t ElectronTools::PassChargeFilter(c
469   Bool_t ElectronTools::PassSpikeRemovalFilter(const Electron *ele)
470   {
471    Bool_t passSpikeRemovalFilter = kTRUE;
472 <  if(ele->SCluster()->Seed()->Energy() > 5.0 &&
472 >  if(ele->SCluster() &&
473 >     ele->SCluster()->Seed()->Energy() > 5.0 &&
474       ele->SCluster()->Seed()->EMax() / ele->SCluster()->Seed()->E3x3() > 0.95
475      ) {
476      passSpikeRemovalFilter = kFALSE;
# Line 340 | Line 486 | Bool_t ElectronTools::PassSpikeRemovalFi
486    return passSpikeRemovalFilter;
487   }
488  
489 + Bool_t ElectronTools::PassTriggerMatching(const Electron *ele, const TriggerObjectCol *trigobjs)
490 + {
491 +  
492 +  for (UInt_t i=0; i<trigobjs->GetEntries(); ++i) {
493 +    const TriggerObject *trigobj = trigobjs->At(i);
494 +    if (trigobj->TriggerType()==TriggerObject::TriggerCluster || trigobj->TriggerType()==TriggerObject::TriggerElectron || trigobj->TriggerType()==TriggerObject::TriggerPhoton) {
495 +      if (MathUtils::DeltaR(ele->SCluster(),trigobj)<0.3) {
496 +        return kTRUE;
497 +      }
498 +    }
499 +  }
500 +  
501 +  return kFALSE;
502 +  
503 +  
504 + }
505 +
506   //--------------------------------------------------------------------------------------------------
507   Int_t ElectronTools::Classify(const Electron *ele) {
508    
509 <  double eta = ele->AbsEta();
509 >  double eta    = ele->AbsEta();
510    double eOverP = ele->ESuperClusterOverP();
511    double fBrem  = ele->FBrem();
512  
513    int cat = -1;
514    if (ele->IsEB()) {
515 <    if ((fBrem >= 0.12) && (eOverP > 0.9) && (eOverP < 1.2))
515 >    if ((fBrem >= 0.12) and (eOverP > 0.9) and (eOverP < 1.2))
516        cat = 0;
517 <    else if ((ele->IsTrackerDriven()) && (!ele->IsEcalDriven()))
517 >    else if (((eta >  .445   and eta <  .45  ) or
518 >              (eta >  .79    and eta <  .81  ) or
519 >              (eta > 1.137   and eta < 1.157 ) or
520 >              (eta > 1.47285 and eta < 1.4744)))
521 >      cat = 6;
522 >    else if (ele->IsTrackerDriven() and !ele->IsEcalDriven())
523        cat = 8;
524      else if (fBrem < 0.12)
525        cat = 1;
358    else if ((eta >  .445   && eta <  .45  ) ||
359             (eta >  .79    && eta <  .81  ) ||
360             (eta > 1.137   && eta < 1.157 ) ||
361             (eta > 1.47285 && eta < 1.4744))
362      cat = 6;
526      else
527        cat = 2;
528    } else {
529 <    if ((fBrem >= 0.2) && (eOverP > 0.82) && (eOverP < 1.22))
529 >    if ((fBrem >= 0.2) and (eOverP > 0.82) and (eOverP < 1.22))
530        cat = 3;
531 <    else if ((ele->IsTrackerDriven()) && (!ele->IsEcalDriven()))
531 >    else if (eta > 1.5 and eta <  1.58)
532 >      cat = 7;
533 >    else if (ele->IsTrackerDriven() and !ele->IsEcalDriven())
534        cat = 8;
535      else if (fBrem < 0.2)
536        cat = 4;
372    else if (eta > 1.5 && eta <  1.58)
373      cat = 7;
537      else
538        cat = 5;
539    }
# Line 380 | Line 543 | Int_t ElectronTools::Classify(const Elec
543  
544   //--------------------------------------------------------------------------------------------------
545   Int_t ElectronTools::PassTightId(const Electron *ele, const VertexCol *vertices,
546 <                                 const DecayParticleCol *conversions, const Int_t typeCuts){
546 >                                 const DecayParticleCol *conversions, const Int_t typeCuts,
547 >                                 Double_t beta){
548  
549 <  Double_t scEt   = ele->SCluster()->Et();
550 <  Double_t eOverP = ele->ESuperClusterOverP();
549 > // original code on
550 > // http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/RecoEgamma/ElectronIdentification/src/CutBasedElectronID.cc
551 > // beta must be computed with a DR cone of 0.4
552 >
553 >  Double_t scEt   = ele->SCluster()->Et();
554 >  Double_t scEta  = ele->SCluster()->Eta();
555  
556    Double_t fBrem = ele->FBrem();
557    Double_t hOverE = ele->HadronicOverEm();
# Line 394 | Line 562 | Int_t ElectronTools::PassTightId(const E
562  
563    Int_t mishits = ele->BestTrk()->NExpectedHitsInner();
564    Double_t tkIso   = ele->TrackIsolationDr03();
565 <  Double_t ecalIso = ele->EcalRecHitIsoDr04();
566 <  Double_t ecalIsoPed = (ele->IsEB())?std::max(0.,ecalIso-1.):ecalIso;
399 <  Double_t hcalIso  = ele->HcalTowerSumEtDr04();
400 <  Double_t hcalIso1 = ele->HcalDepth1TowerSumEtDr04();
401 <  Double_t hcalIso2 = ele->HcalDepth2TowerSumEtDr04();
402 <  Double_t e25Max = ele->E25Max();
403 <  Double_t e15 = ele->E15();
404 <  Double_t e55 = ele->E55();
405 <  Double_t e25Maxoe55 = e25Max/e55;
406 <  Double_t e15oe55 = e15/e55;
565 >  Double_t ecalIso = ele->EcalRecHitIsoDr04()*beta;
566 >  Double_t hcalIso  = ele->HcalTowerSumEtDr04()*beta;
567  
568    int cat = Classify(ele);
569    int eb;
# Line 413 | Line 573 | Int_t ElectronTools::PassTightId(const E
573    else
574      eb = 1;
575  
576 <  Int_t result = 0.;
576 >  // Medium cuts
577 >  Double_t cutdcotdistMedium[9] = {
578 >  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};
579 >  Double_t cutdetainMedium[9] = {
580 >  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};
581 >  Double_t cutdetainlMedium[9] = {
582 >  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};
583 >  Double_t cutdphiinMedium[9] = {
584 >  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};
585 >  Double_t cutdphiinlMedium[9] = {
586 >  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};
587 >  Double_t cuteseedopcorMedium[9] = {
588 >  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};
589 >  Double_t cutfmishitsMedium[9] = {
590 >  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};
591 >  Double_t cuthoeMedium[9] = {
592 >  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};
593 >  Double_t cuthoelMedium[9] = {
594 >  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};
595 >  Double_t cutip_gsfMedium[9] = {
596 >  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};
597 >  Double_t cutip_gsflMedium[9] = {
598 >  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};
599 >  Double_t cutiso_sumMedium[9] = {
600 >  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};
601 >  Double_t cutiso_sumoetMedium[9] = {
602 >  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};
603 >  Double_t cutiso_sumoetlMedium[9] = {
604 >  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};
605 >  Double_t cutseeMedium[9] = {
606 >  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};
607 >  Double_t cutseelMedium[9] = {
608 >  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};
609 >
610 >  // Tight cuts
611 >  Double_t cutdcotdistTight[9] = {
612 >  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};
613 >  Double_t cutdetainTight[9] = {
614 >  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};
615 >  Double_t cutdetainlTight[9] = {
616 >  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};
617 >  Double_t cutdphiinTight[9] = {
618 >  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};
619 >  Double_t cutdphiinlTight[9] = {
620 >  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};
621 >  Double_t cuteseedopcorTight[9] = {
622 >  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};
623 >  Double_t cutfmishitsTight[9] = {
624 >  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};
625 >  Double_t cuthoeTight[9] = {
626 >  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};
627 >  Double_t cuthoelTight[9] = {
628 >  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};
629 >  Double_t cutip_gsfTight[9] = {
630 >  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};
631 >  Double_t cutip_gsflTight[9] = {
632 >  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};
633 >  Double_t cutiso_sumTight[9] = {
634 >  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};
635 >  Double_t cutiso_sumoetTight[9] = {
636 >  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};
637 >  Double_t cutiso_sumoetlTight[9] = {
638 >  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};
639 >  Double_t cutseeTight[9] = {
640 >  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};
641 >  Double_t cutseelTight[9] = {
642 >  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};
643    
644 <  Int_t bin = 0;
645 <  if (scEt < 20.)
646 <    bin = 2;
647 <  else if (scEt > 30.)
648 <    bin = 0;
649 <  else
650 <    bin = 1;
644 >  // SuperTight cuts
645 >  Double_t cutdcotdistSuperTight[9] = {
646 >  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};
647 >  Double_t cutdetainSuperTight[9] = {
648 >  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};
649 >  Double_t cutdetainlSuperTight[9] = {
650 >  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};
651 >  Double_t cutdphiinSuperTight[9] = {
652 >  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};
653 >  Double_t cutdphiinlSuperTight[9] = {
654 >  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};
655 >  Double_t cuteseedopcorSuperTight[9] = {
656 >  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};
657 >  Double_t cutfmishitsSuperTight[9] = {
658 >  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};
659 >  Double_t cuthoeSuperTight[9] = {
660 >  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};
661 >  Double_t cuthoelSuperTight[9] = {
662 >  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};
663 >  Double_t cutip_gsfSuperTight[9] = {
664 >  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};
665 >  Double_t cutip_gsflSuperTight[9] = {
666 >  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};
667 >  Double_t cutiso_sumSuperTight[9] = {
668 >  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};
669 >  Double_t cutiso_sumoetSuperTight[9] = {
670 >  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};
671 >  Double_t cutiso_sumoetlSuperTight[9] = {
672 >  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};
673 >  Double_t cutseeSuperTight[9] = {
674 >  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};
675 >  Double_t cutseelSuperTight[9] = {
676 >  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};
677 >
678 >  // HyperTight1 cuts
679 >  Double_t cutdcotdistHyperTight1[9] = {
680 >  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};
681 >  Double_t cutdetainHyperTight1[9] = {
682 >  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};
683 >  Double_t cutdetainlHyperTight1[9] = {
684 >  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};
685 >  Double_t cutdphiinHyperTight1[9] = {
686 >  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};
687 >  Double_t cutdphiinlHyperTight1[9] = {
688 >  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};
689 >  Double_t cuteseedopcorHyperTight1[9] = {
690 >  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};
691 >  Double_t cutfmishitsHyperTight1[9] = {
692 >  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};
693 >  Double_t cuthoeHyperTight1[9] = {
694 >  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};
695 >  Double_t cuthoelHyperTight1[9] = {
696 >  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};
697 >  Double_t cutip_gsfHyperTight1[9] = {
698 >  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};
699 >  Double_t cutip_gsflHyperTight1[9] = {
700 >  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};
701 >  Double_t cutiso_sumHyperTight1[9] = {
702 >  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};
703 >  Double_t cutiso_sumoetHyperTight1[9] = {
704 >  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};
705 >  Double_t cutiso_sumoetlHyperTight1[9] = {
706 >  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};
707 >  Double_t cutseeHyperTight1[9] = {
708 >  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};
709 >  Double_t cutseelHyperTight1[9] = {
710 >  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};
711 >
712 >  // HyperTight2 cuts
713 >  Double_t cutdcotdistHyperTight2[9] = {
714 >  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};
715 >  Double_t cutdetainHyperTight2[9] = {
716 >  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};
717 >  Double_t cutdetainlHyperTight2[9] = {
718 >  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};
719 >  Double_t cutdphiinHyperTight2[9] = {
720 >  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};
721 >  Double_t cutdphiinlHyperTight2[9] = {
722 >  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};
723 >  Double_t cuteseedopcorHyperTight2[9] = {
724 >  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};
725 >  Double_t cutfmishitsHyperTight2[9] = {
726 >  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};
727 >  Double_t cuthoeHyperTight2[9] = {
728 >  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};
729 >  Double_t cuthoelHyperTight2[9] = {
730 >  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};
731 >  Double_t cutip_gsfHyperTight2[9] = {
732 >  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};
733 >  Double_t cutip_gsflHyperTight2[9] = {
734 >  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};
735 >  Double_t cutiso_sumHyperTight2[9] = {
736 >  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};
737 >  Double_t cutiso_sumoetHyperTight2[9] = {
738 >  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};
739 >  Double_t cutiso_sumoetlHyperTight2[9] = {
740 >  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};
741 >  Double_t cutseeHyperTight2[9] = {
742 >  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};
743 >  Double_t cutseelHyperTight2[9] = {
744 >  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};
745 >
746 >  // HyperTight3 cuts
747 >  Double_t cutdcotdistHyperTight3[9] = {
748 >  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};
749 >  Double_t cutdetainHyperTight3[9] = {
750 >  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};
751 >  Double_t cutdetainlHyperTight3[9] = {
752 >  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};
753 >  Double_t cutdphiinHyperTight3[9] = {
754 >  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};
755 >  Double_t cutdphiinlHyperTight3[9] = {
756 >  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};
757 >  Double_t cuteseedopcorHyperTight3[9] = {
758 >  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};
759 >  Double_t cutfmishitsHyperTight3[9] = {
760 >  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};
761 >  Double_t cuthoeHyperTight3[9] = {
762 >  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};
763 >  Double_t cuthoelHyperTight3[9] = {
764 >  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};
765 >  Double_t cutip_gsfHyperTight3[9] = {
766 >  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};
767 >  Double_t cutip_gsflHyperTight3[9] = {
768 >  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};
769 >  Double_t cutiso_sumHyperTight3[9] = {
770 >  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};
771 >  Double_t cutiso_sumoetHyperTight3[9] = {
772 >  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};
773 >  Double_t cutiso_sumoetlHyperTight3[9] = {
774 >  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};
775 >  Double_t cutseeHyperTight3[9] = {
776 >  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};
777 >  Double_t cutseelHyperTight3[9] = {
778 >  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};
779 >
780 >  // HyperTight4 cuts
781 >  Double_t cutdcotdistHyperTight4[9] = {
782 >  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};
783 >  Double_t cutdetainHyperTight4[9] = {
784 >  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};
785 >  Double_t cutdetainlHyperTight4[9] = {
786 >  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};
787 >  Double_t cutdphiinHyperTight4[9] = {
788 >  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};
789 >  Double_t cutdphiinlHyperTight4[9] = {
790 >  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};
791 >  Double_t cuteseedopcorHyperTight4[9] = {
792 >  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};
793 >  Double_t cutfmishitsHyperTight4[9] = {
794 >  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};
795 >  Double_t cuthoeHyperTight4[9] = {
796 >  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};
797 >  Double_t cuthoelHyperTight4[9] = {
798 >  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};
799 >  Double_t cutip_gsfHyperTight4[9] = {
800 >  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};
801 >  Double_t cutip_gsflHyperTight4[9] = {
802 >  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};
803 >  Double_t cutiso_sumHyperTight4[9] = {
804 >  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};
805 >  Double_t cutiso_sumoetHyperTight4[9] = {
806 >  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};
807 >  Double_t cutiso_sumoetlHyperTight4[9] = {
808 >  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};
809 >  Double_t cutseeHyperTight4[9] = {
810 >  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};
811 >  Double_t cutseelHyperTight4[9] = {
812 >  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};
813 >
814 >  Double_t cutdcotdist[9];
815 >  Double_t cutdetain[9];
816 >  Double_t cutdetainl[9];
817 >  Double_t cutdphiin[9];
818 >  Double_t cutdphiinl[9];
819 >  Double_t cuteseedopcor[9];
820 >  Double_t cutfmishits[9];
821 >  Double_t cuthoe[9];
822 >  Double_t cuthoel[9];
823 >  Double_t cutip_gsf[9];
824 >  Double_t cutip_gsfl[9];
825 >  Double_t cutiso_sum[9];
826 >  Double_t cutiso_sumoet[9];
827 >  Double_t cutiso_sumoetl[9];
828 >  Double_t cutsee[9];
829 >  Double_t cutseel[9];
830 >  if     (typeCuts == 0) {
831 >    memcpy(cutdcotdist   ,cutdcotdistMedium   ,sizeof(cutdcotdistMedium));
832 >    memcpy(cutdetain     ,cutdetainMedium     ,sizeof(cutdetainMedium));
833 >    memcpy(cutdetainl    ,cutdetainlMedium    ,sizeof(cutdetainlMedium));
834 >    memcpy(cutdphiin     ,cutdphiinMedium     ,sizeof(cutdphiinMedium));
835 >    memcpy(cutdphiinl    ,cutdphiinlMedium    ,sizeof(cutdphiinlMedium));
836 >    memcpy(cuteseedopcor ,cuteseedopcorMedium ,sizeof(cuteseedopcorMedium));
837 >    memcpy(cutfmishits   ,cutfmishitsMedium   ,sizeof(cutfmishitsMedium));
838 >    memcpy(cuthoe        ,cuthoeMedium        ,sizeof(cuthoeMedium));
839 >    memcpy(cuthoel       ,cuthoelMedium       ,sizeof(cuthoelMedium));
840 >    memcpy(cutip_gsf     ,cutip_gsfMedium     ,sizeof(cutip_gsfMedium));
841 >    memcpy(cutip_gsfl    ,cutip_gsflMedium    ,sizeof(cutip_gsflMedium));
842 >    memcpy(cutiso_sum    ,cutiso_sumMedium    ,sizeof(cutiso_sumMedium));
843 >    memcpy(cutiso_sumoet ,cutiso_sumoetMedium ,sizeof(cutiso_sumoetMedium));
844 >    memcpy(cutiso_sumoetl,cutiso_sumoetlMedium,sizeof(cutiso_sumoetlMedium));
845 >    memcpy(cutsee        ,cutseeMedium        ,sizeof(cutseeMedium));
846 >    memcpy(cutseel       ,cutseelMedium       ,sizeof(cutseelMedium));
847 >  }
848 >  else if(typeCuts == 1) {
849 >    memcpy(cutdcotdist   ,cutdcotdistTight   ,sizeof(cutdcotdistTight));
850 >    memcpy(cutdetain     ,cutdetainTight     ,sizeof(cutdetainTight));
851 >    memcpy(cutdetainl    ,cutdetainlTight    ,sizeof(cutdetainlTight));
852 >    memcpy(cutdphiin     ,cutdphiinTight     ,sizeof(cutdphiinTight));
853 >    memcpy(cutdphiinl    ,cutdphiinlTight    ,sizeof(cutdphiinlTight));
854 >    memcpy(cuteseedopcor ,cuteseedopcorTight ,sizeof(cuteseedopcorTight));
855 >    memcpy(cutfmishits   ,cutfmishitsTight   ,sizeof(cutfmishitsTight));
856 >    memcpy(cuthoe        ,cuthoeTight        ,sizeof(cuthoeTight));
857 >    memcpy(cuthoel       ,cuthoelTight       ,sizeof(cuthoelTight));
858 >    memcpy(cutip_gsf     ,cutip_gsfTight     ,sizeof(cutip_gsfTight));
859 >    memcpy(cutip_gsfl    ,cutip_gsflTight    ,sizeof(cutip_gsflTight));
860 >    memcpy(cutiso_sum    ,cutiso_sumTight    ,sizeof(cutiso_sumTight));
861 >    memcpy(cutiso_sumoet ,cutiso_sumoetTight ,sizeof(cutiso_sumoetTight));
862 >    memcpy(cutiso_sumoetl,cutiso_sumoetlTight,sizeof(cutiso_sumoetlTight));
863 >    memcpy(cutsee        ,cutseeTight        ,sizeof(cutseeTight));
864 >    memcpy(cutseel       ,cutseelTight       ,sizeof(cutseelTight));
865 >  }
866 >  else if(typeCuts == 2) {
867 >    memcpy(cutdcotdist   ,cutdcotdistSuperTight   ,sizeof(cutdcotdistSuperTight));
868 >    memcpy(cutdetain     ,cutdetainSuperTight     ,sizeof(cutdetainSuperTight));
869 >    memcpy(cutdetainl    ,cutdetainlSuperTight    ,sizeof(cutdetainlSuperTight));
870 >    memcpy(cutdphiin     ,cutdphiinSuperTight     ,sizeof(cutdphiinSuperTight));
871 >    memcpy(cutdphiinl    ,cutdphiinlSuperTight    ,sizeof(cutdphiinlSuperTight));
872 >    memcpy(cuteseedopcor ,cuteseedopcorSuperTight ,sizeof(cuteseedopcorSuperTight));
873 >    memcpy(cutfmishits   ,cutfmishitsSuperTight   ,sizeof(cutfmishitsSuperTight));
874 >    memcpy(cuthoe        ,cuthoeSuperTight        ,sizeof(cuthoeSuperTight));
875 >    memcpy(cuthoel       ,cuthoelSuperTight       ,sizeof(cuthoelSuperTight));
876 >    memcpy(cutip_gsf     ,cutip_gsfSuperTight     ,sizeof(cutip_gsfSuperTight));
877 >    memcpy(cutip_gsfl    ,cutip_gsflSuperTight    ,sizeof(cutip_gsflSuperTight));
878 >    memcpy(cutiso_sum    ,cutiso_sumSuperTight    ,sizeof(cutiso_sumSuperTight));
879 >    memcpy(cutiso_sumoet ,cutiso_sumoetSuperTight ,sizeof(cutiso_sumoetSuperTight));
880 >    memcpy(cutiso_sumoetl,cutiso_sumoetlSuperTight,sizeof(cutiso_sumoetlSuperTight));
881 >    memcpy(cutsee        ,cutseeSuperTight        ,sizeof(cutseeSuperTight));
882 >    memcpy(cutseel       ,cutseelSuperTight       ,sizeof(cutseelSuperTight));
883 >  }
884 >  else if(typeCuts == 3) {
885 >    memcpy(cutdcotdist   ,cutdcotdistHyperTight1   ,sizeof(cutdcotdistHyperTight1));
886 >    memcpy(cutdetain     ,cutdetainHyperTight1     ,sizeof(cutdetainHyperTight1));
887 >    memcpy(cutdetainl    ,cutdetainlHyperTight1    ,sizeof(cutdetainlHyperTight1));
888 >    memcpy(cutdphiin     ,cutdphiinHyperTight1     ,sizeof(cutdphiinHyperTight1));
889 >    memcpy(cutdphiinl    ,cutdphiinlHyperTight1    ,sizeof(cutdphiinlHyperTight1));
890 >    memcpy(cuteseedopcor ,cuteseedopcorHyperTight1 ,sizeof(cuteseedopcorHyperTight1));
891 >    memcpy(cutfmishits   ,cutfmishitsHyperTight1   ,sizeof(cutfmishitsHyperTight1));
892 >    memcpy(cuthoe        ,cuthoeHyperTight1       ,sizeof(cuthoeHyperTight1));
893 >    memcpy(cuthoel       ,cuthoelHyperTight1      ,sizeof(cuthoelHyperTight1));
894 >    memcpy(cutip_gsf     ,cutip_gsfHyperTight1     ,sizeof(cutip_gsfHyperTight1));
895 >    memcpy(cutip_gsfl    ,cutip_gsflHyperTight1    ,sizeof(cutip_gsflHyperTight1));
896 >    memcpy(cutiso_sum    ,cutiso_sumHyperTight1    ,sizeof(cutiso_sumHyperTight1));
897 >    memcpy(cutiso_sumoet ,cutiso_sumoetHyperTight1 ,sizeof(cutiso_sumoetHyperTight1));
898 >    memcpy(cutiso_sumoetl,cutiso_sumoetlHyperTight1,sizeof(cutiso_sumoetlHyperTight1));
899 >    memcpy(cutsee        ,cutseeHyperTight1       ,sizeof(cutseeHyperTight1));
900 >    memcpy(cutseel       ,cutseelHyperTight1      ,sizeof(cutseelHyperTight1));
901 >  }
902 >  else if(typeCuts == 4) {
903 >    memcpy(cutdcotdist   ,cutdcotdistHyperTight2   ,sizeof(cutdcotdistHyperTight2));
904 >    memcpy(cutdetain     ,cutdetainHyperTight2     ,sizeof(cutdetainHyperTight2));
905 >    memcpy(cutdetainl    ,cutdetainlHyperTight2    ,sizeof(cutdetainlHyperTight2));
906 >    memcpy(cutdphiin     ,cutdphiinHyperTight2     ,sizeof(cutdphiinHyperTight2));
907 >    memcpy(cutdphiinl    ,cutdphiinlHyperTight2    ,sizeof(cutdphiinlHyperTight2));
908 >    memcpy(cuteseedopcor ,cuteseedopcorHyperTight2 ,sizeof(cuteseedopcorHyperTight2));
909 >    memcpy(cutfmishits   ,cutfmishitsHyperTight2   ,sizeof(cutfmishitsHyperTight2));
910 >    memcpy(cuthoe        ,cuthoeHyperTight2       ,sizeof(cuthoeHyperTight2));
911 >    memcpy(cuthoel       ,cuthoelHyperTight2      ,sizeof(cuthoelHyperTight2));
912 >    memcpy(cutip_gsf     ,cutip_gsfHyperTight2     ,sizeof(cutip_gsfHyperTight2));
913 >    memcpy(cutip_gsfl    ,cutip_gsflHyperTight2    ,sizeof(cutip_gsflHyperTight2));
914 >    memcpy(cutiso_sum    ,cutiso_sumHyperTight2    ,sizeof(cutiso_sumHyperTight2));
915 >    memcpy(cutiso_sumoet ,cutiso_sumoetHyperTight2 ,sizeof(cutiso_sumoetHyperTight2));
916 >    memcpy(cutiso_sumoetl,cutiso_sumoetlHyperTight2,sizeof(cutiso_sumoetlHyperTight2));
917 >    memcpy(cutsee        ,cutseeHyperTight2       ,sizeof(cutseeHyperTight2));
918 >    memcpy(cutseel       ,cutseelHyperTight2      ,sizeof(cutseelHyperTight2));
919 >  }
920 >  else if(typeCuts == 5) {
921 >    memcpy(cutdcotdist   ,cutdcotdistHyperTight3   ,sizeof(cutdcotdistHyperTight3));
922 >    memcpy(cutdetain     ,cutdetainHyperTight3     ,sizeof(cutdetainHyperTight3));
923 >    memcpy(cutdetainl    ,cutdetainlHyperTight3    ,sizeof(cutdetainlHyperTight3));
924 >    memcpy(cutdphiin     ,cutdphiinHyperTight3     ,sizeof(cutdphiinHyperTight3));
925 >    memcpy(cutdphiinl    ,cutdphiinlHyperTight3    ,sizeof(cutdphiinlHyperTight3));
926 >    memcpy(cuteseedopcor ,cuteseedopcorHyperTight3 ,sizeof(cuteseedopcorHyperTight3));
927 >    memcpy(cutfmishits   ,cutfmishitsHyperTight3   ,sizeof(cutfmishitsHyperTight3));
928 >    memcpy(cuthoe        ,cuthoeHyperTight3       ,sizeof(cuthoeHyperTight3));
929 >    memcpy(cuthoel       ,cuthoelHyperTight3      ,sizeof(cuthoelHyperTight3));
930 >    memcpy(cutip_gsf     ,cutip_gsfHyperTight3     ,sizeof(cutip_gsfHyperTight3));
931 >    memcpy(cutip_gsfl    ,cutip_gsflHyperTight3    ,sizeof(cutip_gsflHyperTight3));
932 >    memcpy(cutiso_sum    ,cutiso_sumHyperTight3    ,sizeof(cutiso_sumHyperTight3));
933 >    memcpy(cutiso_sumoet ,cutiso_sumoetHyperTight3 ,sizeof(cutiso_sumoetHyperTight3));
934 >    memcpy(cutiso_sumoetl,cutiso_sumoetlHyperTight3,sizeof(cutiso_sumoetlHyperTight3));
935 >    memcpy(cutsee        ,cutseeHyperTight3       ,sizeof(cutseeHyperTight3));
936 >    memcpy(cutseel       ,cutseelHyperTight3      ,sizeof(cutseelHyperTight3));
937 >  }
938 >  else if(typeCuts == 6) {
939 >    memcpy(cutdcotdist   ,cutdcotdistHyperTight4   ,sizeof(cutdcotdistHyperTight4));
940 >    memcpy(cutdetain     ,cutdetainHyperTight4     ,sizeof(cutdetainHyperTight4));
941 >    memcpy(cutdetainl    ,cutdetainlHyperTight4    ,sizeof(cutdetainlHyperTight4));
942 >    memcpy(cutdphiin     ,cutdphiinHyperTight4     ,sizeof(cutdphiinHyperTight4));
943 >    memcpy(cutdphiinl    ,cutdphiinlHyperTight4    ,sizeof(cutdphiinlHyperTight4));
944 >    memcpy(cuteseedopcor ,cuteseedopcorHyperTight4 ,sizeof(cuteseedopcorHyperTight4));
945 >    memcpy(cutfmishits   ,cutfmishitsHyperTight4   ,sizeof(cutfmishitsHyperTight4));
946 >    memcpy(cuthoe        ,cuthoeHyperTight4       ,sizeof(cuthoeHyperTight4));
947 >    memcpy(cuthoel       ,cuthoelHyperTight4      ,sizeof(cuthoelHyperTight4));
948 >    memcpy(cutip_gsf     ,cutip_gsfHyperTight4     ,sizeof(cutip_gsfHyperTight4));
949 >    memcpy(cutip_gsfl    ,cutip_gsflHyperTight4    ,sizeof(cutip_gsflHyperTight4));
950 >    memcpy(cutiso_sum    ,cutiso_sumHyperTight4    ,sizeof(cutiso_sumHyperTight4));
951 >    memcpy(cutiso_sumoet ,cutiso_sumoetHyperTight4 ,sizeof(cutiso_sumoetHyperTight4));
952 >    memcpy(cutiso_sumoetl,cutiso_sumoetlHyperTight4,sizeof(cutiso_sumoetlHyperTight4));
953 >    memcpy(cutsee        ,cutseeHyperTight4       ,sizeof(cutseeHyperTight4));
954 >    memcpy(cutseel       ,cutseelHyperTight4      ,sizeof(cutseelHyperTight4));
955 >  }
956 >  else {
957 >    return 0;
958 >  }
959 >  int result = 0;
960 >  
961 >  const int ncuts = 10;
962 >  std::vector<bool> cut_results(ncuts, false);
963 >  
964 >  float iso_sum = tkIso + ecalIso + hcalIso;
965 >  if(fabs(scEta)>1.5)
966 >    iso_sum += (fabs(scEta)-1.5)*1.09;
967 >  
968 >  float iso_sumoet = iso_sum*(40./scEt);
969 >  
970 >  float eseedopincor = eSeedOverPin + fBrem;
971 >  if(fBrem < 0)
972 >    eseedopincor = eSeedOverPin;
973  
974 <  if (fBrem > 0)
975 <    eSeedOverPin = eSeedOverPin + fBrem;
974 >  float dist = (TMath::Abs(ele->ConvPartnerDist())      == -9999.? 9999:TMath::Abs(ele->ConvPartnerDist()));
975 >  float dcot = (TMath::Abs(ele->ConvPartnerDCotTheta()) == -9999.? 9999:TMath::Abs(ele->ConvPartnerDCotTheta()));
976  
977 <  if(typeCuts == 3 || typeCuts == 4){
430 <  // Loose robust cuts
431 <    Double_t robustlooseEleIDCuts[52] = {
432 <       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,
433 <       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
434 <    };
435 <  // Tight robust cuts
436 <    Double_t robusttightEleIDCuts[52] = {
437 <        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,
438 <        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
439 <    };                            
440 <    Double_t cut[52];
441 <    if     (typeCuts == 3) {
442 <      memcpy(cut  ,robustlooseEleIDCuts  ,sizeof(cut));
443 <    }
444 <    else {
445 <      memcpy(cut  ,robusttightEleIDCuts  ,sizeof(cut));
446 <    }
447 <
448 <    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]) ||
449 <        (tkIso/ele->Pt() > cut[26*eb+11]) || (ecalIso/ele->Pt() > cut[26*eb+12]) || (hcalIso/ele->Pt() > cut[26*eb+13]) ||
450 <        ((tkIso+ecalIso+hcalIso)>cut[26*eb+14]) || (((tkIso+ecalIso+hcalIso)/ ele->Pt()) > cut[26*eb+15]) ||
451 <        ((tkIso+ecalIsoPed+hcalIso)>cut[26*eb+16]) || (((tkIso+ecalIsoPed+hcalIso)/ ele->Pt()) > cut[26*eb+17])  )
452 <      result = 0.;
453 <    else
454 <      result = 2.;
977 >  float dcotdistcomb = ((0.04 - std::max(dist, dcot)) > 0?(0.04 - std::max(dist, dcot)):0);
978  
979 <    if (hOverE > cut[26*eb+0])
980 <      return result;    
979 >  Double_t ip = 99999;
980 >  for(UInt_t i0 = 0; i0 < vertices->GetEntries(); i0++) {
981 >    if(vertices->At(i0)->NTracks() > 0){
982 >      Double_t pD0 = ele->GsfTrk()->D0Corrected(*vertices->At(i0));
983 >      ip = TMath::Abs(pD0);
984 >      break;
985 >    }
986 >  }
987  
988 <    if (sigmaee > cut[26*eb+1])
989 <      return result;    
988 >  for (int cut=0; cut<ncuts; cut++) {
989 >    switch (cut) {
990 >    case 0:
991 >      cut_results[cut] = compute_cut(fabs(deltaEtaIn), scEt, cutdetainl[cat], cutdetain[cat]);
992 >      break;
993 >    case 1:
994 >      cut_results[cut] = compute_cut(fabs(deltaPhiIn), scEt, cutdphiinl[cat], cutdphiin[cat]);
995 >      break;
996 >    case 2:
997 >      cut_results[cut] = (eseedopincor > cuteseedopcor[cat]);
998 >      break;
999 >    case 3:
1000 >      cut_results[cut] = compute_cut(hOverE, scEt, cuthoel[cat], cuthoe[cat]);
1001 >      break;
1002 >    case 4:
1003 >      cut_results[cut] = compute_cut(sigmaee, scEt, cutseel[cat], cutsee[cat]);
1004 >      break;
1005 >    case 5:
1006 >      cut_results[cut] = compute_cut(iso_sumoet, scEt, cutiso_sumoetl[cat], cutiso_sumoet[cat]);
1007 >      break;
1008 >    case 6:
1009 >      cut_results[cut] = (iso_sum < cutiso_sum[cat]);
1010 >      break;
1011 >    case 7:
1012 >      cut_results[cut] = compute_cut(fabs(ip), scEt, cutip_gsfl[cat], cutip_gsf[cat]);
1013 >      break;
1014 >    case 8:
1015 >      cut_results[cut] = (mishits < cutfmishits[cat]);
1016 >      break;
1017 >    case 9:
1018 >      cut_results[cut] = (dcotdistcomb < cutdcotdist[cat]);
1019 >      break;
1020 >    }
1021 >  }
1022 >  
1023 >  // ID part
1024 >  if (cut_results[0] & cut_results[1] & cut_results[2] & cut_results[3] & cut_results[4])
1025 >    result = result + 1;
1026 >  
1027 >  // ISO part
1028 >  if (cut_results[5] & cut_results[6])
1029 >    result = result + 2;
1030 >  
1031 >  // IP part
1032 >  if (cut_results[7])
1033 >    result = result + 8;
1034 >  
1035 >  // Conversion part
1036 >  if (cut_results[8] and cut_results[9])
1037 >    result = result + 4;
1038 >  
1039 >  return result;
1040 > }
1041  
1042 <    if (fabs(deltaPhiIn) > cut[26*eb+2])
1043 <      return result;    
1042 > //--------------------------------------------------------------------------------------------------
1043 > bool ElectronTools::compute_cut(double x, double et, double cut_min, double cut_max, bool gtn) {
1044  
1045 <    if (fabs(deltaEtaIn) > cut[26*eb+3])
1046 <      return result;    
467 <    
468 <    if (e25Maxoe55 < cut[26*eb+4] && e15oe55 < cut[26*eb+5])
469 <      return result;
470 <    // some extra electron id cuts
471 <    if (sigmaee < cut[26*eb+18]) // inverted sigmaee cut - spike removal related
472 <      return result;
1045 >  float et_min = 10;
1046 >  float et_max = 40;
1047  
1048 <    if (  eOverP < cut[26*eb+19] ||  eOverP > cut[26*eb+20]) // lower and upper cut in E/P
1049 <      return result;
476 <    
477 <    result = result + 1;
1048 >  bool accept = false;
1049 >  float cut = cut_max; //  the cut at et=40 GeV
1050  
1051 <    Double_t d0_real = 99999;
1052 <    for(UInt_t i0 = 0; i0 < vertices->GetEntries(); i0++) {
1053 <      Double_t pD0 = ele->GsfTrk()->D0Corrected(*vertices->At(i0));
1054 <      if(TMath::Abs(pD0) < TMath::Abs(d0_real)) d0_real = TMath::Abs(pD0);
1055 <    }
1056 <    if (d0_real > cut[26*eb+21])
1057 <      return result;
1051 >  if(et < et_max) {
1052 >    cut = cut_min + (1/et_min - 1/et)*(cut_max - cut_min)/(1/et_min - 1/et_max);
1053 >  }
1054 >  
1055 >  if(et < et_min) {
1056 >    cut = cut_min;
1057 >  }
1058 >
1059 >  if(gtn) {   // useful for e/p cut which is gt
1060 >    accept = (x >= cut);
1061 >  }
1062 >  else {
1063 >    accept = (x <= cut);
1064 >  }
1065 >
1066 >  return accept;
1067 > }
1068 >
1069 > //--------------------------------------------------------------------------------------------------
1070 > Double_t ElectronTools::Likelihood(ElectronLikelihood *LH, const Electron *ele)
1071 > {
1072 >  if (!LH) {
1073 >    std::cout << "Error: Likelihood not properly initialized\n";
1074 >    return -9999;
1075 >  }
1076  
1077 <    if (mishits > cut[26*eb+22]) // expected missing hits
1078 <      return result;
1077 >  LikelihoodMeasurements measurements;
1078 >  measurements.pt = ele->Pt();
1079 >  if (ele->IsEB() && ele->AbsEta()<1.0) measurements.subdet = 0;
1080 >  else if (ele->IsEB())                 measurements.subdet = 1;
1081 >  else                                  measurements.subdet = 2;
1082 >  measurements.deltaPhi = TMath::Abs(ele->DeltaPhiSuperClusterTrackAtVtx());
1083 >  measurements.deltaEta = TMath::Abs(ele->DeltaEtaSuperClusterTrackAtVtx());
1084 >  measurements.eSeedClusterOverPout = ele->ESeedClusterOverPout();
1085 >  measurements.eSuperClusterOverP = ele->ESuperClusterOverP();
1086 >  measurements.hadronicOverEm = ele->HadronicOverEm();
1087 >  measurements.sigmaIEtaIEta = ele->CoviEtaiEta();
1088 >  measurements.sigmaIPhiIPhi = TMath::Sqrt(ele->SCluster()->Seed()->CoviPhiiPhi());
1089 >  measurements.fBrem = ele->FBrem();
1090 >  measurements.nBremClusters = ele->NumberOfClusters() - 1;
1091 >  //measurements.OneOverEMinusOneOverP = (1.0 / ele->SCluster()->Energy()) - (1.0 / ele->BestTrk()->P());
1092 >  measurements.OneOverEMinusOneOverP = (1.0 / ele->ESuperClusterOverP() / ele->BestTrk()->P()) - (1.0 / ele->BestTrk()->P());
1093 >  double likelihood = LH->result(measurements);
1094 >
1095 >  double newLik = 0.0;
1096 >  if     (likelihood<=0) newLik = -20.0;
1097 >  else if(likelihood>=1) newLik =  20.0;
1098 >  else                   newLik = log(likelihood/(1.0-likelihood));
1099 >
1100 >  Bool_t isDebug = kFALSE;
1101 >  if(isDebug == kTRUE){
1102 >    printf("LIKELIHOOD: %f %d %f %f %f %f %f %f %f %f %d %f %f %f - %f %f\n",measurements.pt,measurements.subdet,
1103 >    measurements.deltaPhi          ,measurements.deltaEta      ,measurements.eSeedClusterOverPout,
1104 >    measurements.eSuperClusterOverP,measurements.hadronicOverEm,measurements.sigmaIEtaIEta,
1105 >    measurements.sigmaIPhiIPhi     ,measurements.fBrem         ,measurements.nBremClusters,
1106 >    measurements.OneOverEMinusOneOverP,ele->SCluster()->Energy(),ele->BestTrk()->P(),
1107 >    likelihood,newLik);
1108 >  }
1109 >
1110 >  return newLik;
1111 >
1112 > }
1113 >
1114 > Double_t ElectronTools::ElectronEffectiveArea(EElectronEffectiveAreaType type, Double_t SCEta, EElectronEffectiveAreaTarget EffectiveAreaTarget) {
1115 >
1116 >  Double_t EffectiveArea = 0;
1117 >  
1118 >  if(type == ElectronTools::kEleNeutralIso04){
1119 >    if     (fabs(SCEta) < 1.0                           ) EffectiveArea = 0.19;
1120 >    else if(fabs(SCEta) >= 1.0   && fabs(SCEta) < 1.479 ) EffectiveArea = 0.25;
1121 >    else if(fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.000 ) EffectiveArea = 0.12;
1122 >    else if(fabs(SCEta) >= 2.000 && fabs(SCEta) < 2.200 ) EffectiveArea = 0.21;
1123 >    else if(fabs(SCEta) >= 2.200 && fabs(SCEta) < 2.300 ) EffectiveArea = 0.27;
1124 >    else if(fabs(SCEta) >= 2.300 && fabs(SCEta) < 2.400 ) EffectiveArea = 0.44;
1125 >    else                                                  EffectiveArea = 0.52;
1126 >    return EffectiveArea;
1127 >  }
1128  
1129 <    Bool_t passConvVeto = PassConversionFilter(ele, conversions, kTRUE);
1130 <    if (passConvVeto == kFALSE)
1131 <      return result;
1132 <      
1133 <    result += 4;
1134 <  }
1135 <  else if(typeCuts == 0 || typeCuts == 1 || typeCuts == 2){
1136 <    // Loose cuts
1137 <  Double_t cutdcotdistLoose[27] = {
1138 <  3.98e-02, 3.97e-02, 4.01e-02, 3.99e-02, 3.97e-02, 3.94e-02, 3.82e-02, 3.93e-02, 3.88e-02,
1139 <  3.89e-02, 1.58e-02, 4.18e-03, 3.94e-02, 3.85e-02, 3.86e-02, 2.14e-02, 2.65e-02, 1.33e-02,
1140 <  2.86e-02, 3.19e-02, 1.04e-02, 3.86e-02, 3.25e-02, 3.00e-02, 4.77e-04, 3.55e-02, 2.32e-02
1141 <  };
1142 <  Double_t cutdetainLoose[27] = {
1143 <  9.57e-03, 4.87e-03, 1.49e-02, 1.47e-02, 9.13e-03, 1.68e-02, 1.32e-02, 5.18e-02, 3.00e-02,
1144 <  9.38e-03, 3.72e-03, 9.06e-03, 1.31e-02, 6.65e-03, 1.23e-02, 1.30e-02, 2.32e-02, 1.18e-02,
1145 <  1.07e-02, 3.82e-03, 8.96e-03, 1.40e-02, 6.64e-03, 1.22e-02, 1.20e-02, 2.09e-02, 2.18e-03
1146 <  };
1147 <  Double_t cutdphiinLoose[27] = {
1148 <  4.10e-02, 2.72e-01, 3.69e-01, 4.70e-02, 2.74e-01, 2.91e-01, 3.30e-01, 4.98e-01, 6.38e-01,
1149 <  5.95e-02, 9.63e-02, 3.24e-01, 6.87e-02, 6.17e-02, 2.82e-01, 9.06e-02, 2.93e-01, 2.29e-01,
1150 <  8.14e-02, 5.19e-02, 2.99e-01, 1.14e-01, 6.05e-02, 3.03e-01, 1.16e-01, 2.56e-01, 4.63e-02
1151 <  };
1152 <  Double_t cuteseedopcorLoose[27] = {
1153 <  7.81e-01, 2.96e-01, 4.81e-01, 9.03e-01, 1.68e-01, 6.44e-01, 1.06e-01, 2.83e-01, 4.65e-01,
1154 <  5.99e-01, 3.33e-01, 5.45e-01, 8.17e-01, 7.82e-01, 6.75e-01, 4.17e-01, 8.24e-01, 8.79e-01,
1155 <  5.16e-01, 9.38e-01, 8.10e-01, 8.17e-01, 8.50e-01, 5.06e-01, 4.30e-01, 8.33e-01, 7.36e-01
1156 <  };
1157 <  Double_t cutetLoose[27] = {
1158 <  -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05,
1159 <  -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05,
1160 <   1.20e+01,  1.20e+01,  1.20e+01,  1.20e+01,  1.20e+01,  1.20e+01,  1.20e+01,  1.20e+01,  1.42e+01
1161 <  };
1162 <  Double_t cutfmishitsLoose[27] = {
1163 <  4.50e+00, 1.50e+00, 1.50e+00, 2.50e+00, 2.50e+00, 1.50e+00, 2.50e+00, 2.50e+00, 1.50e+00,
1164 <  2.50e+00, 1.50e+00, 1.50e+00, 1.50e+00, 5.00e-01, 5.00e-01, 2.50e+00, 2.50e+00, 5.00e-01,
1165 <  2.50e+00, 1.50e+00, 5.00e-01, 1.50e+00, 1.50e+00, 5.00e-01, 2.50e+00, 5.00e-01, 1.50e+00
1166 <  };
1167 <  Double_t cuthoeLoose[27] = {
1168 <  1.65e-01, 7.55e-02, 1.43e-01, 3.70e-01, 5.01e-02, 1.25e-01, 4.06e-01, 2.69e+00, 5.58e-01,
1169 <  2.37e-01, 5.43e-02, 1.47e-01, 3.68e-01, 3.12e-02, 1.20e-01, 6.06e-01, 2.81e+00, 1.07e+00,
1170 <  1.04e-01, 6.22e-02, 5.73e-02, 2.97e-01, 2.10e-02, 3.08e-02, 5.46e-01, 4.71e+00, 8.00e-01
1171 <  };
1172 <  Double_t cutip_gsfLoose[27] = {
1173 <  4.31e-02, 7.19e-02, 1.40e-01, 8.68e-02, 1.45e-01, 1.57e-01, 9.21e-01, 1.62e-01, 1.86e-01,
1174 <  2.09e-02, 4.59e-02, 9.03e-02, 3.65e-02, 1.49e-01, 9.89e-02, 6.24e-02, 1.88e-01, 1.31e-01,
1175 <  1.22e-02, 1.23e-02, 7.07e-02, 1.65e-02, 1.23e-01, 6.70e-02, 4.77e-02, 5.92e-02, 1.84e-02
1176 <  };
1177 <  Double_t cutiso_sumLoose[27] = {
1178 <  3.17e+01, 9.85e+00, 8.88e+00, 1.13e+01, 6.05e+00, 7.19e+00, 7.65e+00, 9.84e+00, 3.45e+00,
1179 <  1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05,
1180 <  1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05
1181 <  };
1182 <  Double_t cutiso_sumoetLoose[27] = {
1183 <  2.58e+01, 1.48e+01, 1.14e+01, 1.93e+01, 7.10e+00, 9.51e+00, 1.09e+01, 9.71e+00, 3.86e+00,
1184 <  2.31e+01, 1.58e+01, 1.24e+01, 1.72e+01, 7.37e+00, 8.98e+00, 1.51e+01, 1.31e+01, 6.20e+00,
1185 <  2.12e+01, 2.14e+01, 1.75e+01, 1.56e+01, 9.62e+00, 1.06e+01, 2.00e+01, 2.23e+01, 1.37e+01
1186 <  };
1187 <  Double_t cutseeLoose[27] = {
1188 <  1.82e-02, 1.29e-02, 1.68e-02, 3.73e-02, 3.14e-02, 3.30e-02, 1.53e-02, 3.97e-02, 8.41e+00,
1189 <  1.62e-02, 1.07e-02, 1.40e-02, 3.62e-02, 3.21e-02, 3.53e-02, 1.19e-02, 3.72e-02, 5.04e+01,
1190 <  1.59e-02, 1.12e-02, 1.38e-02, 3.98e-02, 3.27e-02, 4.07e-02, 1.04e-02, 4.42e-02, 1.19e-02
1191 <  };
1192 <
1193 <    // Medium cuts
1194 <  Double_t cutdcotdistMedium[27] = {
1195 <  3.93e-02, 3.01e-02, 3.32e-02, 3.94e-02, 3.91e-02, 3.90e-02, 3.70e-02, 3.88e-02, 3.90e-02,
1196 <  3.21e-02, 7.36e-04, 1.95e-04, 3.76e-02, 2.35e-02, 1.13e-02, 1.96e-02, 1.62e-02, 1.04e-03,
1197 <  1.34e-03, 2.56e-02, 1.31e-03, 3.26e-02, 8.21e-03, 1.60e-02, 5.17e-03, 2.63e-02, 1.80e-03
1198 <  };
1199 <  Double_t cutdetainMedium[27] = {
1200 <  7.95e-03, 3.91e-03, 9.04e-03, 1.46e-02, 7.02e-03, 1.09e-02, 1.10e-02, 3.87e-02, 1.81e-02,
1201 <  9.29e-03, 3.31e-03, 6.94e-03, 1.31e-02, 5.39e-03, 9.18e-03, 1.22e-02, 1.63e-02, 2.82e-03,
1202 <  1.11e-02, 4.09e-03, 6.89e-03, 1.08e-02, 5.78e-03, 9.06e-03, 1.19e-02, 1.50e-02, 1.31e-03
1203 <  };
1204 <  Double_t cutdphiinMedium[27] = {
1205 <  4.03e-02, 9.76e-02, 3.24e-01, 4.70e-02, 2.36e-01, 2.73e-01, 3.10e-01, 3.98e-01, 6.38e-01,
1206 <  5.53e-02, 5.50e-02, 3.21e-01, 6.57e-02, 2.58e-02, 1.14e-01, 5.92e-02, 2.68e-01, 2.61e-02,
1207 <  7.99e-02, 2.47e-02, 1.72e-01, 5.64e-02, 2.45e-02, 8.58e-02, 6.44e-02, 7.18e-02, 3.48e-02
1208 <  };
1209 <  Double_t cuteseedopcorMedium[27] = {
1210 <  7.85e-01, 3.53e-01, 5.77e-01, 9.03e-01, 1.66e-01, 6.43e-01, 1.78e-01, 3.24e-01, 9.02e-01,
1211 <  8.15e-01, 9.11e-01, 8.94e-01, 8.48e-01, 8.70e-01, 9.50e-01, 5.34e-01, 9.19e-01, 9.61e-01,
1212 <  4.57e-01, 9.51e-01, 9.53e-01, 8.22e-01, 8.74e-01, 9.18e-01, 8.08e-01, 9.19e-01, 1.02e+00
1213 <  };
1214 <  Double_t cutetMedium[27] = {
1215 <  -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05,
1216 <  -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05,
1217 <   1.20e+01,  1.20e+01,  1.20e+01,  1.22e+01,  1.22e+01,  1.22e+01,  1.20e+01,  1.23e+01,  1.84e+01
1218 <  };
1219 <  Double_t cutfmishitsMedium[27] = {
1220 <  2.50e+00, 1.50e+00, 1.50e+00, 1.50e+00, 1.50e+00, 1.50e+00, 2.50e+00, 2.50e+00, 1.50e+00,
1221 <  2.50e+00, 1.50e+00, 5.00e-01, 5.00e-01, 5.00e-01, 5.00e-01, 2.50e+00, 5.00e-01, 5.00e-01,
1222 <  2.50e+00, 1.50e+00, 5.00e-01, 5.00e-01, 5.00e-01, 5.00e-01, 5.00e-01, 5.00e-01, 2.50e+00
1223 <  };
1224 <  Double_t cuthoeMedium[27] = {
1225 <  9.79e-02, 5.42e-02, 1.13e-01, 3.61e-01, 3.73e-02, 7.61e-02, 3.45e-01, 2.69e+00, 4.05e-01,
1226 <  1.11e-01, 4.66e-02, 1.39e-01, 3.59e-01, 2.34e-02, 5.75e-02, 6.10e-01, 1.35e+00, 6.35e-01,
1227 <  6.07e-02, 5.34e-02, 2.97e-02, 1.16e-01, 1.45e-02, 1.92e-02, 1.30e-01, 5.37e+00, 5.06e-01
1228 <  };
1229 <  Double_t cutip_gsfMedium[27] = {
1230 <  3.95e-02, 5.29e-02, 1.15e-01, 4.56e-02, 1.31e-01, 1.27e-01, 3.13e-01, 9.50e-02, 1.58e-01,
1231 <  1.41e-02, 2.00e-02, 5.52e-02, 2.97e-02, 7.65e-02, 4.84e-02, 4.15e-02, 1.73e-01, 1.31e-02,
1232 <  1.01e-02, 9.93e-03, 3.60e-02, 1.17e-02, 1.89e-02, 3.43e-02, 1.83e-02, 2.27e-02, 3.30e-03
1233 <  };
1234 <  Double_t cutiso_sumMedium[27] = {
1235 <  1.48e+01, 8.45e+00, 6.96e+00, 8.73e+00, 4.11e+00, 4.97e+00, 5.36e+00, 5.83e+00, 1.89e+00,
1236 <  1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05,
1237 <  1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05
1238 <  };
1239 <  Double_t cutiso_sumoetMedium[27] = {
1240 <  1.74e+01, 1.13e+01, 8.29e+00, 1.42e+01, 4.72e+00, 6.09e+00, 7.07e+00, 8.32e+00, 2.32e+00,
1241 <  1.49e+01, 1.28e+01, 1.01e+01, 1.13e+01, 6.51e+00, 6.93e+00, 1.16e+01, 1.01e+01, 6.16e+00,
1242 <  1.40e+01, 1.49e+01, 1.24e+01, 1.02e+01, 6.59e+00, 7.29e+00, 1.51e+01, 1.61e+01, 1.38e+01
1243 <  };
1244 <  Double_t cutseeMedium[27] = {
1245 <  1.53e-02, 1.11e-02, 1.39e-02, 3.31e-02, 3.08e-02, 3.15e-02, 1.26e-02, 3.18e-02, 4.42e-01,
1246 <  1.45e-02, 1.04e-02, 1.28e-02, 3.50e-02, 3.02e-02, 3.18e-02, 1.14e-02, 3.36e-02, 3.94e+00,
1247 <  1.56e-02, 1.06e-02, 1.28e-02, 3.75e-02, 3.16e-02, 3.65e-02, 9.67e-03, 3.61e-02, 9.56e-03
1248 <  };
1249 <
1250 <    // Tight cuts
1251 <  Double_t cutdcotdistTight[27] = {
1252 <  3.93e-02, 2.56e-02, 8.20e-03, 3.94e-02, 3.85e-02, 3.92e-02, 3.27e-02, 3.71e-02, 3.82e-02,
1253 <  2.40e-02, 3.57e-03, 9.45e-03, 3.35e-02, 2.38e-02, 5.29e-04, 1.75e-02, 2.63e-03, 8.06e-05,
1254 <  4.87e-04, 2.91e-02, 3.85e-03, 1.94e-02, 6.72e-03, 8.84e-03, 2.41e-04, 2.04e-03, 1.80e-03
1255 <  };
1256 <  Double_t cutdetainTight[27] = {
1257 <  8.57e-03, 3.40e-03, 6.56e-03, 1.05e-02, 6.56e-03, 9.98e-03, 1.04e-02, 1.48e-02, 1.44e-02,
1258 <  7.71e-03, 2.59e-03, 5.21e-03, 9.40e-03, 4.25e-03, 8.49e-03, 1.18e-02, 2.29e-02, 1.90e-03,
1259 <  8.70e-03, 3.62e-03, 4.92e-03, 9.33e-03, 4.80e-03, 7.72e-03, 1.19e-02, 4.61e-03, 1.34e-03
1260 <  };
1261 <  Double_t cutdphiinTight[27] = {
1262 <  4.05e-02, 5.29e-02, 2.45e-01, 4.05e-02, 4.87e-02, 2.44e-01, 2.85e-01, 2.27e-01, 1.36e-01,
1263 <  5.49e-02, 3.41e-02, 1.54e-01, 6.24e-02, 1.87e-02, 3.97e-02, 5.33e-02, 9.76e-02, 7.28e-03,
1264 <  4.25e-02, 2.14e-02, 9.01e-02, 5.30e-02, 1.76e-02, 2.48e-02, 6.61e-02, 2.61e-02, 3.48e-02
1265 <  };
1266 <  Double_t cuteseedopcorTight[27] = {
1267 <  7.82e-01, 3.83e-01, 6.00e-01, 9.11e-01, 1.63e-01, 6.39e-01, 5.58e-01, 5.55e-01, 9.62e-01,
1268 <  8.35e-01, 9.66e-01, 9.67e-01, 9.23e-01, 8.97e-01, 9.79e-01, 6.25e-01, 9.60e-01, 1.00e+00,
1269 <  5.51e-01, 9.67e-01, 9.87e-01, 8.21e-01, 8.56e-01, 1.01e+00, 9.40e-01, 1.01e+00, 1.03e+00
1270 <  };
1271 <  Double_t cutetTight[27] = {
1272 <  -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05,
1273 <  -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05, -1.00e+05,
1274 <   1.37e+01,  1.32e+01,  1.36e+01,  1.42e+01,  1.43e+01,  1.41e+01,  1.30e+01,  1.75e+01,  1.83e+01
1275 <  };
1276 <  Double_t cutfmishitsTight[27] = {
1277 <  2.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,
1278 <  2.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,
1279 <  2.50e+00, 1.50e+00, 5.00e-01, 5.00e-01, 5.00e-01, 5.00e-01, 5.00e-01, 5.00e-01, 2.50e+00
1280 <  };
1281 <  Double_t cuthoeTight[27] = {
1282 <  7.61e-02, 3.97e-02, 1.07e-01, 1.22e-01, 2.28e-02, 6.10e-02, 1.19e-01, 2.69e+00, 3.14e-01,
1283 <  9.01e-02, 4.94e-02, 1.01e-01, 7.59e-02, 1.53e-02, 3.38e-02, 5.41e-01, 1.10e+00, 6.97e-01,
1284 <  4.83e-02, 4.88e-02, 2.45e-02, 3.91e-02, 9.84e-03, 1.38e-02, 1.89e-01, 7.10e-01, 4.39e-01
1285 <  };
1286 <  Double_t cutip_gsfTight[27] = {
1287 <  2.45e-02, 4.31e-02, 6.38e-02, 3.33e-02, 7.65e-02, 1.36e-01, 6.79e-01, 9.98e-02, 4.62e-02,
1288 <  1.31e-02, 1.45e-02, 4.60e-02, 1.53e-02, 3.43e-02, 2.58e-02, 2.82e-02, 1.29e-01, 3.21e-03,
1289 <  8.51e-03, 7.46e-03, 1.77e-02, 1.06e-02, 1.18e-02, 1.13e-02, 1.22e-02, 2.26e-02, 5.29e-03
1290 <  };
1291 <  Double_t cutiso_sumTight[27] = {
1292 <  1.14e+01, 8.08e+00, 6.16e+00, 6.73e+00, 3.18e+00, 4.36e+00, 4.40e+00, 5.30e+00, 1.34e+00,
1293 <  1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05,
1294 <  1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05, 1.00e+05
1295 <  };
1296 <  Double_t cutiso_sumoetTight[27] = {
1297 <  1.36e+01, 1.02e+01, 7.07e+00, 9.77e+00, 3.57e+00, 4.85e+00, 6.13e+00, 7.89e+00, 2.14e+00,
1298 <  1.12e+01, 1.18e+01, 7.73e+00, 8.18e+00, 4.85e+00, 5.05e+00, 1.13e+01, 7.16e+00, 5.76e+00,
1299 <  1.04e+01, 1.12e+01, 1.05e+01, 7.53e+00, 5.51e+00, 6.08e+00, 1.21e+01, 1.31e+01, 1.41e+01
1300 <  };
1301 <  Double_t cutseeTight[27] = {
1302 <  1.42e-02, 1.05e-02, 1.25e-02, 3.24e-02, 3.08e-02, 3.01e-02, 1.10e-02, 2.71e-02, 4.69e-02,
1303 <  1.33e-02, 1.04e-02, 1.15e-02, 3.31e-02, 2.96e-02, 3.08e-02, 9.90e-03, 2.74e-02, 3.16e-01,
1304 <  1.45e-02, 1.05e-02, 1.10e-02, 3.37e-02, 2.97e-02, 3.01e-02, 9.40e-03, 2.77e-02, 9.39e-03
1305 <  };
1306 <
1307 <    Double_t cutdcotdist[27];
1308 <    Double_t cutdetain[27];
1309 <    Double_t cutdphiin[27];
1310 <    Double_t cuteseedopcor[27];
1311 <    Double_t cutet[27];
1312 <    Double_t cutfmishits[27];
1313 <    Double_t cuthoe[27];
1314 <    Double_t cutip_gsf[27];
1315 <    Double_t cutiso_sum[27];
1316 <    Double_t cutiso_sumoet[27];
1317 <    Double_t cutsee[27];
1318 <    if     (typeCuts == 0) {
1319 <      memcpy(cutdcotdist  ,cutdcotdistLoose  ,sizeof(cutdcotdistLoose));
1320 <      memcpy(cutdetain    ,cutdetainLoose       ,sizeof(cutdetainLoose));
1321 <      memcpy(cutdphiin    ,cutdphiinLoose       ,sizeof(cutdphiinLoose));
1322 <      memcpy(cuteseedopcor,cuteseedopcorLoose,sizeof(cuteseedopcorLoose));
1323 <      memcpy(cutet        ,cutetLoose   ,sizeof(cutetLoose));
1324 <      memcpy(cutfmishits  ,cutfmishitsLoose  ,sizeof(cutfmishitsLoose));
1325 <      memcpy(cuthoe       ,cuthoeLoose  ,sizeof(cuthoeLoose));
687 <      memcpy(cutip_gsf    ,cutip_gsfLoose       ,sizeof(cutip_gsfLoose));
688 <      memcpy(cutiso_sum   ,cutiso_sumLoose      ,sizeof(cutiso_sumLoose));
689 <      memcpy(cutiso_sumoet,cutiso_sumoetLoose,sizeof(cutiso_sumoetLoose));
690 <      memcpy(cutsee       ,cutseeLoose  ,sizeof(cutseeLoose));
691 <    }
692 <    else if(typeCuts == 1) {
693 <      memcpy(cutdcotdist  ,cutdcotdistMedium  ,sizeof(cutdcotdistMedium));
694 <      memcpy(cutdetain    ,cutdetainMedium      ,sizeof(cutdetainMedium));
695 <      memcpy(cutdphiin    ,cutdphiinMedium      ,sizeof(cutdphiinMedium));
696 <      memcpy(cuteseedopcor,cuteseedopcorMedium,sizeof(cuteseedopcorMedium));
697 <      memcpy(cutet        ,cutetMedium  ,sizeof(cutetMedium));
698 <      memcpy(cutfmishits  ,cutfmishitsMedium  ,sizeof(cutfmishitsMedium));
699 <      memcpy(cuthoe       ,cuthoeMedium ,sizeof(cuthoeMedium));
700 <      memcpy(cutip_gsf    ,cutip_gsfMedium      ,sizeof(cutip_gsfMedium));
701 <      memcpy(cutiso_sum   ,cutiso_sumMedium     ,sizeof(cutiso_sumMedium));
702 <      memcpy(cutiso_sumoet,cutiso_sumoetMedium,sizeof(cutiso_sumoetMedium));
703 <      memcpy(cutsee       ,cutseeMedium ,sizeof(cutseeMedium));
704 <    }
705 <    else {
706 <      memcpy(cutdcotdist  ,cutdcotdistTight  ,sizeof(cutdcotdistTight));
707 <      memcpy(cutdetain    ,cutdetainTight       ,sizeof(cutdetainTight));
708 <      memcpy(cutdphiin    ,cutdphiinTight       ,sizeof(cutdphiinTight));
709 <      memcpy(cuteseedopcor,cuteseedopcorTight,sizeof(cuteseedopcorTight));
710 <      memcpy(cutet        ,cutetTight   ,sizeof(cutetTight));
711 <      memcpy(cutfmishits  ,cutfmishitsTight  ,sizeof(cutfmishitsTight));
712 <      memcpy(cuthoe       ,cuthoeTight  ,sizeof(cuthoeTight));
713 <      memcpy(cutip_gsf    ,cutip_gsfTight       ,sizeof(cutip_gsfTight));
714 <      memcpy(cutiso_sum   ,cutiso_sumTight      ,sizeof(cutiso_sumTight));
715 <      memcpy(cutiso_sumoet,cutiso_sumoetTight,sizeof(cutiso_sumoetTight));
716 <      memcpy(cutsee       ,cutseeTight  ,sizeof(cutseeTight));
717 <    }
718 <
719 <    Double_t iso_sum = tkIso + ecalIso + hcalIso;
720 <    Double_t iso_sum_corrected = iso_sum*pow(40./scEt, 2);
721 <    if ((iso_sum < cutiso_sum[cat+bin*9]) &&
722 <        (iso_sum_corrected < cutiso_sumoet[cat+bin*9]))
723 <      result += 2;
724 <
725 <    if (fBrem > -2) {
726 <      if ((hOverE < cuthoe[cat+bin*9]) and
727 <          (sigmaee < cutsee[cat+bin*9]) and
728 <          (fabs(deltaPhiIn) < cutdphiin[cat+bin*9]) and
729 <          (fabs(deltaEtaIn) < cutdetain[cat+bin*9]) and
730 <          (eSeedOverPin > cuteseedopcor[cat+bin*9]) and
731 <          (scEt > cutet[cat+bin*9]))
732 <        result += 1.;
1129 >  if (fabs(SCEta) < 1.0) {
1130 >    if (type == ElectronTools::kEleChargedIso03) EffectiveArea = 0.000;
1131 >    if (type == ElectronTools::kEleNeutralHadronIso03) EffectiveArea = 0.017;
1132 >    if (type == ElectronTools::kEleGammaIso03) EffectiveArea = 0.045;
1133 >    if (type == ElectronTools::kEleGammaIsoVetoEtaStrip03) EffectiveArea = 0.014;
1134 >    if (type == ElectronTools::kEleChargedIso04) EffectiveArea = 0.000;
1135 >    if (type == ElectronTools::kEleNeutralHadronIso04) EffectiveArea = 0.034;
1136 >    if (type == ElectronTools::kEleGammaIso04) EffectiveArea = 0.079;
1137 >    if (type == ElectronTools::kEleGammaIsoVetoEtaStrip04) EffectiveArea = 0.014;
1138 >    if (type == ElectronTools::kEleNeutralHadronIso007) EffectiveArea = 0.000;
1139 >    if (type == ElectronTools::kEleHoverE) EffectiveArea = 0.00016;
1140 >    if (type == ElectronTools::kEleHcalDepth1OverEcal) EffectiveArea = 0.00016;
1141 >    if (type == ElectronTools::kEleHcalDepth2OverEcal) EffectiveArea = 0.00000;    
1142 >  } else if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) {
1143 >    if (type == ElectronTools::kEleChargedIso03) EffectiveArea = 0.000;
1144 >    if (type == ElectronTools::kEleNeutralHadronIso03) EffectiveArea = 0.025;
1145 >    if (type == ElectronTools::kEleGammaIso03) EffectiveArea = 0.052;
1146 >    if (type == ElectronTools::kEleGammaIsoVetoEtaStrip03) EffectiveArea = 0.030;
1147 >    if (type == ElectronTools::kEleChargedIso04) EffectiveArea = 0.000;
1148 >    if (type == ElectronTools::kEleNeutralHadronIso04) EffectiveArea = 0.050;
1149 >    if (type == ElectronTools::kEleGammaIso04) EffectiveArea = 0.073;
1150 >    if (type == ElectronTools::kEleGammaIsoVetoEtaStrip04) EffectiveArea = 0.030;
1151 >    if (type == ElectronTools::kEleNeutralHadronIso007) EffectiveArea = 0.000;
1152 >    if (type == ElectronTools::kEleHoverE) EffectiveArea = 0.00022;
1153 >    if (type == ElectronTools::kEleHcalDepth1OverEcal) EffectiveArea = 0.00022;
1154 >    if (type == ElectronTools::kEleHcalDepth2OverEcal) EffectiveArea = 0.00000;    
1155 >  } else if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) {
1156 >    if (type == ElectronTools::kEleChargedIso03) EffectiveArea = 0.000;
1157 >    if (type == ElectronTools::kEleNeutralHadronIso03) EffectiveArea = 0.030;
1158 >    if (type == ElectronTools::kEleGammaIso03) EffectiveArea = 0.170;
1159 >    if (type == ElectronTools::kEleGammaIsoVetoEtaStrip03) EffectiveArea = 0.134;
1160 >    if (type == ElectronTools::kEleChargedIso04) EffectiveArea = 0.000;
1161 >    if (type == ElectronTools::kEleNeutralHadronIso04) EffectiveArea = 0.060;
1162 >    if (type == ElectronTools::kEleGammaIso04) EffectiveArea = 0.187;
1163 >    if (type == ElectronTools::kEleGammaIsoVetoEtaStrip04) EffectiveArea = 0.134;
1164 >    if (type == ElectronTools::kEleNeutralHadronIso007) EffectiveArea = 0.000;
1165 >    if (type == ElectronTools::kEleHoverE) EffectiveArea = 0.00030;
1166 >    if (type == ElectronTools::kEleHcalDepth1OverEcal) EffectiveArea = 0.00026;
1167 >    if (type == ElectronTools::kEleHcalDepth2OverEcal) EffectiveArea = 0.00002;        
1168 >  } else if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.25 ) {
1169 >    if (type == ElectronTools::kEleChargedIso03) EffectiveArea = 0.000;
1170 >    if (type == ElectronTools::kEleNeutralHadronIso03) EffectiveArea = 0.022;
1171 >    if (type == ElectronTools::kEleGammaIso03) EffectiveArea = 0.623;
1172 >    if (type == ElectronTools::kEleGammaIsoVetoEtaStrip03) EffectiveArea = 0.516;
1173 >    if (type == ElectronTools::kEleChargedIso04) EffectiveArea = 0.000;
1174 >    if (type == ElectronTools::kEleNeutralHadronIso04) EffectiveArea = 0.055;
1175 >    if (type == ElectronTools::kEleGammaIso04) EffectiveArea = 0.659;
1176 >    if (type == ElectronTools::kEleGammaIsoVetoEtaStrip04) EffectiveArea = 0.517;
1177 >    if (type == ElectronTools::kEleNeutralHadronIso007) EffectiveArea = 0.000;
1178 >    if (type == ElectronTools::kEleHoverE) EffectiveArea = 0.00054;
1179 >    if (type == ElectronTools::kEleHcalDepth1OverEcal) EffectiveArea = 0.00045;
1180 >    if (type == ElectronTools::kEleHcalDepth2OverEcal) EffectiveArea = 0.00003;
1181 >  } else if (fabs(SCEta) >= 2.25 && fabs(SCEta) < 2.5 ) {
1182 >    if (type == ElectronTools::kEleChargedIso03) EffectiveArea = 0.000;
1183 >    if (type == ElectronTools::kEleNeutralHadronIso03) EffectiveArea = 0.018;
1184 >    if (type == ElectronTools::kEleGammaIso03) EffectiveArea = 1.198;
1185 >    if (type == ElectronTools::kEleGammaIsoVetoEtaStrip03) EffectiveArea = 1.049;
1186 >    if (type == ElectronTools::kEleChargedIso04) EffectiveArea = 0.000;
1187 >    if (type == ElectronTools::kEleNeutralHadronIso04) EffectiveArea = 0.073;
1188 >    if (type == ElectronTools::kEleGammaIso04) EffectiveArea = 1.258;
1189 >    if (type == ElectronTools::kEleGammaIsoVetoEtaStrip04) EffectiveArea = 1.051;
1190 >    if (type == ElectronTools::kEleNeutralHadronIso007) EffectiveArea = 0.000;
1191 >    if (type == ElectronTools::kEleHoverE) EffectiveArea = 0.00082;
1192 >    if (type == ElectronTools::kEleHcalDepth1OverEcal) EffectiveArea = 0.00066;
1193 >    if (type == ElectronTools::kEleHcalDepth2OverEcal) EffectiveArea = 0.00004;
1194 >  }
1195 >    
1196 >  //NoCorrections
1197 >  if (EffectiveAreaTarget == kEleEANoCorr) {
1198 >    return 0.0;
1199 >  }
1200 >  else if (EffectiveAreaTarget == kEleEAData2012) {
1201 >    if (type == kEleGammaIso03) {
1202 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.122;
1203 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.147;
1204 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.055;
1205 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.106;
1206 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.138;
1207 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.221;
1208 >      if (fabs(SCEta) >= 2.4 ) EffectiveArea = 0.211;
1209 >    }
1210 >    if (type == kEleGammaIso04) {
1211 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.176;
1212 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.206;
1213 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.094;
1214 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.172;
1215 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.244;
1216 >      if (fabs(SCEta) >= 2.4 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.333;
1217 >      if (fabs(SCEta) >= 2.4 ) EffectiveArea = 0.348;
1218 >    }
1219 >    if (type == kEleNeutralHadronIso03) {
1220 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.013;
1221 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.021;
1222 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.013;
1223 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.010;
1224 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.024;
1225 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.020;
1226 >      if (fabs(SCEta) >= 2.4 ) EffectiveArea = 0.019;
1227 >    }
1228 >    if (type == kEleNeutralHadronIso04) {
1229 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.022;
1230 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.036;
1231 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.027;
1232 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.028;
1233 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.052;
1234 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.063;
1235 >      if (fabs(SCEta) >= 2.4 ) EffectiveArea = 0.028;
1236 >    }
1237 >    if (type == kEleGammaAndNeutralHadronIso04) {
1238 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.19;
1239 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.25;
1240 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.12;
1241 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.21;
1242 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.27;
1243 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.44;
1244 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.52;
1245 >    }                          
1246 >    if (type == kEleGammaIsoDR0p0To0p1) {
1247 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.051;
1248 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.032;
1249 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.006;
1250 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.007;
1251 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.024;
1252 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.013;
1253 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.013;
1254 >    }
1255 >    if (type == kEleGammaIsoDR0p1To0p2) {
1256 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.013;
1257 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.013;
1258 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.021;
1259 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.052;
1260 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.066;
1261 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.043;
1262 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.102;
1263 >    }
1264 >    if (type == kEleGammaIsoDR0p2To0p3) {
1265 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.026;
1266 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.017;
1267 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.012;
1268 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.028;
1269 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.041;
1270 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.034;
1271 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.042;
1272 >    }
1273 >    if (type == kEleGammaIsoDR0p3To0p4) {
1274 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.039;
1275 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.032;
1276 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.017;
1277 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.024;
1278 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.053;
1279 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.059;
1280 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.069;
1281 >    }
1282 >    if (type == kEleGammaIsoDR0p4To0p5) {
1283 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.059;
1284 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.045;
1285 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.033;
1286 >     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.043;
1287 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.056;
1288 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.065;
1289 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.074;
1290 >    }
1291 >    if (type == kEleNeutralHadronIsoDR0p0To0p1) {
1292 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.001;
1293 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.006;
1294 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.001;
1295 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.000;
1296 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.001;
1297 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.003;
1298 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.008;
1299 >    }
1300 >    if (type == kEleNeutralHadronIsoDR0p1To0p2) {
1301 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.002;
1302 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.001;
1303 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.004;
1304 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.003;
1305 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.005;
1306 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.006;
1307 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.010;
1308 >    }
1309 >    if (type == kEleNeutralHadronIsoDR0p2To0p3) {
1310 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.007;
1311 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.010;
1312 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.009;
1313 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.009;
1314 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.007;
1315 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.018;
1316 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.028;
1317 >    }
1318 >    if (type == kEleNeutralHadronIsoDR0p3To0p4) {
1319 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.010;
1320 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.011;
1321 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.012;
1322 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.008;
1323 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.018;
1324 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.026;
1325 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.063;
1326      }
1327 +    if (type == kEleNeutralHadronIsoDR0p4To0p5) {
1328 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.011;
1329 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.012;
1330 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.016;
1331 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.023;
1332 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.038;
1333 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.051;
1334 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.143;
1335 +    }
1336 +  }
1337  
1338 <    Double_t d0_real = 99999;
1339 <    for(UInt_t i0 = 0; i0 < vertices->GetEntries(); i0++) {
1340 <      Double_t pD0 = ele->GsfTrk()->D0Corrected(*vertices->At(i0));
1341 <      if(TMath::Abs(pD0) < TMath::Abs(d0_real)) d0_real = TMath::Abs(pD0);
1338 >  //2011 Data Effective Areas
1339 >  else if (EffectiveAreaTarget == kEleEAData2011) {
1340 >    if (type == kEleGammaAndNeutralHadronIso03) {
1341 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.100;
1342 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.120;
1343 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.085;
1344 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.110;
1345 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.120;
1346 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.120;
1347 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.130;
1348 >    }
1349 >    if (type == kEleGammaAndNeutralHadronIso04) {
1350 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.180;
1351 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.200;
1352 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.150;
1353 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.190;
1354 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.210;
1355 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.220;
1356 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.290;
1357 >    }
1358 >    if (type == kEleGammaIsoDR0p0To0p1) {
1359 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.017;
1360 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.033;
1361 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.005;
1362 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.007;
1363 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.004;
1364 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.000;
1365 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.000;
1366 >    }
1367 >    if (type == kEleGammaIsoDR0p1To0p2) {
1368 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.010;
1369 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.010;
1370 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.019;
1371 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.042;
1372 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.041;
1373 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.035;
1374 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.041;
1375 >    }
1376 >    if (type == kEleGammaIsoDR0p2To0p3) {
1377 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.020;
1378 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.017;
1379 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.014;
1380 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.029;
1381 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.039;
1382 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.042;
1383 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.048;
1384 >    }
1385 >    if (type == kEleGammaIsoDR0p3To0p4) {
1386 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.036;
1387 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.029;
1388 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.020;
1389 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.029;
1390 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.042;
1391 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.047;
1392 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.054;
1393 >    }
1394 >    if (type == kEleGammaIsoDR0p4To0p5) {
1395 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.051;
1396 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.038;
1397 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.028;
1398 >     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.036;
1399 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.047;
1400 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.057;
1401 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.059;
1402      }
1403 <    if (d0_real < cutip_gsf[cat+bin*9])
1404 <      result += 4;
1403 >    if (type == kEleNeutralHadronIsoDR0p0To0p1) {
1404 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.001;
1405 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.002;
1406 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.002;
1407 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.000;
1408 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.000;
1409 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.000;
1410 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.000;
1411 >    }
1412 >    if (type == kEleNeutralHadronIsoDR0p1To0p2) {
1413 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.005;
1414 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.008;
1415 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.008;
1416 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.006;
1417 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.003;
1418 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.001;
1419 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.003;
1420 >    }
1421 >    if (type == kEleNeutralHadronIsoDR0p2To0p3) {
1422 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.010;
1423 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.014;
1424 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.017;
1425 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.016;
1426 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.016;
1427 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.016;
1428 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.019;
1429 >    }
1430 >    if (type == kEleNeutralHadronIsoDR0p3To0p4) {
1431 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.015;
1432 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.021;
1433 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.025;
1434 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.030;
1435 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.036;
1436 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.038;
1437 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.084;
1438 >    }
1439 >    if (type == kEleNeutralHadronIsoDR0p4To0p5) {
1440 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.020;
1441 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.027;
1442 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.035;
1443 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.045;
1444 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.051;
1445 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.107;
1446 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.228;
1447 >    }
1448 >  }
1449  
1450 <    Bool_t passConvVeto = PassConversionFilter(ele, conversions, kTRUE);
1451 <    if (mishits < cutfmishits[cat+bin*9] &&
1452 <        passConvVeto)
1453 <      result += 8;
1454 <  } // classbased
1450 >  //Summer11 MC Effective Areas
1451 >  else if (EffectiveAreaTarget == kEleEASummer11MC) {
1452 >    if (type == kEleGammaIsoDR0p0To0p1) {
1453 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.015;
1454 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.030;
1455 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.004;
1456 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.010;
1457 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.014;
1458 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.024;
1459 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.023;
1460 >    }
1461 >    if (type == kEleGammaIsoDR0p1To0p2) {
1462 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.012;
1463 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.010;
1464 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.009;
1465 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.037;
1466 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.046;
1467 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.055;
1468 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.046;
1469 >    }
1470 >    if (type == kEleGammaIsoDR0p2To0p3) {
1471 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.021;
1472 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.018;
1473 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.013;
1474 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.026;
1475 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.038;
1476 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.045;
1477 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.059;
1478 >    }
1479 >    if (type == kEleGammaIsoDR0p3To0p4) {
1480 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.036;
1481 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.030;
1482 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.017;
1483 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.036;
1484 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.058;
1485 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.073;
1486 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.083;
1487 >    }
1488 >    if (type == kEleGammaIsoDR0p4To0p5) {
1489 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.053;
1490 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.037;
1491 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.032;
1492 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.048;
1493 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.062;
1494 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.085;
1495 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.118;
1496 >    }
1497 >    if (type == kEleNeutralHadronIsoDR0p0To0p1) {
1498 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.000;
1499 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.000;
1500 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.000;
1501 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.000;
1502 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.000;
1503 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.000;
1504 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.000;
1505 >    }
1506 >    if (type == kEleNeutralHadronIsoDR0p1To0p2) {
1507 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.004;
1508 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.007;
1509 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.009;
1510 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.004;
1511 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.003;
1512 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.000;
1513 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.004;
1514 >    }
1515 >    if (type == kEleNeutralHadronIsoDR0p2To0p3) {
1516 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.008;
1517 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.013;
1518 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.016;
1519 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.013;
1520 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.014;
1521 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.016;
1522 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.021;
1523 >    }
1524 >    if (type == kEleNeutralHadronIsoDR0p3To0p4) {
1525 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.012;
1526 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.017;
1527 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.020;
1528 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.024;
1529 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.040;
1530 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.036;
1531 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.086;
1532 >    }
1533 >    if (type == kEleNeutralHadronIsoDR0p4To0p5) {
1534 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.016;
1535 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.026;
1536 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.030;
1537 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.038;
1538 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.051;
1539 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.105;
1540 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.169;
1541 >    }
1542 >  }
1543 >  
1544 >  //Fall11 MC Effective Areas
1545 >  else if (EffectiveAreaTarget == kEleEAFall11MC) {
1546 >    if (type == kEleGammaIsoDR0p0To0p1) {
1547 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.014;
1548 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.020;
1549 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.004;
1550 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.012;
1551 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.016;
1552 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.021;
1553 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.012;
1554 >    }
1555 >    if (type == kEleGammaIsoDR0p1To0p2) {
1556 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.012;
1557 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.011;
1558 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.015;
1559 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.042;
1560 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.055;
1561 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.068;
1562 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.067;
1563 >    }
1564 >    if (type == kEleGammaIsoDR0p2To0p3) {
1565 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.024;
1566 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.020;
1567 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.017;
1568 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.038;
1569 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.051;
1570 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.066;
1571 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.080;
1572 >    }
1573 >    if (type == kEleGammaIsoDR0p3To0p4) {
1574 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.040;
1575 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.032;
1576 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.021;
1577 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.047;
1578 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.066;
1579 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.083;
1580 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.123;
1581 >    }
1582 >    if (type == kEleGammaIsoDR0p4To0p5) {
1583 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.059;
1584 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.041;
1585 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.037;
1586 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.057;
1587 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.095;
1588 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.123;
1589 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.133;
1590 >    }
1591 >    if (type == kEleNeutralHadronIsoDR0p0To0p1) {
1592 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.002;
1593 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.003;
1594 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.000;
1595 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.000;
1596 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.000;
1597 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.000;
1598 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.000;
1599 >    }
1600 >    if (type == kEleNeutralHadronIsoDR0p1To0p2) {
1601 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.006;
1602 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.008;
1603 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.010;
1604 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.006;
1605 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.005;
1606 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.002;
1607 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.007;
1608 >    }
1609 >    if (type == kEleNeutralHadronIsoDR0p2To0p3) {
1610 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.009;
1611 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.014;
1612 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.018;
1613 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.016;
1614 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.017;
1615 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.020;
1616 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.021;
1617 >    }
1618 >    if (type == kEleNeutralHadronIsoDR0p3To0p4) {
1619 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.013;
1620 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.019;
1621 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.027;
1622 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.035;
1623 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.037;
1624 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.043;
1625 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.110;
1626 >    }
1627 >    if (type == kEleNeutralHadronIsoDR0p4To0p5) {
1628 >      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.017;
1629 >      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.027;
1630 >      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.036;
1631 >      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.045;
1632 >      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.057;
1633 >      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.123;
1634 >      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.220;
1635 >    }
1636 >  }
1637 >
1638 >  return EffectiveArea;  
1639 > }
1640 >
1641 >
1642 > Bool_t ElectronTools::PassHggLeptonTagID(const Electron* ele) {
1643 >  
1644 >  float dist = ( ele->ConvPartnerDist()      == -9999.? 9999:TMath::Abs(ele->ConvPartnerDist()));
1645 >  float dcot = ( ele->ConvPartnerDCotTheta() == -9999.? 9999:TMath::Abs(ele->ConvPartnerDCotTheta()));  
1646 >  
1647 >  if (dist < 0.02) return false;
1648 >  if (dcot < 0.02) return false;
1649 >  
1650 >  int numInnerHits = ele->Trk()->NExpectedHitsInner();
1651 >  if( numInnerHits > 1 ) return false;
1652 >
1653 >  float coviEtaiEta = ele->CoviEtaiEta();
1654 >  if( ele->SCluster()->AbsEta() < 1.5 && coviEtaiEta > 0.01 ) return false;
1655 >  else if( ele->SCluster()->AbsEta() > 1.5 && coviEtaiEta > 0.031 ) return false;
1656 >
1657 >  Double_t deltaPhiIn   = TMath::Abs(ele->DeltaPhiSuperClusterTrackAtVtx());
1658 >  Double_t deltaEtaIn   = TMath::Abs(ele->DeltaEtaSuperClusterTrackAtVtx());
1659 >
1660 >  if( ele->SCluster()->AbsEta() < 1.5 && ( deltaPhiIn > 0.039 || deltaEtaIn > 0.005 ) ) return false;
1661 >  else if ( ele->SCluster()->AbsEta() > 1.5 && ( deltaPhiIn > 0.028 || deltaEtaIn > 0.007 ) ) return false;
1662 >
1663 >  return true;
1664 > }
1665 >
1666 > Bool_t ElectronTools::PassHggLeptonTagID2012(const Electron* ele) {
1667 >  
1668 >  if (TMath::Abs(1./ele->E()-1./ele->Pt())>0.05) return false;
1669 >
1670 >  int numInnerHits = ele->Trk()->NExpectedHitsInner();
1671 >  if( numInnerHits > 1 ) return false;
1672 >
1673 >  float coviEtaiEta = ele->CoviEtaiEta();
1674 >  if( ele->SCluster()->AbsEta() < 1.5 && coviEtaiEta > 0.01 ) return false;
1675 >  else if( ele->SCluster()->AbsEta() > 1.5 && coviEtaiEta > 0.03 ) return false; // h
1676 >
1677 >  Double_t deltaPhiIn   = TMath::Abs(ele->DeltaPhiSuperClusterTrackAtVtx());
1678 >  Double_t deltaEtaIn   = TMath::Abs(ele->DeltaEtaSuperClusterTrackAtVtx());
1679 >
1680 >  if( ele->SCluster()->AbsEta() < 1.5 && ( deltaPhiIn > 0.15 || deltaEtaIn > 0.007 || ele->HadronicOverEm()>0.12) ) return false;   // h
1681 >  else if ( ele->SCluster()->AbsEta() > 1.5 && ( deltaPhiIn > 0.10 || deltaEtaIn > 0.009 || ele->HadronicOverEm()>0.10 ) ) return false;   // h
1682 >
1683 >  return true;
1684 > }
1685 >
1686 > std::pair<Double_t,Double_t> ElectronTools::ComputeEPCombination( const Electron * ele, const float regression_energy,
1687 >                                                  const float regression_energy_error) {
1688 >
1689 >  enum Classification { GSF_ELECTRON_UNKNOWN=-1,
1690 >                        GSF_ELECTRON_GOLDEN=0,
1691 >                        GSF_ELECTRON_BIGBREM=1,
1692 >                        GSF_ELECTRON_BADTRACK=2,
1693 >                        GSF_ELECTRON_SHOWERING=3,
1694 >                        GSF_ELECTRON_GAP=4 } ;
1695 >
1696 >  float newEnergyError_ = regression_energy_error;
1697 >  float scEnergy = regression_energy;
1698 >
1699 >  int elClass = ele->Classification();
1700 >
1701 >  float trackMomentum  = ele->PIn() ;
1702 >  float errorTrackMomentum_ = 999. ;
1703 >  
1704 >  // the electron's track momentum error was not available in bambu versions less than 029
1705 >  if(ele->TrackMomentumError() > 0)
1706 >    errorTrackMomentum_ = ele->TrackMomentumError();
1707 >  else if ( ele->GsfTrk()->PtErr() > 0)
1708 >    errorTrackMomentum_ = ele->GsfTrk()->PtErr()*cosh(ele->GsfTrk()->Eta());
1709 >  else
1710 >    assert(0);
1711 >
1712 >  float finalMomentum = ele->E(); // initial
1713 >  float finalMomentumError = 999.;
1714 >  
1715 >  // first check for large errors
1716 >
1717 >  if (errorTrackMomentum_/trackMomentum > 0.5 && regression_energy_error/regression_energy <= 0.5) {
1718 >    finalMomentum = regression_energy;    finalMomentumError = regression_energy_error;
1719 >  }
1720 >  else if (errorTrackMomentum_/trackMomentum <= 0.5 && regression_energy_error/regression_energy > 0.5){  
1721 >    finalMomentum = trackMomentum;  finalMomentumError = errorTrackMomentum_;
1722 >  }
1723 >  else if (errorTrackMomentum_/trackMomentum > 0.5 && regression_energy_error/regression_energy > 0.5){
1724 >    if (errorTrackMomentum_/trackMomentum < regression_energy_error/regression_energy) {
1725 >      finalMomentum = trackMomentum; finalMomentumError = errorTrackMomentum_;
1726 >    }
1727 >    else{
1728 >      finalMomentum = regression_energy; finalMomentumError = regression_energy_error;
1729 >    }
1730 >  }
1731 >  // then apply the combination algorithm
1732 >  else {
1733 >     // calculate E/p and corresponding error
1734 >    float eOverP = regression_energy / trackMomentum;
1735 >    float errorEOverP = sqrt(
1736 >                             (regression_energy_error/trackMomentum)*(regression_energy_error/trackMomentum) +
1737 >                             (regression_energy*errorTrackMomentum_/trackMomentum/trackMomentum)*
1738 >                             (regression_energy*errorTrackMomentum_/trackMomentum/trackMomentum));
1739 >
1740 >
1741 >    bool eleIsNotInCombination = false ;
1742 >    if ( (eOverP  > 1 + 2.5*errorEOverP) || (eOverP  < 1 - 2.5*errorEOverP) || (eOverP < 0.8) || (eOverP > 1.3) )
1743 >      { eleIsNotInCombination = true ; }
1744 >     if (eleIsNotInCombination)
1745 >       {
1746 >         if (eOverP > 1)
1747 >           { finalMomentum = regression_energy ; finalMomentumError = regression_energy_error ; }
1748 >         else
1749 >           {
1750 >             if (elClass == GSF_ELECTRON_GOLDEN)
1751 >               { finalMomentum = regression_energy; finalMomentumError = regression_energy_error; }
1752 >             if (elClass == GSF_ELECTRON_BIGBREM)
1753 >               {
1754 >                 if (regression_energy<36)
1755 >                   { finalMomentum = trackMomentum ; finalMomentumError = errorTrackMomentum_ ; }
1756 >                 else
1757 >                   { finalMomentum = regression_energy ; finalMomentumError = regression_energy_error ; }
1758 >               }
1759 >             if (elClass == GSF_ELECTRON_BADTRACK)
1760 >               { finalMomentum = regression_energy; finalMomentumError = regression_energy_error ; }
1761 >             if (elClass == GSF_ELECTRON_SHOWERING)
1762 >               {
1763 >                 if (regression_energy<30)
1764 >                   { finalMomentum = trackMomentum ; finalMomentumError = errorTrackMomentum_; }
1765 >                 else
1766 >                   { finalMomentum = regression_energy; finalMomentumError = regression_energy_error;}
1767 >               }
1768 >             if (elClass == GSF_ELECTRON_GAP)
1769 >               {
1770 >                 if (regression_energy<60)
1771 >                   { finalMomentum = trackMomentum ; finalMomentumError = errorTrackMomentum_ ; }
1772 >                 else
1773 >                   { finalMomentum = regression_energy; finalMomentumError = regression_energy_error ; }
1774 >               }
1775 >           }
1776 >       }    
1777 >     else
1778 >       {
1779 >         // combination
1780 >         finalMomentum = (regression_energy/regression_energy_error/regression_energy_error + trackMomentum/errorTrackMomentum_/errorTrackMomentum_) /
1781 >           (1/regression_energy_error/regression_energy_error + 1/errorTrackMomentum_/errorTrackMomentum_);
1782 >         float finalMomentumVariance = 1 / (1/regression_energy_error/regression_energy_error + 1/errorTrackMomentum_/errorTrackMomentum_);
1783 >         finalMomentumError = sqrt(finalMomentumVariance);
1784 >       }
1785 >  }  
1786 >
1787 >  std::pair<Double_t,Double_t> value;
1788 >  value.first = finalMomentum;
1789 >  value.second = finalMomentumError;
1790 >  return value;
1791  
749  return result;
1792   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines