9 #include "CLHEP/Vector/LorentzVector.h" 40 float isoPtLepton = 0;
41 const reco::Track * closestTrackDRPt =
nullptr, * closestTrackDR =
nullptr;
42 float closestDRPt = 10000, closestDR = 10000;
45 CLHEP::HepLorentzVector lepton(theTrack.
px(), theTrack.
py(), theTrack.
pz(), theTrack.
p());
47 CLHEP::HepLorentzVector
track(itTrack->px(), itTrack->py(), itTrack->pz(), itTrack->p());
48 float dR = lepton.deltaR(
track);
50 isoPtLepton +=
track.perp();
53 float pRatio =
track.perp()/lepton.perp();
54 if (dR < closestDRPt && pRatio > 0.5 && pRatio < 1.5) {
56 closestTrackDRPt = &*itTrack;
60 closestTrackDR = &*itTrack;
64 if (closestTrackDRPt) {
65 GlobalVector closestTrackVector(closestTrackDRPt->
px(), closestTrackDRPt->
py(), closestTrackDRPt->
pz());
66 isoPtLepton -= closestTrackVector.
perp();
67 }
else if (closestTrackDR) {
68 GlobalVector closestTrackVector(closestTrackDR->px(), closestTrackDR->py(), closestTrackDR->pz());
69 isoPtLepton -= closestTrackVector.
perp();
72 if (isoPtLepton<0) isoPtLepton = 0;
double p() const
momentum vector magnitude
TrackerIsolationPt()
constructor
double px() const
x coordinate of momentum vector
reco::TrackRef track() const override
reference to Track reconstructed in the tracker only (reimplemented from reco::Muon) ...
virtual ~TrackerIsolationPt()
destructor
const_iterator begin() const
double pz() const
z coordinate of momentum vector
float calculate(const Electron &theElectron, const edm::View< reco::Track > &theTracks, float isoConeElectron=0.3) const
calculate the TrackIsoPt for the lepton object
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
const_iterator end() const
reco::GsfTrackRef gsfTrack() const override
override the reco::GsfElectron::gsfTrack method, to access the internal storage of the supercluster ...
double py() const
y coordinate of momentum vector