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.2 by sixie, Sat Apr 10 19:51:58 2010 UTC vs.
Revision 1.54 by mingyang, Sat Feb 23 14:52:59 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.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.02,  0.02,  0.02,  0.02,  0.02,   0.02,   0.02,   0.02 }, //deltaphiin
108 <    {0.006, 0.006, 0.006, 0.006, 0.003,  0.003,  0.003,  0.003}, //deltaetain
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)->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
249 <            if (!(trk->NHits() >= 3 && trk->Prob() > 1e-6) && trk!=ele->GsfTrk())
250 <              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 258 | Line 346 | Bool_t ElectronTools::PassConversionFilt
346          }
347        }
348      }
349 +
350      if (isGoodConversion == kTRUE) break;
351      
352    } // loop over all conversions
# Line 266 | 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 = kFALSE;
370 >
371 >  for (UInt_t ifc=0; ifc<conversions->GetEntries(); ifc++) {
372 >    Bool_t ConversionMatchFound = kFALSE;
373 >    for (UInt_t 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) ) {
381 >        ConversionMatchFound = kTRUE;
382 >        break;
383 >      }
384 >    }
385 >
386 >    // if match between the e-track and one of the conversion legs
387 >    if (ConversionMatchFound == kTRUE){
388 >      isGoodConversion =  (conversions->At(ifc)->Prob() > probMin) &&
389 >        (!requireArbitratedMerged || conversions->At(ifc)->Quality().Quality(ConversionQuality::arbitratedMerged)) &&
390 >        (conversions->At(ifc)->LxyCorrected(vtx) > lxyMin);
391 >
392 >      if (isGoodConversion == kTRUE) {
393 >        for (UInt_t d=0; d<conversions->At(ifc)->NDaughters(); d++) {
394 >          const ChargedParticle *pParticle = 0;
395 >          pParticle = dynamic_cast<const ChargedParticle*>(conversions->At(ifc)->Daughter(d));
396 >          if(pParticle == 0) continue;
397 >          const Track* trk = 0;
398 >          trk = pParticle->Trk();
399 >          if(trk == 0) continue;
400 >          if (trk) {
401 >            if (trk->Pt()<trkptMin) isGoodConversion = kFALSE;
402 >            const StableData *sd = dynamic_cast<const StableData*>
403 >              (conversions->At(ifc)->DaughterDat(d));
404 >            if (sd->NWrongHits() > nWrongHitsMax)
405 >              isGoodConversion = kFALSE;
406 >          } else {
407 >            isGoodConversion = kFALSE;
408 >          }
409 >        }
410 >      }
411 >    }
412 >    
413 >    if (isGoodConversion == kTRUE) break;
414 >    
415 >  } // loop over all conversions
416 >  
417 >  return !isGoodConversion;
418 > }
419 > //--------------------------------------------------------------------------------------------------
420 > Bool_t ElectronTools::PassD0Cut(const Electron *ele, const VertexCol *vertices, Double_t fD0Cut, Int_t nVertex)
421   {
422    Bool_t d0cut = kFALSE;
423 <  // d0 cut
424 <  Double_t d0_real = 99999;
425 <  for(UInt_t i0 = 0; i0 < vertices->GetEntries(); i0++) {
426 <    Double_t pD0 = ele->GsfTrk()->D0Corrected(*vertices->At(i0));
427 <    if(TMath::Abs(pD0) < TMath::Abs(d0_real)) d0_real = TMath::Abs(pD0);
423 >  
424 >  Double_t d0_real = 1e30;
425 >  Double_t dz_real = 1e30;
426 >  Int_t closestVtx = 0;
427 >
428 >  if( nVertex >= (int) vertices->GetEntries() )
429 >    nVertex = vertices->GetEntries() - 1;
430 >  
431 >  if(nVertex >= 0) d0_real = TMath::Abs(ele->GsfTrk()->D0Corrected(*vertices->At(nVertex)));
432 >  else            {
433 >    Double_t distVtx = 999.0;
434 >    for(UInt_t nv=0; nv<vertices->GetEntries(); nv++){
435 >      double dz = TMath::Abs(ele->GsfTrk()->DzCorrected(*vertices->At(nv)));
436 >      if(dz < distVtx) {
437 >        distVtx    = dz;
438 >        closestVtx = nv;
439 >      }
440 >      d0_real = TMath::Abs(ele->GsfTrk()->D0Corrected(*vertices->At(nv)));
441 >      //printf("ming sync check nv:%d dz:%f d0:%f\n",nv,dz,d0_real);
442 >    }
443 >    d0_real = TMath::Abs(ele->GsfTrk()->D0Corrected(*vertices->At(closestVtx)));
444 >    dz_real = TMath::Abs(ele->GsfTrk()->DzCorrected(*vertices->At(closestVtx)));
445    }
279  if(d0_real < fD0Cut) d0cut = kTRUE;
446    
447 <  if     (fReverseD0Cut == kTRUE &&
448 <          d0cut == kFALSE && d0_real < 0.05)
449 <    d0cut = kTRUE;
284 <  else if(fReverseD0Cut == kTRUE)
285 <    d0cut = kFALSE;
447 >  //printf("ming sync check electonidmod vtxind:%d vtx_x:%f vtx_y:%f vtx_z:%f dz:%f d0:%f\n",closestVtx,vertices->At(closestVtx)->X(),vertices->At(closestVtx)->Y(),vertices->At(closestVtx)->Z(),dz_real,d0_real);
448 >  
449 >  if(d0_real < fD0Cut) d0cut = kTRUE;
450    
451    return d0cut;
452   }
453  
454   //--------------------------------------------------------------------------------------------------
455 < Bool_t ElectronTools::PassD0Cut(const Electron *ele, const BeamSpotCol *beamspots, Double_t fD0Cut,
292 <                                Bool_t fReverseD0Cut)
455 > Bool_t ElectronTools::PassD0Cut(const Electron *ele, const BeamSpotCol *beamspots, Double_t fD0Cut)
456   {
457    Bool_t d0cut = kFALSE;
458    // d0 cut
# Line 300 | Line 463 | Bool_t ElectronTools::PassD0Cut(const El
463    }
464    if(d0_real < fD0Cut) d0cut = kTRUE;
465    
303  if     (fReverseD0Cut == kTRUE &&
304          d0cut == kFALSE && d0_real < 0.05)
305    d0cut = kTRUE;
306  else if(fReverseD0Cut == kTRUE)
307    d0cut = kFALSE;
308  
466    return d0cut;
467   }
468  
469   //--------------------------------------------------------------------------------------------------
470 + Bool_t ElectronTools::PassDZCut(const Electron *ele, const VertexCol *vertices, Double_t fDZCut, Int_t nVertex)
471 + {
472 +  Bool_t dzcut = kFALSE;
473 +
474 +  Double_t distVtx = 999.0;
475 +
476 +  if( nVertex >= (int) vertices->GetEntries() )
477 +    nVertex = vertices->GetEntries()-1;
478 +  
479 +  if(nVertex >= 0) distVtx = TMath::Abs(ele->GsfTrk()->DzCorrected(*vertices->At(nVertex)));
480 +  else {
481 +    for(UInt_t nv=0; nv<vertices->GetEntries(); nv++){
482 +      double dz = TMath::Abs(ele->GsfTrk()->DzCorrected(*vertices->At(nv)));
483 +      if(dz < distVtx) {
484 +        distVtx  = dz;
485 +      }
486 +    }
487 +  }
488 +  
489 +  if(distVtx < fDZCut) dzcut = kTRUE;
490 +  
491 +  return dzcut;
492 + }
493 +
494 + //--------------------------------------------------------------------------------------------------
495   Bool_t ElectronTools::PassChargeFilter(const Electron *ele)
496   {
497    Bool_t passChargeFilter = kTRUE;
# Line 323 | Line 505 | Bool_t ElectronTools::PassChargeFilter(c
505   Bool_t ElectronTools::PassSpikeRemovalFilter(const Electron *ele)
506   {
507    Bool_t passSpikeRemovalFilter = kTRUE;
508 <  if(ele->SCluster()->Seed()->Energy() > 5.0 &&
508 >  if(ele->SCluster() &&
509 >     ele->SCluster()->Seed()->Energy() > 5.0 &&
510       ele->SCluster()->Seed()->EMax() / ele->SCluster()->Seed()->E3x3() > 0.95
511      ) {
512      passSpikeRemovalFilter = kFALSE;
# Line 338 | Line 521 | Bool_t ElectronTools::PassSpikeRemovalFi
521      
522    return passSpikeRemovalFilter;
523   }
524 +
525 + Bool_t ElectronTools::PassTriggerMatching(const Electron *ele, const TriggerObjectCol *trigobjs)
526 + {
527 +  
528 +  for (UInt_t i=0; i<trigobjs->GetEntries(); ++i) {
529 +    const TriggerObject *trigobj = trigobjs->At(i);
530 +    if (trigobj->TriggerType()==TriggerObject::TriggerCluster || trigobj->TriggerType()==TriggerObject::TriggerElectron || trigobj->TriggerType()==TriggerObject::TriggerPhoton) {
531 +      if (MathUtils::DeltaR(ele->SCluster(),trigobj)<0.3) {
532 +        return kTRUE;
533 +      }
534 +    }
535 +  }
536 +  
537 +  return kFALSE;
538 +  
539 +  
540 + }
541 +
542 + //--------------------------------------------------------------------------------------------------
543 + Int_t ElectronTools::Classify(const Electron *ele) {
544 +  
545 +  double eta    = ele->AbsEta();
546 +  double eOverP = ele->ESuperClusterOverP();
547 +  double fBrem  = ele->FBrem();
548 +
549 +  int cat = -1;
550 +  if (ele->IsEB()) {
551 +    if ((fBrem >= 0.12) and (eOverP > 0.9) and (eOverP < 1.2))
552 +      cat = 0;
553 +    else if (((eta >  .445   and eta <  .45  ) or
554 +              (eta >  .79    and eta <  .81  ) or
555 +              (eta > 1.137   and eta < 1.157 ) or
556 +              (eta > 1.47285 and eta < 1.4744)))
557 +      cat = 6;
558 +    else if (ele->IsTrackerDriven() and !ele->IsEcalDriven())
559 +      cat = 8;
560 +    else if (fBrem < 0.12)
561 +      cat = 1;
562 +    else
563 +      cat = 2;
564 +  } else {
565 +    if ((fBrem >= 0.2) and (eOverP > 0.82) and (eOverP < 1.22))
566 +      cat = 3;
567 +    else if (eta > 1.5 and eta <  1.58)
568 +      cat = 7;
569 +    else if (ele->IsTrackerDriven() and !ele->IsEcalDriven())
570 +      cat = 8;
571 +    else if (fBrem < 0.2)
572 +      cat = 4;
573 +    else
574 +      cat = 5;
575 +  }
576 +
577 +  return cat;
578 + }
579 +
580 + //--------------------------------------------------------------------------------------------------
581 + Int_t ElectronTools::PassTightId(const Electron *ele, const VertexCol *vertices,
582 +                                 const DecayParticleCol *conversions, const Int_t typeCuts,
583 +                                 Double_t beta){
584 +
585 + // original code on
586 + // http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/RecoEgamma/ElectronIdentification/src/CutBasedElectronID.cc
587 + // beta must be computed with a DR cone of 0.4
588 +
589 +  Double_t scEt   = ele->SCluster()->Et();
590 +  Double_t scEta  = ele->SCluster()->Eta();
591 +
592 +  Double_t fBrem = ele->FBrem();
593 +  Double_t hOverE = ele->HadronicOverEm();
594 +  Double_t sigmaee = ele->CoviEtaiEta();
595 +  Double_t deltaPhiIn = TMath::Abs(ele->DeltaPhiSuperClusterTrackAtVtx());
596 +  Double_t deltaEtaIn = TMath::Abs(ele->DeltaEtaSuperClusterTrackAtVtx());
597 +  Double_t eSeedOverPin = ele->ESeedClusterOverPIn();
598 +
599 +  Int_t mishits = ele->BestTrk()->NExpectedHitsInner();
600 +  Double_t tkIso   = ele->TrackIsolationDr03();
601 +  Double_t ecalIso = ele->EcalRecHitIsoDr04()*beta;
602 +  Double_t hcalIso  = ele->HcalTowerSumEtDr04()*beta;
603 +
604 +  int cat = Classify(ele);
605 +  int eb;
606 +
607 +  if (ele->IsEB())
608 +    eb = 0;
609 +  else
610 +    eb = 1;
611 +
612 +  // Medium cuts
613 +  Double_t cutdcotdistMedium[9] = {
614 +  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};
615 +  Double_t cutdetainMedium[9] = {
616 +  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};
617 +  Double_t cutdetainlMedium[9] = {
618 +  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};
619 +  Double_t cutdphiinMedium[9] = {
620 +  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};
621 +  Double_t cutdphiinlMedium[9] = {
622 +  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};
623 +  Double_t cuteseedopcorMedium[9] = {
624 +  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};
625 +  Double_t cutfmishitsMedium[9] = {
626 +  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};
627 +  Double_t cuthoeMedium[9] = {
628 +  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};
629 +  Double_t cuthoelMedium[9] = {
630 +  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};
631 +  Double_t cutip_gsfMedium[9] = {
632 +  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};
633 +  Double_t cutip_gsflMedium[9] = {
634 +  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};
635 +  Double_t cutiso_sumMedium[9] = {
636 +  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};
637 +  Double_t cutiso_sumoetMedium[9] = {
638 +  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};
639 +  Double_t cutiso_sumoetlMedium[9] = {
640 +  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};
641 +  Double_t cutseeMedium[9] = {
642 +  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};
643 +  Double_t cutseelMedium[9] = {
644 +  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};
645 +
646 +  // Tight cuts
647 +  Double_t cutdcotdistTight[9] = {
648 +  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};
649 +  Double_t cutdetainTight[9] = {
650 +  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};
651 +  Double_t cutdetainlTight[9] = {
652 +  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};
653 +  Double_t cutdphiinTight[9] = {
654 +  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};
655 +  Double_t cutdphiinlTight[9] = {
656 +  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};
657 +  Double_t cuteseedopcorTight[9] = {
658 +  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};
659 +  Double_t cutfmishitsTight[9] = {
660 +  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};
661 +  Double_t cuthoeTight[9] = {
662 +  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};
663 +  Double_t cuthoelTight[9] = {
664 +  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};
665 +  Double_t cutip_gsfTight[9] = {
666 +  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};
667 +  Double_t cutip_gsflTight[9] = {
668 +  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};
669 +  Double_t cutiso_sumTight[9] = {
670 +  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};
671 +  Double_t cutiso_sumoetTight[9] = {
672 +  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};
673 +  Double_t cutiso_sumoetlTight[9] = {
674 +  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};
675 +  Double_t cutseeTight[9] = {
676 +  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};
677 +  Double_t cutseelTight[9] = {
678 +  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};
679 +  
680 +  // SuperTight cuts
681 +  Double_t cutdcotdistSuperTight[9] = {
682 +  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};
683 +  Double_t cutdetainSuperTight[9] = {
684 +  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};
685 +  Double_t cutdetainlSuperTight[9] = {
686 +  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};
687 +  Double_t cutdphiinSuperTight[9] = {
688 +  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};
689 +  Double_t cutdphiinlSuperTight[9] = {
690 +  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};
691 +  Double_t cuteseedopcorSuperTight[9] = {
692 +  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};
693 +  Double_t cutfmishitsSuperTight[9] = {
694 +  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};
695 +  Double_t cuthoeSuperTight[9] = {
696 +  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};
697 +  Double_t cuthoelSuperTight[9] = {
698 +  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};
699 +  Double_t cutip_gsfSuperTight[9] = {
700 +  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};
701 +  Double_t cutip_gsflSuperTight[9] = {
702 +  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};
703 +  Double_t cutiso_sumSuperTight[9] = {
704 +  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};
705 +  Double_t cutiso_sumoetSuperTight[9] = {
706 +  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};
707 +  Double_t cutiso_sumoetlSuperTight[9] = {
708 +  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};
709 +  Double_t cutseeSuperTight[9] = {
710 +  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};
711 +  Double_t cutseelSuperTight[9] = {
712 +  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};
713 +
714 +  // HyperTight1 cuts
715 +  Double_t cutdcotdistHyperTight1[9] = {
716 +  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};
717 +  Double_t cutdetainHyperTight1[9] = {
718 +  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};
719 +  Double_t cutdetainlHyperTight1[9] = {
720 +  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};
721 +  Double_t cutdphiinHyperTight1[9] = {
722 +  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};
723 +  Double_t cutdphiinlHyperTight1[9] = {
724 +  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};
725 +  Double_t cuteseedopcorHyperTight1[9] = {
726 +  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};
727 +  Double_t cutfmishitsHyperTight1[9] = {
728 +  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};
729 +  Double_t cuthoeHyperTight1[9] = {
730 +  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};
731 +  Double_t cuthoelHyperTight1[9] = {
732 +  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};
733 +  Double_t cutip_gsfHyperTight1[9] = {
734 +  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};
735 +  Double_t cutip_gsflHyperTight1[9] = {
736 +  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};
737 +  Double_t cutiso_sumHyperTight1[9] = {
738 +  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};
739 +  Double_t cutiso_sumoetHyperTight1[9] = {
740 +  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};
741 +  Double_t cutiso_sumoetlHyperTight1[9] = {
742 +  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};
743 +  Double_t cutseeHyperTight1[9] = {
744 +  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};
745 +  Double_t cutseelHyperTight1[9] = {
746 +  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};
747 +
748 +  // HyperTight2 cuts
749 +  Double_t cutdcotdistHyperTight2[9] = {
750 +  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};
751 +  Double_t cutdetainHyperTight2[9] = {
752 +  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};
753 +  Double_t cutdetainlHyperTight2[9] = {
754 +  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};
755 +  Double_t cutdphiinHyperTight2[9] = {
756 +  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};
757 +  Double_t cutdphiinlHyperTight2[9] = {
758 +  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};
759 +  Double_t cuteseedopcorHyperTight2[9] = {
760 +  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};
761 +  Double_t cutfmishitsHyperTight2[9] = {
762 +  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};
763 +  Double_t cuthoeHyperTight2[9] = {
764 +  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};
765 +  Double_t cuthoelHyperTight2[9] = {
766 +  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};
767 +  Double_t cutip_gsfHyperTight2[9] = {
768 +  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};
769 +  Double_t cutip_gsflHyperTight2[9] = {
770 +  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};
771 +  Double_t cutiso_sumHyperTight2[9] = {
772 +  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};
773 +  Double_t cutiso_sumoetHyperTight2[9] = {
774 +  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};
775 +  Double_t cutiso_sumoetlHyperTight2[9] = {
776 +  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};
777 +  Double_t cutseeHyperTight2[9] = {
778 +  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};
779 +  Double_t cutseelHyperTight2[9] = {
780 +  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};
781 +
782 +  // HyperTight3 cuts
783 +  Double_t cutdcotdistHyperTight3[9] = {
784 +  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};
785 +  Double_t cutdetainHyperTight3[9] = {
786 +  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};
787 +  Double_t cutdetainlHyperTight3[9] = {
788 +  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};
789 +  Double_t cutdphiinHyperTight3[9] = {
790 +  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};
791 +  Double_t cutdphiinlHyperTight3[9] = {
792 +  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};
793 +  Double_t cuteseedopcorHyperTight3[9] = {
794 +  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};
795 +  Double_t cutfmishitsHyperTight3[9] = {
796 +  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};
797 +  Double_t cuthoeHyperTight3[9] = {
798 +  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};
799 +  Double_t cuthoelHyperTight3[9] = {
800 +  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};
801 +  Double_t cutip_gsfHyperTight3[9] = {
802 +  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};
803 +  Double_t cutip_gsflHyperTight3[9] = {
804 +  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};
805 +  Double_t cutiso_sumHyperTight3[9] = {
806 +  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};
807 +  Double_t cutiso_sumoetHyperTight3[9] = {
808 +  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};
809 +  Double_t cutiso_sumoetlHyperTight3[9] = {
810 +  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};
811 +  Double_t cutseeHyperTight3[9] = {
812 +  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};
813 +  Double_t cutseelHyperTight3[9] = {
814 +  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};
815 +
816 +  // HyperTight4 cuts
817 +  Double_t cutdcotdistHyperTight4[9] = {
818 +  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};
819 +  Double_t cutdetainHyperTight4[9] = {
820 +  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};
821 +  Double_t cutdetainlHyperTight4[9] = {
822 +  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};
823 +  Double_t cutdphiinHyperTight4[9] = {
824 +  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};
825 +  Double_t cutdphiinlHyperTight4[9] = {
826 +  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};
827 +  Double_t cuteseedopcorHyperTight4[9] = {
828 +  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};
829 +  Double_t cutfmishitsHyperTight4[9] = {
830 +  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};
831 +  Double_t cuthoeHyperTight4[9] = {
832 +  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};
833 +  Double_t cuthoelHyperTight4[9] = {
834 +  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};
835 +  Double_t cutip_gsfHyperTight4[9] = {
836 +  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};
837 +  Double_t cutip_gsflHyperTight4[9] = {
838 +  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};
839 +  Double_t cutiso_sumHyperTight4[9] = {
840 +  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};
841 +  Double_t cutiso_sumoetHyperTight4[9] = {
842 +  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};
843 +  Double_t cutiso_sumoetlHyperTight4[9] = {
844 +  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};
845 +  Double_t cutseeHyperTight4[9] = {
846 +  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};
847 +  Double_t cutseelHyperTight4[9] = {
848 +  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};
849 +
850 +  Double_t cutdcotdist[9];
851 +  Double_t cutdetain[9];
852 +  Double_t cutdetainl[9];
853 +  Double_t cutdphiin[9];
854 +  Double_t cutdphiinl[9];
855 +  Double_t cuteseedopcor[9];
856 +  Double_t cutfmishits[9];
857 +  Double_t cuthoe[9];
858 +  Double_t cuthoel[9];
859 +  Double_t cutip_gsf[9];
860 +  Double_t cutip_gsfl[9];
861 +  Double_t cutiso_sum[9];
862 +  Double_t cutiso_sumoet[9];
863 +  Double_t cutiso_sumoetl[9];
864 +  Double_t cutsee[9];
865 +  Double_t cutseel[9];
866 +  if     (typeCuts == 0) {
867 +    memcpy(cutdcotdist   ,cutdcotdistMedium   ,sizeof(cutdcotdistMedium));
868 +    memcpy(cutdetain     ,cutdetainMedium     ,sizeof(cutdetainMedium));
869 +    memcpy(cutdetainl    ,cutdetainlMedium    ,sizeof(cutdetainlMedium));
870 +    memcpy(cutdphiin     ,cutdphiinMedium     ,sizeof(cutdphiinMedium));
871 +    memcpy(cutdphiinl    ,cutdphiinlMedium    ,sizeof(cutdphiinlMedium));
872 +    memcpy(cuteseedopcor ,cuteseedopcorMedium ,sizeof(cuteseedopcorMedium));
873 +    memcpy(cutfmishits   ,cutfmishitsMedium   ,sizeof(cutfmishitsMedium));
874 +    memcpy(cuthoe        ,cuthoeMedium        ,sizeof(cuthoeMedium));
875 +    memcpy(cuthoel       ,cuthoelMedium       ,sizeof(cuthoelMedium));
876 +    memcpy(cutip_gsf     ,cutip_gsfMedium     ,sizeof(cutip_gsfMedium));
877 +    memcpy(cutip_gsfl    ,cutip_gsflMedium    ,sizeof(cutip_gsflMedium));
878 +    memcpy(cutiso_sum    ,cutiso_sumMedium    ,sizeof(cutiso_sumMedium));
879 +    memcpy(cutiso_sumoet ,cutiso_sumoetMedium ,sizeof(cutiso_sumoetMedium));
880 +    memcpy(cutiso_sumoetl,cutiso_sumoetlMedium,sizeof(cutiso_sumoetlMedium));
881 +    memcpy(cutsee        ,cutseeMedium        ,sizeof(cutseeMedium));
882 +    memcpy(cutseel       ,cutseelMedium       ,sizeof(cutseelMedium));
883 +  }
884 +  else if(typeCuts == 1) {
885 +    memcpy(cutdcotdist   ,cutdcotdistTight   ,sizeof(cutdcotdistTight));
886 +    memcpy(cutdetain     ,cutdetainTight     ,sizeof(cutdetainTight));
887 +    memcpy(cutdetainl    ,cutdetainlTight    ,sizeof(cutdetainlTight));
888 +    memcpy(cutdphiin     ,cutdphiinTight     ,sizeof(cutdphiinTight));
889 +    memcpy(cutdphiinl    ,cutdphiinlTight    ,sizeof(cutdphiinlTight));
890 +    memcpy(cuteseedopcor ,cuteseedopcorTight ,sizeof(cuteseedopcorTight));
891 +    memcpy(cutfmishits   ,cutfmishitsTight   ,sizeof(cutfmishitsTight));
892 +    memcpy(cuthoe        ,cuthoeTight        ,sizeof(cuthoeTight));
893 +    memcpy(cuthoel       ,cuthoelTight       ,sizeof(cuthoelTight));
894 +    memcpy(cutip_gsf     ,cutip_gsfTight     ,sizeof(cutip_gsfTight));
895 +    memcpy(cutip_gsfl    ,cutip_gsflTight    ,sizeof(cutip_gsflTight));
896 +    memcpy(cutiso_sum    ,cutiso_sumTight    ,sizeof(cutiso_sumTight));
897 +    memcpy(cutiso_sumoet ,cutiso_sumoetTight ,sizeof(cutiso_sumoetTight));
898 +    memcpy(cutiso_sumoetl,cutiso_sumoetlTight,sizeof(cutiso_sumoetlTight));
899 +    memcpy(cutsee        ,cutseeTight        ,sizeof(cutseeTight));
900 +    memcpy(cutseel       ,cutseelTight       ,sizeof(cutseelTight));
901 +  }
902 +  else if(typeCuts == 2) {
903 +    memcpy(cutdcotdist   ,cutdcotdistSuperTight   ,sizeof(cutdcotdistSuperTight));
904 +    memcpy(cutdetain     ,cutdetainSuperTight     ,sizeof(cutdetainSuperTight));
905 +    memcpy(cutdetainl    ,cutdetainlSuperTight    ,sizeof(cutdetainlSuperTight));
906 +    memcpy(cutdphiin     ,cutdphiinSuperTight     ,sizeof(cutdphiinSuperTight));
907 +    memcpy(cutdphiinl    ,cutdphiinlSuperTight    ,sizeof(cutdphiinlSuperTight));
908 +    memcpy(cuteseedopcor ,cuteseedopcorSuperTight ,sizeof(cuteseedopcorSuperTight));
909 +    memcpy(cutfmishits   ,cutfmishitsSuperTight   ,sizeof(cutfmishitsSuperTight));
910 +    memcpy(cuthoe        ,cuthoeSuperTight        ,sizeof(cuthoeSuperTight));
911 +    memcpy(cuthoel       ,cuthoelSuperTight       ,sizeof(cuthoelSuperTight));
912 +    memcpy(cutip_gsf     ,cutip_gsfSuperTight     ,sizeof(cutip_gsfSuperTight));
913 +    memcpy(cutip_gsfl    ,cutip_gsflSuperTight    ,sizeof(cutip_gsflSuperTight));
914 +    memcpy(cutiso_sum    ,cutiso_sumSuperTight    ,sizeof(cutiso_sumSuperTight));
915 +    memcpy(cutiso_sumoet ,cutiso_sumoetSuperTight ,sizeof(cutiso_sumoetSuperTight));
916 +    memcpy(cutiso_sumoetl,cutiso_sumoetlSuperTight,sizeof(cutiso_sumoetlSuperTight));
917 +    memcpy(cutsee        ,cutseeSuperTight        ,sizeof(cutseeSuperTight));
918 +    memcpy(cutseel       ,cutseelSuperTight       ,sizeof(cutseelSuperTight));
919 +  }
920 +  else if(typeCuts == 3) {
921 +    memcpy(cutdcotdist   ,cutdcotdistHyperTight1   ,sizeof(cutdcotdistHyperTight1));
922 +    memcpy(cutdetain     ,cutdetainHyperTight1     ,sizeof(cutdetainHyperTight1));
923 +    memcpy(cutdetainl    ,cutdetainlHyperTight1    ,sizeof(cutdetainlHyperTight1));
924 +    memcpy(cutdphiin     ,cutdphiinHyperTight1     ,sizeof(cutdphiinHyperTight1));
925 +    memcpy(cutdphiinl    ,cutdphiinlHyperTight1    ,sizeof(cutdphiinlHyperTight1));
926 +    memcpy(cuteseedopcor ,cuteseedopcorHyperTight1 ,sizeof(cuteseedopcorHyperTight1));
927 +    memcpy(cutfmishits   ,cutfmishitsHyperTight1   ,sizeof(cutfmishitsHyperTight1));
928 +    memcpy(cuthoe        ,cuthoeHyperTight1       ,sizeof(cuthoeHyperTight1));
929 +    memcpy(cuthoel       ,cuthoelHyperTight1      ,sizeof(cuthoelHyperTight1));
930 +    memcpy(cutip_gsf     ,cutip_gsfHyperTight1     ,sizeof(cutip_gsfHyperTight1));
931 +    memcpy(cutip_gsfl    ,cutip_gsflHyperTight1    ,sizeof(cutip_gsflHyperTight1));
932 +    memcpy(cutiso_sum    ,cutiso_sumHyperTight1    ,sizeof(cutiso_sumHyperTight1));
933 +    memcpy(cutiso_sumoet ,cutiso_sumoetHyperTight1 ,sizeof(cutiso_sumoetHyperTight1));
934 +    memcpy(cutiso_sumoetl,cutiso_sumoetlHyperTight1,sizeof(cutiso_sumoetlHyperTight1));
935 +    memcpy(cutsee        ,cutseeHyperTight1       ,sizeof(cutseeHyperTight1));
936 +    memcpy(cutseel       ,cutseelHyperTight1      ,sizeof(cutseelHyperTight1));
937 +  }
938 +  else if(typeCuts == 4) {
939 +    memcpy(cutdcotdist   ,cutdcotdistHyperTight2   ,sizeof(cutdcotdistHyperTight2));
940 +    memcpy(cutdetain     ,cutdetainHyperTight2     ,sizeof(cutdetainHyperTight2));
941 +    memcpy(cutdetainl    ,cutdetainlHyperTight2    ,sizeof(cutdetainlHyperTight2));
942 +    memcpy(cutdphiin     ,cutdphiinHyperTight2     ,sizeof(cutdphiinHyperTight2));
943 +    memcpy(cutdphiinl    ,cutdphiinlHyperTight2    ,sizeof(cutdphiinlHyperTight2));
944 +    memcpy(cuteseedopcor ,cuteseedopcorHyperTight2 ,sizeof(cuteseedopcorHyperTight2));
945 +    memcpy(cutfmishits   ,cutfmishitsHyperTight2   ,sizeof(cutfmishitsHyperTight2));
946 +    memcpy(cuthoe        ,cuthoeHyperTight2       ,sizeof(cuthoeHyperTight2));
947 +    memcpy(cuthoel       ,cuthoelHyperTight2      ,sizeof(cuthoelHyperTight2));
948 +    memcpy(cutip_gsf     ,cutip_gsfHyperTight2     ,sizeof(cutip_gsfHyperTight2));
949 +    memcpy(cutip_gsfl    ,cutip_gsflHyperTight2    ,sizeof(cutip_gsflHyperTight2));
950 +    memcpy(cutiso_sum    ,cutiso_sumHyperTight2    ,sizeof(cutiso_sumHyperTight2));
951 +    memcpy(cutiso_sumoet ,cutiso_sumoetHyperTight2 ,sizeof(cutiso_sumoetHyperTight2));
952 +    memcpy(cutiso_sumoetl,cutiso_sumoetlHyperTight2,sizeof(cutiso_sumoetlHyperTight2));
953 +    memcpy(cutsee        ,cutseeHyperTight2       ,sizeof(cutseeHyperTight2));
954 +    memcpy(cutseel       ,cutseelHyperTight2      ,sizeof(cutseelHyperTight2));
955 +  }
956 +  else if(typeCuts == 5) {
957 +    memcpy(cutdcotdist   ,cutdcotdistHyperTight3   ,sizeof(cutdcotdistHyperTight3));
958 +    memcpy(cutdetain     ,cutdetainHyperTight3     ,sizeof(cutdetainHyperTight3));
959 +    memcpy(cutdetainl    ,cutdetainlHyperTight3    ,sizeof(cutdetainlHyperTight3));
960 +    memcpy(cutdphiin     ,cutdphiinHyperTight3     ,sizeof(cutdphiinHyperTight3));
961 +    memcpy(cutdphiinl    ,cutdphiinlHyperTight3    ,sizeof(cutdphiinlHyperTight3));
962 +    memcpy(cuteseedopcor ,cuteseedopcorHyperTight3 ,sizeof(cuteseedopcorHyperTight3));
963 +    memcpy(cutfmishits   ,cutfmishitsHyperTight3   ,sizeof(cutfmishitsHyperTight3));
964 +    memcpy(cuthoe        ,cuthoeHyperTight3       ,sizeof(cuthoeHyperTight3));
965 +    memcpy(cuthoel       ,cuthoelHyperTight3      ,sizeof(cuthoelHyperTight3));
966 +    memcpy(cutip_gsf     ,cutip_gsfHyperTight3     ,sizeof(cutip_gsfHyperTight3));
967 +    memcpy(cutip_gsfl    ,cutip_gsflHyperTight3    ,sizeof(cutip_gsflHyperTight3));
968 +    memcpy(cutiso_sum    ,cutiso_sumHyperTight3    ,sizeof(cutiso_sumHyperTight3));
969 +    memcpy(cutiso_sumoet ,cutiso_sumoetHyperTight3 ,sizeof(cutiso_sumoetHyperTight3));
970 +    memcpy(cutiso_sumoetl,cutiso_sumoetlHyperTight3,sizeof(cutiso_sumoetlHyperTight3));
971 +    memcpy(cutsee        ,cutseeHyperTight3       ,sizeof(cutseeHyperTight3));
972 +    memcpy(cutseel       ,cutseelHyperTight3      ,sizeof(cutseelHyperTight3));
973 +  }
974 +  else if(typeCuts == 6) {
975 +    memcpy(cutdcotdist   ,cutdcotdistHyperTight4   ,sizeof(cutdcotdistHyperTight4));
976 +    memcpy(cutdetain     ,cutdetainHyperTight4     ,sizeof(cutdetainHyperTight4));
977 +    memcpy(cutdetainl    ,cutdetainlHyperTight4    ,sizeof(cutdetainlHyperTight4));
978 +    memcpy(cutdphiin     ,cutdphiinHyperTight4     ,sizeof(cutdphiinHyperTight4));
979 +    memcpy(cutdphiinl    ,cutdphiinlHyperTight4    ,sizeof(cutdphiinlHyperTight4));
980 +    memcpy(cuteseedopcor ,cuteseedopcorHyperTight4 ,sizeof(cuteseedopcorHyperTight4));
981 +    memcpy(cutfmishits   ,cutfmishitsHyperTight4   ,sizeof(cutfmishitsHyperTight4));
982 +    memcpy(cuthoe        ,cuthoeHyperTight4       ,sizeof(cuthoeHyperTight4));
983 +    memcpy(cuthoel       ,cuthoelHyperTight4      ,sizeof(cuthoelHyperTight4));
984 +    memcpy(cutip_gsf     ,cutip_gsfHyperTight4     ,sizeof(cutip_gsfHyperTight4));
985 +    memcpy(cutip_gsfl    ,cutip_gsflHyperTight4    ,sizeof(cutip_gsflHyperTight4));
986 +    memcpy(cutiso_sum    ,cutiso_sumHyperTight4    ,sizeof(cutiso_sumHyperTight4));
987 +    memcpy(cutiso_sumoet ,cutiso_sumoetHyperTight4 ,sizeof(cutiso_sumoetHyperTight4));
988 +    memcpy(cutiso_sumoetl,cutiso_sumoetlHyperTight4,sizeof(cutiso_sumoetlHyperTight4));
989 +    memcpy(cutsee        ,cutseeHyperTight4       ,sizeof(cutseeHyperTight4));
990 +    memcpy(cutseel       ,cutseelHyperTight4      ,sizeof(cutseelHyperTight4));
991 +  }
992 +  else {
993 +    return 0;
994 +  }
995 +  int result = 0;
996 +  
997 +  const int ncuts = 10;
998 +  std::vector<bool> cut_results(ncuts, false);
999 +  
1000 +  float iso_sum = tkIso + ecalIso + hcalIso;
1001 +  if(fabs(scEta)>1.5)
1002 +    iso_sum += (fabs(scEta)-1.5)*1.09;
1003 +  
1004 +  float iso_sumoet = iso_sum*(40./scEt);
1005 +  
1006 +  float eseedopincor = eSeedOverPin + fBrem;
1007 +  if(fBrem < 0)
1008 +    eseedopincor = eSeedOverPin;
1009 +
1010 +  float dist = (TMath::Abs(ele->ConvPartnerDist())      == -9999.? 9999:TMath::Abs(ele->ConvPartnerDist()));
1011 +  float dcot = (TMath::Abs(ele->ConvPartnerDCotTheta()) == -9999.? 9999:TMath::Abs(ele->ConvPartnerDCotTheta()));
1012 +
1013 +  float dcotdistcomb = ((0.04 - std::max(dist, dcot)) > 0?(0.04 - std::max(dist, dcot)):0);
1014 +
1015 +  Double_t ip = 99999;
1016 +  for(UInt_t i0 = 0; i0 < vertices->GetEntries(); i0++) {
1017 +    if(vertices->At(i0)->NTracks() > 0){
1018 +      Double_t pD0 = ele->GsfTrk()->D0Corrected(*vertices->At(i0));
1019 +      ip = TMath::Abs(pD0);
1020 +      break;
1021 +    }
1022 +  }
1023 +
1024 +  for (int cut=0; cut<ncuts; cut++) {
1025 +    switch (cut) {
1026 +    case 0:
1027 +      cut_results[cut] = compute_cut(fabs(deltaEtaIn), scEt, cutdetainl[cat], cutdetain[cat]);
1028 +      break;
1029 +    case 1:
1030 +      cut_results[cut] = compute_cut(fabs(deltaPhiIn), scEt, cutdphiinl[cat], cutdphiin[cat]);
1031 +      break;
1032 +    case 2:
1033 +      cut_results[cut] = (eseedopincor > cuteseedopcor[cat]);
1034 +      break;
1035 +    case 3:
1036 +      cut_results[cut] = compute_cut(hOverE, scEt, cuthoel[cat], cuthoe[cat]);
1037 +      break;
1038 +    case 4:
1039 +      cut_results[cut] = compute_cut(sigmaee, scEt, cutseel[cat], cutsee[cat]);
1040 +      break;
1041 +    case 5:
1042 +      cut_results[cut] = compute_cut(iso_sumoet, scEt, cutiso_sumoetl[cat], cutiso_sumoet[cat]);
1043 +      break;
1044 +    case 6:
1045 +      cut_results[cut] = (iso_sum < cutiso_sum[cat]);
1046 +      break;
1047 +    case 7:
1048 +      cut_results[cut] = compute_cut(fabs(ip), scEt, cutip_gsfl[cat], cutip_gsf[cat]);
1049 +      break;
1050 +    case 8:
1051 +      cut_results[cut] = (mishits < cutfmishits[cat]);
1052 +      break;
1053 +    case 9:
1054 +      cut_results[cut] = (dcotdistcomb < cutdcotdist[cat]);
1055 +      break;
1056 +    }
1057 +  }
1058 +  
1059 +  // ID part
1060 +  if (cut_results[0] & cut_results[1] & cut_results[2] & cut_results[3] & cut_results[4])
1061 +    result = result + 1;
1062 +  
1063 +  // ISO part
1064 +  if (cut_results[5] & cut_results[6])
1065 +    result = result + 2;
1066 +  
1067 +  // IP part
1068 +  if (cut_results[7])
1069 +    result = result + 8;
1070 +  
1071 +  // Conversion part
1072 +  if (cut_results[8] and cut_results[9])
1073 +    result = result + 4;
1074 +  
1075 +  return result;
1076 + }
1077 +
1078 + //--------------------------------------------------------------------------------------------------
1079 + bool ElectronTools::compute_cut(double x, double et, double cut_min, double cut_max, bool gtn) {
1080 +
1081 +  float et_min = 10;
1082 +  float et_max = 40;
1083 +
1084 +  bool accept = false;
1085 +  float cut = cut_max; //  the cut at et=40 GeV
1086 +
1087 +  if(et < et_max) {
1088 +    cut = cut_min + (1/et_min - 1/et)*(cut_max - cut_min)/(1/et_min - 1/et_max);
1089 +  }
1090 +  
1091 +  if(et < et_min) {
1092 +    cut = cut_min;
1093 +  }
1094 +
1095 +  if(gtn) {   // useful for e/p cut which is gt
1096 +    accept = (x >= cut);
1097 +  }
1098 +  else {
1099 +    accept = (x <= cut);
1100 +  }
1101 +
1102 +  return accept;
1103 + }
1104 +
1105 + //--------------------------------------------------------------------------------------------------
1106 + Double_t ElectronTools::Likelihood(ElectronLikelihood *LH, const Electron *ele)
1107 + {
1108 +  if (!LH) {
1109 +    std::cout << "Error: Likelihood not properly initialized\n";
1110 +    return -9999;
1111 +  }
1112 +
1113 +  LikelihoodMeasurements measurements;
1114 +  measurements.pt = ele->Pt();
1115 +  if (ele->IsEB() && ele->AbsEta()<1.0) measurements.subdet = 0;
1116 +  else if (ele->IsEB())                 measurements.subdet = 1;
1117 +  else                                  measurements.subdet = 2;
1118 +  measurements.deltaPhi = TMath::Abs(ele->DeltaPhiSuperClusterTrackAtVtx());
1119 +  measurements.deltaEta = TMath::Abs(ele->DeltaEtaSuperClusterTrackAtVtx());
1120 +  measurements.eSeedClusterOverPout = ele->ESeedClusterOverPout();
1121 +  measurements.eSuperClusterOverP = ele->ESuperClusterOverP();
1122 +  measurements.hadronicOverEm = ele->HadronicOverEm();
1123 +  measurements.sigmaIEtaIEta = ele->CoviEtaiEta();
1124 +  measurements.sigmaIPhiIPhi = TMath::Sqrt(ele->SCluster()->Seed()->CoviPhiiPhi());
1125 +  measurements.fBrem = ele->FBrem();
1126 +  measurements.nBremClusters = ele->NumberOfClusters() - 1;
1127 +  //measurements.OneOverEMinusOneOverP = (1.0 / ele->SCluster()->Energy()) - (1.0 / ele->BestTrk()->P());
1128 +  measurements.OneOverEMinusOneOverP = (1.0 / ele->ESuperClusterOverP() / ele->BestTrk()->P()) - (1.0 / ele->BestTrk()->P());
1129 +  double likelihood = LH->result(measurements);
1130 +
1131 +  double newLik = 0.0;
1132 +  if     (likelihood<=0) newLik = -20.0;
1133 +  else if(likelihood>=1) newLik =  20.0;
1134 +  else                   newLik = log(likelihood/(1.0-likelihood));
1135 +
1136 +  Bool_t isDebug = kFALSE;
1137 +  if(isDebug == kTRUE){
1138 +    printf("LIKELIHOOD: %f %d %f %f %f %f %f %f %f %f %d %f %f %f - %f %f\n",measurements.pt,measurements.subdet,
1139 +    measurements.deltaPhi          ,measurements.deltaEta      ,measurements.eSeedClusterOverPout,
1140 +    measurements.eSuperClusterOverP,measurements.hadronicOverEm,measurements.sigmaIEtaIEta,
1141 +    measurements.sigmaIPhiIPhi     ,measurements.fBrem         ,measurements.nBremClusters,
1142 +    measurements.OneOverEMinusOneOverP,ele->SCluster()->Energy(),ele->BestTrk()->P(),
1143 +    likelihood,newLik);
1144 +  }
1145 +
1146 +  return newLik;
1147 +
1148 + }
1149 +
1150 + Double_t ElectronTools::ElectronEffectiveArea(EElectronEffectiveAreaType type, Double_t SCEta, EElectronEffectiveAreaTarget EffectiveAreaTarget) {
1151 +
1152 +  Double_t EffectiveArea = 0;
1153 +  
1154 +  if(type == ElectronTools::kEleNeutralIso04){
1155 +    if     (fabs(SCEta) < 1.0                           ) EffectiveArea = 0.208;
1156 +    else if(fabs(SCEta) >= 1.0   && fabs(SCEta) < 1.479 ) EffectiveArea = 0.209;
1157 +    else if(fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.000 ) EffectiveArea = 0.115;
1158 +    else if(fabs(SCEta) >= 2.000 && fabs(SCEta) < 2.200 ) EffectiveArea = 0.143;
1159 +    else if(fabs(SCEta) >= 2.200 && fabs(SCEta) < 2.300 ) EffectiveArea = 0.183;
1160 +    else if(fabs(SCEta) >= 2.300 && fabs(SCEta) < 2.400 ) EffectiveArea = 0.194;
1161 +    else                                                  EffectiveArea = 0.261;
1162 +    return EffectiveArea;
1163 +  }
1164 +
1165 +  if (fabs(SCEta) < 1.0) {
1166 +    if (type == ElectronTools::kEleChargedIso03) EffectiveArea = 0.000;
1167 +    if (type == ElectronTools::kEleNeutralHadronIso03) EffectiveArea = 0.017;
1168 +    if (type == ElectronTools::kEleGammaIso03) EffectiveArea = 0.045;
1169 +    if (type == ElectronTools::kEleGammaIsoVetoEtaStrip03) EffectiveArea = 0.014;
1170 +    if (type == ElectronTools::kEleChargedIso04) EffectiveArea = 0.000;
1171 +    if (type == ElectronTools::kEleNeutralHadronIso04) EffectiveArea = 0.034;
1172 +    if (type == ElectronTools::kEleGammaIso04) EffectiveArea = 0.079;
1173 +    if (type == ElectronTools::kEleGammaIsoVetoEtaStrip04) EffectiveArea = 0.014;
1174 +    if (type == ElectronTools::kEleNeutralHadronIso007) EffectiveArea = 0.000;
1175 +    if (type == ElectronTools::kEleHoverE) EffectiveArea = 0.00016;
1176 +    if (type == ElectronTools::kEleHcalDepth1OverEcal) EffectiveArea = 0.00016;
1177 +    if (type == ElectronTools::kEleHcalDepth2OverEcal) EffectiveArea = 0.00000;    
1178 +  } else if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) {
1179 +    if (type == ElectronTools::kEleChargedIso03) EffectiveArea = 0.000;
1180 +    if (type == ElectronTools::kEleNeutralHadronIso03) EffectiveArea = 0.025;
1181 +    if (type == ElectronTools::kEleGammaIso03) EffectiveArea = 0.052;
1182 +    if (type == ElectronTools::kEleGammaIsoVetoEtaStrip03) EffectiveArea = 0.030;
1183 +    if (type == ElectronTools::kEleChargedIso04) EffectiveArea = 0.000;
1184 +    if (type == ElectronTools::kEleNeutralHadronIso04) EffectiveArea = 0.050;
1185 +    if (type == ElectronTools::kEleGammaIso04) EffectiveArea = 0.073;
1186 +    if (type == ElectronTools::kEleGammaIsoVetoEtaStrip04) EffectiveArea = 0.030;
1187 +    if (type == ElectronTools::kEleNeutralHadronIso007) EffectiveArea = 0.000;
1188 +    if (type == ElectronTools::kEleHoverE) EffectiveArea = 0.00022;
1189 +    if (type == ElectronTools::kEleHcalDepth1OverEcal) EffectiveArea = 0.00022;
1190 +    if (type == ElectronTools::kEleHcalDepth2OverEcal) EffectiveArea = 0.00000;    
1191 +  } else if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) {
1192 +    if (type == ElectronTools::kEleChargedIso03) EffectiveArea = 0.000;
1193 +    if (type == ElectronTools::kEleNeutralHadronIso03) EffectiveArea = 0.030;
1194 +    if (type == ElectronTools::kEleGammaIso03) EffectiveArea = 0.170;
1195 +    if (type == ElectronTools::kEleGammaIsoVetoEtaStrip03) EffectiveArea = 0.134;
1196 +    if (type == ElectronTools::kEleChargedIso04) EffectiveArea = 0.000;
1197 +    if (type == ElectronTools::kEleNeutralHadronIso04) EffectiveArea = 0.060;
1198 +    if (type == ElectronTools::kEleGammaIso04) EffectiveArea = 0.187;
1199 +    if (type == ElectronTools::kEleGammaIsoVetoEtaStrip04) EffectiveArea = 0.134;
1200 +    if (type == ElectronTools::kEleNeutralHadronIso007) EffectiveArea = 0.000;
1201 +    if (type == ElectronTools::kEleHoverE) EffectiveArea = 0.00030;
1202 +    if (type == ElectronTools::kEleHcalDepth1OverEcal) EffectiveArea = 0.00026;
1203 +    if (type == ElectronTools::kEleHcalDepth2OverEcal) EffectiveArea = 0.00002;        
1204 +  } else if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.25 ) {
1205 +    if (type == ElectronTools::kEleChargedIso03) EffectiveArea = 0.000;
1206 +    if (type == ElectronTools::kEleNeutralHadronIso03) EffectiveArea = 0.022;
1207 +    if (type == ElectronTools::kEleGammaIso03) EffectiveArea = 0.623;
1208 +    if (type == ElectronTools::kEleGammaIsoVetoEtaStrip03) EffectiveArea = 0.516;
1209 +    if (type == ElectronTools::kEleChargedIso04) EffectiveArea = 0.000;
1210 +    if (type == ElectronTools::kEleNeutralHadronIso04) EffectiveArea = 0.055;
1211 +    if (type == ElectronTools::kEleGammaIso04) EffectiveArea = 0.659;
1212 +    if (type == ElectronTools::kEleGammaIsoVetoEtaStrip04) EffectiveArea = 0.517;
1213 +    if (type == ElectronTools::kEleNeutralHadronIso007) EffectiveArea = 0.000;
1214 +    if (type == ElectronTools::kEleHoverE) EffectiveArea = 0.00054;
1215 +    if (type == ElectronTools::kEleHcalDepth1OverEcal) EffectiveArea = 0.00045;
1216 +    if (type == ElectronTools::kEleHcalDepth2OverEcal) EffectiveArea = 0.00003;
1217 +  } else if (fabs(SCEta) >= 2.25 && fabs(SCEta) < 2.5 ) {
1218 +    if (type == ElectronTools::kEleChargedIso03) EffectiveArea = 0.000;
1219 +    if (type == ElectronTools::kEleNeutralHadronIso03) EffectiveArea = 0.018;
1220 +    if (type == ElectronTools::kEleGammaIso03) EffectiveArea = 1.198;
1221 +    if (type == ElectronTools::kEleGammaIsoVetoEtaStrip03) EffectiveArea = 1.049;
1222 +    if (type == ElectronTools::kEleChargedIso04) EffectiveArea = 0.000;
1223 +    if (type == ElectronTools::kEleNeutralHadronIso04) EffectiveArea = 0.073;
1224 +    if (type == ElectronTools::kEleGammaIso04) EffectiveArea = 1.258;
1225 +    if (type == ElectronTools::kEleGammaIsoVetoEtaStrip04) EffectiveArea = 1.051;
1226 +    if (type == ElectronTools::kEleNeutralHadronIso007) EffectiveArea = 0.000;
1227 +    if (type == ElectronTools::kEleHoverE) EffectiveArea = 0.00082;
1228 +    if (type == ElectronTools::kEleHcalDepth1OverEcal) EffectiveArea = 0.00066;
1229 +    if (type == ElectronTools::kEleHcalDepth2OverEcal) EffectiveArea = 0.00004;
1230 +  }
1231 +    
1232 +  //NoCorrections
1233 +  if (EffectiveAreaTarget == kEleEANoCorr) {
1234 +    return 0.0;
1235 +  }
1236 +  else if (EffectiveAreaTarget == kEleEAData2012) {
1237 +    if (type == kEleGammaIso03) {
1238 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.122;
1239 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.147;
1240 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.055;
1241 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.106;
1242 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.138;
1243 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.221;
1244 +      if (fabs(SCEta) >= 2.4 ) EffectiveArea = 0.211;
1245 +    }
1246 +    if (type == kEleGammaIso04) {
1247 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.176;
1248 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.206;
1249 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.094;
1250 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.172;
1251 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.244;
1252 +      if (fabs(SCEta) >= 2.4 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.333;
1253 +      if (fabs(SCEta) >= 2.4 ) EffectiveArea = 0.348;
1254 +    }
1255 +    if (type == kEleNeutralHadronIso03) {
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.021;
1258 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.013;
1259 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.010;
1260 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.024;
1261 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.020;
1262 +      if (fabs(SCEta) >= 2.4 ) EffectiveArea = 0.019;
1263 +    }
1264 +    if (type == kEleNeutralHadronIso04) {
1265 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.022;
1266 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.036;
1267 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.027;
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.052;
1270 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.063;
1271 +      if (fabs(SCEta) >= 2.4 ) EffectiveArea = 0.028;
1272 +    }
1273 +    if (type == kEleGammaAndNeutralHadronIso04) {
1274 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.208;
1275 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.209;
1276 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.115;
1277 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.143;
1278 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.183;
1279 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.194;
1280 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.261;
1281 +    }                          
1282 +    if (type == kEleGammaIsoDR0p0To0p1) {
1283 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.051;
1284 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.032;
1285 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.006;
1286 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.007;
1287 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.024;
1288 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.013;
1289 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.013;
1290 +    }
1291 +    if (type == kEleGammaIsoDR0p1To0p2) {
1292 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.013;
1293 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.013;
1294 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.021;
1295 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.052;
1296 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.066;
1297 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.043;
1298 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.102;
1299 +    }
1300 +    if (type == kEleGammaIsoDR0p2To0p3) {
1301 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.026;
1302 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.017;
1303 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.012;
1304 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.028;
1305 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.041;
1306 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.034;
1307 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.042;
1308 +    }
1309 +    if (type == kEleGammaIsoDR0p3To0p4) {
1310 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.039;
1311 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.032;
1312 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.017;
1313 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.024;
1314 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.053;
1315 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.059;
1316 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.069;
1317 +    }
1318 +    if (type == kEleGammaIsoDR0p4To0p5) {
1319 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.059;
1320 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.045;
1321 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.033;
1322 +     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.043;
1323 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.056;
1324 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.065;
1325 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.074;
1326 +    }
1327 +    if (type == kEleNeutralHadronIsoDR0p0To0p1) {
1328 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.001;
1329 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.006;
1330 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.001;
1331 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.000;
1332 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.001;
1333 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.003;
1334 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.008;
1335 +    }
1336 +    if (type == kEleNeutralHadronIsoDR0p1To0p2) {
1337 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.002;
1338 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.001;
1339 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.004;
1340 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.003;
1341 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.005;
1342 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.006;
1343 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.010;
1344 +    }
1345 +    if (type == kEleNeutralHadronIsoDR0p2To0p3) {
1346 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.007;
1347 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.010;
1348 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.009;
1349 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.009;
1350 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.007;
1351 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.018;
1352 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.028;
1353 +    }
1354 +    if (type == kEleNeutralHadronIsoDR0p3To0p4) {
1355 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.010;
1356 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.011;
1357 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.012;
1358 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.008;
1359 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.018;
1360 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.026;
1361 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.063;
1362 +    }
1363 +    if (type == kEleNeutralHadronIsoDR0p4To0p5) {
1364 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.011;
1365 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.012;
1366 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.016;
1367 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.023;
1368 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.038;
1369 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.051;
1370 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.143;
1371 +    }
1372 +  }
1373 +
1374 +  //2011 Data Effective Areas
1375 +  else if (EffectiveAreaTarget == kEleEAData2011) {
1376 +    if (type == kEleGammaAndNeutralHadronIso03) {
1377 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.100;
1378 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.120;
1379 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.085;
1380 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.110;
1381 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.120;
1382 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.120;
1383 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.130;
1384 +    }
1385 +    if (type == kEleGammaAndNeutralHadronIso04) {
1386 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.180;
1387 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.200;
1388 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.150;
1389 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.190;
1390 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.210;
1391 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.220;
1392 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.290;
1393 +    }
1394 +    if (type == kEleGammaIsoDR0p0To0p1) {
1395 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.017;
1396 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.033;
1397 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.005;
1398 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.007;
1399 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.004;
1400 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.000;
1401 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.000;
1402 +    }
1403 +    if (type == kEleGammaIsoDR0p1To0p2) {
1404 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.010;
1405 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.010;
1406 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.019;
1407 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.042;
1408 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.041;
1409 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.035;
1410 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.041;
1411 +    }
1412 +    if (type == kEleGammaIsoDR0p2To0p3) {
1413 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.020;
1414 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.017;
1415 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.014;
1416 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.029;
1417 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.039;
1418 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.042;
1419 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.048;
1420 +    }
1421 +    if (type == kEleGammaIsoDR0p3To0p4) {
1422 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.036;
1423 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.029;
1424 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.020;
1425 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.029;
1426 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.042;
1427 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.047;
1428 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.054;
1429 +    }
1430 +    if (type == kEleGammaIsoDR0p4To0p5) {
1431 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.051;
1432 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.038;
1433 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.028;
1434 +     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.036;
1435 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.047;
1436 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.057;
1437 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.059;
1438 +    }
1439 +    if (type == kEleNeutralHadronIsoDR0p0To0p1) {
1440 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.001;
1441 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.002;
1442 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.002;
1443 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.000;
1444 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.000;
1445 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.000;
1446 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.000;
1447 +    }
1448 +    if (type == kEleNeutralHadronIsoDR0p1To0p2) {
1449 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.005;
1450 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.008;
1451 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.008;
1452 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.006;
1453 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.003;
1454 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.001;
1455 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.003;
1456 +    }
1457 +    if (type == kEleNeutralHadronIsoDR0p2To0p3) {
1458 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.010;
1459 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.014;
1460 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.017;
1461 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.016;
1462 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.016;
1463 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.016;
1464 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.019;
1465 +    }
1466 +    if (type == kEleNeutralHadronIsoDR0p3To0p4) {
1467 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.015;
1468 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.021;
1469 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.025;
1470 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.030;
1471 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.036;
1472 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.038;
1473 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.084;
1474 +    }
1475 +    if (type == kEleNeutralHadronIsoDR0p4To0p5) {
1476 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.020;
1477 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.027;
1478 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.035;
1479 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.045;
1480 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.051;
1481 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.107;
1482 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.228;
1483 +    }
1484 +  }
1485 +
1486 +  //Summer11 MC Effective Areas
1487 +  else if (EffectiveAreaTarget == kEleEASummer11MC) {
1488 +    if (type == kEleGammaIsoDR0p0To0p1) {
1489 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.015;
1490 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.030;
1491 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.004;
1492 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.010;
1493 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.014;
1494 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.024;
1495 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.023;
1496 +    }
1497 +    if (type == kEleGammaIsoDR0p1To0p2) {
1498 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.012;
1499 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.010;
1500 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.009;
1501 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.037;
1502 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.046;
1503 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.055;
1504 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.046;
1505 +    }
1506 +    if (type == kEleGammaIsoDR0p2To0p3) {
1507 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.021;
1508 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.018;
1509 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.013;
1510 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.026;
1511 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.038;
1512 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.045;
1513 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.059;
1514 +    }
1515 +    if (type == kEleGammaIsoDR0p3To0p4) {
1516 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.036;
1517 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.030;
1518 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.017;
1519 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.036;
1520 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.058;
1521 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.073;
1522 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.083;
1523 +    }
1524 +    if (type == kEleGammaIsoDR0p4To0p5) {
1525 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.053;
1526 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.037;
1527 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.032;
1528 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.048;
1529 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.062;
1530 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.085;
1531 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.118;
1532 +    }
1533 +    if (type == kEleNeutralHadronIsoDR0p0To0p1) {
1534 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.000;
1535 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.000;
1536 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.000;
1537 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.000;
1538 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.000;
1539 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.000;
1540 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.000;
1541 +    }
1542 +    if (type == kEleNeutralHadronIsoDR0p1To0p2) {
1543 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.004;
1544 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.007;
1545 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.009;
1546 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.004;
1547 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.003;
1548 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.000;
1549 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.004;
1550 +    }
1551 +    if (type == kEleNeutralHadronIsoDR0p2To0p3) {
1552 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.008;
1553 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.013;
1554 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.016;
1555 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.013;
1556 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.014;
1557 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.016;
1558 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.021;
1559 +    }
1560 +    if (type == kEleNeutralHadronIsoDR0p3To0p4) {
1561 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.012;
1562 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.017;
1563 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.020;
1564 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.024;
1565 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.040;
1566 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.036;
1567 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.086;
1568 +    }
1569 +    if (type == kEleNeutralHadronIsoDR0p4To0p5) {
1570 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.016;
1571 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.026;
1572 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.030;
1573 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.038;
1574 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.051;
1575 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.105;
1576 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.169;
1577 +    }
1578 +  }
1579 +  
1580 +  //Fall11 MC Effective Areas
1581 +  else if (EffectiveAreaTarget == kEleEAFall11MC) {
1582 +    if (type == kEleGammaIsoDR0p0To0p1) {
1583 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.014;
1584 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.020;
1585 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.004;
1586 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.012;
1587 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.016;
1588 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.021;
1589 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.012;
1590 +    }
1591 +    if (type == kEleGammaIsoDR0p1To0p2) {
1592 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.012;
1593 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.011;
1594 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.015;
1595 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.042;
1596 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.055;
1597 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.068;
1598 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.067;
1599 +    }
1600 +    if (type == kEleGammaIsoDR0p2To0p3) {
1601 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.024;
1602 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.020;
1603 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.017;
1604 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.038;
1605 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.051;
1606 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.066;
1607 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.080;
1608 +    }
1609 +    if (type == kEleGammaIsoDR0p3To0p4) {
1610 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.040;
1611 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.032;
1612 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.021;
1613 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.047;
1614 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.066;
1615 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.083;
1616 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.123;
1617 +    }
1618 +    if (type == kEleGammaIsoDR0p4To0p5) {
1619 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.059;
1620 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.041;
1621 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.037;
1622 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.057;
1623 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.095;
1624 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.123;
1625 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.133;
1626 +    }
1627 +    if (type == kEleNeutralHadronIsoDR0p0To0p1) {
1628 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.002;
1629 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.003;
1630 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.000;
1631 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.000;
1632 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.000;
1633 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.000;
1634 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.000;
1635 +    }
1636 +    if (type == kEleNeutralHadronIsoDR0p1To0p2) {
1637 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.006;
1638 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.008;
1639 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.010;
1640 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.006;
1641 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.005;
1642 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.002;
1643 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.007;
1644 +    }
1645 +    if (type == kEleNeutralHadronIsoDR0p2To0p3) {
1646 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.009;
1647 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.014;
1648 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.018;
1649 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.016;
1650 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.017;
1651 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.020;
1652 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.021;
1653 +    }
1654 +    if (type == kEleNeutralHadronIsoDR0p3To0p4) {
1655 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.013;
1656 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.019;
1657 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.027;
1658 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.035;
1659 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.037;
1660 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.043;
1661 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.110;
1662 +    }
1663 +    if (type == kEleNeutralHadronIsoDR0p4To0p5) {
1664 +      if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.017;
1665 +      if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.027;
1666 +      if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.036;
1667 +      if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.045;
1668 +      if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.057;
1669 +      if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.123;
1670 +      if (fabs(SCEta) >= 2.4) EffectiveArea = 0.220;
1671 +    }
1672 +  }
1673 +
1674 +  return EffectiveArea;  
1675 + }
1676 +
1677 +
1678 + Bool_t ElectronTools::PassHggLeptonTagID(const Electron* ele) {
1679 +  
1680 +  float dist = ( ele->ConvPartnerDist()      == -9999.? 9999:TMath::Abs(ele->ConvPartnerDist()));
1681 +  float dcot = ( ele->ConvPartnerDCotTheta() == -9999.? 9999:TMath::Abs(ele->ConvPartnerDCotTheta()));  
1682 +  
1683 +  if (dist < 0.02) return false;
1684 +  if (dcot < 0.02) return false;
1685 +  
1686 +  int numInnerHits = ele->Trk()->NExpectedHitsInner();
1687 +  if( numInnerHits > 1 ) return false;
1688 +
1689 +  float coviEtaiEta = ele->CoviEtaiEta();
1690 +  if( ele->SCluster()->AbsEta() < 1.5 && coviEtaiEta > 0.01 ) return false;
1691 +  else if( ele->SCluster()->AbsEta() > 1.5 && coviEtaiEta > 0.031 ) return false;
1692 +
1693 +  Double_t deltaPhiIn   = TMath::Abs(ele->DeltaPhiSuperClusterTrackAtVtx());
1694 +  Double_t deltaEtaIn   = TMath::Abs(ele->DeltaEtaSuperClusterTrackAtVtx());
1695 +
1696 +  if( ele->SCluster()->AbsEta() < 1.5 && ( deltaPhiIn > 0.039 || deltaEtaIn > 0.005 ) ) return false;
1697 +  else if ( ele->SCluster()->AbsEta() > 1.5 && ( deltaPhiIn > 0.028 || deltaEtaIn > 0.007 ) ) return false;
1698 +
1699 +  return true;
1700 + }
1701 +
1702 + Bool_t ElectronTools::PassHggLeptonTagID2012(const Electron* ele) {
1703 +  
1704 +  if (TMath::Abs(1./ele->E()-1./ele->Pt())>0.05) return false;
1705 +
1706 +  int numInnerHits = ele->Trk()->NExpectedHitsInner();
1707 +  if( numInnerHits > 1 ) return false;
1708 +
1709 +  float coviEtaiEta = ele->CoviEtaiEta();
1710 +  if( ele->SCluster()->AbsEta() < 1.5 && coviEtaiEta > 0.01 ) return false;
1711 +  else if( ele->SCluster()->AbsEta() > 1.5 && coviEtaiEta > 0.03 ) return false; // h
1712 +
1713 +  Double_t deltaPhiIn   = TMath::Abs(ele->DeltaPhiSuperClusterTrackAtVtx());
1714 +  Double_t deltaEtaIn   = TMath::Abs(ele->DeltaEtaSuperClusterTrackAtVtx());
1715 +
1716 +  if( ele->SCluster()->AbsEta() < 1.5 && ( deltaPhiIn > 0.15 || deltaEtaIn > 0.007 || ele->HadronicOverEm()>0.12) ) return false;   // h
1717 +  else if ( ele->SCluster()->AbsEta() > 1.5 && ( deltaPhiIn > 0.10 || deltaEtaIn > 0.009 || ele->HadronicOverEm()>0.10 ) ) return false;   // h
1718 +
1719 +  return true;
1720 + }
1721 +
1722 + std::pair<Double_t,Double_t> ElectronTools::ComputeEPCombination( const Electron * ele, const float regression_energy,
1723 +                                                  const float regression_energy_error) {
1724 +
1725 +  enum Classification { GSF_ELECTRON_UNKNOWN=-1,
1726 +                        GSF_ELECTRON_GOLDEN=0,
1727 +                        GSF_ELECTRON_BIGBREM=1,
1728 +                        GSF_ELECTRON_BADTRACK=2,
1729 +                        GSF_ELECTRON_SHOWERING=3,
1730 +                        GSF_ELECTRON_GAP=4 } ;
1731 +
1732 +  float newEnergyError_ = regression_energy_error;
1733 +  float scEnergy = regression_energy;
1734 +
1735 +  int elClass = ele->Classification();
1736 +
1737 +  float trackMomentum  = ele->PIn() ;
1738 +  float errorTrackMomentum_ = 999. ;
1739 +  
1740 +  // the electron's track momentum error was not available in bambu versions less than 029
1741 +  if(ele->TrackMomentumError() > 0)
1742 +    errorTrackMomentum_ = ele->TrackMomentumError();
1743 +  else if ( ele->GsfTrk()->PtErr() > 0)
1744 +    errorTrackMomentum_ = ele->GsfTrk()->PtErr()*cosh(ele->GsfTrk()->Eta());
1745 +  else
1746 +    assert(0);
1747 +
1748 +  float finalMomentum = ele->E(); // initial
1749 +  float finalMomentumError = 999.;
1750 +  
1751 +  // first check for large errors
1752 +
1753 +  if (errorTrackMomentum_/trackMomentum > 0.5 && regression_energy_error/regression_energy <= 0.5) {
1754 +    finalMomentum = regression_energy;    finalMomentumError = regression_energy_error;
1755 +  }
1756 +  else if (errorTrackMomentum_/trackMomentum <= 0.5 && regression_energy_error/regression_energy > 0.5){  
1757 +    finalMomentum = trackMomentum;  finalMomentumError = errorTrackMomentum_;
1758 +  }
1759 +  else if (errorTrackMomentum_/trackMomentum > 0.5 && regression_energy_error/regression_energy > 0.5){
1760 +    if (errorTrackMomentum_/trackMomentum < regression_energy_error/regression_energy) {
1761 +      finalMomentum = trackMomentum; finalMomentumError = errorTrackMomentum_;
1762 +    }
1763 +    else{
1764 +      finalMomentum = regression_energy; finalMomentumError = regression_energy_error;
1765 +    }
1766 +  }
1767 +  // then apply the combination algorithm
1768 +  else {
1769 +     // calculate E/p and corresponding error
1770 +    float eOverP = regression_energy / trackMomentum;
1771 +    float errorEOverP = sqrt(
1772 +                             (regression_energy_error/trackMomentum)*(regression_energy_error/trackMomentum) +
1773 +                             (regression_energy*errorTrackMomentum_/trackMomentum/trackMomentum)*
1774 +                             (regression_energy*errorTrackMomentum_/trackMomentum/trackMomentum));
1775 +
1776 +
1777 +    bool eleIsNotInCombination = false ;
1778 +    if ( (eOverP  > 1 + 2.5*errorEOverP) || (eOverP  < 1 - 2.5*errorEOverP) || (eOverP < 0.8) || (eOverP > 1.3) )
1779 +      { eleIsNotInCombination = true ; }
1780 +     if (eleIsNotInCombination)
1781 +       {
1782 +         if (eOverP > 1)
1783 +           { finalMomentum = regression_energy ; finalMomentumError = regression_energy_error ; }
1784 +         else
1785 +           {
1786 +             if (elClass == GSF_ELECTRON_GOLDEN)
1787 +               { finalMomentum = regression_energy; finalMomentumError = regression_energy_error; }
1788 +             if (elClass == GSF_ELECTRON_BIGBREM)
1789 +               {
1790 +                 if (regression_energy<36)
1791 +                   { finalMomentum = trackMomentum ; finalMomentumError = errorTrackMomentum_ ; }
1792 +                 else
1793 +                   { finalMomentum = regression_energy ; finalMomentumError = regression_energy_error ; }
1794 +               }
1795 +             if (elClass == GSF_ELECTRON_BADTRACK)
1796 +               { finalMomentum = regression_energy; finalMomentumError = regression_energy_error ; }
1797 +             if (elClass == GSF_ELECTRON_SHOWERING)
1798 +               {
1799 +                 if (regression_energy<30)
1800 +                   { finalMomentum = trackMomentum ; finalMomentumError = errorTrackMomentum_; }
1801 +                 else
1802 +                   { finalMomentum = regression_energy; finalMomentumError = regression_energy_error;}
1803 +               }
1804 +             if (elClass == GSF_ELECTRON_GAP)
1805 +               {
1806 +                 if (regression_energy<60)
1807 +                   { finalMomentum = trackMomentum ; finalMomentumError = errorTrackMomentum_ ; }
1808 +                 else
1809 +                   { finalMomentum = regression_energy; finalMomentumError = regression_energy_error ; }
1810 +               }
1811 +           }
1812 +       }    
1813 +     else
1814 +       {
1815 +         // combination
1816 +         finalMomentum = (regression_energy/regression_energy_error/regression_energy_error + trackMomentum/errorTrackMomentum_/errorTrackMomentum_) /
1817 +           (1/regression_energy_error/regression_energy_error + 1/errorTrackMomentum_/errorTrackMomentum_);
1818 +         float finalMomentumVariance = 1 / (1/regression_energy_error/regression_energy_error + 1/errorTrackMomentum_/errorTrackMomentum_);
1819 +         finalMomentumError = sqrt(finalMomentumVariance);
1820 +       }
1821 +  }  
1822 +
1823 +  std::pair<Double_t,Double_t> value;
1824 +  value.first = finalMomentum;
1825 +  value.second = finalMomentumError;
1826 +  return value;
1827 +
1828 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines