CMS 3D CMS Logo

PFCandCommonVertexFitter.h
Go to the documentation of this file.
1 #ifndef TauTagTools_PFCandCommonVertexFitter_h
2 #define TauTagTools_PFCandCommonVertexFitter_h
3 
4 /* \class PFCandCommonVertexFitter
5  *
6  * Adapted from PhysicsTools/RecoUtils for use with ShallowClones of PFCandidates, which
7  * have a different method for retrieving the associated transient track
8  *
9  * \author Luca Lista, INFN
10  * Modified by Evan Friis, UC Davis
11  *
12  */
13 
19 #include <vector>
20 class MagneticField;
21 namespace reco { class VertexCompositeCandidate; }
22 
24 public:
28  void set(const MagneticField * bField) { bField_ = bField; }
29  void set(reco::VertexCompositeCandidate &) const;
30 
31 protected:
33  void fill(std::vector<reco::TransientTrack> &,
34  std::vector<reco::Candidate *> &,
35  std::vector<reco::RecoCandidate::TrackType> &,
36  reco::Candidate &) const;
37  virtual bool fit(TransientVertex &,
38  const std::vector<reco::TransientTrack> &) const = 0;
40  mutable double chi2_;
42  mutable double ndof_;
44  mutable CovarianceMatrix cov_;
45 };
46 
48 
49 template<typename Fitter>
51 public:
54 // fitter_(reco::modules::make<Fitter>(cfg)) {
55  fitter_(Fitter(cfg, true)) {
56  }
57  bool fit(TransientVertex & vertex,
58  const std::vector<reco::TransientTrack> & tracks) const {
59  try {
60  vertex = fitter_.vertex(tracks);
61  } catch (std::exception & err) {
62  std::cerr << ">>> exception thrown by KalmanVertexFitter:\n"
63  << err.what() << "\n"
64  << ">>> candidate not fitted to common vertex" << std::endl;
65  return false;
66  }
67  return vertex.isValid();
68  }
69 private:
71 };
72 
73 #endif
math::Error< dimension >::type CovarianceMatrix
covariance error matrix (3x3)
Definition: Vertex.h:45
PFCandCommonVertexFitterBase(const edm::ParameterSet &)
double ndof_
number of degrees of freedom
CovarianceMatrix cov_
covariance matrix (3x3)
PFCandCommonVertexFitter(const edm::ParameterSet &cfg)
bool fit(TransientVertex &vertex, const std::vector< reco::TransientTrack > &tracks) const
reco::Vertex::CovarianceMatrix CovarianceMatrix
fixed size matrix
bool isValid() const