CMS 3D CMS Logo

KalmanTrackToTrackCovCalculator.cc
Go to the documentation of this file.
3 
4 template <unsigned int N>
6  const CachingVertex<N>& vertex) const {
7  typedef ROOT::Math::SMatrix<double, N, 3, ROOT::Math::MatRepStd<double, N, 3> > AlgebraicMatrixN3;
8  typedef ROOT::Math::SMatrix<double, N, N - 2, ROOT::Math::MatRepStd<double, N, N - 2> > AlgebraicMatrixNM;
9  typedef ROOT::Math::SMatrix<double, N - 2, 3, ROOT::Math::MatRepStd<double, N - 2, 3> > AlgebraicMatrixM3;
10  typedef ROOT::Math::SMatrix<double, 3, N - 2, ROOT::Math::MatRepStd<double, 3, N - 2> > AlgebraicMatrix3M;
11  typedef ROOT::Math::SMatrix<double, N, N, ROOT::Math::MatRepSym<double, N> > AlgebraicSymMatrixNN;
12  typedef ROOT::Math::SMatrix<double, N - 2, N - 2, ROOT::Math::MatRepSym<double, N - 2> > AlgebraicSymMatrixMM;
13  typedef ROOT::Math::SMatrix<double, N - 2, N - 2, ROOT::Math::MatRepStd<double, N - 2, N - 2> > AlgebraicMatrixMM;
14 
15  typename CachingVertex<N>::TrackToTrackMap returnMap;
16  int ifail = 0;
17  std::vector<RefCountedVertexTrack> tracks = vertex.tracks();
18 
19  //vertex initial data needed
20  AlgebraicSymMatrix33 vertexC = vertex.error().matrix();
21 
22  for (typename std::vector<RefCountedVertexTrack>::iterator i = tracks.begin(); i != tracks.end(); i++) {
23  const AlgebraicMatrixN3& leftA = (*i)->linearizedTrack()->positionJacobian();
24  const AlgebraicMatrixNM& leftB = (*i)->linearizedTrack()->momentumJacobian();
25  AlgebraicSymMatrixNN leftG = (*i)->linearizedTrack()->predictedStateWeight(ifail);
26  AlgebraicSymMatrixMM leftW = ROOT::Math::SimilarityT(leftB, leftG);
27 
28  ifail = !leftW.Invert();
29  if (ifail != 0)
30  throw VertexException("KalmanTrackToTrackCovarianceCalculator::leftW matrix inversion failed");
31  AlgebraicMatrixM3 leftPart = leftW * (ROOT::Math::Transpose(leftB)) * leftG * leftA;
32  typename CachingVertex<N>::TrackMap internalMap;
33  for (typename std::vector<RefCountedVertexTrack>::iterator j = tracks.begin(); j != tracks.end(); j++) {
34  if (*i < *j) {
35  const AlgebraicMatrixN3& rightA = (*j)->linearizedTrack()->positionJacobian();
36  const AlgebraicMatrixNM& rightB = (*j)->linearizedTrack()->momentumJacobian();
37  AlgebraicSymMatrixNN rightG = (*j)->linearizedTrack()->predictedStateWeight(ifail);
38  AlgebraicSymMatrixMM rightW = ROOT::Math::SimilarityT(rightB, rightG);
39 
40  ifail = !rightW.Invert();
41 
42  if (ifail != 0)
43  throw VertexException("KalmanTrackToTrackCovarianceCalculator::rightW matrix inversion failed");
44  AlgebraicMatrix3M rightPart = (ROOT::Math::Transpose(rightA)) * rightG * rightB * rightW;
45  internalMap[(*j)] = leftPart * vertexC * rightPart;
46  }
47  }
48  returnMap[*i] = internalMap;
49  }
50  return returnMap;
51 }
52 
std::vector< RefCountedVertexTrack > tracks() const
Common base class.
const AlgebraicSymMatrix33 matrix() const
CachingVertex< N >::TrackToTrackMap operator()(const CachingVertex< N > &vertex) const override
#define N
Definition: blowfish.cc:9
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
std::map< RefCountedVertexTrack, AlgebraicMatrixMM > TrackMap
Definition: CachingVertex.h:27
GlobalError error() const
std::map< RefCountedVertexTrack, TrackMap > TrackToTrackMap
Definition: CachingVertex.h:28