File indexing completed on 2024-04-06 12:29:06
0001 #include "RecoVertex/ConfigurableVertexReco/interface/ConfigurableVertexFitter.h"
0002 #include "RecoVertex/ConfigurableVertexReco/interface/VertexFitterManager.h"
0003
0004 using namespace std;
0005
0006 namespace {
0007 void errorNoFitter(const string& finder) {
0008 cout << "[ConfigurableVertexFitter] got no fitter for \"" << finder << "\"" << endl;
0009 std::vector<std::string> valid = VertexFitterManager::Instance().getNames();
0010 cout << " Valid fitters are:";
0011 for (const auto& i : valid) {
0012 cout << " " << i;
0013 }
0014 cout << endl;
0015 throw std::string(finder + " not available!");
0016 }
0017 }
0018
0019 ConfigurableVertexFitter::ConfigurableVertexFitter(const edm::ParameterSet& p) : theFitter(nullptr) {
0020 string fitter = p.getParameter<string>("fitter");
0021 theFitter = VertexFitterManager::Instance().get(fitter).release();
0022 if (!theFitter) {
0023 errorNoFitter(fitter);
0024 }
0025 theFitter->configure(p);
0026 }
0027
0028 ConfigurableVertexFitter::~ConfigurableVertexFitter() { delete theFitter; }
0029
0030 ConfigurableVertexFitter::ConfigurableVertexFitter(const ConfigurableVertexFitter& o)
0031 : theFitter(o.theFitter->clone()) {}
0032
0033 ConfigurableVertexFitter* ConfigurableVertexFitter::clone() const { return new ConfigurableVertexFitter(*this); }
0034
0035 CachingVertex<5> ConfigurableVertexFitter::vertex(const std::vector<reco::TransientTrack>& t) const {
0036 return theFitter->vertex(t);
0037 }
0038
0039 CachingVertex<5> ConfigurableVertexFitter::vertex(const vector<RefCountedVertexTrack>& tracks) const {
0040 return theFitter->vertex(tracks);
0041 }
0042
0043 CachingVertex<5> ConfigurableVertexFitter::vertex(const vector<RefCountedVertexTrack>& tracks,
0044 const reco::BeamSpot& spot) const {
0045 return theFitter->vertex(tracks, spot);
0046 }
0047
0048 CachingVertex<5> ConfigurableVertexFitter::vertex(const vector<reco::TransientTrack>& tracks,
0049 const GlobalPoint& linPoint) const {
0050 return theFitter->vertex(tracks, linPoint);
0051 }
0052
0053 CachingVertex<5> ConfigurableVertexFitter::vertex(const vector<reco::TransientTrack>& tracks,
0054 const GlobalPoint& priorPos,
0055 const GlobalError& priorError) const {
0056 return theFitter->vertex(tracks, priorPos, priorError);
0057 }
0058
0059 CachingVertex<5> ConfigurableVertexFitter::vertex(const vector<reco::TransientTrack>& tracks,
0060 const reco::BeamSpot& beamSpot) const {
0061 return theFitter->vertex(tracks, beamSpot);
0062 }
0063
0064 CachingVertex<5> ConfigurableVertexFitter::vertex(const vector<RefCountedVertexTrack>& tracks,
0065 const GlobalPoint& priorPos,
0066 const GlobalError& priorError) const {
0067 return theFitter->vertex(tracks, priorPos, priorError);
0068 }