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.20 by bendavid, Mon Feb 21 04:06:33 2011 UTC

# Line 36 | Line 36 | Bool_t ElectronTools::PassCustomID(const
36      {0.8,0.2,0,0,0,0,0,0}};                                     //extra cuts fbrem and E_Over_P
37  
38    Double_t VBTFWorkingPoint95[6][8] = {
39 <    {0.05,  0.05,  0.05,  0.05,  0.04,   0.04,   0.04,   0.04  }, //hovere
39 >    {0.15,  0.15,  0.15,  0.15,  0.07,   0.07,   0.07,   0.07  }, //hovere
40      {0.01,  0.01,  0.01,  0.01,  0.03,   0.03,   0.03,   0.03  }, //sigmaetaeta
41      {0.8,   0.8,   0.8,   0.8,   0.7,    0.7,    0.7,    0.7   }, //deltaphiin
42 <    {0.006, 0.006, 0.006, 0.006, 0.008,  0.008,  0.008,  0.008 }, //deltaetain
42 >    {0.007, 0.007, 0.007, 0.007, 0.010,  0.010,  0.010,  0.010 }, //deltaetain
43      {0.0,   0.0,   0.0,   0.0,   0.0,    0.0,    0.0,    0.0   }, //eoverp
44      {0.0,   0.0,   0,     0,     0,      0,      0,      0     }  //extra cuts fbrem and E_Over_P
45    };            
46  
47
47    Double_t VBTFWorkingPoint90[6][8] = {
48 <    {0.05,  0.05,  0.05,  0.05,  0.025,  0.025,  0.025,  0.025 }, //hovere
48 >    {0.12,  0.12,  0.12,  0.12,  0.05,   0.05,   0.05,   0.05  }, //hovere
49 >    {0.01,  0.01,  0.01,  0.01,  0.03,   0.03,   0.03,   0.03  }, //sigmaetaeta
50 >    {0.8,   0.8,   0.8,   0.8,   0.7,    0.7,    0.7,    0.7   }, //deltaphiin
51 >    {0.007, 0.007, 0.007, 0.007, 0.009,  0.009,  0.009,  0.009 }, //deltaetain
52 >    {0.0,   0.0,   0.0,   0.0,   0.0,    0.0,    0.0,    0.0   }, //eoverp
53 >    {0.0,   0.0,   0,     0,     0,      0,      0,      0     }  //extra cuts fbrem and E_Over_P
54 >  };            
55 >
56 >  Double_t VBTFWorkingPoint85[6][8] = {
57 >    {0.04,  0.04,  0.04,  0.04,  0.025,  0.025,  0.025,  0.025 }, //hovere
58      {0.01,  0.01,  0.01,  0.01,  0.03,   0.03,   0.03,   0.03  }, //sigmaetaeta
59 <    {0.04,  0.04,  0.04,  0.04,  0.025,  0.025,  0.025,  0.025 }, //deltaphiin
60 <    {0.006, 0.006, 0.006, 0.006, 0.008,  0.008,  0.008,  0.008 }, //deltaetain
59 >    {0.06,  0.06,  0.06,  0.06,  0.04,   0.04,   0.04,   0.04  }, //deltaphiin
60 >    {0.006, 0.006, 0.006, 0.006, 0.007,  0.007,  0.007,  0.007 }, //deltaetain
61      {0.0,   0.0,   0.0,   0.0,   0.0,    0.0,    0.0,    0.0   }, //eoverp
62      {0.0,   0.0,   0,     0,     0,      0,      0,      0     }  //extra cuts fbrem and E_Over_P
63    };            
64  
65    Double_t VBTFWorkingPoint80[6][8] = {
66 <    {0.05,  0.05,  0.05,  0.05,  0.025,  0.025,  0.025,  0.025}, //hovere
66 >    {0.04,  0.04,  0.04,  0.04,  0.025,  0.025,  0.025,  0.025}, //hovere
67      {0.01,  0.01,  0.01,  0.01,  0.03,   0.03,   0.03,   0.03 }, //sigmaetaeta
68 <    {0.02,  0.02,  0.02,  0.02,  0.02,   0.02,   0.02,   0.02 }, //deltaphiin
69 <    {0.006, 0.006, 0.006, 0.006, 0.006,  0.006,  0.006,  0.006}, //deltaetain
68 >    {0.06,  0.06,  0.06,  0.06,  0.03,   0.03,   0.03,   0.03 }, //deltaphiin
69 >    {0.004, 0.004, 0.004, 0.004, 0.007,  0.007,  0.007,  0.007}, //deltaetain
70      {0.0,   0.0,   0.0,   0.0,   0.0,    0.0,    0.0,    0.0  }, //eoverp
71      {0.0,   0.0,   0,     0,     0,      0,      0,      0    }  //extra cuts fbrem and E_Over_P
72    };            
73  
74    Double_t VBTFWorkingPoint70[6][8] = {
75 <    {0.02,  0.02,  0.02,  0.02,  0.025,  0.025,  0.025,  0.025}, //hovere
75 >    {0.025, 0.025, 0.025, 0.025, 0.012,  0.012,  0.012,  0.012}, //hovere
76      {0.01,  0.01,  0.01,  0.01,  0.03,   0.03,   0.03,   0.03 }, //sigmaetaeta
77 <    {0.02,  0.02,  0.02,  0.02,  0.02,   0.02,   0.02,   0.02 }, //deltaphiin
78 <    {0.006, 0.006, 0.006, 0.006, 0.003,  0.003,  0.003,  0.003}, //deltaetain
77 >    {0.03,  0.03,  0.03,  0.03,  0.02,   0.02,   0.02,   0.02 }, //deltaphiin
78 >    {0.004, 0.004, 0.004, 0.004, 0.005,  0.005,  0.005,  0.005}, //deltaetain
79      {0.0,   0.0,   0.0,   0.0,   0.0,    0.0,    0.0,    0.0  }, //eoverp
80      {0.0,   0.0,   0,     0,     0,      0,      0,      0    }  //extra cuts fbrem and E_Over_P
81    };            
# Line 85 | Line 93 | Bool_t ElectronTools::PassCustomID(const
93      case kVBTFWorkingPoint90Id:
94        memcpy(fCuts,VBTFWorkingPoint90,sizeof(fCuts));
95        break;
96 +    case kVBTFWorkingPoint85Id:
97 +      memcpy(fCuts,VBTFWorkingPoint85,sizeof(fCuts));
98 +      break;
99      case kVBTFWorkingPoint80Id:
100        memcpy(fCuts,VBTFWorkingPoint80,sizeof(fCuts));
101        break;
# Line 101 | Line 112 | Bool_t ElectronTools::PassCustomID(const
112    Double_t eOverP = ele->ESuperClusterOverP();
113    Double_t fBrem  = ele->FBrem();
114  
115 <  if ((eOverP < fCuts[5][0]) && (fBrem < fCuts[5][1]))
115 >  if ( (fCuts[5][0]>0.0) && (eOverP < fCuts[5][0]) && (fCuts[5][1]>0.0) && (fBrem < fCuts[5][1]))
116      return kFALSE;
117  
118 <  if (eOverP < fCuts[5][2]*(1-fBrem))
118 >  if ( (fCuts[5][2]>0.0) && (eOverP < fCuts[5][2]*(1-fBrem)))
119      return kFALSE;
120  
121    Int_t cat = 2;
# Line 112 | Line 123 | Bool_t ElectronTools::PassCustomID(const
123      cat=1;
124    else if (eOverP < 1.2 && eOverP > 0.8)
125      cat=0;
126 <
126 >  
127 >  if(ele->SCluster() == 0)
128 >    return kFALSE;
129    Double_t eSeedOverPin = ele->ESeedClusterOverPIn();
130    Double_t hOverE       = ele->HadronicOverEm();
131    Double_t sigmaee      = ele->CoviEtaiEta();
# Line 142 | Line 155 | Bool_t ElectronTools::PassCustomID(const
155   }
156  
157   //--------------------------------------------------------------------------------------------------
158 < Bool_t ElectronTools::PassCustomIso(const Electron *ele, EElIsoType isoType)
158 > Bool_t ElectronTools::PassCustomIso(const Electron *ele, EElIsoType isoType,
159 >                                    Bool_t useCombineIso)
160   {
161    Bool_t pass = kTRUE;
162    Double_t fIsoCuts[4][2];          //!custom isolation cuts
149
163    Double_t VBTFWorkingPoint95[4][2] = {
164 <    {7.0 ,  8.0   },   //TrkIso
165 <    {5.0 ,  3.0   },   //ECALIso
166 <    {5.0 ,  2.0   },   //HCALIso
167 <    {9999,  9999  }   //Combined    
164 >    {0.15 , 0.08   },   //TrkIso
165 >    {2.00 , 0.06   },   //ECALIso
166 >    {0.12 , 0.05   },   //HCALIso
167 >    {0.15,  0.10   }   //Combined    
168    };            
169  
170    Double_t VBTFWorkingPoint90[4][2] = {
171 <    {6.0 ,  6.0   },   //TrkIso
172 <    {5.0 ,  2.5   },   //ECALIso
173 <    {5.0 ,  1.5   },   //HCALIso
174 <    {9999,  9999  }   //Combined    
171 >    {0.12 , 0.05   },   //TrkIso
172 >    {0.09 , 0.06   },   //ECALIso
173 >    {0.10 , 0.03   },   //HCALIso
174 >    {0.10,  0.07   }   //Combined    
175 >  };            
176 >
177 >  Double_t VBTFWorkingPoint85[4][2] = {
178 >    {0.09 , 0.05   },   //TrkIso
179 >    {0.08 , 0.05   },   //ECALIso
180 >    {0.10 , 0.025  },   //HCALIso
181 >    {0.09,  0.06   }   //Combined    
182    };            
183  
184    Double_t VBTFWorkingPoint80[4][2] = {
185 <    {3.0 ,  1.5   },   //TrkIso
186 <    {4.0 ,  2.5   },   //ECALIso
187 <    {5.0 ,  0.7   },   //HCALIso
188 <    {9999,  9999  }   //Combined    
185 >    {0.09 , 0.04   },   //TrkIso
186 >    {0.07 , 0.05   },   //ECALIso
187 >    {0.10 , 0.025  },   //HCALIso
188 >    {0.07,  0.06   }   //Combined    
189    };            
190  
191    Double_t VBTFWorkingPoint70[4][2] = {
192 <    {2.5 ,  0.8   },   //TrkIso
193 <    {3.0 ,  2.5   },   //ECALIso
194 <    {5.0 ,  0.25  },   //HCALIso
195 <    {9999,  9999  }   //Combined    
192 >    {0.05 , 0.025  },   //TrkIso
193 >    {0.06 , 0.025  },   //ECALIso
194 >    {0.03 , 0.020  },   //HCALIso
195 >    {0.04,  0.030  }   //Combined
196    };            
197  
198    switch (isoType) {
# Line 182 | Line 202 | Bool_t ElectronTools::PassCustomIso(cons
202      case kVBTFWorkingPoint90Iso:
203        memcpy(fIsoCuts,VBTFWorkingPoint90,sizeof(fIsoCuts));
204        break;
205 +    case kVBTFWorkingPoint85Iso:
206 +      memcpy(fIsoCuts,VBTFWorkingPoint85,sizeof(fIsoCuts));
207 +      break;
208      case kVBTFWorkingPoint80Iso:
209        memcpy(fIsoCuts,VBTFWorkingPoint80,sizeof(fIsoCuts));
210        break;
# Line 193 | Line 216 | Bool_t ElectronTools::PassCustomIso(cons
216        break;
217    }
218  
219 <  Double_t trkIso  = ele->TrackIsolationDr03();
220 <  Double_t ecalIso = ele->EcalRecHitIsoDr04();
221 <  Double_t hcalIso = ele->HcalIsolation();
222 <  Double_t combinedIso = ele->TrackIsolationDr03() + ele->EcalRecHitIsoDr04() - 1.5;
219 >  Double_t trkIso  = ele->TrackIsolationDr03() / ele->Pt();
220 >  Double_t ecalIso = ele->EcalRecHitIsoDr03() / ele->Pt();
221 >  Double_t hcalIso = ele->HcalTowerSumEtDr03() / ele->Pt();
222 >  Double_t combinedIso = ele->TrackIsolationDr03() + ele->EcalRecHitIsoDr03() + ele->HcalTowerSumEtDr03();
223 >  if(ele->IsEB()) combinedIso = ele->TrackIsolationDr03() + TMath::Max(ele->EcalRecHitIsoDr03() - 1.0, 0.0) + ele->HcalTowerSumEtDr03();
224 >  combinedIso = combinedIso / ele->Pt();
225  
226    Int_t eb = 1;
227    if (ele->IsEB())
228      eb = 0;
229  
230 <  if (trkIso>fIsoCuts[0][eb])
231 <    pass = kFALSE;
232 <  if (ecalIso>fIsoCuts[1][eb])
233 <    pass = kFALSE;
234 <  if (hcalIso>fIsoCuts[2][eb])
235 <    pass = kFALSE;
236 <  if (combinedIso>fIsoCuts[3][eb])
237 <    pass = kFALSE;
238 <
230 >  if(useCombineIso == kFALSE){
231 >    if (trkIso>fIsoCuts[0][eb])
232 >      pass = kFALSE;
233 >    if (ecalIso>fIsoCuts[1][eb])
234 >      pass = kFALSE;
235 >    if (hcalIso>fIsoCuts[2][eb])
236 >      pass = kFALSE;
237 >  }
238 >  else {
239 >    if (combinedIso>fIsoCuts[3][eb])
240 >      pass = kFALSE;
241 >  }
242  
243    return pass;
244   }
# Line 218 | Line 246 | Bool_t ElectronTools::PassCustomIso(cons
246  
247   //--------------------------------------------------------------------------------------------------
248   Bool_t ElectronTools::PassConversionFilter(const Electron *ele,
249 <                                           const DecayParticleCol *conversions,
250 <                                           Bool_t WrongHitsRequirement)
249 >                                           const DecayParticleCol *conversions,
250 >                                           const BaseVertex *vtx,
251 >                                           UInt_t nWrongHitsMax,
252 >                                           Double_t probMin,
253 >                                           Double_t lxyMin,
254 >                                           Bool_t matchCkf,
255 >                                           Bool_t requireArbitratedMerged)
256   {
257    Bool_t isGoodConversion = kFALSE;
258  
# Line 228 | Line 261 | Bool_t ElectronTools::PassConversionFilt
261      for (UInt_t d=0; d<conversions->At(ifc)->NDaughters(); d++) {
262        const Track *trk = dynamic_cast<const ChargedParticle*>
263          (conversions->At(ifc)->Daughter(d))->Trk();
264 <      if (ele->GsfTrk() == trk) {
264 >      if (ele->GsfTrk() == trk || (matchCkf && ele->TrackerTrk()==trk) ) {
265          ConversionMatchFound = kTRUE;
266          break;
267        }
# Line 236 | Line 269 | Bool_t ElectronTools::PassConversionFilt
269  
270      // if match between the e-track and one of the conversion legs
271      if (ConversionMatchFound == kTRUE){
272 <      isGoodConversion =  (conversions->At(ifc)->Prob() > 1e-6) &&
273 <        (conversions->At(ifc)->Lxy() > 0) &&
274 <        (conversions->At(ifc)->Position().Rho() > 2.0);
272 >      isGoodConversion =  (conversions->At(ifc)->Prob() > probMin) &&
273 >        (!requireArbitratedMerged || conversions->At(ifc)->Quality().Quality(ConversionQuality::arbitratedMerged)) &&
274 >        (conversions->At(ifc)->LxyCorrected(vtx) > lxyMin);
275  
276        if (isGoodConversion == kTRUE) {
277          for (UInt_t d=0; d<conversions->At(ifc)->NDaughters(); d++) {
278            const Track *trk = dynamic_cast<const ChargedParticle*>
279              (conversions->At(ifc)->Daughter(d))->Trk();
280            if (trk) {
248            // These requirements are not used for the GSF track
249            if (!(trk->NHits() >= 3 && trk->Prob() > 1e-6) && trk!=ele->GsfTrk())
250              isGoodConversion = kFALSE;
281              const StableData *sd = dynamic_cast<const StableData*>
282                (conversions->At(ifc)->DaughterDat(d));
283 <            if (WrongHitsRequirement && sd->NWrongHits() != 0)
283 >            if (sd->NWrongHits() > nWrongHitsMax)
284                isGoodConversion = kFALSE;
285            } else {
286              isGoodConversion = kFALSE;
# Line 258 | Line 288 | Bool_t ElectronTools::PassConversionFilt
288          }
289        }
290      }
291 +
292      if (isGoodConversion == kTRUE) break;
293      
294    } // loop over all conversions
# Line 266 | Line 297 | Bool_t ElectronTools::PassConversionFilt
297   }
298  
299   //--------------------------------------------------------------------------------------------------
300 < Bool_t ElectronTools::PassD0Cut(const Electron *ele, const VertexCol *vertices, Double_t fD0Cut,
270 <                                Bool_t fReverseD0Cut)
300 > Bool_t ElectronTools::PassD0Cut(const Electron *ele, const VertexCol *vertices, Double_t fD0Cut)
301   {
302    Bool_t d0cut = kFALSE;
303    // d0 cut
304    Double_t d0_real = 99999;
305    for(UInt_t i0 = 0; i0 < vertices->GetEntries(); i0++) {
306 <    Double_t pD0 = ele->GsfTrk()->D0Corrected(*vertices->At(i0));
307 <    if(TMath::Abs(pD0) < TMath::Abs(d0_real)) d0_real = TMath::Abs(pD0);
306 >    if(vertices->At(i0)->NTracks() > 0){
307 >      Double_t pD0 = ele->GsfTrk()->D0Corrected(*vertices->At(i0));
308 >      d0_real = TMath::Abs(pD0);
309 >      break;
310 >    }
311    }
312    if(d0_real < fD0Cut) d0cut = kTRUE;
313    
281  if     (fReverseD0Cut == kTRUE &&
282          d0cut == kFALSE && d0_real < 0.05)
283    d0cut = kTRUE;
284  else if(fReverseD0Cut == kTRUE)
285    d0cut = kFALSE;
286  
314    return d0cut;
315   }
316  
317   //--------------------------------------------------------------------------------------------------
318 < Bool_t ElectronTools::PassD0Cut(const Electron *ele, const BeamSpotCol *beamspots, Double_t fD0Cut,
292 <                                Bool_t fReverseD0Cut)
318 > Bool_t ElectronTools::PassD0Cut(const Electron *ele, const BeamSpotCol *beamspots, Double_t fD0Cut)
319   {
320    Bool_t d0cut = kFALSE;
321    // d0 cut
# Line 300 | Line 326 | Bool_t ElectronTools::PassD0Cut(const El
326    }
327    if(d0_real < fD0Cut) d0cut = kTRUE;
328    
303  if     (fReverseD0Cut == kTRUE &&
304          d0cut == kFALSE && d0_real < 0.05)
305    d0cut = kTRUE;
306  else if(fReverseD0Cut == kTRUE)
307    d0cut = kFALSE;
308  
329    return d0cut;
330   }
331  
# Line 323 | Line 343 | Bool_t ElectronTools::PassChargeFilter(c
343   Bool_t ElectronTools::PassSpikeRemovalFilter(const Electron *ele)
344   {
345    Bool_t passSpikeRemovalFilter = kTRUE;
346 <  if(ele->SCluster()->Seed()->Energy() > 5.0 &&
346 >  if(ele->SCluster() &&
347 >     ele->SCluster()->Seed()->Energy() > 5.0 &&
348       ele->SCluster()->Seed()->EMax() / ele->SCluster()->Seed()->E3x3() > 0.95
349      ) {
350      passSpikeRemovalFilter = kFALSE;
# Line 338 | Line 359 | Bool_t ElectronTools::PassSpikeRemovalFi
359      
360    return passSpikeRemovalFilter;
361   }
362 +
363 + Bool_t ElectronTools::PassTriggerMatching(const Electron *ele, const TriggerObjectCol *trigobjs)
364 + {
365 +  
366 +  for (UInt_t i=0; i<trigobjs->GetEntries(); ++i) {
367 +    const TriggerObject *trigobj = trigobjs->At(i);
368 +    if (trigobj->TriggerType()==TriggerObject::TriggerCluster || trigobj->TriggerType()==TriggerObject::TriggerElectron || trigobj->TriggerType()==TriggerObject::TriggerPhoton) {
369 +      if (MathUtils::DeltaR(ele->SCluster(),trigobj)<0.3) {
370 +        return kTRUE;
371 +      }
372 +    }
373 +  }
374 +  
375 +  return kFALSE;
376 +  
377 +  
378 + }
379 +
380 + //--------------------------------------------------------------------------------------------------
381 + Int_t ElectronTools::Classify(const Electron *ele) {
382 +  
383 +  double eta    = ele->AbsEta();
384 +  double eOverP = ele->ESuperClusterOverP();
385 +  double fBrem  = ele->FBrem();
386 +
387 +  int cat = -1;
388 +  if (ele->IsEB()) {
389 +    if ((fBrem >= 0.12) and (eOverP > 0.9) and (eOverP < 1.2))
390 +      cat = 0;
391 +    else if (((eta >  .445   and eta <  .45  ) or
392 +              (eta >  .79    and eta <  .81  ) or
393 +              (eta > 1.137   and eta < 1.157 ) or
394 +              (eta > 1.47285 and eta < 1.4744)))
395 +      cat = 6;
396 +    else if (ele->IsTrackerDriven() and !ele->IsEcalDriven())
397 +      cat = 8;
398 +    else if (fBrem < 0.12)
399 +      cat = 1;
400 +    else
401 +      cat = 2;
402 +  } else {
403 +    if ((fBrem >= 0.2) and (eOverP > 0.82) and (eOverP < 1.22))
404 +      cat = 3;
405 +    else if (eta > 1.5 and eta <  1.58)
406 +      cat = 7;
407 +    else if (ele->IsTrackerDriven() and !ele->IsEcalDriven())
408 +      cat = 8;
409 +    else if (fBrem < 0.2)
410 +      cat = 4;
411 +    else
412 +      cat = 5;
413 +  }
414 +
415 +  return cat;
416 + }
417 +
418 + //--------------------------------------------------------------------------------------------------
419 + Int_t ElectronTools::PassTightId(const Electron *ele, const VertexCol *vertices,
420 +                                 const DecayParticleCol *conversions, const Int_t typeCuts){
421 +
422 + // original code on
423 + // http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/RecoEgamma/ElectronIdentification/src/CutBasedElectronID.cc
424 +
425 +  Double_t scEt   = ele->SCluster()->Et();
426 +  Double_t scEta  = ele->SCluster()->Eta();
427 +
428 +  Double_t fBrem = ele->FBrem();
429 +  Double_t hOverE = ele->HadronicOverEm();
430 +  Double_t sigmaee = ele->CoviEtaiEta();
431 +  Double_t deltaPhiIn = TMath::Abs(ele->DeltaPhiSuperClusterTrackAtVtx());
432 +  Double_t deltaEtaIn = TMath::Abs(ele->DeltaEtaSuperClusterTrackAtVtx());
433 +  Double_t eSeedOverPin = ele->ESeedClusterOverPIn();
434 +
435 +  Int_t mishits = ele->BestTrk()->NExpectedHitsInner();
436 +  Double_t tkIso   = ele->TrackIsolationDr03();
437 +  Double_t ecalIso = ele->EcalRecHitIsoDr04();
438 +  Double_t hcalIso  = ele->HcalTowerSumEtDr04();
439 +
440 +  int cat = Classify(ele);
441 +  int eb;
442 +
443 +  if (ele->IsEB())
444 +    eb = 0;
445 +  else
446 +    eb = 1;
447 +
448 +  // Medium cuts
449 +  Double_t cutdcotdistMedium[9] = {
450 +  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};
451 +  Double_t cutdetainMedium[9] = {
452 +  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};
453 +  Double_t cutdetainlMedium[9] = {
454 +  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};
455 +  Double_t cutdphiinMedium[9] = {
456 +  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};
457 +  Double_t cutdphiinlMedium[9] = {
458 +  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};
459 +  Double_t cuteseedopcorMedium[9] = {
460 +  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};
461 +  Double_t cutfmishitsMedium[9] = {
462 +  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};
463 +  Double_t cuthoeMedium[9] = {
464 +  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};
465 +  Double_t cuthoelMedium[9] = {
466 +  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};
467 +  Double_t cutip_gsfMedium[9] = {
468 +  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};
469 +  Double_t cutip_gsflMedium[9] = {
470 +  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};
471 +  Double_t cutiso_sumMedium[9] = {
472 +  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};
473 +  Double_t cutiso_sumoetMedium[9] = {
474 +  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};
475 +  Double_t cutiso_sumoetlMedium[9] = {
476 +  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};
477 +  Double_t cutseeMedium[9] = {
478 +  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};
479 +  Double_t cutseelMedium[9] = {
480 +  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};
481 +
482 +  // Tight cuts
483 +  Double_t cutdcotdistTight[9] = {
484 +  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};
485 +  Double_t cutdetainTight[9] = {
486 +  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};
487 +  Double_t cutdetainlTight[9] = {
488 +  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};
489 +  Double_t cutdphiinTight[9] = {
490 +  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};
491 +  Double_t cutdphiinlTight[9] = {
492 +  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};
493 +  Double_t cuteseedopcorTight[9] = {
494 +  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};
495 +  Double_t cutfmishitsTight[9] = {
496 +  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};
497 +  Double_t cuthoeTight[9] = {
498 +  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};
499 +  Double_t cuthoelTight[9] = {
500 +  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};
501 +  Double_t cutip_gsfTight[9] = {
502 +  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};
503 +  Double_t cutip_gsflTight[9] = {
504 +  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};
505 +  Double_t cutiso_sumTight[9] = {
506 +  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};
507 +  Double_t cutiso_sumoetTight[9] = {
508 +  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};
509 +  Double_t cutiso_sumoetlTight[9] = {
510 +  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};
511 +  Double_t cutseeTight[9] = {
512 +  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};
513 +  Double_t cutseelTight[9] = {
514 +  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};
515 +  
516 +  Double_t cutdcotdistSuperTight[9] = {
517 +  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};
518 +  Double_t cutdetainSuperTight[9] = {
519 +  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};
520 +  Double_t cutdetainlSuperTight[9] = {
521 +  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};
522 +  Double_t cutdphiinSuperTight[9] = {
523 +  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};
524 +  Double_t cutdphiinlSuperTight[9] = {
525 +  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};
526 +  Double_t cuteseedopcorSuperTight[9] = {
527 +  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};
528 +  Double_t cutfmishitsSuperTight[9] = {
529 +  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};
530 +  Double_t cuthoeSuperTight[9] = {
531 +  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};
532 +  Double_t cuthoelSuperTight[9] = {
533 +  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};
534 +  Double_t cutip_gsfSuperTight[9] = {
535 +  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};
536 +  Double_t cutip_gsflSuperTight[9] = {
537 +  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};
538 +  Double_t cutiso_sumSuperTight[9] = {
539 +  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};
540 +  Double_t cutiso_sumoetSuperTight[9] = {
541 +  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};
542 +  Double_t cutiso_sumoetlSuperTight[9] = {
543 +  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};
544 +  Double_t cutseeSuperTight[9] = {
545 +  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};
546 +  Double_t cutseelSuperTight[9] = {
547 +  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};
548 +
549 +  Double_t cutdcotdist[9];
550 +  Double_t cutdetain[9];
551 +  Double_t cutdetainl[9];
552 +  Double_t cutdphiin[9];
553 +  Double_t cutdphiinl[9];
554 +  Double_t cuteseedopcor[9];
555 +  Double_t cutfmishits[9];
556 +  Double_t cuthoe[9];
557 +  Double_t cuthoel[9];
558 +  Double_t cutip_gsf[9];
559 +  Double_t cutip_gsfl[9];
560 +  Double_t cutiso_sum[9];
561 +  Double_t cutiso_sumoet[9];
562 +  Double_t cutiso_sumoetl[9];
563 +  Double_t cutsee[9];
564 +  Double_t cutseel[9];
565 +  if     (typeCuts == 0) {
566 +    memcpy(cutdcotdist   ,cutdcotdistMedium   ,sizeof(cutdcotdistMedium));
567 +    memcpy(cutdetain     ,cutdetainMedium     ,sizeof(cutdetainMedium));
568 +    memcpy(cutdetainl    ,cutdetainlMedium    ,sizeof(cutdetainlMedium));
569 +    memcpy(cutdphiin     ,cutdphiinMedium     ,sizeof(cutdphiinMedium));
570 +    memcpy(cutdphiinl    ,cutdphiinlMedium    ,sizeof(cutdphiinlMedium));
571 +    memcpy(cuteseedopcor ,cuteseedopcorMedium ,sizeof(cuteseedopcorMedium));
572 +    memcpy(cutfmishits   ,cutfmishitsMedium   ,sizeof(cutfmishitsMedium));
573 +    memcpy(cuthoe        ,cuthoeMedium        ,sizeof(cuthoeMedium));
574 +    memcpy(cuthoel       ,cuthoelMedium       ,sizeof(cuthoelMedium));
575 +    memcpy(cutip_gsf     ,cutip_gsfMedium     ,sizeof(cutip_gsfMedium));
576 +    memcpy(cutip_gsfl    ,cutip_gsflMedium    ,sizeof(cutip_gsflMedium));
577 +    memcpy(cutiso_sum    ,cutiso_sumMedium    ,sizeof(cutiso_sumMedium));
578 +    memcpy(cutiso_sumoet ,cutiso_sumoetMedium ,sizeof(cutiso_sumoetMedium));
579 +    memcpy(cutiso_sumoetl,cutiso_sumoetlMedium,sizeof(cutiso_sumoetlMedium));
580 +    memcpy(cutsee        ,cutseeMedium        ,sizeof(cutseeMedium));
581 +    memcpy(cutseel       ,cutseelMedium       ,sizeof(cutseelMedium));
582 +  }
583 +  else if(typeCuts == 1) {
584 +    memcpy(cutdcotdist   ,cutdcotdistTight   ,sizeof(cutdcotdistTight));
585 +    memcpy(cutdetain     ,cutdetainTight     ,sizeof(cutdetainTight));
586 +    memcpy(cutdetainl    ,cutdetainlTight    ,sizeof(cutdetainlTight));
587 +    memcpy(cutdphiin     ,cutdphiinTight     ,sizeof(cutdphiinTight));
588 +    memcpy(cutdphiinl    ,cutdphiinlTight    ,sizeof(cutdphiinlTight));
589 +    memcpy(cuteseedopcor ,cuteseedopcorTight ,sizeof(cuteseedopcorTight));
590 +    memcpy(cutfmishits   ,cutfmishitsTight   ,sizeof(cutfmishitsTight));
591 +    memcpy(cuthoe        ,cuthoeTight        ,sizeof(cuthoeTight));
592 +    memcpy(cuthoel       ,cuthoelTight       ,sizeof(cuthoelTight));
593 +    memcpy(cutip_gsf     ,cutip_gsfTight     ,sizeof(cutip_gsfTight));
594 +    memcpy(cutip_gsfl    ,cutip_gsflTight    ,sizeof(cutip_gsflTight));
595 +    memcpy(cutiso_sum    ,cutiso_sumTight    ,sizeof(cutiso_sumTight));
596 +    memcpy(cutiso_sumoet ,cutiso_sumoetTight ,sizeof(cutiso_sumoetTight));
597 +    memcpy(cutiso_sumoetl,cutiso_sumoetlTight,sizeof(cutiso_sumoetlTight));
598 +    memcpy(cutsee        ,cutseeTight        ,sizeof(cutseeTight));
599 +    memcpy(cutseel       ,cutseelTight       ,sizeof(cutseelTight));
600 +  }
601 +  else {
602 +    memcpy(cutdcotdist   ,cutdcotdistSuperTight   ,sizeof(cutdcotdistSuperTight));
603 +    memcpy(cutdetain     ,cutdetainSuperTight     ,sizeof(cutdetainSuperTight));
604 +    memcpy(cutdetainl    ,cutdetainlSuperTight    ,sizeof(cutdetainlSuperTight));
605 +    memcpy(cutdphiin     ,cutdphiinSuperTight     ,sizeof(cutdphiinSuperTight));
606 +    memcpy(cutdphiinl    ,cutdphiinlSuperTight    ,sizeof(cutdphiinlSuperTight));
607 +    memcpy(cuteseedopcor ,cuteseedopcorSuperTight ,sizeof(cuteseedopcorSuperTight));
608 +    memcpy(cutfmishits   ,cutfmishitsSuperTight   ,sizeof(cutfmishitsSuperTight));
609 +    memcpy(cuthoe        ,cuthoeSuperTight        ,sizeof(cuthoeSuperTight));
610 +    memcpy(cuthoel       ,cuthoelSuperTight       ,sizeof(cuthoelSuperTight));
611 +    memcpy(cutip_gsf     ,cutip_gsfSuperTight     ,sizeof(cutip_gsfSuperTight));
612 +    memcpy(cutip_gsfl    ,cutip_gsflSuperTight    ,sizeof(cutip_gsflSuperTight));
613 +    memcpy(cutiso_sum    ,cutiso_sumSuperTight    ,sizeof(cutiso_sumSuperTight));
614 +    memcpy(cutiso_sumoet ,cutiso_sumoetSuperTight ,sizeof(cutiso_sumoetSuperTight));
615 +    memcpy(cutiso_sumoetl,cutiso_sumoetlSuperTight,sizeof(cutiso_sumoetlSuperTight));
616 +    memcpy(cutsee        ,cutseeSuperTight        ,sizeof(cutseeSuperTight));
617 +    memcpy(cutseel       ,cutseelSuperTight       ,sizeof(cutseelSuperTight));
618 +  }
619 +
620 +  int result = 0;
621 +  
622 +  const int ncuts = 10;
623 +  std::vector<bool> cut_results(ncuts, false);
624 +  
625 +  float iso_sum = tkIso + ecalIso + hcalIso;
626 +  if(fabs(scEta)>1.5)
627 +    iso_sum += (fabs(scEta)-1.5)*1.09;
628 +  
629 +  float iso_sumoet = iso_sum*(40./scEt);
630 +  
631 +  float eseedopincor = eSeedOverPin + fBrem;
632 +  if(fBrem < 0)
633 +    eseedopincor = eSeedOverPin;
634 +
635 +  float dist = (TMath::Abs(ele->ConvPartnerDist())      == -9999.? 9999:TMath::Abs(ele->ConvPartnerDist()));
636 +  float dcot = (TMath::Abs(ele->ConvPartnerDCotTheta()) == -9999.? 9999:TMath::Abs(ele->ConvPartnerDCotTheta()));
637 +
638 +  float dcotdistcomb = ((0.04 - std::max(dist, dcot)) > 0?(0.04 - std::max(dist, dcot)):0);
639 +
640 +  Double_t ip = 99999;
641 +  for(UInt_t i0 = 0; i0 < vertices->GetEntries(); i0++) {
642 +    if(vertices->At(i0)->NTracks() > 0){
643 +      Double_t pD0 = ele->GsfTrk()->D0Corrected(*vertices->At(i0));
644 +      ip = TMath::Abs(pD0);
645 +      break;
646 +    }
647 +  }
648 +
649 +  for (int cut=0; cut<ncuts; cut++) {
650 +    switch (cut) {
651 +    case 0:
652 +      cut_results[cut] = compute_cut(fabs(deltaEtaIn), scEt, cutdetainl[cat], cutdetain[cat]);
653 +      break;
654 +    case 1:
655 +      cut_results[cut] = compute_cut(fabs(deltaPhiIn), scEt, cutdphiinl[cat], cutdphiin[cat]);
656 +      break;
657 +    case 2:
658 +      cut_results[cut] = (eseedopincor > cuteseedopcor[cat]);
659 +      break;
660 +    case 3:
661 +      cut_results[cut] = compute_cut(hOverE, scEt, cuthoel[cat], cuthoe[cat]);
662 +      break;
663 +    case 4:
664 +      cut_results[cut] = compute_cut(sigmaee, scEt, cutseel[cat], cutsee[cat]);
665 +      break;
666 +    case 5:
667 +      cut_results[cut] = compute_cut(iso_sumoet, scEt, cutiso_sumoetl[cat], cutiso_sumoet[cat]);
668 +      break;
669 +    case 6:
670 +      cut_results[cut] = (iso_sum < cutiso_sum[cat]);
671 +      break;
672 +    case 7:
673 +      cut_results[cut] = compute_cut(fabs(ip), scEt, cutip_gsfl[cat], cutip_gsf[cat]);
674 +      break;
675 +    case 8:
676 +      cut_results[cut] = (mishits < cutfmishits[cat]);
677 +      break;
678 +    case 9:
679 +      cut_results[cut] = (dcotdistcomb < cutdcotdist[cat]);
680 +      break;
681 +    }
682 +  }
683 +  
684 +  // ID part
685 +  if (cut_results[0] & cut_results[1] & cut_results[2] & cut_results[3] & cut_results[4])
686 +    result = result + 1;
687 +  
688 +  // ISO part
689 +  if (cut_results[5] & cut_results[6])
690 +    result = result + 2;
691 +  
692 +  // IP part
693 +  if (cut_results[7])
694 +    result = result + 8;
695 +  
696 +  // Conversion part
697 +  if (cut_results[8] and cut_results[9])
698 +    result = result + 4;
699 +  
700 +  return result;
701 + }
702 +
703 + //--------------------------------------------------------------------------------------------------
704 + bool ElectronTools::compute_cut(double x, double et, double cut_min, double cut_max, bool gtn) {
705 +
706 +  float et_min = 10;
707 +  float et_max = 40;
708 +
709 +  bool accept = false;
710 +  float cut = cut_max; //  the cut at et=40 GeV
711 +
712 +  if(et < et_max) {
713 +    cut = cut_min + (1/et_min - 1/et)*(cut_max - cut_min)/(1/et_min - 1/et_max);
714 +  }
715 +  
716 +  if(et < et_min) {
717 +    cut = cut_min;
718 +  }
719 +
720 +  if(gtn) {   // useful for e/p cut which is gt
721 +    accept = (x >= cut);
722 +  }
723 +  else {
724 +    accept = (x <= cut);
725 +  }
726 +
727 +  return accept;
728 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines