CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
19 
21  double intRadius,
22  double ptLow,
23  double lip,
25  extRadius_(extRadius),
26  intRadius_(intRadius),
27  ptLow_(ptLow),
28  lip_(lip),
29  trackCollection_(trackCollection)
30 {
31 }
32 
34 {
35 }
36 
37 // unified acces to isolations
38 std::pair<int,double> ElectronSqPtTkIsolation::getIso(const reco::GsfElectron* electron) const
39 {
40  int counter =0 ;
41  double ptSum =0.;
42  //Take the electron track
43  reco::GsfTrackRef tmpTrack = electron->gsfTrack() ;
44  math::XYZVector tmpElectronMomentumAtVtx = (*tmpTrack).momentum () ;
45 
46  for ( reco::TrackCollection::const_iterator itrTr = (*trackCollection_).begin() ;
47  itrTr != (*trackCollection_).end() ;
48  ++itrTr )
49  {
50  math::XYZVector tmpTrackMomentumAtVtx = (*itrTr).momentum () ;
51  double this_pt = (*itrTr).pt();
52  if ( this_pt < ptLow_ )
53  continue ;
54  if (fabs( (*itrTr).dz() - (*tmpTrack).dz() ) > lip_ )
55  continue ;
56  double dr = DeltaR(tmpTrackMomentumAtVtx,tmpElectronMomentumAtVtx) ;
57  if ( fabs(dr) < extRadius_ &&
58  fabs(dr) >= intRadius_ )
59  {
60  ++counter ;
61  ptSum += this_pt*this_pt; // sum of squared pT
62  }
63  }//end loop over tracks
64 
65  std::pair<int,double> retval;
66  retval.first = counter;
67  retval.second = ptSum;
68 
69  return retval;
70 }
71 
72 
74 {
75  //counter for the tracks in the isolation cone
76  return getIso(electron).first ;
77 }
78 
80 {
81  return getIso(electron).second ;
82 }
double getPtTracks(const reco::GsfElectron *) const
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
std::pair< int, double > getIso(const reco::GsfElectron *) const
ElectronSqPtTkIsolation(double extRadius, double intRadius, double ptLow, double lip, const reco::TrackCollection *)
tuple trackCollection
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
static std::atomic< unsigned int > counter
int getNumberTracks(const reco::GsfElectron *) const
virtual GsfTrackRef gsfTrack() const
reference to a GsfTrack
Definition: GsfElectron.h:183