Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:28:12

0001 #include "RecoVertex/KalmanVertexFit/interface/KVFHelper.h"
0002 using namespace std;
0003 
0004 template <unsigned int N>
0005 double KVFHelper<N>::vertexChi2(const CachingVertex<N>& vertexA, const CachingVertex<N>& vertexB) const {
0006   return vertexChi2(vertexA.vertexState(), vertexB.vertexState());
0007 }
0008 
0009 template <unsigned int N>
0010 double KVFHelper<N>::vertexChi2(const VertexState& vertexA, const VertexState& vertexB) const {
0011   // std::cout <<"Start\n";
0012   GlobalPoint inPosition = vertexA.position();
0013   GlobalPoint fnPosition = vertexB.position();
0014   //   std::cout << inPosition<< fnPosition<<std::endl;
0015 
0016   AlgebraicVector3 oldVertexPositionV;
0017   oldVertexPositionV(0) = inPosition.x();
0018   oldVertexPositionV(1) = inPosition.y();
0019   oldVertexPositionV(2) = inPosition.z();
0020 
0021   AlgebraicVector3 newVertexPositionV;
0022   newVertexPositionV(0) = fnPosition.x();
0023   newVertexPositionV(1) = fnPosition.y();
0024   newVertexPositionV(2) = fnPosition.z();
0025 
0026   AlgebraicVector3 positionResidual = newVertexPositionV - oldVertexPositionV;
0027 
0028   return ROOT::Math::Similarity(positionResidual, vertexA.weight().matrix());
0029 }
0030 
0031 template <unsigned int N>
0032 typename KVFHelper<N>::BDpair KVFHelper<N>::trackParameterChi2(const RefCountedVertexTrack track) const {
0033   return trackParameterChi2(track->linearizedTrack(), track->refittedState());
0034 }
0035 
0036 template <unsigned int N>
0037 typename KVFHelper<N>::BDpair KVFHelper<N>::trackParameterChi2(
0038     const RefCountedLinearizedTrackState linTrack, const RefCountedRefittedTrackState refittedTrackState) const {
0039   typedef ROOT::Math::SMatrix<double, N, N, ROOT::Math::MatRepSym<double, N> > AlgebraicSymMatrixNN;
0040   typedef ROOT::Math::SVector<double, N> AlgebraicVectorN;
0041 
0042   AlgebraicVectorN parameterResiduals =
0043       linTrack->predictedStateParameters() - linTrack->refittedParamFromEquation(refittedTrackState);
0044   linTrack->checkParameters(parameterResiduals);
0045   int error;
0046   float lChi2 = ROOT::Math::Similarity(parameterResiduals, linTrack->predictedStateWeight(error));
0047   if (error != 0)
0048     return BDpair(false, -1.);
0049   return BDpair(true, lChi2);
0050 }
0051 
0052 template class KVFHelper<5>;
0053 template class KVFHelper<6>;