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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines