File indexing completed on 2024-04-06 12:29:09
0001 #include "RecoVertex/KalmanVertexFit/interface/KalmanSmoothedVertexChi2Estimator.h"
0002
0003
0004 template <unsigned int N>
0005 typename KalmanSmoothedVertexChi2Estimator<N>::BDpair KalmanSmoothedVertexChi2Estimator<N>::estimate(
0006 const CachingVertex<N>& vertex) const {
0007
0008 float v_part = 0.;
0009 float returnChi = 0.;
0010
0011 if (vertex.hasPrior()) {
0012 v_part = helper.vertexChi2(vertex.priorVertexState(), vertex.vertexState());
0013 }
0014
0015
0016 typedef typename CachingVertex<N>::RefCountedVertexTrack RefCountedVertexTrack;
0017 std::vector<RefCountedVertexTrack> tracks = vertex.tracks();
0018 float sum = 0.;
0019 bool success = true;
0020 for (typename std::vector<RefCountedVertexTrack>::iterator i = tracks.begin(); i != tracks.end(); i++) {
0021 BDpair result = helper.trackParameterChi2((*i)->linearizedTrack(), (*i)->refittedState());
0022 success = success && result.first;
0023 sum += (*i)->weight() * result.second;
0024 }
0025 returnChi = v_part + sum;
0026 return BDpair(success, returnChi);
0027 }
0028
0029 template class KalmanSmoothedVertexChi2Estimator<5>;
0030 template class KalmanSmoothedVertexChi2Estimator<6>;