CMS 3D CMS Logo

CandCommonVertexFitter.h
Go to the documentation of this file.
1 #ifndef RecoCandUtils_CandCommonVertexFitter_h
2 #define RecoCandUtils_CandCommonVertexFitter_h
3 /* \class CandCommonVertexFitter
4  *
5  * \author Luca Lista, INFN
6  *
7  */
8 
13 #include <vector>
14 class MagneticField;
15 namespace reco { class VertexCompositeCandidate; }
16 
18 public:
22  void set(const MagneticField * bField) { bField_ = bField; }
23  void set(reco::VertexCompositeCandidate &) const;
24 
25 protected:
27  void fill(std::vector<reco::TransientTrack> &,
28  std::vector<reco::Candidate *> &,
29  std::vector<reco::RecoCandidate::TrackType> &,
30  reco::Candidate &) const;
31  virtual bool fit(TransientVertex &,
32  const std::vector<reco::TransientTrack> &) const = 0;
34  mutable double chi2_;
36  mutable double ndof_;
38  mutable CovarianceMatrix cov_;
39 };
40 
42 
43 template<typename Fitter>
45 public:
48  fitter_(reco::modules::make<Fitter>(cfg)) {
49  }
50  bool fit(TransientVertex & vertex,
51  const std::vector<reco::TransientTrack> & tracks) const {
52  try {
53  vertex = fitter_.vertex(tracks);
54  } catch (std::exception & err) {
55  std::cerr << ">>> exception thrown by KalmanVertexFitter:\n"
56  << err.what() << "\n"
57  << ">>> candidate not fitted to common vertex" << std::endl;
58  return false;
59  }
60  return vertex.isValid();
61  }
62 private:
64 };
65 
66 #endif
CandCommonVertexFitter(const edm::ParameterSet &cfg)
S make(const edm::ParameterSet &cfg)
reco::Vertex::CovarianceMatrix CovarianceMatrix
math::Error< dimension >::type CovarianceMatrix
covariance error matrix (3x3)
Definition: Vertex.h:45
CovarianceMatrix cov_
covariance matrix (3x3)
bool fit(TransientVertex &vertex, const std::vector< reco::TransientTrack > &tracks) const
double ndof_
number of degrees of freedom
fixed size matrix
CandCommonVertexFitterBase(const edm::ParameterSet &)
bool isValid() const