00001 #include "RecoVertex/VertexTools/interface/SequentialVertexSmoother.h"
00002
00003
00004 template <unsigned int N>
00005 SequentialVertexSmoother<N>::SequentialVertexSmoother(
00006 const VertexTrackUpdator<N> & vtu,
00007 const VertexSmoothedChiSquaredEstimator<N> & vse,
00008 const TrackToTrackCovCalculator<N> & covCalc) :
00009 theVertexTrackUpdator(vtu.clone()),
00010 theVertexSmoothedChiSquaredEstimator(vse.clone()),
00011 theTrackToTrackCovCalculator(covCalc.clone())
00012 {}
00013
00014
00015 template <unsigned int N>
00016 SequentialVertexSmoother<N>::~SequentialVertexSmoother()
00017 {
00018 delete theVertexTrackUpdator;
00019 delete theVertexSmoothedChiSquaredEstimator;
00020 delete theTrackToTrackCovCalculator;
00021 }
00022
00023
00024 template <unsigned int N>
00025 SequentialVertexSmoother<N>::SequentialVertexSmoother(
00026 const SequentialVertexSmoother & smoother)
00027 {
00028 theVertexTrackUpdator = smoother.vertexTrackUpdator()->clone();
00029 theVertexSmoothedChiSquaredEstimator
00030 = smoother.vertexSmoothedChiSquaredEstimator()->clone();
00031 theTrackToTrackCovCalculator = smoother.trackToTrackCovCalculator()->clone();
00032 }
00033
00034
00035 template <unsigned int N>
00036 CachingVertex<N>
00037 SequentialVertexSmoother<N>::smooth(const CachingVertex<N> & vertex) const
00038 {
00039
00040
00041
00042 vector<RefCountedVertexTrack> newTracks;
00043 if (theVertexTrackUpdator != 0) {
00044 const vector<RefCountedVertexTrack>& vOut=vertex.tracks();
00045 for(typename vector<RefCountedVertexTrack>::const_iterator i = vOut.begin();
00046 i != vOut.end();i++)
00047 {
00048 RefCountedVertexTrack nTrack = theVertexTrackUpdator->update(vertex, *i);
00049 newTracks.push_back(nTrack);
00050 }
00051 } else {
00052 newTracks = vertex.tracks();
00053 }
00054
00055
00056 CachingVertex<N> interVertex(vertex.position(), vertex.weight(),
00057 newTracks, 0.);
00058
00059
00060
00061 float smChi2 = vertex.totalChiSquared();
00062 if (theVertexSmoothedChiSquaredEstimator != 0) {
00063 smChi2 = theVertexSmoothedChiSquaredEstimator->estimate(interVertex);
00064 }
00065
00066 if (theTrackToTrackCovCalculator == 0) {
00067 if (vertex.hasPrior()) {
00068 return CachingVertex<N>(vertex.priorVertexState(), vertex.vertexState(),
00069 newTracks, smChi2);
00070 } else {
00071 return CachingVertex<N>(vertex.vertexState(), newTracks, smChi2);
00072 }
00073 }
00074
00075
00076 typename CachingVertex<N>::TrackToTrackMap tkMap = (*theTrackToTrackCovCalculator)(interVertex);
00077
00078
00079
00080 if (vertex.hasPrior()) {
00081 CachingVertex<N> finalVertex(vertex.priorVertexState(), vertex.vertexState(),
00082 newTracks, smChi2, tkMap);
00083 return finalVertex;
00084 }
00085
00086 CachingVertex<N> finalVertex(vertex.vertexState(), newTracks, smChi2, tkMap);
00087 return finalVertex;
00088
00089 }
00090
00091 template class SequentialVertexSmoother<5>;
00092 template class SequentialVertexSmoother<6>;