File indexing completed on 2024-04-06 12:29:18
0001 #include "RecoVertex/TrimmedVertexFit/interface/TrimmedVertexFitter.h"
0002 #include "RecoVertex/VertexTools/interface/VertexTrackFactory.h"
0003 #include "RecoVertex/VertexTools/interface/LinearizedTrackStateFactory.h"
0004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0005
0006 TrimmedVertexFitter::TrimmedVertexFitter() {
0007 theRector.setMaxNbOfVertices(1);
0008 setPtCut(0.);
0009 }
0010
0011 TrimmedVertexFitter::TrimmedVertexFitter(const edm::ParameterSet& pSet) {
0012 theRector.setMaxNbOfVertices(1);
0013 setPtCut(pSet.getParameter<double>("minPt"));
0014 setTrackCompatibilityCut(pSet.getParameter<double>("trackCompatibilityCut"));
0015 setVertexFitProbabilityCut(pSet.getParameter<double>("vtxFitProbCut"));
0016 }
0017
0018 CachingVertex<5> TrimmedVertexFitter::vertex(const std::vector<reco::TransientTrack>& tracks) const {
0019 std::vector<TransientVertex> vtces = theRector.vertices(tracks);
0020 if (!vtces.empty()) {
0021 const TransientVertex& rv = *(vtces.begin());
0022 LinearizedTrackStateFactory lfac;
0023 VertexTrackFactory<5> vfac;
0024 VertexState state(rv.position(), rv.positionError());
0025 std::vector<RefCountedVertexTrack> vtrks;
0026 std::vector<reco::TransientTrack> mytrks = rv.originalTracks();
0027 for (std::vector<reco::TransientTrack>::const_iterator rt = mytrks.begin(); rt != mytrks.end(); ++rt) {
0028 RefCountedLinearizedTrackState lstate = lfac.linearizedTrackState(rv.position(), *rt);
0029
0030 RefCountedVertexTrack vtrk = vfac.vertexTrack(lstate, state, 1.0);
0031 vtrks.push_back(vtrk);
0032 };
0033 return CachingVertex<5>(rv.position(), rv.positionError(), vtrks, rv.totalChiSquared());
0034 };
0035 return CachingVertex<5>();
0036 }
0037
0038 CachingVertex<5> TrimmedVertexFitter::vertex(const std::vector<RefCountedVertexTrack>& tracks) const {
0039 std::cout << "[TrimmedVertexFitter] method not implemented" << std::endl;
0040 throw VertexException("not implemented");
0041 }
0042
0043 CachingVertex<5> TrimmedVertexFitter::vertex(const std::vector<RefCountedVertexTrack>& tracks,
0044 const reco::BeamSpot& spot) const {
0045 std::cout << "[TrimmedVertexFitter] method not implemented" << std::endl;
0046 throw VertexException("not implemented");
0047 }
0048
0049 CachingVertex<5> TrimmedVertexFitter::vertex(const std::vector<reco::TransientTrack>& tracks,
0050 const GlobalPoint& linPoint) const {
0051 std::cout << "[TrimmedVertexFitter] method not implemented" << std::endl;
0052 throw VertexException("not implemented");
0053 }
0054
0055 CachingVertex<5> TrimmedVertexFitter::vertex(const std::vector<reco::TransientTrack>& tracks,
0056 const GlobalPoint& priorPos,
0057 const GlobalError& priorError) const {
0058 std::cout << "[TrimmedVertexFitter] method not implemented" << std::endl;
0059 throw VertexException("not implemented");
0060 }
0061
0062 CachingVertex<5> TrimmedVertexFitter::vertex(const std::vector<RefCountedVertexTrack>& tracks,
0063 const GlobalPoint& priorPos,
0064 const GlobalError& priorError) const {
0065 std::cout << "[TrimmedVertexFitter] method not implemented" << std::endl;
0066 throw VertexException("not implemented");
0067 }
0068
0069 CachingVertex<5> TrimmedVertexFitter::vertex(const std::vector<reco::TransientTrack>& tracks,
0070 const reco::BeamSpot& beamSpot) const {
0071 std::cout << "[TrimmedVertexFitter] method not implemented" << std::endl;
0072 throw VertexException("not implemented");
0073 }
0074
0075 TrimmedVertexFitter* TrimmedVertexFitter::clone() const { return new TrimmedVertexFitter(*this); }
0076
0077 void TrimmedVertexFitter::setPtCut(float cut) {
0078 ptcut = cut;
0079 theRector.setPtCut(cut);
0080 }
0081
0082 void TrimmedVertexFitter::setTrackCompatibilityCut(float cut) { theRector.setTrackCompatibilityCut(cut); }
0083
0084 void TrimmedVertexFitter::setVertexFitProbabilityCut(float cut) { theRector.setVertexFitProbabilityCut(cut); }