Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:33:15

0001 #ifndef RecoCandUtils_CandKinematicVertexFitter_h
0002 #define RecoCandUtils_CandKinematicVertexFitter_h
0003 /* \class CandKinematicVertexFitter

0004  *

0005  * \author Luca Lista, INFN

0006  *

0007  */
0008 
0009 #include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
0010 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
0011 #include "RecoVertex/VertexPrimitives/interface/TransientVertex.h"
0012 #include "DataFormats/RecoCandidate/interface/RecoCandidate.h"
0013 #include "RecoVertex/KinematicFit/interface/KinematicParticleVertexFitter.h"
0014 #include "PhysicsTools/UtilAlgos/interface/ParameterAdapter.h"
0015 #include "RecoVertex/KinematicFitPrimitives/interface/KinematicParticleFactoryFromTransientTrack.h"
0016 #include "SimGeneral/HepPDTRecord/interface/ParticleDataTable.h"
0017 #include <vector>
0018 
0019 class MagneticField;
0020 namespace reco {
0021   class VertexCompositeCandidate;
0022 }
0023 
0024 class CandKinematicVertexFitter {
0025 public:
0026   typedef reco::Vertex::CovarianceMatrix CovarianceMatrix;
0027   CandKinematicVertexFitter(const edm::ParameterSet &cfg)
0028       : bField_(nullptr), pdt_(nullptr), fitter_(), fitters_(new std::vector<CandKinematicVertexFitter>) {}
0029   CandKinematicVertexFitter(const CandKinematicVertexFitter &o)
0030       : bField_(o.bField_), pdt_(o.pdt_), fitter_(), fitters_(new std::vector<CandKinematicVertexFitter>) {}
0031   void set(const MagneticField *bField) { bField_ = bField; }
0032   void set(const ParticleDataTable *pdt) { pdt_ = pdt; }
0033   void set(reco::VertexCompositeCandidate &) const;
0034   bool fit(const std::vector<RefCountedKinematicParticle> &tracks) const;
0035   RefCountedKinematicParticle currentParticle() const {
0036     tree_->movePointerToTheTop();
0037     return tree_->currentParticle();
0038   }
0039 
0040 private:
0041   const MagneticField *bField_;
0042   const ParticleDataTable *pdt_;
0043   void fill(std::vector<RefCountedKinematicParticle> &,
0044             std::vector<reco::Candidate *> &,
0045             std::vector<reco::RecoCandidate::TrackType> &,
0046             reco::Candidate &) const;
0047   /// fitter

0048   KinematicParticleVertexFitter fitter_;
0049   /// fit tree

0050   mutable RefCountedKinematicTree tree_;
0051   /// particle factor

0052   KinematicParticleFactoryFromTransientTrack factory_;
0053   /// chi-sqared

0054   mutable double chi2_;
0055   /// number of degrees of freedom

0056   mutable double ndof_;
0057   /// covariance matrix (3x3)

0058   mutable CovarianceMatrix cov_;
0059   /// fitters used for recursive calls

0060   std::shared_ptr<std::vector<CandKinematicVertexFitter> > fitters_;
0061 };
0062 
0063 #endif