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.9 by loizides, Tue Apr 7 15:37:10 2009 UTC vs.
Revision 1.18 by sixie, Sat Apr 30 21:01:11 2011 UTC

# Line 3 | Line 3
3   #include "MitPhysics/Utils/interface/MuonTools.h"
4   #include <TFile.h>
5  
6 + ClassImp(mithep::MuonTools)
7 +
8   using namespace mithep;
9  
10   //--------------------------------------------------------------------------------------------------
# Line 426 | Line 428 | TH2D *MuonTools::LoadHisto(const char *n
428    ret->SetDirectory(0);
429    return ret;
430   }
431 + //--------------------------------------------------------------------------------------------------
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 +  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 +  
454 +  return d0cut;
455 + }
456 +
457 + //--------------------------------------------------------------------------------------------------
458 + Bool_t MuonTools::PassD0Cut(const Muon *mu, const BeamSpotCol *beamspots, Double_t fD0Cut)
459 + {
460 +  Bool_t d0cut = kFALSE;
461 +  const Track *mt = mu->BestTrk();
462 +  if (!mt) return kFALSE;
463 +
464 +  // d0 cut
465 +  Double_t d0_real = 99999;
466 +  for(UInt_t i0 = 0; i0 < beamspots->GetEntries(); i0++) {
467 +    Double_t pD0 = mt->D0Corrected(*beamspots->At(i0));
468 +    if(TMath::Abs(pD0) < TMath::Abs(d0_real)) d0_real = TMath::Abs(pD0);
469 +  }
470 +  if(d0_real < fD0Cut) d0cut = kTRUE;
471 +  
472 +  return d0cut;
473 + }
474 +
475 + //--------------------------------------------------------------------------------------------------
476 + Bool_t MuonTools::PassDZCut(const Muon *mu, const VertexCol *vertices, Double_t fDZCut, Int_t nVertex)
477 + {
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)
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 +  
507 +  if(mu->BestTrk()->NHits() <= 10) return kFALSE;
508 +
509 +  if(!PassD0Cut(mu, vertices, 0.2, 0)) return kFALSE;
510 +
511 +  if(!PassDZCut(mu, vertices, 0.2, 0)) return kFALSE;
512 +  
513 +  Double_t totalIso = 1.0 * mu->IsoR03SumPt() +
514 +                      1.0 * mu->IsoR03EmEt() +
515 +                      1.0 * mu->IsoR03HadEt();
516 +  if (totalIso < (mu->Pt()*0.10) && mu->Pt() > 20.0) return kFALSE;
517 +
518 +  return kTRUE;
519 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines