CMS 3D CMS Logo

KVFHelper.cc
Go to the documentation of this file.
2 using namespace std;
3 
4 template <unsigned int N>
5 double KVFHelper<N>::vertexChi2(const CachingVertex<N>& vertexA, const CachingVertex<N>& vertexB) const {
6  return vertexChi2(vertexA.vertexState(), vertexB.vertexState());
7 }
8 
9 template <unsigned int N>
10 double KVFHelper<N>::vertexChi2(const VertexState& vertexA, const VertexState& vertexB) const {
11  // std::cout <<"Start\n";
12  GlobalPoint inPosition = vertexA.position();
13  GlobalPoint fnPosition = vertexB.position();
14  // std::cout << inPosition<< fnPosition<<std::endl;
15 
16  AlgebraicVector3 oldVertexPositionV;
17  oldVertexPositionV(0) = inPosition.x();
18  oldVertexPositionV(1) = inPosition.y();
19  oldVertexPositionV(2) = inPosition.z();
20 
21  AlgebraicVector3 newVertexPositionV;
22  newVertexPositionV(0) = fnPosition.x();
23  newVertexPositionV(1) = fnPosition.y();
24  newVertexPositionV(2) = fnPosition.z();
25 
26  AlgebraicVector3 positionResidual = newVertexPositionV - oldVertexPositionV;
27 
28  return ROOT::Math::Similarity(positionResidual, vertexA.weight().matrix());
29 }
30 
31 template <unsigned int N>
33  return trackParameterChi2(track->linearizedTrack(), track->refittedState());
34 }
35 
36 template <unsigned int N>
38  const RefCountedLinearizedTrackState linTrack, const RefCountedRefittedTrackState refittedTrackState) const {
39  typedef ROOT::Math::SMatrix<double, N, N, ROOT::Math::MatRepSym<double, N> > AlgebraicSymMatrixNN;
40  typedef ROOT::Math::SVector<double, N> AlgebraicVectorN;
41 
42  AlgebraicVectorN parameterResiduals =
43  linTrack->predictedStateParameters() - linTrack->refittedParamFromEquation(refittedTrackState);
44  linTrack->checkParameters(parameterResiduals);
45  int error;
46  float lChi2 = ROOT::Math::Similarity(parameterResiduals, linTrack->predictedStateWeight(error));
47  if (error != 0)
48  return BDpair(false, -1.);
49  return BDpair(true, lChi2);
50 }
51 
52 template class KVFHelper<5>;
53 template class KVFHelper<6>;
std::pair< bool, double > BDpair
Definition: KVFHelper.h:16
T z() const
Definition: PV3DBase.h:61
VertexState const & vertexState() const
double vertexChi2(const VertexState &vertexA, const VertexState &VertexB) const
Definition: KVFHelper.cc:10
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
GlobalWeight weight() const
Definition: VertexState.h:69
const AlgebraicSymMatrix33 matrix() const
BDpair trackParameterChi2(const RefCountedLinearizedTrackState linTrack, const RefCountedRefittedTrackState refittedTrackState) const
Definition: KVFHelper.cc:37
ROOT::Math::SVector< double, 3 > AlgebraicVector3
GlobalPoint position() const
Definition: VertexState.h:62