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.22 by ceballos, Tue Mar 15 08:33:42 2011 UTC vs.
Revision 1.23 by ceballos, Tue Mar 15 12:02:49 2011 UTC

# Line 308 | Line 308 | Bool_t ElectronTools::PassConversionFilt
308   }
309  
310   //--------------------------------------------------------------------------------------------------
311 < Bool_t ElectronTools::PassD0Cut(const Electron *ele, const VertexCol *vertices, Double_t fD0Cut)
311 > Bool_t ElectronTools::PassD0Cut(const Electron *ele, const VertexCol *vertices, Double_t fD0Cut, Int_t nVertex)
312   {
313    Bool_t d0cut = kFALSE;
314 <  // d0 cut
315 <  Double_t d0_real = 99999;
316 <  for(UInt_t i0 = 0; i0 < vertices->GetEntries(); i0++) {
317 <    if(vertices->At(i0)->NTracks() > 0){
318 <      Double_t pD0 = ele->GsfTrk()->D0Corrected(*vertices->At(i0));
319 <      d0_real = TMath::Abs(pD0);
320 <      break;
314 >
315 >  Double_t d0_real = 1e30;
316 >  if(nVertex >= 0) d0_real = TMath::Abs(ele->GsfTrk()->D0Corrected(*vertices->At(nVertex)));
317 >  else            {
318 >    Double_t distVtx = 999.0;
319 >    Int_t closestVtx = 0;
320 >    for(UInt_t nv=0; nv<vertices->GetEntries(); nv++){
321 >      double dz = TMath::Abs(ele->GsfTrk()->DzCorrected(*vertices->At(nv)));
322 >      if(dz < distVtx) {
323 >        distVtx    = dz;
324 >        closestVtx = nv;
325 >      }
326      }
327 +    d0_real = TMath::Abs(ele->GsfTrk()->D0Corrected(*vertices->At(closestVtx)));
328    }
329    if(d0_real < fD0Cut) d0cut = kTRUE;
330    
# Line 341 | Line 347 | Bool_t ElectronTools::PassD0Cut(const El
347   }
348  
349   //--------------------------------------------------------------------------------------------------
350 + Bool_t ElectronTools::PassDZCut(const Electron *ele, const VertexCol *vertices, Double_t fDZCut)
351 + {
352 +  Bool_t dzcut = kFALSE;
353 +
354 +  Double_t distVtx = 999.0;
355 +  for(UInt_t nv=0; nv<vertices->GetEntries(); nv++){
356 +    double dz = TMath::Abs(ele->GsfTrk()->DzCorrected(*vertices->At(nv)));
357 +    if(dz < distVtx) {
358 +      distVtx    = dz;
359 +    }
360 +  }
361 +  if(distVtx < fDZCut) dzcut = kTRUE;
362 +  
363 +  return dzcut;
364 + }
365 +
366 + //--------------------------------------------------------------------------------------------------
367   Bool_t ElectronTools::PassChargeFilter(const Electron *ele)
368   {
369    Bool_t passChargeFilter = kTRUE;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines