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.6 by loizides, Fri Nov 28 09:13:35 2008 UTC vs.
Revision 1.22 by ceballos, Wed Oct 5 16:11:10 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 91 | Line 93 | void MuonTools::DeleteHistos()
93   Double_t MuonTools::GetCaloCompatability(const Muon *iMuon,
94                                           Bool_t iEMSpecial, Bool_t iCorrectedHCAL) const
95   {
96 <  // todo
96 >  // Get calo compatibility value for given muon based on calorimeter templates.
97 >  // If iEMSpecial is true, then a use different arrangement of ECAL for compatibility.
98  
99    Double_t lEta = iMuon->Eta();
100    Double_t aEta = TMath::Abs(lEta);
# Line 144 | Line 147 | Double_t MuonTools::GetCaloCompatability
147  
148    if (aEta < 1.1) {
149      if(iCorrectedHCAL)    
150 <      lHad *= TMath::Sin(2*TMath::ATan(TMath::Exp(lEta))); //todo ask!
150 >      lHad *= TMath::Sin(2*TMath::ATan(TMath::Exp(lEta)));
151      lTPionHad  = fpion_had_etaB;
152      lTMuonHad  = fmuon_had_etaB;
153    }
# Line 276 | Line 279 | Bool_t MuonTools::IsGood(const mithep::M
279        return iMuon->PromptTight(Muon::kAny);
280        break;
281      case kTMOneStationLoose:
282 <      return iMuon->TMOneStation(99999,999999);
282 >      return iMuon->TMOneStation(999999,999999);
283        break;
284      case kTMOneStationTight:
285        return iMuon->TMOneStation();
# Line 298 | Line 301 | Bool_t MuonTools::IsGood(const mithep::M
301        break;
302    }
303  
304 <  Double_t lVal = 1.2*GetSegmentCompatability(iMuon);
305 <  if (lVal/1.2 == 0.5)
304 >  Double_t lVal = GetSegmentCompatability(iMuon);
305 >  if (lVal == 0.5) // exclude this border case
306      return kFALSE;
307  
308 +  lVal *= 1.2;
309    lVal += 0.8*GetCaloCompatability(iMuon,kTRUE,kTRUE);
310    if (lVal > tm2dcut)
311      return kTRUE;
312 +
313    return kFALSE;
314   }
315  
316   //--------------------------------------------------------------------------------------------------
317   Double_t MuonTools::GetSegmentCompatability(const mithep::Muon *iMuon) const
318   {
319 <  // todo
319 >  // Get segment compatability for given muon based on likelihood of well defined
320 >  // track through chambers.
321  
322    Int_t lNStationsCrossed = 0;
323    Int_t lNStationsSegment = 0;
# Line 332 | Line 338 | Double_t MuonTools::GetSegmentCompatabil
338      } else
339        lStCrossed[i0]  = 0;
340  
341 <    if(iMuon->GetDX(i0) < 999999.) { //Use iMuon->GetSegmentX--> CHECK
341 >    if(iMuon->GetDX(i0) < 999999.) {
342        lNStationsSegment++;
343        lStSegmentmatch[i0] = 1;
344      } else
# Line 422 | 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, 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 +
508 +  if(mu->BestTrk()->NHits() <= 10) return kFALSE;
509 +
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 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines