CMS 3D CMS Logo

Public Member Functions | Private Member Functions

pat::TrackerIsolationPt Class Reference

Calculates a lepton's tracker isolation pt. More...

#include <PhysicsTools/PatUtils/interface/TrackerIsolationPt.h>

List of all members.

Public Member Functions

float calculate (const Electron &theElectron, const edm::View< reco::Track > &theTracks, float isoConeElectron=0.3) const
 calculate the TrackIsoPt for the lepton object
float calculate (const Muon &theMuon, const edm::View< reco::Track > &theTracks, float isoConeMuon=0.3) const
 TrackerIsolationPt ()
 constructor
virtual ~TrackerIsolationPt ()
 destructor

Private Member Functions

float calculate (const reco::Track &theTrack, const edm::View< reco::Track > &theTracks, float isoCone) const
 calculate the TrackIsoPt for the lepton's track

Detailed Description

Calculates a lepton's tracker isolation pt.

TrackerIsolationPt calculates a tracker isolation pt in a cone around the lepton's direction, without doing track extrapolation

Author:
Steven Lowette
Version:
Id:
TrackerIsolationPt.h,v 1.4 2008/03/05 14:51:03 fronga Exp

Definition at line 31 of file TrackerIsolationPt.h.


Constructor & Destructor Documentation

TrackerIsolationPt::TrackerIsolationPt ( )

constructor

Definition at line 22 of file TrackerIsolationPt.cc.

                                       {
}
TrackerIsolationPt::~TrackerIsolationPt ( ) [virtual]

destructor

Definition at line 26 of file TrackerIsolationPt.cc.

                                        {
}

Member Function Documentation

float TrackerIsolationPt::calculate ( const Electron theElectron,
const edm::View< reco::Track > &  theTracks,
float  isoConeElectron = 0.3 
) const

calculate the TrackIsoPt for the lepton object

Definition at line 30 of file TrackerIsolationPt.cc.

References pat::Electron::gsfTrack().

Referenced by calculate(), and pat::LeptonJetIsolationAngle::calculate().

                                                                                                                                   {
  return this->calculate(*theElectron.gsfTrack(), theTracks, isoConeElectron);
}
float TrackerIsolationPt::calculate ( const reco::Track theTrack,
const edm::View< reco::Track > &  theTracks,
float  isoCone 
) const [private]

calculate the TrackIsoPt for the lepton's track

Definition at line 39 of file TrackerIsolationPt.cc.

References edm::View< T >::begin(), edm::View< T >::end(), reco::TrackBase::p(), PV3DBase< T, PVType, FrameType >::perp(), reco::TrackBase::px(), reco::TrackBase::py(), and reco::TrackBase::pz().

                                                                                                                         {
  // initialize some variables
  float isoPtLepton = 0;
  const reco::Track * closestTrackDRPt = 0, * closestTrackDR = 0;
  float closestDRPt = 10000, closestDR = 10000;
  // use all these pointless vector conversions because the momenta from tracks
  // are completely unusable; bah, these math-vectors are worthless!
  CLHEP::HepLorentzVector lepton(theTrack.px(), theTrack.py(), theTrack.pz(), theTrack.p());
  for (edm::View<reco::Track>::const_iterator itTrack = theTracks.begin(); itTrack != theTracks.end(); itTrack++) {
    CLHEP::HepLorentzVector track(itTrack->px(), itTrack->py(), itTrack->pz(), itTrack->p());
    float dR = lepton.deltaR(track);
    if (dR < isoCone) {
      isoPtLepton += track.perp();
      // find the closest matching track
      // FIXME: we could association by hits or chi2 to match
      float pRatio = track.perp()/lepton.perp();
      if (dR < closestDRPt && pRatio > 0.5 && pRatio < 1.5) {
        closestDRPt = dR;
        closestTrackDRPt = &*itTrack;
      }
      if (dR < closestDR) {
        closestDR = dR;
        closestTrackDR = &*itTrack;
      }
    }
  }
  if (closestTrackDRPt) {
    GlobalVector closestTrackVector(closestTrackDRPt->px(), closestTrackDRPt->py(), closestTrackDRPt->pz());
    isoPtLepton -= closestTrackVector.perp();
  } else if (closestTrackDR) {
    GlobalVector closestTrackVector(closestTrackDR->px(), closestTrackDR->py(), closestTrackDR->pz());
    isoPtLepton -= closestTrackVector.perp();
  }
  // back to normal sum - S.L. 30/10/2007
  if (isoPtLepton<0) isoPtLepton = 0;
  //  isoPtLepton <= 0.01 ? isoPtLepton = -1 : isoPtLepton = log(isoPtLepton);
  return isoPtLepton;
}
float TrackerIsolationPt::calculate ( const Muon theMuon,
const edm::View< reco::Track > &  theTracks,
float  isoConeMuon = 0.3 
) const

Definition at line 34 of file TrackerIsolationPt.cc.

References calculate(), and pat::Muon::track().

                                                                                                                       {
  return this->calculate(*theMuon.track(), theTracks, isoConeMuon);
}