test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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_;
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
void fill(std::vector< reco::TransientTrack > &, std::vector< reco::Candidate * > &, std::vector< reco::RecoCandidate::TrackType > &, reco::Candidate &) const
void set(const MagneticField *bField)
tuple tracks
Definition: testEve_cfg.py:39
double ndof_
number of degrees of freedom
CandCommonVertexFitterBase(const edm::ParameterSet &)
bool isValid() const
virtual bool fit(TransientVertex &, const std::vector< reco::TransientTrack > &) const =0