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;
39 };
40 
42 
43 template<typename Fitter>
45 public:
48 // fitter_(reco::modules::make<Fitter>(cfg)) {
49  fitter_(Fitter(cfg, true)) {
50  }
51  bool fit(TransientVertex & vertex,
52  const std::vector<reco::TransientTrack> & tracks) const override {
53  try {
54  vertex = fitter_.vertex(tracks);
55  } catch (std::exception & err) {
56  std::cerr << ">>> exception thrown by KalmanVertexFitter:\n"
57  << err.what() << "\n"
58  << ">>> candidate not fitted to common vertex" << std::endl;
59  return false;
60  }
61  return vertex.isValid();
62  }
63 private:
65 };
66 
67 #endif
bool fit(TransientVertex &vertex, const std::vector< reco::TransientTrack > &tracks) const override
#define nullptr
math::Error< dimension >::type CovarianceMatrix
covariance error matrix (3x3)
Definition: Vertex.h:45
PFCandCommonVertexFitterBase(const edm::ParameterSet &)
PFCandCommonVertexFitter(const edm::ParameterSet &cfg)
reco::Vertex::CovarianceMatrix CovarianceMatrix
fixed size matrix
bool isValid() const