ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Utils/src/ElectronTools.cc
Revision: 1.36
Committed: Wed Apr 18 14:38:38 2012 UTC (13 years ago) by ceballos
Content type: text/plain
Branch: MAIN
Changes since 1.35: +9 -1 lines
Log Message:
minor change

File Contents

# User Rev Content
1 ceballos 1.36 // $Id: ElectronTools.cc,v 1.35 2012/04/15 12:06:26 sixie Exp $
2 sixie 1.1
3     #include "MitPhysics/Utils/interface/ElectronTools.h"
4     #include "MitAna/DataTree/interface/StableData.h"
5     #include <TFile.h>
6 sixie 1.32 #include "MitPhysics/ElectronLikelihood/interface/ElectronLikelihood.h"
7     #include "MitPhysics/ElectronLikelihood/interface/LikelihoodSwitches.h"
8     #include "MitPhysics/ElectronLikelihood/interface/LikelihoodMeasurements.h"
9 sixie 1.1
10     ClassImp(mithep::ElectronTools)
11    
12     using namespace mithep;
13    
14     //--------------------------------------------------------------------------------------------------
15     ElectronTools::ElectronTools()
16     {
17     // Constructor.
18     }
19    
20     //--------------------------------------------------------------------------------------------------
21     Bool_t ElectronTools::PassCustomID(const Electron *ele, EElIdType idType) {
22    
23     Double_t fCuts[6][8]; //!custom id cuts
24    
25     Double_t tightcuts[6][8]={
26     {0.086, 0.1, 0.052, 0.0, 0.050, 0.059, 0.061, 0.0}, //hovere
27     {0.011, 0.011, 0.011, 0.0, 0.033, 0.029, 0.030, 0.0}, //sigmaetaeta
28     {0.038, 0.024, 0.045, 0.0, 0.034, 0.017, 0.026, 0.0}, //deltaphiin
29     {0.0081, 0.0029, 0.0051, 0.0, 0.0070, 0.0062, 0.0088, 0.0}, //deltaetain
30     {0.0, 0.9, 0.0, 0.0, 0.0, 0.78, 0.0, 0.0}, //eoverp
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
40    
41 ceballos 1.28 Double_t VBTFWorkingPointFakeable[6][8] = {
42     {0.12, 0.12, 0.12, 0.12, 0.10, 0.10, 0.10, 0.10 }, //hovere
43     {0.01, 0.01, 0.01, 0.01, 0.03, 0.03, 0.03, 0.03 }, //sigmaetaeta
44     {0.15, 0.15, 0.15, 0.15, 0.10, 0.10, 0.10, 0.10 }, //deltaphiin
45     {0.007, 0.007, 0.007, 0.007, 0.009, 0.009, 0.009, 0.009 }, //deltaetain
46     {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, //eoverp
47     {0.0, 0.0, 0, 0, 0, 0, 0, 0 } //extra cuts fbrem and E_Over_P
48     };
49    
50 sixie 1.1 Double_t VBTFWorkingPoint95[6][8] = {
51 ceballos 1.14 {0.15, 0.15, 0.15, 0.15, 0.07, 0.07, 0.07, 0.07 }, //hovere
52 sixie 1.1 {0.01, 0.01, 0.01, 0.01, 0.03, 0.03, 0.03, 0.03 }, //sigmaetaeta
53     {0.8, 0.8, 0.8, 0.8, 0.7, 0.7, 0.7, 0.7 }, //deltaphiin
54 ceballos 1.5 {0.007, 0.007, 0.007, 0.007, 0.010, 0.010, 0.010, 0.010 }, //deltaetain
55 sixie 1.1 {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, //eoverp
56     {0.0, 0.0, 0, 0, 0, 0, 0, 0 } //extra cuts fbrem and E_Over_P
57     };
58    
59 ceballos 1.5 Double_t VBTFWorkingPoint90[6][8] = {
60     {0.12, 0.12, 0.12, 0.12, 0.05, 0.05, 0.05, 0.05 }, //hovere
61     {0.01, 0.01, 0.01, 0.01, 0.03, 0.03, 0.03, 0.03 }, //sigmaetaeta
62     {0.8, 0.8, 0.8, 0.8, 0.7, 0.7, 0.7, 0.7 }, //deltaphiin
63     {0.007, 0.007, 0.007, 0.007, 0.009, 0.009, 0.009, 0.009 }, //deltaetain
64     {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, //eoverp
65     {0.0, 0.0, 0, 0, 0, 0, 0, 0 } //extra cuts fbrem and E_Over_P
66     };
67 sixie 1.1
68 ceballos 1.5 Double_t VBTFWorkingPoint85[6][8] = {
69     {0.04, 0.04, 0.04, 0.04, 0.025, 0.025, 0.025, 0.025 }, //hovere
70 sixie 1.1 {0.01, 0.01, 0.01, 0.01, 0.03, 0.03, 0.03, 0.03 }, //sigmaetaeta
71 ceballos 1.5 {0.06, 0.06, 0.06, 0.06, 0.04, 0.04, 0.04, 0.04 }, //deltaphiin
72     {0.006, 0.006, 0.006, 0.006, 0.007, 0.007, 0.007, 0.007 }, //deltaetain
73 sixie 1.1 {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, //eoverp
74     {0.0, 0.0, 0, 0, 0, 0, 0, 0 } //extra cuts fbrem and E_Over_P
75     };
76    
77     Double_t VBTFWorkingPoint80[6][8] = {
78 sixie 1.31 {0.04, 0.04, 0.04, 0.04, 0.10, 0.10, 0.10, 0.10 }, //hovere
79 sixie 1.1 {0.01, 0.01, 0.01, 0.01, 0.03, 0.03, 0.03, 0.03 }, //sigmaetaeta
80 ceballos 1.5 {0.06, 0.06, 0.06, 0.06, 0.03, 0.03, 0.03, 0.03 }, //deltaphiin
81     {0.004, 0.004, 0.004, 0.004, 0.007, 0.007, 0.007, 0.007}, //deltaetain
82 sixie 1.1 {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, //eoverp
83     {0.0, 0.0, 0, 0, 0, 0, 0, 0 } //extra cuts fbrem and E_Over_P
84     };
85    
86     Double_t VBTFWorkingPoint70[6][8] = {
87 ceballos 1.5 {0.025, 0.025, 0.025, 0.025, 0.012, 0.012, 0.012, 0.012}, //hovere
88 sixie 1.1 {0.01, 0.01, 0.01, 0.01, 0.03, 0.03, 0.03, 0.03 }, //sigmaetaeta
89 ceballos 1.5 {0.03, 0.03, 0.03, 0.03, 0.02, 0.02, 0.02, 0.02 }, //deltaphiin
90 ceballos 1.11 {0.004, 0.004, 0.004, 0.004, 0.005, 0.005, 0.005, 0.005}, //deltaetain
91 sixie 1.1 {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, //eoverp
92     {0.0, 0.0, 0, 0, 0, 0, 0, 0 } //extra cuts fbrem and E_Over_P
93     };
94    
95 ceballos 1.25 Double_t VBTFWorkingPoint80NoHOverEE[6][8] = {
96 ceballos 1.28 {0.04, 0.04, 0.04, 0.04, 0.10, 0.10, 0.10, 0.10 }, //hovere
97 ceballos 1.25 {0.01, 0.01, 0.01, 0.01, 0.03, 0.03, 0.03, 0.03 }, //sigmaetaeta
98     {0.06, 0.06, 0.06, 0.06, 0.03, 0.03, 0.03, 0.03 }, //deltaphiin
99     {0.004, 0.004, 0.004, 0.004, 0.007, 0.007, 0.007, 0.007}, //deltaetain
100     {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, //eoverp
101     {0.0, 0.0, 0, 0, 0, 0, 0, 0 } //extra cuts fbrem and E_Over_P
102     };
103    
104     Double_t VBTFWorkingPoint70NoHOverEE[6][8] = {
105 ceballos 1.28 {0.025, 0.025, 0.025, 0.025, 0.10, 0.10, 0.10, 0.10 }, //hovere
106 ceballos 1.25 {0.01, 0.01, 0.01, 0.01, 0.03, 0.03, 0.03, 0.03 }, //sigmaetaeta
107     {0.03, 0.03, 0.03, 0.03, 0.02, 0.02, 0.02, 0.02 }, //deltaphiin
108     {0.004, 0.004, 0.004, 0.004, 0.005, 0.005, 0.005, 0.005}, //deltaetain
109     {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, //eoverp
110     {0.0, 0.0, 0, 0, 0, 0, 0, 0 } //extra cuts fbrem and E_Over_P
111     };
112    
113 sixie 1.1 switch (idType) {
114     case kCustomIdTight:
115     memcpy(fCuts,tightcuts,sizeof(fCuts));
116     break;
117     case kCustomIdLoose:
118     memcpy(fCuts,loosecuts,sizeof(fCuts));
119     break;
120 ceballos 1.28 case kVBTFWorkingPointFakeableId:
121     memcpy(fCuts,VBTFWorkingPointFakeable,sizeof(fCuts));
122     break;
123 sixie 1.1 case kVBTFWorkingPoint95Id:
124     memcpy(fCuts,VBTFWorkingPoint95,sizeof(fCuts));
125     break;
126     case kVBTFWorkingPoint90Id:
127     memcpy(fCuts,VBTFWorkingPoint90,sizeof(fCuts));
128     break;
129 ceballos 1.5 case kVBTFWorkingPoint85Id:
130     memcpy(fCuts,VBTFWorkingPoint85,sizeof(fCuts));
131     break;
132 sixie 1.1 case kVBTFWorkingPoint80Id:
133     memcpy(fCuts,VBTFWorkingPoint80,sizeof(fCuts));
134     break;
135 ceballos 1.25 case kVBTFWorkingPointLowPtId:
136     if(ele->Pt() < 20)
137     memcpy(fCuts,VBTFWorkingPoint70NoHOverEE,sizeof(fCuts));
138     else
139     memcpy(fCuts,VBTFWorkingPoint80NoHOverEE,sizeof(fCuts));
140 ceballos 1.22 break;
141 sixie 1.1 case kVBTFWorkingPoint70Id:
142     memcpy(fCuts,VBTFWorkingPoint70,sizeof(fCuts));
143     break;
144     default:
145     memset(fCuts,0,sizeof(fCuts));
146     break;
147     }
148    
149     // Based on RecoEgamma/ElectronIdentification/src/CutBasedElectronID.cc.
150     Double_t eOverP = ele->ESuperClusterOverP();
151     Double_t fBrem = ele->FBrem();
152    
153 bendavid 1.16 if ( (fCuts[5][0]>0.0) && (eOverP < fCuts[5][0]) && (fCuts[5][1]>0.0) && (fBrem < fCuts[5][1]))
154 sixie 1.1 return kFALSE;
155    
156 bendavid 1.16 if ( (fCuts[5][2]>0.0) && (eOverP < fCuts[5][2]*(1-fBrem)))
157 sixie 1.1 return kFALSE;
158    
159     Int_t cat = 2;
160     if ((ele->IsEB() && fBrem<0.06) || (ele->IsEE() && fBrem<0.1))
161     cat=1;
162     else if (eOverP < 1.2 && eOverP > 0.8)
163     cat=0;
164 ceballos 1.13
165     if(ele->SCluster() == 0)
166     return kFALSE;
167 ceballos 1.21 Double_t eSeedOverPin = ele->ESeedClusterOverPIn();
168 sixie 1.1 Double_t hOverE = ele->HadronicOverEm();
169     Double_t sigmaee = ele->CoviEtaiEta();
170     Double_t deltaPhiIn = TMath::Abs(ele->DeltaPhiSuperClusterTrackAtVtx());
171     Double_t deltaEtaIn = TMath::Abs(ele->DeltaEtaSuperClusterTrackAtVtx());
172    
173     Int_t eb = 1;
174     if (ele->IsEB())
175     eb = 0;
176 ceballos 1.25
177 sixie 1.1 if (hOverE>fCuts[0][cat+4*eb])
178     return kFALSE;
179    
180     if (sigmaee>fCuts[1][cat+4*eb])
181     return kFALSE;
182    
183     if (deltaPhiIn>fCuts[2][cat+4*eb])
184     return kFALSE;
185    
186     if(deltaEtaIn>fCuts[3][cat+4*eb])
187     return kFALSE;
188    
189     if(eSeedOverPin<fCuts[4][cat+4*eb])
190     return kFALSE;
191    
192 ceballos 1.36 Bool_t isoCut = kTRUE;
193     if(idType == kVBTFWorkingPointFakeableId){
194     isoCut = (ele->TrackIsolationDr03() < ele->Pt()*0.2) &&
195     (ele->EcalRecHitIsoDr03() < ele->Pt()*0.2) &&
196     (ele->HcalTowerSumEtDr03() < ele->Pt()*0.2);
197     }
198     if(isoCut == kFALSE) return kFALSE;
199    
200 ceballos 1.25 // Cuts only for pt<20 region and kVBTFWorkingPointLowPtId
201     if(ele->Pt() < 20 && idType == kVBTFWorkingPointLowPtId) {
202 ceballos 1.22 Bool_t isGoodLowPtEl = fBrem > 0.15 ||
203 ceballos 1.29 (ele->SCluster()->AbsEta() < 1.0 && eOverP > 0.95);
204 ceballos 1.22 if(!isGoodLowPtEl) return kFALSE;
205     }
206    
207 sixie 1.1 return kTRUE;
208     }
209    
210     //--------------------------------------------------------------------------------------------------
211 ceballos 1.5 Bool_t ElectronTools::PassCustomIso(const Electron *ele, EElIsoType isoType,
212     Bool_t useCombineIso)
213 sixie 1.1 {
214     Bool_t pass = kTRUE;
215     Double_t fIsoCuts[4][2]; //!custom isolation cuts
216     Double_t VBTFWorkingPoint95[4][2] = {
217 ceballos 1.5 {0.15 , 0.08 }, //TrkIso
218     {2.00 , 0.06 }, //ECALIso
219     {0.12 , 0.05 }, //HCALIso
220     {0.15, 0.10 } //Combined
221 sixie 1.1 };
222    
223     Double_t VBTFWorkingPoint90[4][2] = {
224 ceballos 1.5 {0.12 , 0.05 }, //TrkIso
225     {0.09 , 0.06 }, //ECALIso
226     {0.10 , 0.03 }, //HCALIso
227     {0.10, 0.07 } //Combined
228     };
229    
230     Double_t VBTFWorkingPoint85[4][2] = {
231     {0.09 , 0.05 }, //TrkIso
232     {0.08 , 0.05 }, //ECALIso
233     {0.10 , 0.025 }, //HCALIso
234     {0.09, 0.06 } //Combined
235 sixie 1.1 };
236    
237     Double_t VBTFWorkingPoint80[4][2] = {
238 ceballos 1.5 {0.09 , 0.04 }, //TrkIso
239     {0.07 , 0.05 }, //ECALIso
240     {0.10 , 0.025 }, //HCALIso
241     {0.07, 0.06 } //Combined
242 sixie 1.1 };
243    
244     Double_t VBTFWorkingPoint70[4][2] = {
245 ceballos 1.11 {0.05 , 0.025 }, //TrkIso
246     {0.06 , 0.025 }, //ECALIso
247     {0.03 , 0.020 }, //HCALIso
248     {0.04, 0.030 } //Combined
249 sixie 1.1 };
250    
251     switch (isoType) {
252     case kVBTFWorkingPoint95Iso:
253     memcpy(fIsoCuts,VBTFWorkingPoint95,sizeof(fIsoCuts));
254     break;
255     case kVBTFWorkingPoint90Iso:
256     memcpy(fIsoCuts,VBTFWorkingPoint90,sizeof(fIsoCuts));
257     break;
258 ceballos 1.5 case kVBTFWorkingPoint85Iso:
259     memcpy(fIsoCuts,VBTFWorkingPoint85,sizeof(fIsoCuts));
260     break;
261 sixie 1.1 case kVBTFWorkingPoint80Iso:
262     memcpy(fIsoCuts,VBTFWorkingPoint80,sizeof(fIsoCuts));
263     break;
264     case kVBTFWorkingPoint70Iso:
265     memcpy(fIsoCuts,VBTFWorkingPoint70,sizeof(fIsoCuts));
266     break;
267     default:
268     memset(fIsoCuts,0,sizeof(fIsoCuts));
269     break;
270     }
271    
272 ceballos 1.10 Double_t trkIso = ele->TrackIsolationDr03() / ele->Pt();
273     Double_t ecalIso = ele->EcalRecHitIsoDr03() / ele->Pt();
274     Double_t hcalIso = ele->HcalTowerSumEtDr03() / ele->Pt();
275     Double_t combinedIso = ele->TrackIsolationDr03() + ele->EcalRecHitIsoDr03() + ele->HcalTowerSumEtDr03();
276     if(ele->IsEB()) combinedIso = ele->TrackIsolationDr03() + TMath::Max(ele->EcalRecHitIsoDr03() - 1.0, 0.0) + ele->HcalTowerSumEtDr03();
277 ceballos 1.11 combinedIso = combinedIso / ele->Pt();
278 sixie 1.1
279     Int_t eb = 1;
280     if (ele->IsEB())
281     eb = 0;
282    
283 ceballos 1.5 if(useCombineIso == kFALSE){
284     if (trkIso>fIsoCuts[0][eb])
285     pass = kFALSE;
286     if (ecalIso>fIsoCuts[1][eb])
287     pass = kFALSE;
288     if (hcalIso>fIsoCuts[2][eb])
289     pass = kFALSE;
290     }
291     else {
292     if (combinedIso>fIsoCuts[3][eb])
293     pass = kFALSE;
294     }
295 sixie 1.1
296     return pass;
297     }
298    
299    
300     //--------------------------------------------------------------------------------------------------
301     Bool_t ElectronTools::PassConversionFilter(const Electron *ele,
302 bendavid 1.19 const DecayParticleCol *conversions,
303     const BaseVertex *vtx,
304 bendavid 1.20 UInt_t nWrongHitsMax,
305     Double_t probMin,
306     Double_t lxyMin,
307     Bool_t matchCkf,
308 bendavid 1.27 Bool_t requireArbitratedMerged,
309     Double_t trkptMin)
310 sixie 1.1 {
311     Bool_t isGoodConversion = kFALSE;
312    
313     for (UInt_t ifc=0; ifc<conversions->GetEntries(); ifc++) {
314     Bool_t ConversionMatchFound = kFALSE;
315     for (UInt_t d=0; d<conversions->At(ifc)->NDaughters(); d++) {
316     const Track *trk = dynamic_cast<const ChargedParticle*>
317     (conversions->At(ifc)->Daughter(d))->Trk();
318 bendavid 1.20 if (ele->GsfTrk() == trk || (matchCkf && ele->TrackerTrk()==trk) ) {
319 sixie 1.1 ConversionMatchFound = kTRUE;
320     break;
321     }
322     }
323    
324     // if match between the e-track and one of the conversion legs
325     if (ConversionMatchFound == kTRUE){
326 bendavid 1.20 isGoodConversion = (conversions->At(ifc)->Prob() > probMin) &&
327     (!requireArbitratedMerged || conversions->At(ifc)->Quality().Quality(ConversionQuality::arbitratedMerged)) &&
328     (conversions->At(ifc)->LxyCorrected(vtx) > lxyMin);
329 sixie 1.1
330     if (isGoodConversion == kTRUE) {
331     for (UInt_t d=0; d<conversions->At(ifc)->NDaughters(); d++) {
332     const Track *trk = dynamic_cast<const ChargedParticle*>
333     (conversions->At(ifc)->Daughter(d))->Trk();
334     if (trk) {
335 bendavid 1.27 if (trk->Pt()<trkptMin) isGoodConversion = kFALSE;
336 sixie 1.1 const StableData *sd = dynamic_cast<const StableData*>
337     (conversions->At(ifc)->DaughterDat(d));
338 bendavid 1.19 if (sd->NWrongHits() > nWrongHitsMax)
339 sixie 1.1 isGoodConversion = kFALSE;
340     } else {
341     isGoodConversion = kFALSE;
342     }
343     }
344     }
345     }
346 ceballos 1.13
347 sixie 1.1 if (isGoodConversion == kTRUE) break;
348    
349     } // loop over all conversions
350    
351     return !isGoodConversion;
352     }
353    
354     //--------------------------------------------------------------------------------------------------
355 ceballos 1.23 Bool_t ElectronTools::PassD0Cut(const Electron *ele, const VertexCol *vertices, Double_t fD0Cut, Int_t nVertex)
356 sixie 1.1 {
357     Bool_t d0cut = kFALSE;
358 ceballos 1.23
359     Double_t d0_real = 1e30;
360     if(nVertex >= 0) d0_real = TMath::Abs(ele->GsfTrk()->D0Corrected(*vertices->At(nVertex)));
361     else {
362     Double_t distVtx = 999.0;
363     Int_t closestVtx = 0;
364     for(UInt_t nv=0; nv<vertices->GetEntries(); nv++){
365     double dz = TMath::Abs(ele->GsfTrk()->DzCorrected(*vertices->At(nv)));
366     if(dz < distVtx) {
367     distVtx = dz;
368     closestVtx = nv;
369     }
370 ceballos 1.12 }
371 ceballos 1.23 d0_real = TMath::Abs(ele->GsfTrk()->D0Corrected(*vertices->At(closestVtx)));
372 sixie 1.1 }
373     if(d0_real < fD0Cut) d0cut = kTRUE;
374    
375     return d0cut;
376     }
377    
378     //--------------------------------------------------------------------------------------------------
379 ceballos 1.18 Bool_t ElectronTools::PassD0Cut(const Electron *ele, const BeamSpotCol *beamspots, Double_t fD0Cut)
380 sixie 1.2 {
381     Bool_t d0cut = kFALSE;
382     // d0 cut
383     Double_t d0_real = 99999;
384     for(UInt_t i0 = 0; i0 < beamspots->GetEntries(); i0++) {
385     Double_t pD0 = ele->GsfTrk()->D0Corrected(*beamspots->At(i0));
386     if(TMath::Abs(pD0) < TMath::Abs(d0_real)) d0_real = TMath::Abs(pD0);
387     }
388     if(d0_real < fD0Cut) d0cut = kTRUE;
389    
390     return d0cut;
391     }
392    
393     //--------------------------------------------------------------------------------------------------
394 ceballos 1.25 Bool_t ElectronTools::PassDZCut(const Electron *ele, const VertexCol *vertices, Double_t fDZCut, Int_t nVertex)
395 ceballos 1.23 {
396     Bool_t dzcut = kFALSE;
397    
398     Double_t distVtx = 999.0;
399 ceballos 1.25 if(nVertex >= 0) distVtx = TMath::Abs(ele->GsfTrk()->DzCorrected(*vertices->At(nVertex)));
400     else {
401     for(UInt_t nv=0; nv<vertices->GetEntries(); nv++){
402     double dz = TMath::Abs(ele->GsfTrk()->DzCorrected(*vertices->At(nv)));
403     if(dz < distVtx) {
404     distVtx = dz;
405     }
406 ceballos 1.23 }
407     }
408 ceballos 1.25
409 ceballos 1.23 if(distVtx < fDZCut) dzcut = kTRUE;
410    
411     return dzcut;
412     }
413    
414     //--------------------------------------------------------------------------------------------------
415 sixie 1.1 Bool_t ElectronTools::PassChargeFilter(const Electron *ele)
416     {
417     Bool_t passChargeFilter = kTRUE;
418     if(ele->TrackerTrk() &&
419     ele->TrackerTrk()->Charge() != ele->Charge()) passChargeFilter = kFALSE;
420    
421     return passChargeFilter;
422     }
423    
424     //--------------------------------------------------------------------------------------------------
425     Bool_t ElectronTools::PassSpikeRemovalFilter(const Electron *ele)
426     {
427     Bool_t passSpikeRemovalFilter = kTRUE;
428 ceballos 1.13 if(ele->SCluster() &&
429     ele->SCluster()->Seed()->Energy() > 5.0 &&
430 sixie 1.1 ele->SCluster()->Seed()->EMax() / ele->SCluster()->Seed()->E3x3() > 0.95
431     ) {
432     passSpikeRemovalFilter = kFALSE;
433     }
434    
435     // For Now Only use the EMax/E3x3 prescription.
436     // if(ele->SCluster()->Seed()->Energy() > 5.0 &&
437     // (1 - (ele->SCluster()->Seed()->E1x3() + ele->SCluster()->Seed()->E3x1() - 2*ele->SCluster()->Seed()->EMax())) > 0.95
438     // ) {
439     // passSpikeRemovalFilter = kFALSE;
440     // }
441    
442     return passSpikeRemovalFilter;
443     }
444 ceballos 1.4
445 bendavid 1.9 Bool_t ElectronTools::PassTriggerMatching(const Electron *ele, const TriggerObjectCol *trigobjs)
446     {
447    
448     for (UInt_t i=0; i<trigobjs->GetEntries(); ++i) {
449     const TriggerObject *trigobj = trigobjs->At(i);
450 bendavid 1.15 if (trigobj->TriggerType()==TriggerObject::TriggerCluster || trigobj->TriggerType()==TriggerObject::TriggerElectron || trigobj->TriggerType()==TriggerObject::TriggerPhoton) {
451     if (MathUtils::DeltaR(ele->SCluster(),trigobj)<0.3) {
452 bendavid 1.9 return kTRUE;
453     }
454     }
455     }
456    
457     return kFALSE;
458    
459    
460     }
461    
462 ceballos 1.4 //--------------------------------------------------------------------------------------------------
463     Int_t ElectronTools::Classify(const Electron *ele) {
464    
465 ceballos 1.5 double eta = ele->AbsEta();
466 ceballos 1.4 double eOverP = ele->ESuperClusterOverP();
467     double fBrem = ele->FBrem();
468    
469     int cat = -1;
470     if (ele->IsEB()) {
471 ceballos 1.5 if ((fBrem >= 0.12) and (eOverP > 0.9) and (eOverP < 1.2))
472 ceballos 1.4 cat = 0;
473 ceballos 1.5 else if (((eta > .445 and eta < .45 ) or
474     (eta > .79 and eta < .81 ) or
475     (eta > 1.137 and eta < 1.157 ) or
476     (eta > 1.47285 and eta < 1.4744)))
477     cat = 6;
478     else if (ele->IsTrackerDriven() and !ele->IsEcalDriven())
479 ceballos 1.4 cat = 8;
480     else if (fBrem < 0.12)
481     cat = 1;
482     else
483     cat = 2;
484     } else {
485 ceballos 1.5 if ((fBrem >= 0.2) and (eOverP > 0.82) and (eOverP < 1.22))
486 ceballos 1.4 cat = 3;
487 ceballos 1.5 else if (eta > 1.5 and eta < 1.58)
488     cat = 7;
489     else if (ele->IsTrackerDriven() and !ele->IsEcalDriven())
490 ceballos 1.4 cat = 8;
491     else if (fBrem < 0.2)
492     cat = 4;
493     else
494     cat = 5;
495     }
496    
497     return cat;
498     }
499    
500     //--------------------------------------------------------------------------------------------------
501     Int_t ElectronTools::PassTightId(const Electron *ele, const VertexCol *vertices,
502 ceballos 1.21 const DecayParticleCol *conversions, const Int_t typeCuts,
503     Double_t beta){
504 ceballos 1.4
505 ceballos 1.17 // original code on
506     // http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/RecoEgamma/ElectronIdentification/src/CutBasedElectronID.cc
507 ceballos 1.21 // beta must be computed with a DR cone of 0.4
508 ceballos 1.17
509     Double_t scEt = ele->SCluster()->Et();
510     Double_t scEta = ele->SCluster()->Eta();
511 ceballos 1.4
512     Double_t fBrem = ele->FBrem();
513     Double_t hOverE = ele->HadronicOverEm();
514     Double_t sigmaee = ele->CoviEtaiEta();
515     Double_t deltaPhiIn = TMath::Abs(ele->DeltaPhiSuperClusterTrackAtVtx());
516     Double_t deltaEtaIn = TMath::Abs(ele->DeltaEtaSuperClusterTrackAtVtx());
517     Double_t eSeedOverPin = ele->ESeedClusterOverPIn();
518    
519     Int_t mishits = ele->BestTrk()->NExpectedHitsInner();
520     Double_t tkIso = ele->TrackIsolationDr03();
521 ceballos 1.21 Double_t ecalIso = ele->EcalRecHitIsoDr04()*beta;
522     Double_t hcalIso = ele->HcalTowerSumEtDr04()*beta;
523 ceballos 1.4
524     int cat = Classify(ele);
525     int eb;
526    
527     if (ele->IsEB())
528     eb = 0;
529     else
530     eb = 1;
531    
532 ceballos 1.17 // Medium cuts
533     Double_t cutdcotdistMedium[9] = {
534     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};
535     Double_t cutdetainMedium[9] = {
536     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};
537     Double_t cutdetainlMedium[9] = {
538     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};
539     Double_t cutdphiinMedium[9] = {
540     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};
541     Double_t cutdphiinlMedium[9] = {
542     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};
543     Double_t cuteseedopcorMedium[9] = {
544     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};
545     Double_t cutfmishitsMedium[9] = {
546     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};
547     Double_t cuthoeMedium[9] = {
548     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};
549     Double_t cuthoelMedium[9] = {
550     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};
551     Double_t cutip_gsfMedium[9] = {
552     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};
553     Double_t cutip_gsflMedium[9] = {
554     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};
555     Double_t cutiso_sumMedium[9] = {
556     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};
557     Double_t cutiso_sumoetMedium[9] = {
558     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};
559     Double_t cutiso_sumoetlMedium[9] = {
560     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};
561     Double_t cutseeMedium[9] = {
562     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};
563     Double_t cutseelMedium[9] = {
564     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};
565    
566     // Tight cuts
567     Double_t cutdcotdistTight[9] = {
568     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};
569     Double_t cutdetainTight[9] = {
570     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};
571     Double_t cutdetainlTight[9] = {
572     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};
573     Double_t cutdphiinTight[9] = {
574     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};
575     Double_t cutdphiinlTight[9] = {
576     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};
577     Double_t cuteseedopcorTight[9] = {
578     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};
579     Double_t cutfmishitsTight[9] = {
580     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};
581     Double_t cuthoeTight[9] = {
582     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};
583     Double_t cuthoelTight[9] = {
584     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};
585     Double_t cutip_gsfTight[9] = {
586     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};
587     Double_t cutip_gsflTight[9] = {
588     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};
589     Double_t cutiso_sumTight[9] = {
590     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};
591     Double_t cutiso_sumoetTight[9] = {
592     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};
593     Double_t cutiso_sumoetlTight[9] = {
594     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};
595     Double_t cutseeTight[9] = {
596     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};
597     Double_t cutseelTight[9] = {
598     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};
599    
600 ceballos 1.21 // SuperTight cuts
601 ceballos 1.17 Double_t cutdcotdistSuperTight[9] = {
602     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};
603     Double_t cutdetainSuperTight[9] = {
604     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};
605     Double_t cutdetainlSuperTight[9] = {
606     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};
607     Double_t cutdphiinSuperTight[9] = {
608     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};
609     Double_t cutdphiinlSuperTight[9] = {
610     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};
611     Double_t cuteseedopcorSuperTight[9] = {
612     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};
613     Double_t cutfmishitsSuperTight[9] = {
614     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};
615     Double_t cuthoeSuperTight[9] = {
616     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};
617     Double_t cuthoelSuperTight[9] = {
618     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};
619     Double_t cutip_gsfSuperTight[9] = {
620     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};
621     Double_t cutip_gsflSuperTight[9] = {
622     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};
623     Double_t cutiso_sumSuperTight[9] = {
624     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};
625     Double_t cutiso_sumoetSuperTight[9] = {
626     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};
627     Double_t cutiso_sumoetlSuperTight[9] = {
628     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};
629     Double_t cutseeSuperTight[9] = {
630     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};
631     Double_t cutseelSuperTight[9] = {
632     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};
633    
634 ceballos 1.21 // HyperTight1 cuts
635     Double_t cutdcotdistHyperTight1[9] = {
636     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};
637     Double_t cutdetainHyperTight1[9] = {
638     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};
639     Double_t cutdetainlHyperTight1[9] = {
640     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};
641     Double_t cutdphiinHyperTight1[9] = {
642     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};
643     Double_t cutdphiinlHyperTight1[9] = {
644     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};
645     Double_t cuteseedopcorHyperTight1[9] = {
646     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};
647     Double_t cutfmishitsHyperTight1[9] = {
648     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};
649     Double_t cuthoeHyperTight1[9] = {
650     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};
651     Double_t cuthoelHyperTight1[9] = {
652     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};
653     Double_t cutip_gsfHyperTight1[9] = {
654     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};
655     Double_t cutip_gsflHyperTight1[9] = {
656     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};
657     Double_t cutiso_sumHyperTight1[9] = {
658     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};
659     Double_t cutiso_sumoetHyperTight1[9] = {
660     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};
661     Double_t cutiso_sumoetlHyperTight1[9] = {
662     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};
663     Double_t cutseeHyperTight1[9] = {
664     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};
665     Double_t cutseelHyperTight1[9] = {
666     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};
667    
668     // HyperTight2 cuts
669     Double_t cutdcotdistHyperTight2[9] = {
670     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};
671     Double_t cutdetainHyperTight2[9] = {
672     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};
673     Double_t cutdetainlHyperTight2[9] = {
674     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};
675     Double_t cutdphiinHyperTight2[9] = {
676     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};
677     Double_t cutdphiinlHyperTight2[9] = {
678     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};
679     Double_t cuteseedopcorHyperTight2[9] = {
680     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};
681     Double_t cutfmishitsHyperTight2[9] = {
682     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};
683     Double_t cuthoeHyperTight2[9] = {
684     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};
685     Double_t cuthoelHyperTight2[9] = {
686     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};
687     Double_t cutip_gsfHyperTight2[9] = {
688     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};
689     Double_t cutip_gsflHyperTight2[9] = {
690     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};
691     Double_t cutiso_sumHyperTight2[9] = {
692     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};
693     Double_t cutiso_sumoetHyperTight2[9] = {
694     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};
695     Double_t cutiso_sumoetlHyperTight2[9] = {
696     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};
697     Double_t cutseeHyperTight2[9] = {
698     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};
699     Double_t cutseelHyperTight2[9] = {
700     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};
701    
702     // HyperTight3 cuts
703     Double_t cutdcotdistHyperTight3[9] = {
704     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};
705     Double_t cutdetainHyperTight3[9] = {
706     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};
707     Double_t cutdetainlHyperTight3[9] = {
708     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};
709     Double_t cutdphiinHyperTight3[9] = {
710     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};
711     Double_t cutdphiinlHyperTight3[9] = {
712     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};
713     Double_t cuteseedopcorHyperTight3[9] = {
714     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};
715     Double_t cutfmishitsHyperTight3[9] = {
716     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};
717     Double_t cuthoeHyperTight3[9] = {
718     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};
719     Double_t cuthoelHyperTight3[9] = {
720     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};
721     Double_t cutip_gsfHyperTight3[9] = {
722     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};
723     Double_t cutip_gsflHyperTight3[9] = {
724     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};
725     Double_t cutiso_sumHyperTight3[9] = {
726     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};
727     Double_t cutiso_sumoetHyperTight3[9] = {
728     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};
729     Double_t cutiso_sumoetlHyperTight3[9] = {
730     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};
731     Double_t cutseeHyperTight3[9] = {
732     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};
733     Double_t cutseelHyperTight3[9] = {
734     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};
735    
736     // HyperTight4 cuts
737     Double_t cutdcotdistHyperTight4[9] = {
738     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};
739     Double_t cutdetainHyperTight4[9] = {
740     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};
741     Double_t cutdetainlHyperTight4[9] = {
742     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};
743     Double_t cutdphiinHyperTight4[9] = {
744     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};
745     Double_t cutdphiinlHyperTight4[9] = {
746     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};
747     Double_t cuteseedopcorHyperTight4[9] = {
748     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};
749     Double_t cutfmishitsHyperTight4[9] = {
750     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};
751     Double_t cuthoeHyperTight4[9] = {
752     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};
753     Double_t cuthoelHyperTight4[9] = {
754     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};
755     Double_t cutip_gsfHyperTight4[9] = {
756     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};
757     Double_t cutip_gsflHyperTight4[9] = {
758     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};
759     Double_t cutiso_sumHyperTight4[9] = {
760     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};
761     Double_t cutiso_sumoetHyperTight4[9] = {
762     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};
763     Double_t cutiso_sumoetlHyperTight4[9] = {
764     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};
765     Double_t cutseeHyperTight4[9] = {
766     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};
767     Double_t cutseelHyperTight4[9] = {
768     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};
769    
770 ceballos 1.17 Double_t cutdcotdist[9];
771     Double_t cutdetain[9];
772     Double_t cutdetainl[9];
773     Double_t cutdphiin[9];
774     Double_t cutdphiinl[9];
775     Double_t cuteseedopcor[9];
776     Double_t cutfmishits[9];
777     Double_t cuthoe[9];
778     Double_t cuthoel[9];
779     Double_t cutip_gsf[9];
780     Double_t cutip_gsfl[9];
781     Double_t cutiso_sum[9];
782     Double_t cutiso_sumoet[9];
783     Double_t cutiso_sumoetl[9];
784     Double_t cutsee[9];
785     Double_t cutseel[9];
786     if (typeCuts == 0) {
787     memcpy(cutdcotdist ,cutdcotdistMedium ,sizeof(cutdcotdistMedium));
788     memcpy(cutdetain ,cutdetainMedium ,sizeof(cutdetainMedium));
789     memcpy(cutdetainl ,cutdetainlMedium ,sizeof(cutdetainlMedium));
790     memcpy(cutdphiin ,cutdphiinMedium ,sizeof(cutdphiinMedium));
791     memcpy(cutdphiinl ,cutdphiinlMedium ,sizeof(cutdphiinlMedium));
792     memcpy(cuteseedopcor ,cuteseedopcorMedium ,sizeof(cuteseedopcorMedium));
793     memcpy(cutfmishits ,cutfmishitsMedium ,sizeof(cutfmishitsMedium));
794     memcpy(cuthoe ,cuthoeMedium ,sizeof(cuthoeMedium));
795     memcpy(cuthoel ,cuthoelMedium ,sizeof(cuthoelMedium));
796     memcpy(cutip_gsf ,cutip_gsfMedium ,sizeof(cutip_gsfMedium));
797     memcpy(cutip_gsfl ,cutip_gsflMedium ,sizeof(cutip_gsflMedium));
798     memcpy(cutiso_sum ,cutiso_sumMedium ,sizeof(cutiso_sumMedium));
799     memcpy(cutiso_sumoet ,cutiso_sumoetMedium ,sizeof(cutiso_sumoetMedium));
800     memcpy(cutiso_sumoetl,cutiso_sumoetlMedium,sizeof(cutiso_sumoetlMedium));
801     memcpy(cutsee ,cutseeMedium ,sizeof(cutseeMedium));
802     memcpy(cutseel ,cutseelMedium ,sizeof(cutseelMedium));
803     }
804     else if(typeCuts == 1) {
805     memcpy(cutdcotdist ,cutdcotdistTight ,sizeof(cutdcotdistTight));
806     memcpy(cutdetain ,cutdetainTight ,sizeof(cutdetainTight));
807     memcpy(cutdetainl ,cutdetainlTight ,sizeof(cutdetainlTight));
808     memcpy(cutdphiin ,cutdphiinTight ,sizeof(cutdphiinTight));
809     memcpy(cutdphiinl ,cutdphiinlTight ,sizeof(cutdphiinlTight));
810     memcpy(cuteseedopcor ,cuteseedopcorTight ,sizeof(cuteseedopcorTight));
811     memcpy(cutfmishits ,cutfmishitsTight ,sizeof(cutfmishitsTight));
812     memcpy(cuthoe ,cuthoeTight ,sizeof(cuthoeTight));
813     memcpy(cuthoel ,cuthoelTight ,sizeof(cuthoelTight));
814     memcpy(cutip_gsf ,cutip_gsfTight ,sizeof(cutip_gsfTight));
815     memcpy(cutip_gsfl ,cutip_gsflTight ,sizeof(cutip_gsflTight));
816     memcpy(cutiso_sum ,cutiso_sumTight ,sizeof(cutiso_sumTight));
817     memcpy(cutiso_sumoet ,cutiso_sumoetTight ,sizeof(cutiso_sumoetTight));
818     memcpy(cutiso_sumoetl,cutiso_sumoetlTight,sizeof(cutiso_sumoetlTight));
819     memcpy(cutsee ,cutseeTight ,sizeof(cutseeTight));
820     memcpy(cutseel ,cutseelTight ,sizeof(cutseelTight));
821 ceballos 1.5 }
822 ceballos 1.21 else if(typeCuts == 2) {
823 ceballos 1.17 memcpy(cutdcotdist ,cutdcotdistSuperTight ,sizeof(cutdcotdistSuperTight));
824     memcpy(cutdetain ,cutdetainSuperTight ,sizeof(cutdetainSuperTight));
825     memcpy(cutdetainl ,cutdetainlSuperTight ,sizeof(cutdetainlSuperTight));
826     memcpy(cutdphiin ,cutdphiinSuperTight ,sizeof(cutdphiinSuperTight));
827     memcpy(cutdphiinl ,cutdphiinlSuperTight ,sizeof(cutdphiinlSuperTight));
828     memcpy(cuteseedopcor ,cuteseedopcorSuperTight ,sizeof(cuteseedopcorSuperTight));
829     memcpy(cutfmishits ,cutfmishitsSuperTight ,sizeof(cutfmishitsSuperTight));
830     memcpy(cuthoe ,cuthoeSuperTight ,sizeof(cuthoeSuperTight));
831     memcpy(cuthoel ,cuthoelSuperTight ,sizeof(cuthoelSuperTight));
832     memcpy(cutip_gsf ,cutip_gsfSuperTight ,sizeof(cutip_gsfSuperTight));
833     memcpy(cutip_gsfl ,cutip_gsflSuperTight ,sizeof(cutip_gsflSuperTight));
834     memcpy(cutiso_sum ,cutiso_sumSuperTight ,sizeof(cutiso_sumSuperTight));
835     memcpy(cutiso_sumoet ,cutiso_sumoetSuperTight ,sizeof(cutiso_sumoetSuperTight));
836     memcpy(cutiso_sumoetl,cutiso_sumoetlSuperTight,sizeof(cutiso_sumoetlSuperTight));
837     memcpy(cutsee ,cutseeSuperTight ,sizeof(cutseeSuperTight));
838     memcpy(cutseel ,cutseelSuperTight ,sizeof(cutseelSuperTight));
839     }
840 ceballos 1.21 else if(typeCuts == 3) {
841     memcpy(cutdcotdist ,cutdcotdistHyperTight1 ,sizeof(cutdcotdistHyperTight1));
842     memcpy(cutdetain ,cutdetainHyperTight1 ,sizeof(cutdetainHyperTight1));
843     memcpy(cutdetainl ,cutdetainlHyperTight1 ,sizeof(cutdetainlHyperTight1));
844     memcpy(cutdphiin ,cutdphiinHyperTight1 ,sizeof(cutdphiinHyperTight1));
845     memcpy(cutdphiinl ,cutdphiinlHyperTight1 ,sizeof(cutdphiinlHyperTight1));
846     memcpy(cuteseedopcor ,cuteseedopcorHyperTight1 ,sizeof(cuteseedopcorHyperTight1));
847     memcpy(cutfmishits ,cutfmishitsHyperTight1 ,sizeof(cutfmishitsHyperTight1));
848     memcpy(cuthoe ,cuthoeHyperTight1 ,sizeof(cuthoeHyperTight1));
849     memcpy(cuthoel ,cuthoelHyperTight1 ,sizeof(cuthoelHyperTight1));
850     memcpy(cutip_gsf ,cutip_gsfHyperTight1 ,sizeof(cutip_gsfHyperTight1));
851     memcpy(cutip_gsfl ,cutip_gsflHyperTight1 ,sizeof(cutip_gsflHyperTight1));
852     memcpy(cutiso_sum ,cutiso_sumHyperTight1 ,sizeof(cutiso_sumHyperTight1));
853     memcpy(cutiso_sumoet ,cutiso_sumoetHyperTight1 ,sizeof(cutiso_sumoetHyperTight1));
854     memcpy(cutiso_sumoetl,cutiso_sumoetlHyperTight1,sizeof(cutiso_sumoetlHyperTight1));
855     memcpy(cutsee ,cutseeHyperTight1 ,sizeof(cutseeHyperTight1));
856     memcpy(cutseel ,cutseelHyperTight1 ,sizeof(cutseelHyperTight1));
857     }
858     else if(typeCuts == 4) {
859     memcpy(cutdcotdist ,cutdcotdistHyperTight2 ,sizeof(cutdcotdistHyperTight2));
860     memcpy(cutdetain ,cutdetainHyperTight2 ,sizeof(cutdetainHyperTight2));
861     memcpy(cutdetainl ,cutdetainlHyperTight2 ,sizeof(cutdetainlHyperTight2));
862     memcpy(cutdphiin ,cutdphiinHyperTight2 ,sizeof(cutdphiinHyperTight2));
863     memcpy(cutdphiinl ,cutdphiinlHyperTight2 ,sizeof(cutdphiinlHyperTight2));
864     memcpy(cuteseedopcor ,cuteseedopcorHyperTight2 ,sizeof(cuteseedopcorHyperTight2));
865     memcpy(cutfmishits ,cutfmishitsHyperTight2 ,sizeof(cutfmishitsHyperTight2));
866     memcpy(cuthoe ,cuthoeHyperTight2 ,sizeof(cuthoeHyperTight2));
867     memcpy(cuthoel ,cuthoelHyperTight2 ,sizeof(cuthoelHyperTight2));
868     memcpy(cutip_gsf ,cutip_gsfHyperTight2 ,sizeof(cutip_gsfHyperTight2));
869     memcpy(cutip_gsfl ,cutip_gsflHyperTight2 ,sizeof(cutip_gsflHyperTight2));
870     memcpy(cutiso_sum ,cutiso_sumHyperTight2 ,sizeof(cutiso_sumHyperTight2));
871     memcpy(cutiso_sumoet ,cutiso_sumoetHyperTight2 ,sizeof(cutiso_sumoetHyperTight2));
872     memcpy(cutiso_sumoetl,cutiso_sumoetlHyperTight2,sizeof(cutiso_sumoetlHyperTight2));
873     memcpy(cutsee ,cutseeHyperTight2 ,sizeof(cutseeHyperTight2));
874     memcpy(cutseel ,cutseelHyperTight2 ,sizeof(cutseelHyperTight2));
875     }
876     else if(typeCuts == 5) {
877     memcpy(cutdcotdist ,cutdcotdistHyperTight3 ,sizeof(cutdcotdistHyperTight3));
878     memcpy(cutdetain ,cutdetainHyperTight3 ,sizeof(cutdetainHyperTight3));
879     memcpy(cutdetainl ,cutdetainlHyperTight3 ,sizeof(cutdetainlHyperTight3));
880     memcpy(cutdphiin ,cutdphiinHyperTight3 ,sizeof(cutdphiinHyperTight3));
881     memcpy(cutdphiinl ,cutdphiinlHyperTight3 ,sizeof(cutdphiinlHyperTight3));
882     memcpy(cuteseedopcor ,cuteseedopcorHyperTight3 ,sizeof(cuteseedopcorHyperTight3));
883     memcpy(cutfmishits ,cutfmishitsHyperTight3 ,sizeof(cutfmishitsHyperTight3));
884     memcpy(cuthoe ,cuthoeHyperTight3 ,sizeof(cuthoeHyperTight3));
885     memcpy(cuthoel ,cuthoelHyperTight3 ,sizeof(cuthoelHyperTight3));
886     memcpy(cutip_gsf ,cutip_gsfHyperTight3 ,sizeof(cutip_gsfHyperTight3));
887     memcpy(cutip_gsfl ,cutip_gsflHyperTight3 ,sizeof(cutip_gsflHyperTight3));
888     memcpy(cutiso_sum ,cutiso_sumHyperTight3 ,sizeof(cutiso_sumHyperTight3));
889     memcpy(cutiso_sumoet ,cutiso_sumoetHyperTight3 ,sizeof(cutiso_sumoetHyperTight3));
890     memcpy(cutiso_sumoetl,cutiso_sumoetlHyperTight3,sizeof(cutiso_sumoetlHyperTight3));
891     memcpy(cutsee ,cutseeHyperTight3 ,sizeof(cutseeHyperTight3));
892     memcpy(cutseel ,cutseelHyperTight3 ,sizeof(cutseelHyperTight3));
893     }
894     else if(typeCuts == 6) {
895     memcpy(cutdcotdist ,cutdcotdistHyperTight4 ,sizeof(cutdcotdistHyperTight4));
896     memcpy(cutdetain ,cutdetainHyperTight4 ,sizeof(cutdetainHyperTight4));
897     memcpy(cutdetainl ,cutdetainlHyperTight4 ,sizeof(cutdetainlHyperTight4));
898     memcpy(cutdphiin ,cutdphiinHyperTight4 ,sizeof(cutdphiinHyperTight4));
899     memcpy(cutdphiinl ,cutdphiinlHyperTight4 ,sizeof(cutdphiinlHyperTight4));
900     memcpy(cuteseedopcor ,cuteseedopcorHyperTight4 ,sizeof(cuteseedopcorHyperTight4));
901     memcpy(cutfmishits ,cutfmishitsHyperTight4 ,sizeof(cutfmishitsHyperTight4));
902     memcpy(cuthoe ,cuthoeHyperTight4 ,sizeof(cuthoeHyperTight4));
903     memcpy(cuthoel ,cuthoelHyperTight4 ,sizeof(cuthoelHyperTight4));
904     memcpy(cutip_gsf ,cutip_gsfHyperTight4 ,sizeof(cutip_gsfHyperTight4));
905     memcpy(cutip_gsfl ,cutip_gsflHyperTight4 ,sizeof(cutip_gsflHyperTight4));
906     memcpy(cutiso_sum ,cutiso_sumHyperTight4 ,sizeof(cutiso_sumHyperTight4));
907     memcpy(cutiso_sumoet ,cutiso_sumoetHyperTight4 ,sizeof(cutiso_sumoetHyperTight4));
908     memcpy(cutiso_sumoetl,cutiso_sumoetlHyperTight4,sizeof(cutiso_sumoetlHyperTight4));
909     memcpy(cutsee ,cutseeHyperTight4 ,sizeof(cutseeHyperTight4));
910     memcpy(cutseel ,cutseelHyperTight4 ,sizeof(cutseelHyperTight4));
911     }
912     else {
913     return 0;
914     }
915 ceballos 1.17 int result = 0;
916    
917     const int ncuts = 10;
918     std::vector<bool> cut_results(ncuts, false);
919    
920     float iso_sum = tkIso + ecalIso + hcalIso;
921     if(fabs(scEta)>1.5)
922     iso_sum += (fabs(scEta)-1.5)*1.09;
923    
924     float iso_sumoet = iso_sum*(40./scEt);
925    
926     float eseedopincor = eSeedOverPin + fBrem;
927     if(fBrem < 0)
928     eseedopincor = eSeedOverPin;
929 ceballos 1.4
930 ceballos 1.17 float dist = (TMath::Abs(ele->ConvPartnerDist()) == -9999.? 9999:TMath::Abs(ele->ConvPartnerDist()));
931     float dcot = (TMath::Abs(ele->ConvPartnerDCotTheta()) == -9999.? 9999:TMath::Abs(ele->ConvPartnerDCotTheta()));
932 ceballos 1.4
933 ceballos 1.17 float dcotdistcomb = ((0.04 - std::max(dist, dcot)) > 0?(0.04 - std::max(dist, dcot)):0);
934    
935     Double_t ip = 99999;
936     for(UInt_t i0 = 0; i0 < vertices->GetEntries(); i0++) {
937     if(vertices->At(i0)->NTracks() > 0){
938     Double_t pD0 = ele->GsfTrk()->D0Corrected(*vertices->At(i0));
939     ip = TMath::Abs(pD0);
940     break;
941 ceballos 1.4 }
942 ceballos 1.17 }
943    
944     for (int cut=0; cut<ncuts; cut++) {
945     switch (cut) {
946     case 0:
947     cut_results[cut] = compute_cut(fabs(deltaEtaIn), scEt, cutdetainl[cat], cutdetain[cat]);
948     break;
949     case 1:
950     cut_results[cut] = compute_cut(fabs(deltaPhiIn), scEt, cutdphiinl[cat], cutdphiin[cat]);
951     break;
952     case 2:
953     cut_results[cut] = (eseedopincor > cuteseedopcor[cat]);
954     break;
955     case 3:
956     cut_results[cut] = compute_cut(hOverE, scEt, cuthoel[cat], cuthoe[cat]);
957     break;
958     case 4:
959     cut_results[cut] = compute_cut(sigmaee, scEt, cutseel[cat], cutsee[cat]);
960     break;
961     case 5:
962     cut_results[cut] = compute_cut(iso_sumoet, scEt, cutiso_sumoetl[cat], cutiso_sumoet[cat]);
963     break;
964     case 6:
965     cut_results[cut] = (iso_sum < cutiso_sum[cat]);
966     break;
967     case 7:
968     cut_results[cut] = compute_cut(fabs(ip), scEt, cutip_gsfl[cat], cutip_gsf[cat]);
969     break;
970     case 8:
971     cut_results[cut] = (mishits < cutfmishits[cat]);
972     break;
973     case 9:
974     cut_results[cut] = (dcotdistcomb < cutdcotdist[cat]);
975     break;
976 ceballos 1.4 }
977 ceballos 1.17 }
978    
979     // ID part
980     if (cut_results[0] & cut_results[1] & cut_results[2] & cut_results[3] & cut_results[4])
981     result = result + 1;
982    
983     // ISO part
984     if (cut_results[5] & cut_results[6])
985     result = result + 2;
986    
987     // IP part
988     if (cut_results[7])
989     result = result + 8;
990    
991     // Conversion part
992     if (cut_results[8] and cut_results[9])
993     result = result + 4;
994    
995     return result;
996     }
997 ceballos 1.4
998 ceballos 1.17 //--------------------------------------------------------------------------------------------------
999     bool ElectronTools::compute_cut(double x, double et, double cut_min, double cut_max, bool gtn) {
1000 ceballos 1.4
1001 ceballos 1.17 float et_min = 10;
1002     float et_max = 40;
1003 ceballos 1.4
1004 ceballos 1.17 bool accept = false;
1005     float cut = cut_max; // the cut at et=40 GeV
1006 ceballos 1.4
1007 ceballos 1.17 if(et < et_max) {
1008     cut = cut_min + (1/et_min - 1/et)*(cut_max - cut_min)/(1/et_min - 1/et_max);
1009     }
1010    
1011     if(et < et_min) {
1012     cut = cut_min;
1013     }
1014 ceballos 1.4
1015 ceballos 1.17 if(gtn) { // useful for e/p cut which is gt
1016     accept = (x >= cut);
1017     }
1018     else {
1019     accept = (x <= cut);
1020     }
1021 ceballos 1.4
1022 ceballos 1.17 return accept;
1023 ceballos 1.4 }
1024 sixie 1.32
1025     //--------------------------------------------------------------------------------------------------
1026     Double_t ElectronTools::Likelihood(ElectronLikelihood *LH, const Electron *ele)
1027     {
1028     if (!LH) {
1029     std::cout << "Error: Likelihood not properly initialized\n";
1030     return -9999;
1031     }
1032    
1033     LikelihoodMeasurements measurements;
1034     measurements.pt = ele->Pt();
1035     if (ele->IsEB() && ele->AbsEta()<1.0) measurements.subdet = 0;
1036     else if (ele->IsEB()) measurements.subdet = 1;
1037     else measurements.subdet = 2;
1038     measurements.deltaPhi = TMath::Abs(ele->DeltaPhiSuperClusterTrackAtVtx());
1039     measurements.deltaEta = TMath::Abs(ele->DeltaEtaSuperClusterTrackAtVtx());
1040     measurements.eSeedClusterOverPout = ele->ESeedClusterOverPout();
1041     measurements.eSuperClusterOverP = ele->ESuperClusterOverP();
1042     measurements.hadronicOverEm = ele->HadronicOverEm();
1043     measurements.sigmaIEtaIEta = ele->CoviEtaiEta();
1044     measurements.sigmaIPhiIPhi = TMath::Sqrt(ele->SCluster()->Seed()->CoviPhiiPhi());
1045     measurements.fBrem = ele->FBrem();
1046     measurements.nBremClusters = ele->NumberOfClusters() - 1;
1047     //measurements.OneOverEMinusOneOverP = (1.0 / ele->SCluster()->Energy()) - (1.0 / ele->BestTrk()->P());
1048     measurements.OneOverEMinusOneOverP = (1.0 / ele->ESuperClusterOverP() / ele->BestTrk()->P()) - (1.0 / ele->BestTrk()->P());
1049     double likelihood = LH->result(measurements);
1050    
1051     double newLik = 0.0;
1052     if (likelihood<=0) newLik = -20.0;
1053     else if(likelihood>=1) newLik = 20.0;
1054     else newLik = log(likelihood/(1.0-likelihood));
1055    
1056     Bool_t isDebug = kFALSE;
1057     if(isDebug == kTRUE){
1058     printf("LIKELIHOOD: %f %d %f %f %f %f %f %f %f %f %d %f %f %f - %f %f\n",measurements.pt,measurements.subdet,
1059     measurements.deltaPhi ,measurements.deltaEta ,measurements.eSeedClusterOverPout,
1060     measurements.eSuperClusterOverP,measurements.hadronicOverEm,measurements.sigmaIEtaIEta,
1061     measurements.sigmaIPhiIPhi ,measurements.fBrem ,measurements.nBremClusters,
1062     measurements.OneOverEMinusOneOverP,ele->SCluster()->Energy(),ele->BestTrk()->P(),
1063     likelihood,newLik);
1064     }
1065    
1066     return newLik;
1067    
1068     }
1069 sixie 1.33
1070 sixie 1.35 Double_t ElectronTools::ElectronEffectiveArea(EElectronEffectiveAreaType type, Double_t SCEta, EElectronEffectiveAreaTarget EffectiveAreaTarget) {
1071 sixie 1.33
1072     Double_t EffectiveArea = 0;
1073 sixie 1.35
1074     if (fabs(SCEta) < 1.0) {
1075 sixie 1.34 if (type == ElectronTools::kEleChargedIso03) EffectiveArea = 0.000;
1076     if (type == ElectronTools::kEleNeutralHadronIso03) EffectiveArea = 0.017;
1077     if (type == ElectronTools::kEleGammaIso03) EffectiveArea = 0.045;
1078     if (type == ElectronTools::kEleGammaIsoVetoEtaStrip03) EffectiveArea = 0.014;
1079     if (type == ElectronTools::kEleChargedIso04) EffectiveArea = 0.000;
1080     if (type == ElectronTools::kEleNeutralHadronIso04) EffectiveArea = 0.034;
1081     if (type == ElectronTools::kEleGammaIso04) EffectiveArea = 0.079;
1082     if (type == ElectronTools::kEleGammaIsoVetoEtaStrip04) EffectiveArea = 0.014;
1083     if (type == ElectronTools::kEleNeutralHadronIso007) EffectiveArea = 0.000;
1084     if (type == ElectronTools::kEleHoverE) EffectiveArea = 0.00016;
1085     if (type == ElectronTools::kEleHcalDepth1OverEcal) EffectiveArea = 0.00016;
1086     if (type == ElectronTools::kEleHcalDepth2OverEcal) EffectiveArea = 0.00000;
1087 sixie 1.35 } else if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) {
1088 sixie 1.34 if (type == ElectronTools::kEleChargedIso03) EffectiveArea = 0.000;
1089     if (type == ElectronTools::kEleNeutralHadronIso03) EffectiveArea = 0.025;
1090     if (type == ElectronTools::kEleGammaIso03) EffectiveArea = 0.052;
1091     if (type == ElectronTools::kEleGammaIsoVetoEtaStrip03) EffectiveArea = 0.030;
1092     if (type == ElectronTools::kEleChargedIso04) EffectiveArea = 0.000;
1093     if (type == ElectronTools::kEleNeutralHadronIso04) EffectiveArea = 0.050;
1094     if (type == ElectronTools::kEleGammaIso04) EffectiveArea = 0.073;
1095     if (type == ElectronTools::kEleGammaIsoVetoEtaStrip04) EffectiveArea = 0.030;
1096     if (type == ElectronTools::kEleNeutralHadronIso007) EffectiveArea = 0.000;
1097     if (type == ElectronTools::kEleHoverE) EffectiveArea = 0.00022;
1098     if (type == ElectronTools::kEleHcalDepth1OverEcal) EffectiveArea = 0.00022;
1099     if (type == ElectronTools::kEleHcalDepth2OverEcal) EffectiveArea = 0.00000;
1100 sixie 1.35 } else if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) {
1101 sixie 1.34 if (type == ElectronTools::kEleChargedIso03) EffectiveArea = 0.000;
1102     if (type == ElectronTools::kEleNeutralHadronIso03) EffectiveArea = 0.030;
1103     if (type == ElectronTools::kEleGammaIso03) EffectiveArea = 0.170;
1104     if (type == ElectronTools::kEleGammaIsoVetoEtaStrip03) EffectiveArea = 0.134;
1105     if (type == ElectronTools::kEleChargedIso04) EffectiveArea = 0.000;
1106     if (type == ElectronTools::kEleNeutralHadronIso04) EffectiveArea = 0.060;
1107     if (type == ElectronTools::kEleGammaIso04) EffectiveArea = 0.187;
1108     if (type == ElectronTools::kEleGammaIsoVetoEtaStrip04) EffectiveArea = 0.134;
1109     if (type == ElectronTools::kEleNeutralHadronIso007) EffectiveArea = 0.000;
1110     if (type == ElectronTools::kEleHoverE) EffectiveArea = 0.00030;
1111     if (type == ElectronTools::kEleHcalDepth1OverEcal) EffectiveArea = 0.00026;
1112     if (type == ElectronTools::kEleHcalDepth2OverEcal) EffectiveArea = 0.00002;
1113 sixie 1.35 } else if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.25 ) {
1114 sixie 1.34 if (type == ElectronTools::kEleChargedIso03) EffectiveArea = 0.000;
1115     if (type == ElectronTools::kEleNeutralHadronIso03) EffectiveArea = 0.022;
1116     if (type == ElectronTools::kEleGammaIso03) EffectiveArea = 0.623;
1117     if (type == ElectronTools::kEleGammaIsoVetoEtaStrip03) EffectiveArea = 0.516;
1118     if (type == ElectronTools::kEleChargedIso04) EffectiveArea = 0.000;
1119     if (type == ElectronTools::kEleNeutralHadronIso04) EffectiveArea = 0.055;
1120     if (type == ElectronTools::kEleGammaIso04) EffectiveArea = 0.659;
1121     if (type == ElectronTools::kEleGammaIsoVetoEtaStrip04) EffectiveArea = 0.517;
1122     if (type == ElectronTools::kEleNeutralHadronIso007) EffectiveArea = 0.000;
1123     if (type == ElectronTools::kEleHoverE) EffectiveArea = 0.00054;
1124     if (type == ElectronTools::kEleHcalDepth1OverEcal) EffectiveArea = 0.00045;
1125     if (type == ElectronTools::kEleHcalDepth2OverEcal) EffectiveArea = 0.00003;
1126 sixie 1.35 } else if (fabs(SCEta) >= 2.25 && fabs(SCEta) < 2.5 ) {
1127 sixie 1.34 if (type == ElectronTools::kEleChargedIso03) EffectiveArea = 0.000;
1128     if (type == ElectronTools::kEleNeutralHadronIso03) EffectiveArea = 0.018;
1129     if (type == ElectronTools::kEleGammaIso03) EffectiveArea = 1.198;
1130     if (type == ElectronTools::kEleGammaIsoVetoEtaStrip03) EffectiveArea = 1.049;
1131     if (type == ElectronTools::kEleChargedIso04) EffectiveArea = 0.000;
1132     if (type == ElectronTools::kEleNeutralHadronIso04) EffectiveArea = 0.073;
1133     if (type == ElectronTools::kEleGammaIso04) EffectiveArea = 1.258;
1134     if (type == ElectronTools::kEleGammaIsoVetoEtaStrip04) EffectiveArea = 1.051;
1135     if (type == ElectronTools::kEleNeutralHadronIso007) EffectiveArea = 0.000;
1136     if (type == ElectronTools::kEleHoverE) EffectiveArea = 0.00082;
1137     if (type == ElectronTools::kEleHcalDepth1OverEcal) EffectiveArea = 0.00066;
1138     if (type == ElectronTools::kEleHcalDepth2OverEcal) EffectiveArea = 0.00004;
1139 sixie 1.33 }
1140    
1141 sixie 1.35 //NoCorrections
1142     if (EffectiveAreaTarget == kEleEANoCorr) {
1143     return 0.0;
1144     }
1145     //2011 Data Effective Areas
1146     else if (EffectiveAreaTarget == kEleEAData2011) {
1147     if (type == kEleGammaIsoDR0p0To0p1) {
1148     if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.017;
1149     if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.033;
1150     if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.005;
1151     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.007;
1152     if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.004;
1153     if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.000;
1154     if (fabs(SCEta) >= 2.4) EffectiveArea = 0.000;
1155     }
1156     if (type == kEleGammaIsoDR0p1To0p2) {
1157     if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.010;
1158     if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.010;
1159     if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.019;
1160     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.042;
1161     if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.041;
1162     if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.035;
1163     if (fabs(SCEta) >= 2.4) EffectiveArea = 0.041;
1164     }
1165     if (type == kEleGammaIsoDR0p2To0p3) {
1166     if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.020;
1167     if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.017;
1168     if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.014;
1169     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.029;
1170     if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.039;
1171     if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.042;
1172     if (fabs(SCEta) >= 2.4) EffectiveArea = 0.048;
1173     }
1174     if (type == kEleGammaIsoDR0p3To0p4) {
1175     if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.036;
1176     if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.029;
1177     if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.020;
1178     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.029;
1179     if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.042;
1180     if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.047;
1181     if (fabs(SCEta) >= 2.4) EffectiveArea = 0.054;
1182     }
1183     if (type == kEleGammaIsoDR0p4To0p5) {
1184     if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.051;
1185     if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.038;
1186     if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.028;
1187     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.036;
1188     if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.047;
1189     if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.057;
1190     if (fabs(SCEta) >= 2.4) EffectiveArea = 0.059;
1191     }
1192     if (type == kEleNeutralHadronIsoDR0p0To0p1) {
1193     if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.001;
1194     if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.002;
1195     if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.002;
1196     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.000;
1197     if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.000;
1198     if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.000;
1199     if (fabs(SCEta) >= 2.4) EffectiveArea = 0.000;
1200     }
1201     if (type == kEleNeutralHadronIsoDR0p1To0p2) {
1202     if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.005;
1203     if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.008;
1204     if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.008;
1205     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.006;
1206     if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.003;
1207     if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.001;
1208     if (fabs(SCEta) >= 2.4) EffectiveArea = 0.003;
1209     }
1210     if (type == kEleNeutralHadronIsoDR0p2To0p3) {
1211     if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.010;
1212     if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.014;
1213     if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.017;
1214     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.016;
1215     if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.016;
1216     if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.016;
1217     if (fabs(SCEta) >= 2.4) EffectiveArea = 0.019;
1218     }
1219     if (type == kEleNeutralHadronIsoDR0p3To0p4) {
1220     if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.015;
1221     if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.021;
1222     if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.025;
1223     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.030;
1224     if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.036;
1225     if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.038;
1226     if (fabs(SCEta) >= 2.4) EffectiveArea = 0.084;
1227     }
1228     if (type == kEleNeutralHadronIsoDR0p4To0p5) {
1229     if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.020;
1230     if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.027;
1231     if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.035;
1232     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.045;
1233     if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.051;
1234     if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.107;
1235     if (fabs(SCEta) >= 2.4) EffectiveArea = 0.228;
1236     }
1237     }
1238    
1239     //Summer11 MC Effective Areas
1240     else if (EffectiveAreaTarget == kEleEASummer11MC) {
1241     if (type == kEleGammaIsoDR0p0To0p1) {
1242     if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.015;
1243     if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.030;
1244     if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.004;
1245     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.010;
1246     if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.014;
1247     if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.024;
1248     if (fabs(SCEta) >= 2.4) EffectiveArea = 0.023;
1249     }
1250     if (type == kEleGammaIsoDR0p1To0p2) {
1251     if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.012;
1252     if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.010;
1253     if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.009;
1254     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.037;
1255     if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.046;
1256     if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.055;
1257     if (fabs(SCEta) >= 2.4) EffectiveArea = 0.046;
1258     }
1259     if (type == kEleGammaIsoDR0p2To0p3) {
1260     if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.021;
1261     if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.018;
1262     if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.013;
1263     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.026;
1264     if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.038;
1265     if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.045;
1266     if (fabs(SCEta) >= 2.4) EffectiveArea = 0.059;
1267     }
1268     if (type == kEleGammaIsoDR0p3To0p4) {
1269     if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.036;
1270     if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.030;
1271     if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.017;
1272     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.036;
1273     if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.058;
1274     if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.073;
1275     if (fabs(SCEta) >= 2.4) EffectiveArea = 0.083;
1276     }
1277     if (type == kEleGammaIsoDR0p4To0p5) {
1278     if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.053;
1279     if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.037;
1280     if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.032;
1281     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.048;
1282     if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.062;
1283     if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.085;
1284     if (fabs(SCEta) >= 2.4) EffectiveArea = 0.118;
1285     }
1286     if (type == kEleNeutralHadronIsoDR0p0To0p1) {
1287     if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.000;
1288     if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.000;
1289     if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.000;
1290     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.000;
1291     if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.000;
1292     if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.000;
1293     if (fabs(SCEta) >= 2.4) EffectiveArea = 0.000;
1294     }
1295     if (type == kEleNeutralHadronIsoDR0p1To0p2) {
1296     if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.004;
1297     if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.007;
1298     if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.009;
1299     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.004;
1300     if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.003;
1301     if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.000;
1302     if (fabs(SCEta) >= 2.4) EffectiveArea = 0.004;
1303     }
1304     if (type == kEleNeutralHadronIsoDR0p2To0p3) {
1305     if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.008;
1306     if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.013;
1307     if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.016;
1308     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.013;
1309     if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.014;
1310     if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.016;
1311     if (fabs(SCEta) >= 2.4) EffectiveArea = 0.021;
1312     }
1313     if (type == kEleNeutralHadronIsoDR0p3To0p4) {
1314     if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.012;
1315     if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.017;
1316     if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.020;
1317     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.024;
1318     if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.040;
1319     if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.036;
1320     if (fabs(SCEta) >= 2.4) EffectiveArea = 0.086;
1321     }
1322     if (type == kEleNeutralHadronIsoDR0p4To0p5) {
1323     if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.016;
1324     if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.026;
1325     if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.030;
1326     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.038;
1327     if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.051;
1328     if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.105;
1329     if (fabs(SCEta) >= 2.4) EffectiveArea = 0.169;
1330     }
1331     }
1332    
1333     //Fall11 MC Effective Areas
1334     else if (EffectiveAreaTarget == kEleEAFall11MC) {
1335     if (type == kEleGammaIsoDR0p0To0p1) {
1336     if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.014;
1337     if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.020;
1338     if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.004;
1339     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.012;
1340     if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.016;
1341     if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.021;
1342     if (fabs(SCEta) >= 2.4) EffectiveArea = 0.012;
1343     }
1344     if (type == kEleGammaIsoDR0p1To0p2) {
1345     if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.012;
1346     if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.011;
1347     if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.015;
1348     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.042;
1349     if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.055;
1350     if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.068;
1351     if (fabs(SCEta) >= 2.4) EffectiveArea = 0.067;
1352     }
1353     if (type == kEleGammaIsoDR0p2To0p3) {
1354     if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.024;
1355     if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.020;
1356     if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.017;
1357     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.038;
1358     if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.051;
1359     if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.066;
1360     if (fabs(SCEta) >= 2.4) EffectiveArea = 0.080;
1361     }
1362     if (type == kEleGammaIsoDR0p3To0p4) {
1363     if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.040;
1364     if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.032;
1365     if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.021;
1366     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.047;
1367     if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.066;
1368     if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.083;
1369     if (fabs(SCEta) >= 2.4) EffectiveArea = 0.123;
1370     }
1371     if (type == kEleGammaIsoDR0p4To0p5) {
1372     if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.059;
1373     if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.041;
1374     if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.037;
1375     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.057;
1376     if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.095;
1377     if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.123;
1378     if (fabs(SCEta) >= 2.4) EffectiveArea = 0.133;
1379     }
1380     if (type == kEleNeutralHadronIsoDR0p0To0p1) {
1381     if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.002;
1382     if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.003;
1383     if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.000;
1384     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.000;
1385     if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.000;
1386     if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.000;
1387     if (fabs(SCEta) >= 2.4) EffectiveArea = 0.000;
1388     }
1389     if (type == kEleNeutralHadronIsoDR0p1To0p2) {
1390     if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.006;
1391     if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.008;
1392     if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.010;
1393     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.006;
1394     if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.005;
1395     if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.002;
1396     if (fabs(SCEta) >= 2.4) EffectiveArea = 0.007;
1397     }
1398     if (type == kEleNeutralHadronIsoDR0p2To0p3) {
1399     if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.009;
1400     if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.014;
1401     if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.018;
1402     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.016;
1403     if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.017;
1404     if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.020;
1405     if (fabs(SCEta) >= 2.4) EffectiveArea = 0.021;
1406     }
1407     if (type == kEleNeutralHadronIsoDR0p3To0p4) {
1408     if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.013;
1409     if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.019;
1410     if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.027;
1411     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.035;
1412     if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.037;
1413     if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.043;
1414     if (fabs(SCEta) >= 2.4) EffectiveArea = 0.110;
1415     }
1416     if (type == kEleNeutralHadronIsoDR0p4To0p5) {
1417     if (fabs(SCEta) >= 0.0 && fabs(SCEta) < 1.0 ) EffectiveArea = 0.017;
1418     if (fabs(SCEta) >= 1.0 && fabs(SCEta) < 1.479 ) EffectiveArea = 0.027;
1419     if (fabs(SCEta) >= 1.479 && fabs(SCEta) < 2.0 ) EffectiveArea = 0.036;
1420     if (fabs(SCEta) >= 2.0 && fabs(SCEta) < 2.2 ) EffectiveArea = 0.045;
1421     if (fabs(SCEta) >= 2.2 && fabs(SCEta) < 2.3 ) EffectiveArea = 0.057;
1422     if (fabs(SCEta) >= 2.3 && fabs(SCEta) < 2.4 ) EffectiveArea = 0.123;
1423     if (fabs(SCEta) >= 2.4) EffectiveArea = 0.220;
1424     }
1425     }
1426    
1427    
1428    
1429 sixie 1.33 return EffectiveArea;
1430     }
1431    
1432