CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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)
 
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 : n(0), sumWeights(0) {}
TrackKinematics::TrackKinematics ( const std::vector< reco::Track > &  tracks)

Definition at line 18 of file TrackKinematics.cc.

References add().

18  : n(0), sumWeights(0) {
19  for (std::vector<Track>::const_iterator iter = tracks.begin(); iter != tracks.end(); iter++)
20  add(*iter);
21 }
void add(const reco::Track &track, double weight=1.0)
auto const & tracks
cannot be loose
TrackKinematics::TrackKinematics ( const reco::TrackRefVector tracks)

Definition at line 23 of file TrackKinematics.cc.

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

23  : n(0), sumWeights(0) {
24  for (TrackRefVector::const_iterator iter = tracks.begin(); iter != tracks.end(); iter++)
25  add(**iter);
26 }
void add(const reco::Track &track, double weight=1.0)
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:228
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:223
TrackKinematics::TrackKinematics ( const std::vector< reco::CandidatePtr > &  tracks)

Definition at line 28 of file TrackKinematics.cc.

References add().

28  : n(0), sumWeights(0) {
29  for (std::vector<CandidatePtr>::const_iterator iter = tracks.begin(); iter != tracks.end(); iter++)
30  add(*iter);
31 }
void add(const reco::Track &track, double weight=1.0)
auto const & tracks
cannot be loose
TrackKinematics::TrackKinematics ( const reco::CandidatePtrVector tracks)

Definition at line 33 of file TrackKinematics.cc.

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

33  : n(0), sumWeights(0) {
34  for (CandidatePtrVector::const_iterator iter = tracks.begin(); iter != tracks.end(); iter++)
35  add(*iter);
36 }
void add(const reco::Track &track, double weight=1.0)
const_iterator begin() const
Definition: PtrVector.h:144
const_iterator end() const
Definition: PtrVector.h:146
TrackKinematics::TrackKinematics ( const reco::Vertex vertex)

Definition at line 38 of file TrackKinematics.cc.

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

38  : n(0), sumWeights(0) {
39  bool hasRefittedTracks = vertex.hasRefittedTracks();
40  for (Vertex::trackRef_iterator iter = vertex.tracks_begin(); iter != vertex.tracks_end(); ++iter) {
41  if (hasRefittedTracks)
42  add(vertex.refittedTrack(*iter), vertex.trackWeight(*iter));
43  else
44  add(**iter, vertex.trackWeight(*iter));
45  }
46 }
void add(const reco::Track &track, double weight=1.0)
bool hasRefittedTracks() const
Checks whether refitted tracks are stored.
Definition: Vertex.h:181
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.h:110
float trackWeight(const TREF &r) const
returns the weight with which a Track has contributed to the vertex-fit.
Definition: Vertex.h:96
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.h:108
Track refittedTrack(const TrackBaseRef &track) const
Definition: Vertex.cc:91
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector&lt;TrackRef&gt;
Definition: Vertex.h:38
reco::TrackKinematics::TrackKinematics ( const reco::VertexCompositePtrCandidate vertex)
inline

Definition at line 24 of file TrackKinematics.h.

25  : n(vertex.numberOfSourceCandidatePtrs()),
27  sum(vertex.p4()),
28  weightedSum(vertex.p4()) {}
size_type numberOfSourceCandidatePtrs() const override
math::XYZTLorentzVector weightedSum
const LorentzVector & p4() const final
four-momentum Lorentz vector
math::XYZTLorentzVector sum
reco::TrackKinematics::~TrackKinematics ( )
inline

Definition at line 30 of file TrackKinematics.h.

30 {}

Member Function Documentation

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

Definition at line 57 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 CombinedSVComputer::fillCommonVariables(), GhostTrackComputer::operator()(), BoostedDoubleSVProducer::produce(), counter.Counter::register(), and TrackKinematics().

57  {
58  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> > vec;
59 
60  vec.SetPx(track.px());
61  vec.SetPy(track.py());
62  vec.SetPz(track.pz());
63  vec.SetM(ParticleMasses::piPlus);
64 
65  n++;
66  sumWeights += weight;
67  sum += vec;
68  weightedSum += weight * vec;
69 }
const double piPlus
Definition: ParticleMasses.h:9
math::XYZTLorentzVector weightedSum
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:640
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:646
int weight
Definition: histoStyle.py:51
math::XYZTLorentzVector sum
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:643
void TrackKinematics::add ( const reco::CandidatePtr track)

Definition at line 71 of file TrackKinematics.cc.

References n, sum, sumWeights, histoStyle::weight, and weightedSum.

Referenced by counter.Counter::register().

71  {
72  double weight = 1.0;
73 
74  n++;
75  sumWeights += weight;
76  sum += track->p4();
77  weightedSum += weight * track->p4();
78 }
math::XYZTLorentzVector weightedSum
int weight
Definition: histoStyle.py:51
math::XYZTLorentzVector sum
void reco::TrackKinematics::add ( const reco::TrackRef track,
double  weight = 1.0 
)
inline

Definition at line 35 of file TrackKinematics.h.

References add(), and histoStyle::weight.

Referenced by add(), and counter.Counter::register().

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

Definition at line 44 of file TrackKinematics.h.

References n.

Referenced by CombinedSVComputer::fillCommonVariables().

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

Definition at line 38 of file TrackKinematics.h.

References filterCSVwithJSON::copy.

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

Definition at line 48 of file TrackKinematics.cc.

References n, sum, sumWeights, and weightedSum.

48  {
49  n += other.n;
50  sumWeights += other.sumWeights;
51  sum += other.sum;
52  weightedSum += other.weightedSum;
53 
54  return *this;
55 }
math::XYZTLorentzVector weightedSum
math::XYZTLorentzVector sum
double reco::TrackKinematics::sumOfWeights ( ) const
inline

Definition at line 45 of file TrackKinematics.h.

References sumWeights.

45 { 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 51 of file TrackKinematics.h.

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

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

Definition at line 53 of file TrackKinematics.h.

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

double reco::TrackKinematics::sumWeights
private

Definition at line 52 of file TrackKinematics.h.

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

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

Definition at line 54 of file TrackKinematics.h.

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