CMS 3D CMS Logo

VertexCompositePtrCandidate.h
Go to the documentation of this file.
1 #ifndef DataFormats_Candidate_VertexCompositePtrCandidate_H
2 #define DataFormats_Candidate_VertexCompositePtrCandidate_H
3 
14 
15 namespace reco {
17  public:
18  enum { dimension4D = 4 };
22  enum { size4D = dimension4D * (dimension4D + 1)/2 };
23 
27  int pdgId = 0, int status = 0, bool integerCharge = true) :
28  CompositePtrCandidate(q, p4, vtx, pdgId, status, integerCharge),
29  chi2_(0), ndof_(0), time_(0) { }
31  double time, int pdgId = 0, int status = 0,
32  bool integerCharge = true) :
33  CompositePtrCandidate(q, p4, vtx, pdgId, status, integerCharge),
34  chi2_(0), ndof_(0), time_(time) { }
37  const CovarianceMatrix & err, double chi2, double ndof,
38  int pdgId = 0, int status = 0, bool integerCharge = true);
39  VertexCompositePtrCandidate(Charge q, const LorentzVector & p4, const Point & vtx,
40  double time, const CovarianceMatrix4D & err, double chi2,
41  double ndof, int pdgId = 0, int status = 0,
42  bool integerCharge = true);
45  CompositePtrCandidate(p), chi2_(0), ndof_(0), time_(0) { }
48  CompositePtrCandidate(p), chi2_(0), ndof_(0), time_(0) { }
52  VertexCompositePtrCandidate * clone() const override;
53 
55  double vertexChi2() const override { return chi2_; }
62  double vertexNdof() const override { return ndof_; }
64  double vertexNormalizedChi2() const override { return chi2_ / ndof_; }
66  double vertexCovariance(int i, int j) const override {
67  return covariance_[idx(i, j)];
68  }
69  using reco::LeafCandidate::vertexCovariance; // avoid hiding the
71  CovarianceMatrix4D vertexCovariance4D() const { CovarianceMatrix4D m; fillVertexCovariance( m ); return m; }
72 
74  void fillVertexCovariance(CovarianceMatrix & v) const override;
76  void fillVertexCovariance( CovarianceMatrix4D & v ) const;
77 
79  void setChi2AndNdof(double chi2, double ndof) {
80  chi2_ = chi2; ndof_ = ndof;
81  }
83  void setCovariance(const CovarianceMatrix &m);
85  void setCovariance(const CovarianceMatrix4D &m);
86 
87  // set time
88  void setTime(double time) { time_ = time; }
89 
93  const Point & position() const {return vertex();}
94  double t() const { return time_; }
95  double tError() const { return std::sqrt( vertexCovariance(3,3) ); }
96  Error error() const { Error m; fillVertexCovariance( m ); return m; }
98  Error4D error4D() const { Error4D m; fillVertexCovariance( m ); return m; }
99 
100  private:
102  Double32_t chi2_;
104  Double32_t ndof_;
106  Double32_t covariance_[size4D];
108  Double32_t time_;
110  index idx(index i, index j) const {
111  int a = (i <= j ? i : j), b = (i <= j ? j : i);
112  return b * (b + 1)/2 + a;
113  }
114  };
115 
116 }
117 
118 #endif
int pdgId() const final
PDG identifier.
int Charge
electric charge type
Definition: Candidate.h:35
void fillVertexCovariance(CovarianceMatrix &v) const override
fill SMatrix
Double32_t ndof_
number of degrees of freedom
math::Error< dimension >::type Error
the following functions are implemented to have a more consistent interface with the one of reco::Ver...
ErrorD< N >::type type
Definition: Error.h:33
double vertexNormalizedChi2() const override
chi-squared divided by n.d.o.f.
VertexCompositePtrCandidate(Charge q, const LorentzVector &p4, const Point &vtx, double time, int pdgId=0, int status=0, bool integerCharge=true)
VertexCompositePtrCandidate * clone() const override
returns a clone of the candidate
VertexCompositePtrCandidate(const Candidate &p)
constructor from values
Error4D error4D() const
return SMatrix 4D
math::Error< dimension4D >::type CovarianceMatrix4D
covariance error matrix (3x3)
CovarianceMatrix vertexCovariance() const final
return SMatrix
T sqrt(T t)
Definition: SSEVec.h:18
double vertexCovariance(int i, int j) const override
(i, j)-th element of error matrix, i, j = 0, ... 3
const Point & vertex() const override
vertex position (overwritten by PF...)
index idx(index i, index j) const
position index
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:99
VertexCompositePtrCandidate(const CompositePtrCandidate &p)
constructor from values
double p() const final
magnitude of momentum vector
unsigned int index
index type
Definition: Candidate.h:51
double b
Definition: hdecay.h:120
math::Error< dimension4D >::type Error4D
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
fixed size matrix
double a
Definition: hdecay.h:121
void setCovariance(const CovarianceMatrix &m)
set covariance matrix
int status() const final
status word
math::XYZPoint Point
point in the space
Definition: Candidate.h:41
Double32_t covariance_[size4D]
covariance matrix (4x4) as vector
void setChi2AndNdof(double chi2, double ndof)
set chi2 and ndof
double vertexChi2() const override
chi-squares
CovarianceMatrix4D vertexCovariance4D() const
return SMatrix 4D
VertexCompositePtrCandidate(Charge q, const LorentzVector &p4, const Point &vtx, int pdgId=0, int status=0, bool integerCharge=true)
constructor from values