Go to the documentation of this file.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 std::vector<RefCountedVertexTrack> newTracks;
00043 if (theVertexTrackUpdator != 0) {
00044 const std::vector<RefCountedVertexTrack>& vOut=vertex.tracks();
00045 for(typename std::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 std::pair<bool, double> result = theVertexSmoothedChiSquaredEstimator->estimate(interVertex);
00064 smChi2 = result.second;
00065 }
00066
00067 if (theTrackToTrackCovCalculator == 0) {
00068 if (vertex.hasPrior()) {
00069 return CachingVertex<N>(vertex.priorVertexState(), vertex.vertexState(),
00070 newTracks, smChi2);
00071 } else {
00072 return CachingVertex<N>(vertex.vertexState(), newTracks, smChi2);
00073 }
00074 }
00075
00076
00077 typename CachingVertex<N>::TrackToTrackMap tkMap = (*theTrackToTrackCovCalculator)(interVertex);
00078
00079
00080
00081 if (vertex.hasPrior()) {
00082 CachingVertex<N> finalVertex(vertex.priorVertexState(), vertex.vertexState(),
00083 newTracks, smChi2, tkMap);
00084 return finalVertex;
00085 }
00086
00087 CachingVertex<N> finalVertex(vertex.vertexState(), newTracks, smChi2, tkMap);
00088 return finalVertex;
00089
00090 }
00091
00092 template class SequentialVertexSmoother<5>;
00093 template class SequentialVertexSmoother<6>;