CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions
pat::TrackerIsolationPt Class Reference

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

#include "PhysicsTools/PatUtils/interface/TrackerIsolationPt.h"

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 More...
 
float calculate (const Muon &theMuon, const edm::View< reco::Track > &theTracks, float isoConeMuon=0.3) const
 
 TrackerIsolationPt ()
 constructor More...
 
virtual ~TrackerIsolationPt ()
 destructor More...
 

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 More...
 

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.3 2008/02/28 14:54:24 llista Exp

Definition at line 31 of file TrackerIsolationPt.h.

Constructor & Destructor Documentation

◆ TrackerIsolationPt()

TrackerIsolationPt::TrackerIsolationPt ( )

constructor

Definition at line 21 of file TrackerIsolationPt.cc.

21 {}

◆ ~TrackerIsolationPt()

TrackerIsolationPt::~TrackerIsolationPt ( )
virtual

destructor

Definition at line 24 of file TrackerIsolationPt.cc.

24 {}

Member Function Documentation

◆ calculate() [1/3]

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 27 of file TrackerIsolationPt.cc.

References pat::Electron::gsfTrack().

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

29  {
30  return this->calculate(*theElectron.gsfTrack(), theTracks, isoConeElectron);
31 }
reco::GsfTrackRef gsfTrack() const override
override the reco::GsfElectron::gsfTrack method, to access the internal storage of the supercluster ...
float calculate(const Electron &theElectron, const edm::View< reco::Track > &theTracks, float isoConeElectron=0.3) const
calculate the TrackIsoPt for the lepton object

◆ calculate() [2/3]

float TrackerIsolationPt::calculate ( const Muon theMuon,
const edm::View< reco::Track > &  theTracks,
float  isoConeMuon = 0.3 
) const

Definition at line 33 of file TrackerIsolationPt.cc.

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

35  {
36  return this->calculate(*theMuon.track(), theTracks, isoConeMuon);
37 }
float calculate(const Electron &theElectron, const edm::View< reco::Track > &theTracks, float isoConeElectron=0.3) const
calculate the TrackIsoPt for the lepton object
reco::TrackRef track() const override
reference to Track reconstructed in the tracker only (reimplemented from reco::Muon) ...

◆ calculate() [3/3]

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 40 of file TrackerIsolationPt.cc.

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

42  {
43  // initialize some variables
44  float isoPtLepton = 0;
45  const reco::Track *closestTrackDRPt = nullptr, *closestTrackDR = nullptr;
46  float closestDRPt = 10000, closestDR = 10000;
47  // use all these pointless vector conversions because the momenta from tracks
48  // are completely unusable; bah, these math-vectors are worthless!
49  CLHEP::HepLorentzVector lepton(theTrack.px(), theTrack.py(), theTrack.pz(), theTrack.p());
50  for (edm::View<reco::Track>::const_iterator itTrack = theTracks.begin(); itTrack != theTracks.end(); itTrack++) {
51  CLHEP::HepLorentzVector track(itTrack->px(), itTrack->py(), itTrack->pz(), itTrack->p());
52  float dR = lepton.deltaR(track);
53  if (dR < isoCone) {
54  isoPtLepton += track.perp();
55  // find the closest matching track
56  // FIXME: we could association by hits or chi2 to match
57  float pRatio = track.perp() / lepton.perp();
58  if (dR < closestDRPt && pRatio > 0.5 && pRatio < 1.5) {
59  closestDRPt = dR;
60  closestTrackDRPt = &*itTrack;
61  }
62  if (dR < closestDR) {
63  closestDR = dR;
64  closestTrackDR = &*itTrack;
65  }
66  }
67  }
68  if (closestTrackDRPt) {
69  GlobalVector closestTrackVector(closestTrackDRPt->px(), closestTrackDRPt->py(), closestTrackDRPt->pz());
70  isoPtLepton -= closestTrackVector.perp();
71  } else if (closestTrackDR) {
72  GlobalVector closestTrackVector(closestTrackDR->px(), closestTrackDR->py(), closestTrackDR->pz());
73  isoPtLepton -= closestTrackVector.perp();
74  }
75  // back to normal sum - S.L. 30/10/2007
76  if (isoPtLepton < 0)
77  isoPtLepton = 0;
78  // isoPtLepton <= 0.01 ? isoPtLepton = -1 : isoPtLepton = log(isoPtLepton);
79  return isoPtLepton;
80 }
T perp() const
Definition: PV3DBase.h:69
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:640
double p() const
momentum vector magnitude
Definition: TrackBase.h:631
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:643
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:646
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
const_iterator begin() const
const_iterator end() const