CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
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 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 14 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)
tuple tracks
Definition: testEve_cfg.py:39
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:255
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:250
TrackKinematics::TrackKinematics ( const reco::Vertex vertex)

Definition at line 37 of file TrackKinematics.cc.

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

37  :
38  n(0), sumWeights(0)
39 {
40  bool hasRefittedTracks = vertex.hasRefittedTracks();
41  for(Vertex::trackRef_iterator iter = vertex.tracks_begin();
42  iter != vertex.tracks_end(); ++iter) {
43  if (hasRefittedTracks)
44  add(vertex.refittedTrack(*iter),
45  vertex.trackWeight(*iter));
46  else
47  add(**iter, vertex.trackWeight(*iter));
48  }
49 }
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.cc:44
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:134
float trackWeight(const TrackBaseRef &r) const
returns the weight with which a Track has contributed to the vertex-fit.
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector&lt;TrackRef&gt;
Definition: Vertex.h:37
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.cc:39
reco::TrackKinematics::TrackKinematics ( const reco::VertexCompositePtrCandidate vertex)
inline

Definition at line 20 of file TrackKinematics.h.

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

Definition at line 24 of file TrackKinematics.h.

24 {}

Member Function Documentation

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

Definition at line 61 of file TrackKinematics.cc.

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

Referenced by CandidateBoostedDoubleSecondaryVertexComputer::discriminator(), CombinedSVComputer::fillCommonVariables(), counter.Counter::register(), GhostTrackComputer::threshTrack(), TrackKinematics(), and CandidateBoostedDoubleSecondaryVertexComputer::vertexKinematics().

62 {
63  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> > vec;
64 
65  vec.SetPx(track.px());
66  vec.SetPy(track.py());
67  vec.SetPz(track.pz());
68  vec.SetM(ParticleMasses::piPlus);
69 
70  n++;
71  sumWeights += weight;
72  sum += vec;
73  weightedSum += weight * vec;
74 }
const double piPlus
Definition: ParticleMasses.h:9
math::XYZTLorentzVector weightedSum
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:580
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:592
int weight
Definition: histoStyle.py:50
math::XYZTLorentzVector sum
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:586
unsigned int reco::TrackKinematics::numberOfTracks ( ) const
inline

Definition at line 32 of file TrackKinematics.h.

References n.

Referenced by CombinedSVComputer::fillCommonVariables().

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

Definition at line 29 of file TrackKinematics.h.

References filterCSVwithJSON::copy.

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

Definition at line 51 of file TrackKinematics.cc.

References n, sum, sumWeights, and weightedSum.

52 {
53  n += other.n;
54  sumWeights += other.sumWeights;
55  sum += other.sum;
56  weightedSum += other.weightedSum;
57 
58  return *this;
59 }
math::XYZTLorentzVector weightedSum
math::XYZTLorentzVector sum
double reco::TrackKinematics::sumOfWeights ( ) const
inline

Definition at line 33 of file TrackKinematics.h.

References sumWeights.

33 { 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 41 of file TrackKinematics.h.

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

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

Definition at line 43 of file TrackKinematics.h.

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

double reco::TrackKinematics::sumWeights
private

Definition at line 42 of file TrackKinematics.h.

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

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

Definition at line 44 of file TrackKinematics.h.

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