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 if ( vertex.hasPrior() )
00059 {
00060 interVertex = CachingVertex<N> ( vertex.priorPosition(), vertex.priorError(),
00061 vertex.position(), vertex.weight(), newTracks, 0.);
00062 }
00063
00064
00065
00066 float smChi2 = vertex.totalChiSquared();
00067 if (theVertexSmoothedChiSquaredEstimator != 0) {
00068 std::pair<bool, double> result = theVertexSmoothedChiSquaredEstimator->estimate(interVertex);
00069 smChi2 = result.second;
00070 }
00071
00072 if (theTrackToTrackCovCalculator == 0) {
00073 if (vertex.hasPrior()) {
00074 return CachingVertex<N>(vertex.priorVertexState(), vertex.vertexState(),
00075 newTracks, smChi2);
00076 } else {
00077 return CachingVertex<N>(vertex.vertexState(), newTracks, smChi2);
00078 }
00079 }
00080
00081
00082 typename CachingVertex<N>::TrackToTrackMap tkMap = (*theTrackToTrackCovCalculator)(interVertex);
00083
00084
00085
00086 if (vertex.hasPrior()) {
00087 CachingVertex<N> finalVertex(vertex.priorVertexState(), vertex.vertexState(),
00088 newTracks, smChi2, tkMap);
00089 return finalVertex;
00090 }
00091
00092 CachingVertex<N> finalVertex(vertex.vertexState(), newTracks, smChi2, tkMap);
00093 return finalVertex;
00094
00095 }
00096
00097 template class SequentialVertexSmoother<5>;
00098 template class SequentialVertexSmoother<6>;