CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TrackKinematics.h
Go to the documentation of this file.
1 #ifndef RecoBTag_SecondaryVertex_TrackKinematics_h
2 #define RecoBTag_SecondaryVertex_TrackKinematics_h
3 
4 #include <vector>
5 
13 
14 namespace reco {
15 
17  public:
19  TrackKinematics(const std::vector<reco::Track> &tracks);
21  TrackKinematics(const std::vector<reco::CandidatePtr> &tracks);
23  TrackKinematics(const reco::Vertex &vertex);
25  : n(vertex.numberOfSourceCandidatePtrs()),
26  sumWeights(vertex.numberOfSourceCandidatePtrs()),
27  sum(vertex.p4()),
28  weightedSum(vertex.p4()) {}
29 
31 
32  void add(const reco::Track &track, double weight = 1.0);
33  void add(const reco::CandidatePtr &track);
34 
35  inline void add(const reco::TrackRef &track, double weight = 1.0) { return add(*track, weight); }
36 
38  inline TrackKinematics operator+(const TrackKinematics &other) {
39  TrackKinematics copy = *this;
40  copy += other;
41  return copy;
42  }
43 
44  inline unsigned int numberOfTracks() const { return n; }
45  inline double sumOfWeights() const { return sumWeights; }
46 
47  inline const math::XYZTLorentzVector &vectorSum() const { return sum; }
48  inline const math::XYZTLorentzVector &weightedVectorSum() const { return weightedSum; }
49 
50  private:
51  unsigned int n;
52  double sumWeights;
55  };
56 
57 } // namespace reco
58 
59 #endif // RecoBTag_SecondaryVertex_TrackKinematics_h
const math::XYZTLorentzVector & weightedVectorSum() const
math::XYZTLorentzVector weightedSum
TrackKinematics & operator+=(const TrackKinematics &other)
void add(const reco::Track &track, double weight=1.0)
auto const & tracks
cannot be loose
double sumOfWeights() const
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
unsigned int numberOfTracks() const
TrackKinematics operator+(const TrackKinematics &other)
const math::XYZTLorentzVector & vectorSum() const
int weight
Definition: histoStyle.py:51
math::XYZTLorentzVector sum
void add(const reco::TrackRef &track, double weight=1.0)
TrackKinematics(const reco::VertexCompositePtrCandidate &vertex)