ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Utils/src/MuonTools.cc
(Generate patch)

Comparing UserCode/MitPhysics/Utils/src/MuonTools.cc (file contents):
Revision 1.14 by ceballos, Fri Jan 21 11:25:29 2011 UTC vs.
Revision 1.21 by ceballos, Sun Oct 2 10:05:42 2011 UTC

# Line 429 | Line 429 | TH2D *MuonTools::LoadHisto(const char *n
429    return ret;
430   }
431   //--------------------------------------------------------------------------------------------------
432 < Bool_t MuonTools::PassD0Cut(const Muon *mu, const VertexCol *vertices, Double_t fD0Cut)
432 > Bool_t MuonTools::PassD0Cut(const Muon *mu, const VertexCol *vertices, Double_t fD0Cut, Int_t nVertex)
433   {
434    Bool_t d0cut = kFALSE;
435    const Track *mt = mu->BestTrk();
436    if (!mt) return kFALSE;
437  
438    Double_t d0_real = 1e30;
439 <  for(UInt_t i0 = 0; i0 < vertices->GetEntries(); i0++) {
440 <    if(vertices->At(i0)->NTracks() > 0){
441 <      Double_t pD0 = mt->D0Corrected(*vertices->At(i0));
442 <      d0_real = TMath::Abs(pD0);
443 <      break;
439 >  if(nVertex >= 0) d0_real = TMath::Abs(mt->D0Corrected(*vertices->At(nVertex)));
440 >  else            {
441 >    Double_t distVtx = 999.0;
442 >    Int_t closestVtx = 0;
443 >    for(UInt_t nv=0; nv<vertices->GetEntries(); nv++){
444 >      double dz = TMath::Abs(mt->DzCorrected(*vertices->At(nv)));
445 >      if(dz < distVtx) {
446 >        distVtx    = dz;
447 >        closestVtx = nv;
448 >      }
449      }
450 +    d0_real = TMath::Abs(mt->D0Corrected(*vertices->At(closestVtx)));
451    }
452    if(d0_real < fD0Cut) d0cut = kTRUE;
453    
# Line 467 | Line 473 | Bool_t MuonTools::PassD0Cut(const Muon *
473   }
474  
475   //--------------------------------------------------------------------------------------------------
476 < Bool_t MuonTools::PassSoftMuonCut(const Muon *mu, const VertexCol *vertices)
476 > Bool_t MuonTools::PassDZCut(const Muon *mu, const VertexCol *vertices, Double_t fDZCut, Int_t nVertex)
477   {
478 <  if(mu->Pt() <= 3.0) return kFALSE;
478 >  Bool_t dzcut = kFALSE;
479 >  const Track *mt = mu->BestTrk();
480 >  if (!mt) return kFALSE;
481 >
482 >  Double_t distVtx = 999.0;
483 >  if(nVertex >= 0) distVtx = TMath::Abs(mt->DzCorrected(*vertices->At(nVertex)));
484 >  else {
485 >    for(UInt_t nv=0; nv<vertices->GetEntries(); nv++){
486 >      double dz = TMath::Abs(mt->DzCorrected(*vertices->At(nv)));
487 >      if(dz < distVtx) {
488 >        distVtx = dz;
489 >      }
490 >    }
491 >  }
492 >
493 >  if(distVtx < fDZCut) dzcut = kTRUE;
494    
495 +  return dzcut;
496 + }
497 +
498 + //--------------------------------------------------------------------------------------------------
499 + Bool_t MuonTools::PassSoftMuonCut(const Muon *mu, const VertexCol *vertices, const Double_t fDZCut)
500 + {
501 +  if(mu->Pt() <= 3.0) return kFALSE;
502 +
503    if(!mu->IsTrackerMuon()) return kFALSE;
504    
505    if(!mu->Quality().Quality(MuonQuality::TMLastStationAngTight)) return kFALSE;
506 <  
506 >
507    if(mu->BestTrk()->NHits() <= 10) return kFALSE;
508  
509 <  if(!PassD0Cut(mu, vertices, 0.2)) return kFALSE;
510 <  
509 >  if(!PassD0Cut(mu, vertices, 0.2, 0)) return kFALSE;
510 >
511 >  if(!PassDZCut(mu, vertices, fDZCut, 0)) return kFALSE;
512 >
513    Double_t totalIso = 1.0 * mu->IsoR03SumPt() +
514                        1.0 * mu->IsoR03EmEt() +
515                        1.0 * mu->IsoR03HadEt();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines