Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:52:55

0001 #include "DataFormats/Candidate/interface/VertexCompositePtrCandidate.h"
0002 
0003 using namespace reco;
0004 
0005 VertexCompositePtrCandidate::VertexCompositePtrCandidate(Charge q,
0006                                                          const LorentzVector& p4,
0007                                                          const Point& vtx,
0008                                                          const CovarianceMatrix& err,
0009                                                          double chi2,
0010                                                          double ndof,
0011                                                          int pdgId,
0012                                                          int status,
0013                                                          bool integerCharge)
0014     : CompositePtrCandidate(q, p4, vtx, pdgId, status, integerCharge), chi2_(chi2), ndof_(ndof), time_(0.) {
0015   setCovariance(err);
0016 }
0017 
0018 VertexCompositePtrCandidate::VertexCompositePtrCandidate(Charge q,
0019                                                          const LorentzVector& p4,
0020                                                          const Point& vtx,
0021                                                          double time,
0022                                                          const CovarianceMatrix4D& err,
0023                                                          double chi2,
0024                                                          double ndof,
0025                                                          int pdgId,
0026                                                          int status,
0027                                                          bool integerCharge)
0028     : CompositePtrCandidate(q, p4, vtx, pdgId, status, integerCharge), chi2_(chi2), ndof_(ndof), time_(time) {
0029   setCovariance(err);
0030 }
0031 
0032 VertexCompositePtrCandidate::~VertexCompositePtrCandidate() {}
0033 
0034 VertexCompositePtrCandidate* VertexCompositePtrCandidate::clone() const {
0035   return new VertexCompositePtrCandidate(*this);
0036 }
0037 
0038 void VertexCompositePtrCandidate::fillVertexCovariance(CovarianceMatrix& err) const {
0039   Error4D temp;
0040   fillVertexCovariance(temp);
0041   err = temp.Sub<Error>(0, 0);
0042 }
0043 
0044 void VertexCompositePtrCandidate::fillVertexCovariance(CovarianceMatrix4D& err) const {
0045   index idx = 0;
0046   for (index i = 0; i < dimension4D; ++i)
0047     for (index j = 0; j <= i; ++j)
0048       err(i, j) = covariance_[idx++];
0049 }
0050 
0051 void VertexCompositePtrCandidate::setCovariance(const CovarianceMatrix& err) {
0052   index idx = 0;
0053   for (index i = 0; i < dimension4D; ++i) {
0054     for (index j = 0; j <= i; ++j) {
0055       if (i == dimension || j == dimension) {
0056         covariance_[idx++] = 0.0;
0057       } else {
0058         covariance_[idx++] = err(i, j);
0059       }
0060     }
0061   }
0062 }
0063 
0064 void VertexCompositePtrCandidate::setCovariance(const CovarianceMatrix4D& err) {
0065   index idx = 0;
0066   for (index i = 0; i < dimension4D; ++i)
0067     for (index j = 0; j <= i; ++j)
0068       covariance_[idx++] = err(i, j);
0069 }