CMS 3D CMS Logo

ElectronTkIsolation.cc
Go to the documentation of this file.
1 //*****************************************************************************
2 // File: ElectronTkIsolation.cc
3 // ----------------------------------------------------------------------------
4 // OrigAuth: Matthias Mozer
5 // Institute: IIHE-VUB
6 //=============================================================================
7 //*****************************************************************************
8 
11 
12 #include <Math/VectorUtil.h>
13 
15  double intRadiusBarrel,
16  double intRadiusEndcap,
17  double stripBarrel,
18  double stripEndcap,
19  double ptLow,
20  double lip,
21  double drb,
23  reco::TrackBase::Point beamPoint,
24  const std::string& dzOptionString)
25  : extRadius_(extRadius),
26  intRadiusBarrel_(intRadiusBarrel),
27  intRadiusEndcap_(intRadiusEndcap),
28  stripBarrel_(stripBarrel),
29  stripEndcap_(stripEndcap),
30  ptLow_(ptLow),
31  lip_(lip),
32  drb_(drb),
33  trackCollection_(trackCollection),
34  beamPoint_(beamPoint) {
36  setDzOption(dzOptionString);
37 }
38 
40 
41 std::pair<int, double> ElectronTkIsolation::getIso(const reco::GsfElectron* electron) const {
42  return getIso(&(*(electron->gsfTrack())));
43 }
44 
45 // unified acces to isolations
46 std::pair<int, double> ElectronTkIsolation::getIso(const reco::Track* tmpTrack) const {
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 }
99 
101  //counter for the tracks in the isolation cone
102  return getIso(electron).first;
103 }
104 
106 
108  int algo = trk.algo();
109  bool rejAlgo = std::binary_search(algosToReject_.begin(), algosToReject_.end(), algo);
110  return rejAlgo == false;
111 }
112 
115  std::sort(algosToReject_.begin(), algosToReject_.end());
116 }
egammaisolation::EgammaTrackSelector::vz
Definition: EgammaTrackSelector.h:20
counter
Definition: counter.py:1
egammaisolation::EgammaTrackSelector::vtx
Definition: EgammaTrackSelector.h:20
ElectronTkIsolation::intRadiusBarrel_
double intRadiusBarrel_
Definition: ElectronTkIsolation.h:106
electronTrackIsolationLcone_cfi.stripEndcap
stripEndcap
Definition: electronTrackIsolationLcone_cfi.py:9
ElectronTkIsolation::~ElectronTkIsolation
~ElectronTkIsolation()
Definition: ElectronTkIsolation.cc:39
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
electronEcalRecHitIsolationLcone_cfi.extRadius
extRadius
Definition: electronEcalRecHitIsolationLcone_cfi.py:16
electronEcalRecHitIsolationLcone_cfi.intRadiusBarrel
intRadiusBarrel
Definition: electronEcalRecHitIsolationLcone_cfi.py:13
qcdUeDQM_cfi.lip
lip
Definition: qcdUeDQM_cfi.py:25
cmsdt::algo
algo
Definition: constants.h:171
reco::TrackBase::jetCoreRegionalStep
Definition: TrackBase.h:101
ElectronTkIsolation::lip_
double lip_
Definition: ElectronTkIsolation.h:111
TrackSplittingMonitor_cfi.dzCut
dzCut
Definition: TrackSplittingMonitor_cfi.py:20
ElectronTkIsolation::algosToReject_
std::vector< int > algosToReject_
Definition: ElectronTkIsolation.h:113
reco::Track
Definition: Track.h:27
ElectronTkIsolation::stripEndcap_
double stripEndcap_
Definition: ElectronTkIsolation.h:109
reco::GsfElectron
Definition: GsfElectron.h:35
ElectronTkIsolation::ElectronTkIsolation
ElectronTkIsolation(double extRadius, double intRadius, double ptLow, double lip, double drb, const reco::TrackCollection *trackCollection, reco::TrackBase::Point beamPoint)
Definition: ElectronTkIsolation.h:22
egammaisolation::EgammaTrackSelector::dz
Definition: EgammaTrackSelector.h:20
PixelPluginsPhase0_cfi.isBarrel
isBarrel
Definition: PixelPluginsPhase0_cfi.py:17
ElectronTkIsolation::stripBarrel_
double stripBarrel_
Definition: ElectronTkIsolation.h:108
electronTrackIsolationLcone_cfi.stripBarrel
stripBarrel
Definition: electronTrackIsolationLcone_cfi.py:8
ElectronTkIsolation::setAlgosToReject
void setAlgosToReject()
Definition: ElectronTkIsolation.cc:113
duplicaterechits_cfi.trackCollection
trackCollection
Definition: duplicaterechits_cfi.py:4
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
ElectronTkIsolation::intRadiusEndcap_
double intRadiusEndcap_
Definition: ElectronTkIsolation.h:107
math::XYZVector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
reco::TrackBase
Definition: TrackBase.h:62
GsfTrack.h
counter
static std::atomic< unsigned int > counter
Definition: SharedResourceNames.cc:18
ElectronTkIsolation::dzOption_
int dzOption_
Definition: ElectronTkIsolation.h:117
electronAnalyzer_cfi.DeltaR
DeltaR
Definition: electronAnalyzer_cfi.py:33
HPSPFTauProducerPuppi_cfi.electron
electron
Definition: HPSPFTauProducerPuppi_cfi.py:13
ElectronTkIsolation::getIso
std::pair< int, double > getIso(const reco::GsfElectron *) const
Definition: ElectronTkIsolation.cc:41
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
reco::TrackBase::vertex
const Point & vertex() const
reference point on the track. This method is DEPRECATED, please use referencePoint() instead
Definition: TrackBase.h:676
electronEcalRecHitIsolationLcone_cfi.intRadiusEndcap
intRadiusEndcap
Definition: electronEcalRecHitIsolationLcone_cfi.py:14
reco::TrackBase::Point
math::XYZPoint Point
point in the space
Definition: TrackBase.h:80
reco::TrackBase::algo
TrackAlgorithm algo() const
Definition: TrackBase.h:547
ElectronTkIsolation::ptLow_
double ptLow_
Definition: ElectronTkIsolation.h:110
ElectronTkIsolation::setDzOption
void setDzOption(const std::string &s)
Definition: ElectronTkIsolation.h:84
ElectronTkIsolation::drb_
double drb_
Definition: ElectronTkIsolation.h:112
electronHcalTowerIsolationLcone_cfi.intRadius
intRadius
Definition: electronHcalTowerIsolationLcone_cfi.py:5
flavorHistoryFilter_cfi.dr
dr
Definition: flavorHistoryFilter_cfi.py:37
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
egammaisolation::EgammaTrackSelector::bs
Definition: EgammaTrackSelector.h:20
ElectronTkIsolation::passAlgo
bool passAlgo(const reco::TrackBase &trk) const
Definition: ElectronTkIsolation.cc:107
ElectronTkIsolation.h
ElectronTkIsolation::getNumberTracks
int getNumberTracks(const reco::GsfElectron *) const
Definition: ElectronTkIsolation.cc:100
ElectronTkIsolation::beamPoint_
reco::TrackBase::Point beamPoint_
Definition: ElectronTkIsolation.h:115
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
ElectronTkIsolation::getPtTracks
double getPtTracks(const reco::GsfElectron *) const
Definition: ElectronTkIsolation.cc:105