00001 #include "RecoVertex/AdaptiveVertexFit/interface/KalmanChiSquare.h" 00002 #include "RecoVertex/VertexPrimitives/interface/VertexException.h" 00003 00004 using namespace std; 00005 00006 float KalmanChiSquare::estimate( 00007 const GlobalPoint & vertex, 00008 RefCountedLinearizedTrackState lt ) const 00009 { 00010 AlgebraicVector3 vtxposV; 00011 vtxposV[0] = vertex.x(); 00012 vtxposV[1] = vertex.y(); 00013 vtxposV[2] = vertex.z(); 00014 00015 AlgebraicMatrix53 a = lt->positionJacobian(); 00016 AlgebraicMatrix53 b = lt->momentumJacobian(); 00017 00018 // track information 00019 AlgebraicVector5 trackParameters = 00020 lt->predictedStateParameters(); 00021 00022 AlgebraicSymMatrix55 trackParametersWeight = 00023 lt->predictedStateWeight(); 00024 00025 AlgebraicSymMatrix33 s = ROOT::Math::SimilarityT(b,trackParametersWeight); 00026 bool ret = s.Invert(); 00027 if(!ret) throw VertexException 00028 ("[KalmanChiSquare] S matrix inversion failed"); 00029 00030 AlgebraicVector5 residual = lt->constantTerm(); 00031 AlgebraicVector3 newTrackMomentumP = s * ROOT::Math::Transpose(b) * trackParametersWeight * 00032 (trackParameters - residual - a*vtxposV); 00033 00034 AlgebraicVector5 rtp = ( residual + a * vtxposV + b * newTrackMomentumP); 00035 00036 AlgebraicVector5 parameterResiduals = trackParameters - rtp; 00037 lt->checkParameters(parameterResiduals); 00038 00039 return ROOT::Math::Similarity(parameterResiduals, trackParametersWeight); 00040 }