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 19 of file ElectronTkIsolation.h.

Constructor & Destructor Documentation

◆ ElectronTkIsolation() [1/3]

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

Definition at line 22 of file ElectronTkIsolation.h.

References setAlgosToReject(), and setDzOption().

32  stripBarrel_(0.0),
33  stripEndcap_(0.0),
34  ptLow_(ptLow),
35  lip_(lip),
36  drb_(drb),
38  beamPoint_(beamPoint) {
40  setDzOption("vz");
41  }
void setDzOption(const std::string &s)
trackCollection
Definition: JetHT_cfg.py:51
const reco::TrackCollection * trackCollection_
reco::TrackBase::Point beamPoint_

◆ ElectronTkIsolation() [2/3]

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 43 of file ElectronTkIsolation.h.

References setAlgosToReject(), and setDzOption().

58  ptLow_(ptLow),
59  lip_(lip),
60  drb_(drb),
62  beamPoint_(beamPoint) {
64  setDzOption("vz");
65  }
void setDzOption(const std::string &s)
trackCollection
Definition: JetHT_cfg.py:51
const reco::TrackCollection * trackCollection_
reco::TrackBase::Point beamPoint_

◆ ElectronTkIsolation() [3/3]

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 14 of file ElectronTkIsolation.cc.

References setAlgosToReject(), and setDzOption().

30  ptLow_(ptLow),
31  lip_(lip),
32  drb_(drb),
34  beamPoint_(beamPoint) {
36  setDzOption(dzOptionString);
37 }
void setDzOption(const std::string &s)
trackCollection
Definition: JetHT_cfg.py:51
const reco::TrackCollection * trackCollection_
reco::TrackBase::Point beamPoint_

◆ ~ElectronTkIsolation()

ElectronTkIsolation::~ElectronTkIsolation ( )

Definition at line 39 of file ElectronTkIsolation.cc.

39 {}

Member Function Documentation

◆ getIso() [1/2]

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

Definition at line 41 of file ElectronTkIsolation.cc.

References HPSPFTauProducerPuppi_cfi::electron.

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

41  {
42  return getIso(&(*(electron->gsfTrack())));
43 }
std::pair< int, double > getIso(const reco::GsfElectron *) const

◆ getIso() [2/2]

std::pair< int, double > ElectronTkIsolation::getIso ( const reco::Track tmpTrack) const

Definition at line 46 of file ElectronTkIsolation.cc.

References funct::abs(), beamPoint_, egammaisolation::EgammaTrackSelector::bs, counter, electronAnalyzer_cfi::DeltaR, l1ctLayer1_cff::dr, drb_, egammaisolation::EgammaTrackSelector::dz, TrackSplittingMonitor_cfi::dzCut, dzOption_, electronHcalTowerIsolationLcone_cfi::intRadius, intRadiusBarrel_, intRadiusEndcap_, PixelPluginsPhase0_cfi::isBarrel, lip_, passAlgo(), ptLow_, digitizers_cfi::strip, stripBarrel_, stripEndcap_, reco::TrackBase::vertex(), egammaisolation::EgammaTrackSelector::vtx, and egammaisolation::EgammaTrackSelector::vz.

46  {
47  int counter = 0;
48  double ptSum = 0.;
49  //Take the electron track
50  math::XYZVector tmpElectronMomentumAtVtx = (*tmpTrack).momentum();
51  double tmpElectronEtaAtVertex = (*tmpTrack).eta();
52 
53  for (reco::TrackCollection::const_iterator itrTr = (*trackCollection_).begin(); itrTr != (*trackCollection_).end();
54  ++itrTr) {
55  double this_pt = (*itrTr).pt();
56  if (this_pt < ptLow_)
57  continue;
58 
59  double dzCut = 0;
60  switch (dzOption_) {
62  dzCut = fabs((*itrTr).dz() - (*tmpTrack).dz());
63  break;
65  dzCut = fabs((*itrTr).vz() - (*tmpTrack).vz());
66  break;
68  dzCut = fabs((*itrTr).dz(beamPoint_) - (*tmpTrack).dz(beamPoint_));
69  break;
71  dzCut = fabs((*itrTr).dz(tmpTrack->vertex()));
72  break;
73  default:
74  dzCut = fabs((*itrTr).vz() - (*tmpTrack).vz());
75  break;
76  }
77  if (dzCut > lip_)
78  continue;
79  if (fabs((*itrTr).dxy(beamPoint_)) > drb_)
80  continue;
81  double dr = ROOT::Math::VectorUtil::DeltaR(itrTr->momentum(), tmpElectronMomentumAtVtx);
82  double deta = (*itrTr).eta() - tmpElectronEtaAtVertex;
83  bool isBarrel = std::abs(tmpElectronEtaAtVertex) < 1.479;
86  if (dr < extRadius_ && dr >= intRadius && std::abs(deta) >= strip && passAlgo(*itrTr)) {
87  ++counter;
88  ptSum += this_pt;
89  }
90 
91  } //end loop over tracks
92 
93  std::pair<int, double> retval;
94  retval.first = counter;
95  retval.second = ptSum;
96 
97  return retval;
98 }
bool passAlgo(const reco::TrackBase &trk) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const Point & vertex() const
reference point on the track. This method is DEPRECATED, please use referencePoint() instead ...
Definition: TrackBase.h:676
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
static std::atomic< unsigned int > counter
reco::TrackBase::Point beamPoint_

◆ getNumberTracks()

int ElectronTkIsolation::getNumberTracks ( const reco::GsfElectron electron) const

Definition at line 100 of file ElectronTkIsolation.cc.

References HPSPFTauProducerPuppi_cfi::electron, and getIso().

100  {
101  //counter for the tracks in the isolation cone
102  return getIso(electron).first;
103 }
std::pair< int, double > getIso(const reco::GsfElectron *) const

◆ getPtTracks()

double ElectronTkIsolation::getPtTracks ( const reco::GsfElectron electron) const

Definition at line 105 of file ElectronTkIsolation.cc.

References HPSPFTauProducerPuppi_cfi::electron, and getIso().

Referenced by EgammaElectronTkIsolationProducer::produce().

105 { return getIso(electron).second; }
std::pair< int, double > getIso(const reco::GsfElectron *) const

◆ passAlgo()

bool ElectronTkIsolation::passAlgo ( const reco::TrackBase trk) const
private

Definition at line 107 of file ElectronTkIsolation.cc.

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

Referenced by getIso().

107  {
108  int algo = trk.algo();
109  bool rejAlgo = std::binary_search(algosToReject_.begin(), algosToReject_.end(), algo);
110  //check also the originalAlgo in case the track is reconstructed by more than one
111  algo = trk.originalAlgo();
112  //reject only if both algo and originalAlgo are not acceptable
113  rejAlgo &= std::binary_search(algosToReject_.begin(), algosToReject_.end(), algo);
114  return !rejAlgo;
115 }
TrackAlgorithm originalAlgo() const
Definition: TrackBase.h:548
std::vector< int > algosToReject_
TrackAlgorithm algo() const
Definition: TrackBase.h:547

◆ setAlgosToReject()

void ElectronTkIsolation::setAlgosToReject ( )
private

◆ setDzOption()

void ElectronTkIsolation::setDzOption ( const std::string &  s)
inline

Member Data Documentation

◆ algosToReject_

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

Definition at line 113 of file ElectronTkIsolation.h.

Referenced by passAlgo(), and setAlgosToReject().

◆ beamPoint_

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

Definition at line 115 of file ElectronTkIsolation.h.

Referenced by getIso().

◆ drb_

double ElectronTkIsolation::drb_
private

Definition at line 112 of file ElectronTkIsolation.h.

Referenced by getIso().

◆ dzOption_

int ElectronTkIsolation::dzOption_
private

Definition at line 117 of file ElectronTkIsolation.h.

Referenced by getIso(), and setDzOption().

◆ extRadius_

double ElectronTkIsolation::extRadius_
private

Definition at line 105 of file ElectronTkIsolation.h.

◆ intRadiusBarrel_

double ElectronTkIsolation::intRadiusBarrel_
private

Definition at line 106 of file ElectronTkIsolation.h.

Referenced by getIso().

◆ intRadiusEndcap_

double ElectronTkIsolation::intRadiusEndcap_
private

Definition at line 107 of file ElectronTkIsolation.h.

Referenced by getIso().

◆ lip_

double ElectronTkIsolation::lip_
private

Definition at line 111 of file ElectronTkIsolation.h.

Referenced by getIso().

◆ ptLow_

double ElectronTkIsolation::ptLow_
private

Definition at line 110 of file ElectronTkIsolation.h.

Referenced by getIso().

◆ stripBarrel_

double ElectronTkIsolation::stripBarrel_
private

Definition at line 108 of file ElectronTkIsolation.h.

Referenced by getIso().

◆ stripEndcap_

double ElectronTkIsolation::stripEndcap_
private

Definition at line 109 of file ElectronTkIsolation.h.

Referenced by getIso().

◆ trackCollection_

const reco::TrackCollection* ElectronTkIsolation::trackCollection_
private

Definition at line 114 of file ElectronTkIsolation.h.