Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:28:08

0001 #include "RecoVertex/ConfigurableVertexReco/interface/ReconstructorFromFitter.h"
0002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0003 
0004 using namespace std;
0005 
0006 ReconstructorFromFitter::ReconstructorFromFitter(std::unique_ptr<AbstractConfFitter>&& f) : theFitter(f.release()) {}
0007 
0008 vector<TransientVertex> ReconstructorFromFitter::vertices(const vector<reco::TransientTrack>& t) const {
0009   vector<TransientVertex> ret;
0010   // cout << "[ReconstructorFromFitter] debug: fitting without bs!" << endl;

0011   try {
0012     CachingVertex<5> tmp = theFitter->vertex(t);
0013     if (tmp.isValid())
0014       ret.push_back(tmp);
0015   } catch (VertexException& e) {
0016     edm::LogWarning("ReconstructorFromFitter") << "exception caught: " << e.what();
0017   }
0018   return ret;
0019 }
0020 
0021 vector<TransientVertex> ReconstructorFromFitter::vertices(const vector<reco::TransientTrack>& t,
0022                                                           const reco::BeamSpot& s) const {
0023   vector<TransientVertex> ret;
0024   try {
0025     /*

0026     cout << "[ReconstructorFromFitter] debug: fitting with s: " << s.BeamWidth() 

0027          << " sz=" << s.sigmaZ() << endl;

0028          */
0029     CachingVertex<5> tmp = theFitter->vertex(t, s);
0030     if (tmp.isValid())
0031       ret.push_back(tmp);
0032   } catch (VertexException& e) {
0033     edm::LogWarning("ReconstructorFromFitter") << "exception caught: " << e.what();
0034   }
0035   return ret;
0036 }
0037 
0038 ReconstructorFromFitter::~ReconstructorFromFitter() { delete theFitter; }
0039 
0040 ReconstructorFromFitter::ReconstructorFromFitter(const ReconstructorFromFitter& o) : theFitter(o.theFitter->clone()) {}
0041 
0042 edm::ParameterSet ReconstructorFromFitter::defaults() const { return theFitter->defaults(); }
0043 
0044 void ReconstructorFromFitter::configure(const edm::ParameterSet& s) {
0045   //this looks better than changing the data member to be non-const ptr and allow changes in all calls

0046   const_cast<AbstractConfFitter*>(theFitter)->configure(s);
0047 }
0048 
0049 ReconstructorFromFitter* ReconstructorFromFitter::clone() const { return new ReconstructorFromFitter(*this); }