CMS 3D CMS Logo

ElectronSqPtTkIsolation.cc
Go to the documentation of this file.
1 //C++ includes
2 #include <vector>
3 #include <functional>
4 
5 //ROOT includes
6 #include <Math/VectorUtil.h>
7 
8 //CMSSW includes
16 
17 using namespace ROOT::Math::VectorUtil;
18 
20  double extRadius, double intRadius, double ptLow, double lip, const reco::TrackCollection* trackCollection)
21  : extRadius_(extRadius), intRadius_(intRadius), ptLow_(ptLow), lip_(lip), trackCollection_(trackCollection) {}
22 
24 
25 // unified acces to isolations
26 std::pair<int, double> ElectronSqPtTkIsolation::getIso(const reco::GsfElectron* electron) const {
27  int counter = 0;
28  double ptSum = 0.;
29  //Take the electron track
30  reco::GsfTrackRef tmpTrack = electron->gsfTrack();
31  math::XYZVector tmpElectronMomentumAtVtx = (*tmpTrack).momentum();
32 
33  for (reco::TrackCollection::const_iterator itrTr = (*trackCollection_).begin(); itrTr != (*trackCollection_).end();
34  ++itrTr) {
35  math::XYZVector tmpTrackMomentumAtVtx = (*itrTr).momentum();
36  double this_pt = (*itrTr).pt();
37  if (this_pt < ptLow_)
38  continue;
39  if (fabs((*itrTr).dz() - (*tmpTrack).dz()) > lip_)
40  continue;
41  double dr = DeltaR(tmpTrackMomentumAtVtx, tmpElectronMomentumAtVtx);
42  if (fabs(dr) < extRadius_ && fabs(dr) >= intRadius_) {
43  ++counter;
44  ptSum += this_pt * this_pt; // sum of squared pT
45  }
46  } //end loop over tracks
47 
48  std::pair<int, double> retval;
49  retval.first = counter;
50  retval.second = ptSum;
51 
52  return retval;
53 }
54 
56  //counter for the tracks in the isolation cone
57  return getIso(electron).first;
58 }
59 
ElectronSqPtTkIsolation::getNumberTracks
int getNumberTracks(const reco::GsfElectron *) const
Definition: ElectronSqPtTkIsolation.cc:55
counter
Definition: counter.py:1
ElectronSqPtTkIsolation::~ElectronSqPtTkIsolation
~ElectronSqPtTkIsolation()
Definition: ElectronSqPtTkIsolation.cc:23
ElectronSqPtTkIsolation.h
electronEcalRecHitIsolationLcone_cfi.extRadius
extRadius
Definition: electronEcalRecHitIsolationLcone_cfi.py:18
ElectronSqPtTkIsolation::lip_
double lip_
Definition: ElectronSqPtTkIsolation.h:32
edm::Ref< GsfTrackCollection >
qcdUeDQM_cfi.lip
lip
Definition: qcdUeDQM_cfi.py:25
ElectronSqPtTkIsolation::intRadius_
double intRadius_
Definition: ElectronSqPtTkIsolation.h:30
TrackFwd.h
metsig::electron
Definition: SignAlgoResolutions.h:48
ElectronSqPtTkIsolation::extRadius_
double extRadius_
Definition: ElectronSqPtTkIsolation.h:29
reco::GsfElectron
Definition: GsfElectron.h:35
duplicaterechits_cfi.trackCollection
trackCollection
Definition: duplicaterechits_cfi.py:4
math::XYZVector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
GsfTrack.h
counter
static std::atomic< unsigned int > counter
Definition: SharedResourceNames.cc:15
electronAnalyzer_cfi.DeltaR
DeltaR
Definition: electronAnalyzer_cfi.py:33
Trajectory.h
electronHcalTowerIsolationLcone_cfi.intRadius
intRadius
Definition: electronHcalTowerIsolationLcone_cfi.py:5
flavorHistoryFilter_cfi.dr
dr
Definition: flavorHistoryFilter_cfi.py:37
GlobalVector.h
ElectronSqPtTkIsolation::getPtTracks
double getPtTracks(const reco::GsfElectron *) const
Definition: ElectronSqPtTkIsolation.cc:60
TrajectoryStateTransform.h
ElectronSqPtTkIsolation::ElectronSqPtTkIsolation
ElectronSqPtTkIsolation(double extRadius, double intRadius, double ptLow, double lip, const reco::TrackCollection *)
Definition: ElectronSqPtTkIsolation.cc:19
ElectronSqPtTkIsolation::ptLow_
double ptLow_
Definition: ElectronSqPtTkIsolation.h:31
GlobalPoint.h
ElectronSqPtTkIsolation::getIso
std::pair< int, double > getIso(const reco::GsfElectron *) const
Definition: ElectronSqPtTkIsolation.cc:26
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14