CMS 3D CMS Logo

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