CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ElectronTkIsolation Class Reference

#include <ElectronTkIsolation.h>

Public Member Functions

 ElectronTkIsolation (double extRadius, double intRadius, double ptLow, double lip, double drb, const reco::TrackCollection *trackCollection, reco::TrackBase::Point beamPoint)
 
 ElectronTkIsolation (double extRadius, double intRadiusBarrel, double intRadiusEndcap, double stripBarrel, double stripEndcap, double ptLow, double lip, double drb, const reco::TrackCollection *trackCollection, reco::TrackBase::Point beamPoint)
 
 ElectronTkIsolation (double extRadius, double intRadiusBarrel, double intRadiusEndcap, double stripBarrel, double stripEndcap, double ptLow, double lip, double drb, const reco::TrackCollection *, reco::TrackBase::Point beamPoint, const std::string &)
 
std::pair< int, double > getIso (const reco::GsfElectron *) const
 
std::pair< int, double > getIso (const reco::Track *) const
 
int getNumberTracks (const reco::GsfElectron *) const
 
double getPtTracks (const reco::GsfElectron *) const
 
void setDzOption (const std::string &s)
 
 ~ElectronTkIsolation ()
 

Private Member Functions

bool passAlgo (const reco::TrackBase &trk) const
 
void setAlgosToReject ()
 

Private Attributes

std::vector< int > algosToReject_
 
reco::TrackBase::Point beamPoint_
 
double drb_
 
int dzOption_
 
double extRadius_
 
double intRadiusBarrel_
 
double intRadiusEndcap_
 
double lip_
 
double ptLow_
 
double stripBarrel_
 
double stripEndcap_
 
const reco::TrackCollectiontrackCollection_
 

Detailed Description

Definition at line 27 of file ElectronTkIsolation.h.

Constructor & Destructor Documentation

ElectronTkIsolation::ElectronTkIsolation ( double  extRadius,
double  intRadius,
double  ptLow,
double  lip,
double  drb,
const reco::TrackCollection trackCollection,
reco::TrackBase::Point  beamPoint 
)
inline

Definition at line 31 of file ElectronTkIsolation.h.

References setAlgosToReject(), and setDzOption().

Referenced by ElectronTkIsolation().

37  :
41  stripBarrel_(0.0),
42  stripEndcap_(0.0),
43  ptLow_(ptLow),
44  lip_(lip),
45  drb_(drb),
47  beamPoint_(beamPoint) {
49  setDzOption("vz");
50 
51  }
void setDzOption(const std::string &s)
const reco::TrackCollection * trackCollection_
reco::TrackBase::Point beamPoint_
ElectronTkIsolation::ElectronTkIsolation ( double  extRadius,
double  intRadiusBarrel,
double  intRadiusEndcap,
double  stripBarrel,
double  stripEndcap,
double  ptLow,
double  lip,
double  drb,
const reco::TrackCollection trackCollection,
reco::TrackBase::Point  beamPoint 
)
inline

Definition at line 53 of file ElectronTkIsolation.h.

References ElectronTkIsolation(), electronEcalRecHitIsolationLcone_cfi::extRadius, electronEcalRecHitIsolationLcone_cfi::intRadiusBarrel, electronEcalRecHitIsolationLcone_cfi::intRadiusEndcap, btvTracks_cfi::lip, setAlgosToReject(), setDzOption(), AlCaHLTBitMon_QueryRunRegistry::string, electronTrackIsolationLcone_cfi::stripBarrel, electronTrackIsolationLcone_cfi::stripEndcap, and ~ElectronTkIsolation().

62  :
68  ptLow_(ptLow),
69  lip_(lip),
70  drb_(drb),
72  beamPoint_(beamPoint) {
74  setDzOption("vz");
75 
76  }
void setDzOption(const std::string &s)
const reco::TrackCollection * trackCollection_
reco::TrackBase::Point beamPoint_
ElectronTkIsolation::ElectronTkIsolation ( double  extRadius,
double  intRadiusBarrel,
double  intRadiusEndcap,
double  stripBarrel,
double  stripEndcap,
double  ptLow,
double  lip,
double  drb,
const reco::TrackCollection trackCollection,
reco::TrackBase::Point  beamPoint,
const std::string &  dzOptionString 
)

Definition at line 26 of file ElectronTkIsolation.cc.

References setAlgosToReject(), and setDzOption().

36  :
42  ptLow_(ptLow),
43  lip_(lip),
44  drb_(drb),
46  beamPoint_(beamPoint)
47 {
49  setDzOption(dzOptionString);
50 }
void setDzOption(const std::string &s)
const reco::TrackCollection * trackCollection_
reco::TrackBase::Point beamPoint_
ElectronTkIsolation::~ElectronTkIsolation ( )

Definition at line 52 of file ElectronTkIsolation.cc.

Referenced by ElectronTkIsolation().

53 {}

Member Function Documentation

std::pair< int, double > ElectronTkIsolation::getIso ( const reco::GsfElectron electron) const

Definition at line 55 of file ElectronTkIsolation.cc.

References reco::GsfElectron::gsfTrack().

Referenced by getNumberTracks(), getPtTracks(), EgammaHLTElectronTrackIsolationProducers::produce(), and setDzOption().

55  {
56  return getIso(&(*(electron->gsfTrack())));
57 }
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:185
std::pair< int, double > getIso(const reco::GsfElectron *) const
std::pair< int, double > ElectronTkIsolation::getIso ( const reco::Track tmpTrack) const

Definition at line 60 of file ElectronTkIsolation.cc.

References funct::abs(), beamPoint_, egammaisolation::EgammaTrackSelector::bs, counter, HiRegitMuonDetachedTripletStep_cff::DeltaR, runTauDisplay::dr, drb_, egammaisolation::EgammaTrackSelector::dz, pfChMet_cfi::dzCut, dzOption_, electronHcalTowerIsolationLcone_cfi::intRadius, intRadiusBarrel_, intRadiusEndcap_, gedGsfElectrons_cfi::isBarrel, lip_, passAlgo(), ptLow_, digi_MixPreMix_cfi::strip, stripBarrel_, stripEndcap_, reco::TrackBase::vertex(), egammaisolation::EgammaTrackSelector::vtx, and egammaisolation::EgammaTrackSelector::vz.

61 {
62  int counter =0 ;
63  double ptSum =0.;
64  //Take the electron track
65  //reco::GsfTrackRef tmpTrack = electron->gsfTrack() ;
66  math::XYZVector tmpElectronMomentumAtVtx = (*tmpTrack).momentum () ;
67  double tmpElectronEtaAtVertex = (*tmpTrack).eta();
68 
69 
70  for ( reco::TrackCollection::const_iterator itrTr = (*trackCollection_).begin() ;
71  itrTr != (*trackCollection_).end() ;
72  ++itrTr ) {
73 
74  double this_pt = (*itrTr).pt();
75  if ( this_pt < ptLow_ ) continue;
76 
77 
78  double dzCut = 0;
79  switch( dzOption_ ) {
80  case egammaisolation::EgammaTrackSelector::dz : dzCut = fabs( (*itrTr).dz() - (*tmpTrack).dz() ); break;
81  case egammaisolation::EgammaTrackSelector::vz : dzCut = fabs( (*itrTr).vz() - (*tmpTrack).vz() ); break;
82  case egammaisolation::EgammaTrackSelector::bs : dzCut = fabs( (*itrTr).dz(beamPoint_) - (*tmpTrack).dz(beamPoint_) ); break;
83  case egammaisolation::EgammaTrackSelector::vtx: dzCut = fabs( (*itrTr).dz(tmpTrack->vertex()) ); break;
84  default : dzCut = fabs( (*itrTr).vz() - (*tmpTrack).vz() ); break;
85  }
86  if (dzCut > lip_ ) continue;
87  if (fabs( (*itrTr).dxy(beamPoint_) ) > drb_ ) continue;
88  double dr = ROOT::Math::VectorUtil::DeltaR(itrTr->momentum(),tmpElectronMomentumAtVtx) ;
89  double deta = (*itrTr).eta() - tmpElectronEtaAtVertex;
90  bool isBarrel = std::abs(tmpElectronEtaAtVertex) < 1.479;
91  double intRadius = isBarrel ? intRadiusBarrel_ : intRadiusEndcap_;
92  double strip = isBarrel ? stripBarrel_ : stripEndcap_;
93  if(dr < extRadius_ && dr>=intRadius && std::abs(deta) >=strip && passAlgo(*itrTr)){
94 
95  ++counter ;
96  ptSum += this_pt;
97  }
98 
99  }//end loop over tracks
100 
101  std::pair<int,double> retval;
102  retval.first = counter;
103  retval.second = ptSum;
104 
105  return retval;
106 }
bool passAlgo(const reco::TrackBase &trk) const
const Point & vertex() const
reference point on the track. This method is DEPRECATED, please use referencePoint() instead ...
Definition: TrackBase.h:687
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
static std::atomic< unsigned int > counter
reco::TrackBase::Point beamPoint_
int ElectronTkIsolation::getNumberTracks ( const reco::GsfElectron electron) const

Definition at line 109 of file ElectronTkIsolation.cc.

References getIso().

Referenced by EgammaElectronTkNumIsolationProducer::produce(), and setDzOption().

110 {
111  //counter for the tracks in the isolation cone
112  return getIso(electron).first ;
113 }
std::pair< int, double > getIso(const reco::GsfElectron *) const
double ElectronTkIsolation::getPtTracks ( const reco::GsfElectron electron) const

Definition at line 115 of file ElectronTkIsolation.cc.

References getIso().

Referenced by EgammaElectronTkIsolationProducer::produce(), and setDzOption().

116 {
117  return getIso(electron).second ;
118 }
std::pair< int, double > getIso(const reco::GsfElectron *) const
bool ElectronTkIsolation::passAlgo ( const reco::TrackBase trk) const
private

Definition at line 121 of file ElectronTkIsolation.cc.

References patPFMETCorrections_cff::algo, reco::TrackBase::algo(), and algosToReject_.

Referenced by getIso(), and setDzOption().

122 {
123  int algo = trk.algo();
124  bool rejAlgo=std::binary_search(algosToReject_.begin(),algosToReject_.end(),algo);
125  return rejAlgo==false;
126 }
TrackAlgorithm algo() const
Definition: TrackBase.h:497
std::vector< int > algosToReject_
void ElectronTkIsolation::setAlgosToReject ( )
private
void ElectronTkIsolation::setDzOption ( const std::string &  s)
inline

Member Data Documentation

std::vector<int> ElectronTkIsolation::algosToReject_
private

Definition at line 120 of file ElectronTkIsolation.h.

Referenced by passAlgo(), and setAlgosToReject().

reco::TrackBase::Point ElectronTkIsolation::beamPoint_
private

Definition at line 122 of file ElectronTkIsolation.h.

Referenced by getIso().

double ElectronTkIsolation::drb_
private

Definition at line 119 of file ElectronTkIsolation.h.

Referenced by getIso().

int ElectronTkIsolation::dzOption_
private

Definition at line 124 of file ElectronTkIsolation.h.

Referenced by getIso(), and setDzOption().

double ElectronTkIsolation::extRadius_
private

Definition at line 112 of file ElectronTkIsolation.h.

double ElectronTkIsolation::intRadiusBarrel_
private

Definition at line 113 of file ElectronTkIsolation.h.

Referenced by getIso().

double ElectronTkIsolation::intRadiusEndcap_
private

Definition at line 114 of file ElectronTkIsolation.h.

Referenced by getIso().

double ElectronTkIsolation::lip_
private

Definition at line 118 of file ElectronTkIsolation.h.

Referenced by getIso().

double ElectronTkIsolation::ptLow_
private

Definition at line 117 of file ElectronTkIsolation.h.

Referenced by getIso().

double ElectronTkIsolation::stripBarrel_
private

Definition at line 115 of file ElectronTkIsolation.h.

Referenced by getIso().

double ElectronTkIsolation::stripEndcap_
private

Definition at line 116 of file ElectronTkIsolation.h.

Referenced by getIso().

const reco::TrackCollection* ElectronTkIsolation::trackCollection_
private

Definition at line 121 of file ElectronTkIsolation.h.