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() [1/7]

TrackKinematics::TrackKinematics ( )

Definition at line 16 of file TrackKinematics.cc.

16 : n(0), sumWeights(0) {}

◆ TrackKinematics() [2/7]

TrackKinematics::TrackKinematics ( const std::vector< reco::Track > &  tracks)

Definition at line 18 of file TrackKinematics.cc.

References add(), and DiMuonV_cfg::tracks.

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)

◆ TrackKinematics() [3/7]

TrackKinematics::TrackKinematics ( const reco::TrackRefVector tracks)

Definition at line 23 of file TrackKinematics.cc.

References add(), and DiMuonV_cfg::tracks.

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)

◆ TrackKinematics() [4/7]

TrackKinematics::TrackKinematics ( const std::vector< reco::CandidatePtr > &  tracks)

Definition at line 28 of file TrackKinematics.cc.

References add(), and DiMuonV_cfg::tracks.

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)

◆ TrackKinematics() [5/7]

TrackKinematics::TrackKinematics ( const reco::CandidatePtrVector tracks)

Definition at line 33 of file TrackKinematics.cc.

References add(), and DiMuonV_cfg::tracks.

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)

◆ TrackKinematics() [6/7]

TrackKinematics::TrackKinematics ( const reco::Vertex vertex)

Definition at line 38 of file TrackKinematics.cc.

References add(), and bphysicsOniaDQM_cfi::vertex.

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)
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
Definition: Vertex.h:38

◆ TrackKinematics() [7/7]

reco::TrackKinematics::TrackKinematics ( const reco::VertexCompositePtrCandidate vertex)
inline

Definition at line 24 of file TrackKinematics.h.

25  : n(vertex.numberOfSourceCandidatePtrs()),
26  sumWeights(vertex.numberOfSourceCandidatePtrs()),
27  sum(vertex.p4()),
28  weightedSum(vertex.p4()) {}
math::XYZTLorentzVector weightedSum
math::XYZTLorentzVector sum

◆ ~TrackKinematics()

reco::TrackKinematics::~TrackKinematics ( )
inline

Definition at line 30 of file TrackKinematics.h.

30 {}

Member Function Documentation

◆ add() [1/3]

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

Definition at line 57 of file TrackKinematics.cc.

References n, reco::ParticleMasses::piPlus, sum, sumWeights, HLT_2024v12_cff::track, mps_merge::weight, and weightedSum.

Referenced by CombinedSVComputer::fillCommonVariables(), GhostTrackComputer::operator()(), CombinedSVComputer::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
Definition: weight.py:1
math::XYZTLorentzVector sum

◆ add() [2/3]

void TrackKinematics::add ( const reco::CandidatePtr track)

Definition at line 71 of file TrackKinematics.cc.

References n, sum, sumWeights, HLT_2024v12_cff::track, mps_merge::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
Definition: weight.py:1
math::XYZTLorentzVector sum

◆ add() [3/3]

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

Definition at line 35 of file TrackKinematics.h.

References add(), and HLT_2024v12_cff::track.

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

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

◆ numberOfTracks()

unsigned int reco::TrackKinematics::numberOfTracks ( ) const
inline

Definition at line 44 of file TrackKinematics.h.

References n.

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

44 { return n; }

◆ operator+()

TrackKinematics reco::TrackKinematics::operator+ ( const TrackKinematics other)
inline

Definition at line 38 of file TrackKinematics.h.

References filterCSVwithJSON::copy, and trackingPlots::other.

38  {
39  TrackKinematics copy = *this;
40  copy += other;
41  return copy;
42  }

◆ operator+=()

TrackKinematics & TrackKinematics::operator+= ( const TrackKinematics other)

Definition at line 48 of file TrackKinematics.cc.

References n, trackingPlots::other, 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

◆ sumOfWeights()

double reco::TrackKinematics::sumOfWeights ( ) const
inline

Definition at line 45 of file TrackKinematics.h.

References sumWeights.

45 { return sumWeights; }

◆ vectorSum()

const math::XYZTLorentzVector& reco::TrackKinematics::vectorSum ( ) const
inline

◆ weightedVectorSum()

const math::XYZTLorentzVector& reco::TrackKinematics::weightedVectorSum ( ) const
inline

Member Data Documentation

◆ n

unsigned int reco::TrackKinematics::n
private

Definition at line 51 of file TrackKinematics.h.

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

◆ sum

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

Definition at line 53 of file TrackKinematics.h.

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

◆ sumWeights

double reco::TrackKinematics::sumWeights
private

Definition at line 52 of file TrackKinematics.h.

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

◆ weightedSum

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

Definition at line 54 of file TrackKinematics.h.

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