00001 #ifndef RecoCandUtils_CandKinematicVertexFitter_h 00002 #define RecoCandUtils_CandKinematicVertexFitter_h 00003 /* \class CandKinematicVertexFitter 00004 * 00005 * \author Luca Lista, INFN 00006 * 00007 */ 00008 00009 #include "FWCore/ParameterSet/interface/ParameterSetfwd.h" 00010 #include "TrackingTools/TransientTrack/interface/TransientTrack.h" 00011 #include "RecoVertex/VertexPrimitives/interface/TransientVertex.h" 00012 #include "DataFormats/RecoCandidate/interface/RecoCandidate.h" 00013 #include "RecoVertex/KinematicFit/interface/KinematicParticleVertexFitter.h" 00014 #include "PhysicsTools/UtilAlgos/interface/ParameterAdapter.h" 00015 #include "RecoVertex/KinematicFitPrimitives/interface/KinematicParticleFactoryFromTransientTrack.h" 00016 #include <vector> 00017 #include "boost/shared_ptr.hpp" 00018 00019 class MagneticField; 00020 namespace reco { class VertexCompositeCandidate; } 00021 00022 class CandKinematicVertexFitter { 00023 public: 00024 typedef reco::Vertex::CovarianceMatrix CovarianceMatrix; 00025 CandKinematicVertexFitter(const edm::ParameterSet & cfg) : 00026 bField_(0), fitter_(), fitters_(new std::vector<CandKinematicVertexFitter>) { 00027 } 00028 CandKinematicVertexFitter(const CandKinematicVertexFitter& o) : 00029 bField_(o.bField_), fitter_(), fitters_(new std::vector<CandKinematicVertexFitter>) { 00030 } 00031 void set(const MagneticField * bField) { bField_ = bField; } 00032 void set(reco::VertexCompositeCandidate &) const; 00033 bool fit(const std::vector<RefCountedKinematicParticle> & tracks) const; 00034 RefCountedKinematicParticle currentParticle() const { 00035 tree_->movePointerToTheTop(); 00036 return tree_->currentParticle(); 00037 } 00038 private: 00039 const MagneticField * bField_; 00040 void fill(std::vector<RefCountedKinematicParticle> &, 00041 std::vector<reco::Candidate *> &, 00042 std::vector<reco::RecoCandidate::TrackType> &, 00043 reco::Candidate &) const; 00045 KinematicParticleVertexFitter fitter_; 00047 mutable RefCountedKinematicTree tree_; 00049 KinematicParticleFactoryFromTransientTrack factory_; 00051 mutable double chi2_; 00053 mutable double ndof_; 00055 mutable CovarianceMatrix cov_; 00057 boost::shared_ptr<std::vector<CandKinematicVertexFitter> > fitters_; 00058 }; 00059 00060 #endif