00001 #include "RecoVertex/TrimmedVertexFit/interface/TrimmedVertexFitter.h" 00002 #include "RecoVertex/VertexTools/interface/VertexTrackFactory.h" 00003 #include "RecoVertex/VertexTools/interface/LinearizedTrackStateFactory.h" 00004 #include "FWCore/MessageLogger/interface/MessageLogger.h" 00005 00006 00007 00008 TrimmedVertexFitter::TrimmedVertexFitter(const edm::ParameterSet & pSet) 00009 { 00010 theRector.setMaxNbOfVertices(1); 00011 setPtCut(pSet.getParameter<double>("PtCut")); 00012 } 00013 00014 00015 CachingVertex<5> 00016 TrimmedVertexFitter::vertex(const std::vector<reco::TransientTrack> & tracks) const 00017 { 00018 std::vector<TransientVertex> vtces = theRector.vertices ( tracks ); 00019 if (vtces.size() ) 00020 { 00021 const TransientVertex & rv = *(vtces.begin()); 00022 LinearizedTrackStateFactory lfac; 00023 VertexTrackFactory<5> vfac; 00024 VertexState state ( rv.position(), rv.positionError() ); 00025 vector < RefCountedVertexTrack > vtrks; 00026 std::vector<reco::TransientTrack> mytrks = rv.originalTracks(); 00027 for ( std::vector<reco::TransientTrack>::const_iterator rt=mytrks.begin(); 00028 rt!=mytrks.end() ; ++rt ) 00029 { 00030 RefCountedLinearizedTrackState lstate =lfac.linearizedTrackState 00031 ( rv.position(), *rt ); 00032 00033 RefCountedVertexTrack vtrk = vfac.vertexTrack ( lstate, state, 1.0 ); 00034 vtrks.push_back ( vtrk ); 00035 }; 00036 return CachingVertex<5> ( rv.position(), rv.positionError(), vtrks, rv.totalChiSquared() ); 00037 }; 00038 return CachingVertex<5>(); 00039 } 00040 00041 CachingVertex<5> TrimmedVertexFitter::vertex( 00042 const vector<RefCountedVertexTrack> & tracks) const 00043 { 00044 cout << "[TrimmedVertexFitter] method not implemented" << endl; 00045 throw VertexException("not implemented"); 00046 } 00047 00048 CachingVertex<5> TrimmedVertexFitter::vertex( 00049 const std::vector<reco::TransientTrack> & tracks, const GlobalPoint& linPoint) const 00050 { 00051 cout << "[TrimmedVertexFitter] method not implemented" << endl; 00052 throw VertexException("not implemented"); 00053 } 00054 00055 CachingVertex<5> TrimmedVertexFitter::vertex( 00056 const std::vector<reco::TransientTrack> & tracks, const GlobalPoint& priorPos, 00057 const GlobalError& priorError) const 00058 { 00059 cout << "[TrimmedVertexFitter] method not implemented" << endl; 00060 throw VertexException("not implemented"); 00061 } 00062 00063 CachingVertex<5> TrimmedVertexFitter::vertex( 00064 const vector<RefCountedVertexTrack> & tracks, 00065 const GlobalPoint& priorPos, 00066 const GlobalError& priorError) const 00067 { 00068 cout << "[TrimmedVertexFitter] method not implemented" << endl; 00069 throw VertexException("not implemented"); 00070 } 00071 00072 CachingVertex<5> 00073 TrimmedVertexFitter::vertex(const vector<reco::TransientTrack> & tracks, 00074 const reco::BeamSpot& beamSpot) const 00075 { 00076 cout << "[TrimmedVertexFitter] method not implemented" << endl; 00077 throw VertexException("not implemented"); 00078 } 00079 00080 00081 TrimmedVertexFitter * TrimmedVertexFitter::clone() const 00082 { 00083 return new TrimmedVertexFitter( * this ); 00084 } 00085 00086 void TrimmedVertexFitter::setPtCut ( float cut ) 00087 { 00088 ptcut = cut; 00089 theRector.setPtCut ( cut ); 00090 } 00091 00092 void TrimmedVertexFitter::setTrackCompatibilityCut ( float cut ) 00093 { 00094 theRector.setTrackCompatibilityCut ( cut ); 00095 } 00096 00097 void TrimmedVertexFitter::setVertexFitProbabilityCut ( float cut ) 00098 { 00099 theRector.setVertexFitProbabilityCut ( cut ); 00100 } 00101