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  Charge q, const LorentzVector &p4, const Point &vtx, int pdgId = 0, int status = 0, bool integerCharge = true)
28  : CompositePtrCandidate(q, p4, vtx, pdgId, status, integerCharge), chi2_(0), ndof_(0), time_(0) {}
30  const LorentzVector &p4,
31  const Point &vtx,
32  double time,
33  int pdgId = 0,
34  int status = 0,
35  bool integerCharge = true)
36  : CompositePtrCandidate(q, p4, vtx, pdgId, status, integerCharge), chi2_(0), ndof_(0), time_(time) {}
39  const LorentzVector &p4,
40  const Point &vtx,
41  const CovarianceMatrix &err,
42  double chi2,
43  double ndof,
44  int pdgId = 0,
45  int status = 0,
46  bool integerCharge = true);
48  const LorentzVector &p4,
49  const Point &vtx,
50  double time,
51  const CovarianceMatrix4D &err,
52  double chi2,
53  double ndof,
54  int pdgId = 0,
55  int status = 0,
56  bool integerCharge = true);
61  : CompositePtrCandidate(p), chi2_(0), ndof_(0), time_(0) {}
65  VertexCompositePtrCandidate *clone() const override;
66 
68  double vertexChi2() const override { return chi2_; }
75  double vertexNdof() const override { return ndof_; }
77  double vertexNormalizedChi2() const override { return chi2_ / ndof_; }
79  double vertexCovariance(int i, int j) const override { return covariance_[idx(i, j)]; }
80  using reco::LeafCandidate::vertexCovariance; // avoid hiding the
85  return m;
86  }
87 
89  void fillVertexCovariance(CovarianceMatrix &v) const override;
92 
94  void setChi2AndNdof(double chi2, double ndof) {
95  chi2_ = chi2;
96  ndof_ = ndof;
97  }
99  void setCovariance(const CovarianceMatrix &m);
101  void setCovariance(const CovarianceMatrix4D &m);
102 
103  // set time
104  void setTime(double time) { time_ = time; }
105 
109  const Point &position() const { return vertex(); }
110  double t() const { return time_; }
111  double tError() const { return std::sqrt(vertexCovariance(3, 3)); }
112  Error error() const {
113  Error m;
115  return m;
116  }
118  Error4D error4D() const {
119  Error4D m;
121  return m;
122  }
123 
124  private:
126  Double32_t chi2_;
128  Double32_t ndof_;
130  Double32_t covariance_[size4D];
132  Double32_t time_;
134  index idx(index i, index j) const {
135  int a = (i <= j ? i : j), b = (i <= j ? j : i);
136  return b * (b + 1) / 2 + a;
137  }
138  };
139 
140 } // namespace reco
141 
142 #endif
VertexCompositePtrCandidate * clone() const override
returns a clone of the candidate
int Charge
electric charge type
Definition: Candidate.h:34
void fillVertexCovariance(CovarianceMatrix &v) const override
fill SMatrix
double vertexCovariance(int i, int j) const override
(i, j)-th element of error matrix, i, j = 0, ... 3
Double32_t ndof_
number of degrees of freedom
double vertexChi2() const override
chi-squares
math::Error< dimension >::type Error
the following functions are implemented to have a more consistent interface with the one of reco::Ver...
index idx(index i, index j) const
position index
int status() const final
status word
ErrorD< N >::type type
Definition: Error.h:32
Error4D error4D() const
return SMatrix 4D
const Point & vertex() const override
vertex position (overwritten by PF...)
VertexCompositePtrCandidate(Charge q, const LorentzVector &p4, const Point &vtx, double time, int pdgId=0, int status=0, bool integerCharge=true)
const LorentzVector & p4() const final
four-momentum Lorentz vector
int pdgId() const final
PDG identifier.
VertexCompositePtrCandidate(const Candidate &p)
constructor from values
double p() const final
magnitude of momentum vector
math::Error< dimension4D >::type CovarianceMatrix4D
covariance error matrix (3x3)
T sqrt(T t)
Definition: SSEVec.h:19
CovarianceMatrix4D vertexCovariance4D() const
return SMatrix 4D
double vertexNormalizedChi2() const override
chi-squared divided by n.d.o.f.
math::XYZTLorentzVector LorentzVector
VertexCompositePtrCandidate(const CompositePtrCandidate &p)
constructor from values
unsigned int index
index type
Definition: Candidate.h:50
CovarianceMatrix vertexCovariance() const final
return SMatrix
double b
Definition: hdecay.h:118
math::Error< dimension4D >::type Error4D
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
fixed size matrix
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:57
double a
Definition: hdecay.h:119
void setCovariance(const CovarianceMatrix &m)
set covariance matrix
Double32_t covariance_[size4D]
covariance matrix (4x4) as vector
void setChi2AndNdof(double chi2, double ndof)
set chi2 and ndof
int Charge
electric charge type
Definition: LeafCandidate.h:21
VertexCompositePtrCandidate(Charge q, const LorentzVector &p4, const Point &vtx, int pdgId=0, int status=0, bool integerCharge=true)
constructor from values