CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
reco::TrackKinematics Class Reference

#include <TrackKinematics.h>

Public Member Functions

void add (const reco::Track &track, double weight=1.0)
 
void add (const reco::CandidatePtr &track)
 
void add (const reco::TrackRef &track, double weight=1.0)
 
unsigned int numberOfTracks () const
 
TrackKinematics operator+ (const TrackKinematics &other)
 
TrackKinematicsoperator+= (const TrackKinematics &other)
 
double sumOfWeights () const
 
 TrackKinematics ()
 
 TrackKinematics (const std::vector< reco::Track > &tracks)
 
 TrackKinematics (const reco::TrackRefVector &tracks)
 
 TrackKinematics (const std::vector< reco::CandidatePtr > &tracks)
 
 TrackKinematics (const reco::CandidatePtrVector &tracks)
 
 TrackKinematics (const reco::Vertex &vertex)
 
 TrackKinematics (const reco::VertexCompositePtrCandidate &vertex)
 
const math::XYZTLorentzVectorvectorSum () const
 
const math::XYZTLorentzVectorweightedVectorSum () const
 
 ~TrackKinematics ()
 

Private Attributes

unsigned int n
 
math::XYZTLorentzVector sum
 
double sumWeights
 
math::XYZTLorentzVector weightedSum
 

Detailed Description

Definition at line 16 of file TrackKinematics.h.

Constructor & Destructor Documentation

TrackKinematics::TrackKinematics ( )

Definition at line 16 of file TrackKinematics.cc.

16  :
17  n(0), sumWeights(0)
18 {
19 }
TrackKinematics::TrackKinematics ( const std::vector< reco::Track > &  tracks)

Definition at line 21 of file TrackKinematics.cc.

References add().

21  :
22  n(0), sumWeights(0)
23 {
24  for(std::vector<Track>::const_iterator iter = tracks.begin();
25  iter != tracks.end(); iter++)
26  add(*iter);
27 }
void add(const reco::Track &track, double weight=1.0)
TrackKinematics::TrackKinematics ( const reco::TrackRefVector tracks)

Definition at line 29 of file TrackKinematics.cc.

References add(), edm::RefVector< C, T, F >::begin(), and edm::RefVector< C, T, F >::end().

29  :
30  n(0), sumWeights(0)
31 {
32  for(TrackRefVector::const_iterator iter = tracks.begin();
33  iter != tracks.end(); iter++)
34  add(**iter);
35 }
void add(const reco::Track &track, double weight=1.0)
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:253
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:248
TrackKinematics::TrackKinematics ( const std::vector< reco::CandidatePtr > &  tracks)

Definition at line 37 of file TrackKinematics.cc.

References add().

37  :
38  n(0), sumWeights(0)
39 {
40  for(std::vector<CandidatePtr>::const_iterator iter = tracks.begin();
41  iter != tracks.end(); iter++)
42  add(*iter);
43 }
void add(const reco::Track &track, double weight=1.0)
TrackKinematics::TrackKinematics ( const reco::CandidatePtrVector tracks)

Definition at line 45 of file TrackKinematics.cc.

References add(), edm::PtrVector< T >::begin(), and edm::PtrVector< T >::end().

45  :
46  n(0), sumWeights(0)
47 {
48  for(CandidatePtrVector::const_iterator iter = tracks.begin();
49  iter != tracks.end(); iter++)
50  add(*iter);
51 }
void add(const reco::Track &track, double weight=1.0)
const_iterator begin() const
Definition: PtrVector.h:129
const_iterator end() const
Definition: PtrVector.h:134
TrackKinematics::TrackKinematics ( const reco::Vertex vertex)

Definition at line 53 of file TrackKinematics.cc.

References add(), reco::Vertex::hasRefittedTracks(), reco::Vertex::refittedTrack(), reco::Vertex::tracks_begin(), reco::Vertex::tracks_end(), and reco::Vertex::trackWeight().

53  :
54  n(0), sumWeights(0)
55 {
56  bool hasRefittedTracks = vertex.hasRefittedTracks();
57  for(Vertex::trackRef_iterator iter = vertex.tracks_begin();
58  iter != vertex.tracks_end(); ++iter) {
59  if (hasRefittedTracks)
60  add(vertex.refittedTrack(*iter),
61  vertex.trackWeight(*iter));
62  else
63  add(**iter, vertex.trackWeight(*iter));
64  }
65 }
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.cc:81
void add(const reco::Track &track, double weight=1.0)
Track refittedTrack(const TrackBaseRef &track) const
bool hasRefittedTracks() const
Checks whether refitted tracks are stored.
Definition: Vertex.h:149
float trackWeight(const TREF &r) const
returns the weight with which a Track has contributed to the vertex-fit.
Definition: Vertex.h:81
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
Definition: Vertex.h:37
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.cc:76
reco::TrackKinematics::TrackKinematics ( const reco::VertexCompositePtrCandidate vertex)
inline

Definition at line 24 of file TrackKinematics.h.

24  :
26  sum(vertex.p4()),weightedSum(vertex.p4()){}
math::XYZTLorentzVector weightedSum
size_type numberOfSourceCandidatePtrs() const override
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:99
math::XYZTLorentzVector sum
reco::TrackKinematics::~TrackKinematics ( )
inline

Definition at line 28 of file TrackKinematics.h.

References add(), and HiIsolationCommonParameters_cff::track.

28 {}

Member Function Documentation

void TrackKinematics::add ( const reco::Track track,
double  weight = 1.0 
)

Definition at line 77 of file TrackKinematics.cc.

References n, reco::ParticleMasses::piPlus, reco::TrackBase::px(), reco::TrackBase::py(), reco::TrackBase::pz(), sum, sumWeights, mps_merge::weight, and weightedSum.

Referenced by add(), CombinedSVComputer::fillCommonVariables(), GhostTrackComputer::GhostTrackComputer(), GhostTrackComputer::operator()(), CombinedSVComputer::operator()(), BoostedDoubleSVProducer::produce(), counter.Counter::register(), TrackKinematics(), reco::GhostTrackVertexFinder::vertexFitter(), and ~TrackKinematics().

78 {
79  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> > vec;
80 
81  vec.SetPx(track.px());
82  vec.SetPy(track.py());
83  vec.SetPz(track.pz());
84  vec.SetM(ParticleMasses::piPlus);
85 
86  n++;
87  sumWeights += weight;
88  sum += vec;
89  weightedSum += weight * vec;
90 }
const double piPlus
Definition: ParticleMasses.h:9
math::XYZTLorentzVector weightedSum
Definition: weight.py:1
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:627
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:639
math::XYZTLorentzVector sum
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:633
void TrackKinematics::add ( const reco::CandidatePtr track)

Definition at line 92 of file TrackKinematics.cc.

References n, reco::Candidate::p4(), sum, sumWeights, mps_merge::weight, and weightedSum.

Referenced by counter.Counter::register().

93 {
94  double weight = 1.0;
95 
96  n++;
97  sumWeights += weight;
98  sum += track->p4();
99  weightedSum += weight * track->p4();
100 }
math::XYZTLorentzVector weightedSum
Definition: weight.py:1
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
math::XYZTLorentzVector sum
void reco::TrackKinematics::add ( const reco::TrackRef track,
double  weight = 1.0 
)
inline

Definition at line 34 of file TrackKinematics.h.

References add(), operator+=(), and trackingPlots::other.

Referenced by counter.Counter::register().

35  {return add(*track, weight); }
void add(const reco::Track &track, double weight=1.0)
Definition: weight.py:1
unsigned int reco::TrackKinematics::numberOfTracks ( ) const
inline

Definition at line 41 of file TrackKinematics.h.

References n.

Referenced by CombinedSVComputer::fillCommonVariables(), and GhostTrackComputer::operator()().

41 { return n; }
TrackKinematics reco::TrackKinematics::operator+ ( const TrackKinematics other)
inline

Definition at line 38 of file TrackKinematics.h.

References popcon2dropbox::copy(), and trackingPlots::other.

39  { TrackKinematics copy = *this; copy += other; return copy; }
TrackKinematics & TrackKinematics::operator+= ( const TrackKinematics other)

Definition at line 67 of file TrackKinematics.cc.

References n, sum, sumWeights, and weightedSum.

Referenced by add().

68 {
69  n += other.n;
70  sumWeights += other.sumWeights;
71  sum += other.sum;
72  weightedSum += other.weightedSum;
73 
74  return *this;
75 }
math::XYZTLorentzVector weightedSum
math::XYZTLorentzVector sum
double reco::TrackKinematics::sumOfWeights ( ) const
inline

Definition at line 42 of file TrackKinematics.h.

References sumWeights.

42 { return sumWeights; }
const math::XYZTLorentzVector& reco::TrackKinematics::vectorSum ( ) const
inline
const math::XYZTLorentzVector& reco::TrackKinematics::weightedVectorSum ( ) const
inline

Member Data Documentation

unsigned int reco::TrackKinematics::n
private

Definition at line 50 of file TrackKinematics.h.

Referenced by add(), numberOfTracks(), and operator+=().

math::XYZTLorentzVector reco::TrackKinematics::sum
private

Definition at line 52 of file TrackKinematics.h.

Referenced by add(), operator+=(), and vectorSum().

double reco::TrackKinematics::sumWeights
private

Definition at line 51 of file TrackKinematics.h.

Referenced by add(), operator+=(), and sumOfWeights().

math::XYZTLorentzVector reco::TrackKinematics::weightedSum
private

Definition at line 53 of file TrackKinematics.h.

Referenced by add(), operator+=(), and weightedVectorSum().