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.23 by sixie, Sat Dec 31 23:18:39 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 +                                  const Bool_t applyIso)
501 + {
502 +  if(mu->Pt() <= 3.0) return kFALSE;
503 +
504    if(!mu->IsTrackerMuon()) return kFALSE;
505    
506    if(!mu->Quality().Quality(MuonQuality::TMLastStationAngTight)) return kFALSE;
507 <  
507 >
508    if(mu->BestTrk()->NHits() <= 10) return kFALSE;
509  
510 <  if(!PassD0Cut(mu, vertices, 0.2)) return kFALSE;
511 <  
512 <  Double_t totalIso = 1.0 * mu->IsoR03SumPt() +
513 <                      1.0 * mu->IsoR03EmEt() +
514 <                      1.0 * mu->IsoR03HadEt();
515 <  if (totalIso < (mu->Pt()*0.10) && mu->Pt() > 20.0) return kFALSE;
510 >  if(!PassD0Cut(mu, vertices, 0.2, 0)) return kFALSE;
511 >
512 >  if(!PassDZCut(mu, vertices, fDZCut, 0)) return kFALSE;
513 >
514 >  if(applyIso == kTRUE){
515 >    Double_t totalIso = 1.0 * mu->IsoR03SumPt() +
516 >                        1.0 * mu->IsoR03EmEt() +
517 >                        1.0 * mu->IsoR03HadEt();
518 >    if (totalIso < (mu->Pt()*0.10) && mu->Pt() > 20.0) return kFALSE;
519 >  }
520  
521    return kTRUE;
522   }
523 +
524 + Double_t MuonTools::MuonEffectiveArea(EMuonEffectiveAreaType type, Double_t Eta) {
525 +
526 +  Double_t EffectiveArea = 0;
527 +  if (fabs(Eta) < 1.0) {
528 +    if (type == kMuChargedIso03) EffectiveArea = 0.000;
529 +    if (type == kMuNeutralIso03) EffectiveArea = 0.080;
530 +    if (type == kMuChargedIso04) EffectiveArea = 0.000;
531 +    if (type == kMuNeutralIso04) EffectiveArea = 0.163;
532 +    if (type == kMuHadEnergy)    EffectiveArea = 0.000;
533 +    if (type == kMuHoEnergy)     EffectiveArea = 0.000;
534 +    if (type == kMuEmEnergy)     EffectiveArea = 0.000;
535 +    if (type == kMuHadS9Energy)  EffectiveArea = 0.016;
536 +    if (type == kMuHoS9Energy)   EffectiveArea = 0.000;
537 +    if (type == kMuEmS9Energy)   EffectiveArea = 0.000;
538 +  } else if (fabs(Eta) >= 1.0 && fabs(Eta) < 1.479 ) {
539 +    if (type == kMuChargedIso03) EffectiveArea = 0.000;
540 +    if (type == kMuNeutralIso03) EffectiveArea = 0.083;
541 +    if (type == kMuChargedIso04) EffectiveArea = 0.000;
542 +    if (type == kMuNeutralIso04) EffectiveArea = 0.168;
543 +    if (type == kMuHadEnergy)    EffectiveArea = 0.005;
544 +    if (type == kMuHoEnergy)     EffectiveArea = 0.000;
545 +    if (type == kMuEmEnergy)     EffectiveArea = 0.000;
546 +    if (type == kMuHadS9Energy)  EffectiveArea = 0.041;
547 +    if (type == kMuHoS9Energy)   EffectiveArea = 0.000;
548 +    if (type == kMuEmS9Energy)   EffectiveArea = 0.000;
549 +  } else if (fabs(Eta) >= 1.479 && fabs(Eta) < 2.0 ) {
550 +    if (type == kMuChargedIso03) EffectiveArea = 0.000;
551 +    if (type == kMuNeutralIso03) EffectiveArea = 0.060;
552 +    if (type == kMuChargedIso04) EffectiveArea = 0.000;
553 +    if (type == kMuNeutralIso04) EffectiveArea = 0.131;
554 +    if (type == kMuHadEnergy)    EffectiveArea = 0.020;
555 +    if (type == kMuHoEnergy)     EffectiveArea = 0.000;
556 +    if (type == kMuEmEnergy)     EffectiveArea = 0.000;
557 +    if (type == kMuHadS9Energy)  EffectiveArea = 0.072;
558 +    if (type == kMuHoS9Energy)   EffectiveArea = 0.000;
559 +    if (type == kMuEmS9Energy)   EffectiveArea = 0.000;
560 +  } else if (fabs(Eta) >= 2.0 && fabs(Eta) < 2.25 ) {
561 +    if (type == kMuChargedIso03) EffectiveArea = 0.000;
562 +    if (type == kMuNeutralIso03) EffectiveArea = 0.066;
563 +    if (type == kMuChargedIso04) EffectiveArea = 0.000;
564 +    if (type == kMuNeutralIso04) EffectiveArea = 0.149;
565 +    if (type == kMuHadEnergy)    EffectiveArea = 0.056;
566 +    if (type == kMuHoEnergy)     EffectiveArea = 0.000;
567 +    if (type == kMuEmEnergy)     EffectiveArea = 0.000;
568 +    if (type == kMuHadS9Energy)  EffectiveArea = 0.148;
569 +    if (type == kMuHoS9Energy)   EffectiveArea = 0.000;
570 +    if (type == kMuEmS9Energy)   EffectiveArea = 0.000;
571 +  } else if (fabs(Eta) >= 2.25 && fabs(Eta) < 2.4 ) {
572 +    if (type == kMuChargedIso03) EffectiveArea = 0.000;
573 +    if (type == kMuNeutralIso03) EffectiveArea = 0.098;
574 +    if (type == kMuChargedIso04) EffectiveArea = 0.000;
575 +    if (type == kMuNeutralIso04) EffectiveArea = 0.200;
576 +    if (type == kMuHadEnergy)    EffectiveArea = 0.093;
577 +    if (type == kMuHoEnergy)     EffectiveArea = 0.000;
578 +    if (type == kMuEmEnergy)     EffectiveArea = 0.000;
579 +    if (type == kMuHadS9Energy)  EffectiveArea = 0.260;
580 +    if (type == kMuHoS9Energy)   EffectiveArea = 0.000;
581 +    if (type == kMuEmS9Energy)   EffectiveArea = 0.000;
582 +  }
583 +  return EffectiveArea;
584 + }
585 +
586 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines