00001 #include "RecoVertex/KalmanVertexFit/interface/SingleTrackVertexConstraint.h"
00002 #include "DataFormats/GeometryCommonDetAlgo/interface/GlobalError.h"
00003
00004 #include <algorithm>
00005 using namespace std;
00006 using namespace reco;
00007
00008 SingleTrackVertexConstraint::TrackFloatPair SingleTrackVertexConstraint::constrain(
00009 const TransientTrack & track, const GlobalPoint& priorPos,
00010 const GlobalError & priorError) const
00011 {
00012 VertexState priorVertexState(priorPos, priorError);
00013 return constrain(track, priorVertexState);
00014 }
00015
00016
00017 SingleTrackVertexConstraint::TrackFloatPair SingleTrackVertexConstraint::constrain(
00018 const TransientTrack & track, const VertexState priorVertexState) const
00019 {
00020
00021
00022 typedef CachingVertex<5>::RefCountedVertexTrack RefCountedVertexTrack;
00023 typedef VertexTrack<5>::RefCountedLinearizedTrackState RefCountedLinearizedTrackState;
00024
00025 RefCountedLinearizedTrackState lTrData
00026 = theLTrackFactory.linearizedTrackState(priorVertexState.position(), track);
00027 RefCountedVertexTrack vertexTrack = theVTrackFactory.vertexTrack(lTrData, priorVertexState);
00028
00029
00030
00031 vector<RefCountedVertexTrack> initialTracks;
00032 CachingVertex<5> vertex(priorVertexState,priorVertexState,initialTracks,0);
00033 vertex = vertexUpdator.add(vertex, vertexTrack);
00034 RefCountedVertexTrack nTrack = theVertexTrackUpdator.update(vertex, vertexTrack);
00035
00036 return TrackFloatPair(nTrack->refittedState()->transientTrack(), nTrack->smoothedChi2()) ;
00037 }
00038
00039 SingleTrackVertexConstraint::TrackFloatPair SingleTrackVertexConstraint::constrain(
00040 const FreeTrajectoryState & fts, const GlobalPoint& priorPos,
00041 const GlobalError& priorError) const
00042 {
00043 return constrain(ttFactory.build(fts), priorPos, priorError);
00044 }
00045
00046 SingleTrackVertexConstraint::TrackFloatPair SingleTrackVertexConstraint::constrain(
00047 const TransientTrack & track, const reco::BeamSpot & spot ) const
00048 {
00049 VertexState priorVertexState(spot);
00050 return constrain(track, priorVertexState);
00051 }
00052
00053 SingleTrackVertexConstraint::TrackFloatPair SingleTrackVertexConstraint::constrain(
00054 const FreeTrajectoryState & fts, const reco::BeamSpot & spot) const
00055 {
00056 VertexState priorVertexState(spot);
00057 return constrain(ttFactory.build(fts), priorVertexState);
00058 }
00059