CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
KalmanVertexTrackUpdator< N > Class Template Reference

#include <KalmanVertexTrackUpdator.h>

Inheritance diagram for KalmanVertexTrackUpdator< N >:
VertexTrackUpdator< N >

Public Types

typedef ROOT::Math::SMatrix< double, 3, N - 2, ROOT::Math::MatRepStd< double, 3, N - 2 > > AlgebraicMatrix3M
 
typedef ROOT::Math::SMatrix< double, N+1, N+1, ROOT::Math::MatRepSym< double, N+1 > > AlgebraicSymMatrixOO
 
typedef VertexTrack< N >::RefCountedLinearizedTrackState RefCountedLinearizedTrackState
 
typedef VertexTrack< N >::RefCountedRefittedTrackState RefCountedRefittedTrackState
 
typedef CachingVertex< N >::RefCountedVertexTrack RefCountedVertexTrack
 
typedef std::pair< RefCountedRefittedTrackState, AlgebraicSymMatrixOOtrackMatrixPair
 

Public Member Functions

KalmanVertexTrackUpdator< N > * clone () const override
 
 KalmanVertexTrackUpdator ()
 
trackMatrixPair trackRefit (const VertexState &vertex, RefCountedLinearizedTrackState linTrackState, float weight) const
 
RefCountedVertexTrack update (const CachingVertex< N > &vertex, RefCountedVertexTrack track) const override
 
 ~KalmanVertexTrackUpdator () override
 
- Public Member Functions inherited from VertexTrackUpdator< N >
virtual CachingVertex< N >::RefCountedVertexTrack update (const CachingVertex< N > &v, typename CachingVertex< N >::RefCountedVertexTrack t) const =0
 
virtual ~VertexTrackUpdator ()
 

Private Attributes

KVFHelper< Nhelper
 
VertexTrackFactory< NtheVTFactory
 
KalmanVertexUpdator< Nupdator
 

Detailed Description

template<unsigned int N>
class KalmanVertexTrackUpdator< N >

Performs the refit of the tracks with the vertex constraint, using the Kalman filter algorithms.

Definition at line 17 of file KalmanVertexTrackUpdator.h.

Member Typedef Documentation

◆ AlgebraicMatrix3M

template<unsigned int N>
typedef ROOT::Math::SMatrix<double, 3, N - 2, ROOT::Math::MatRepStd<double, 3, N - 2> > KalmanVertexTrackUpdator< N >::AlgebraicMatrix3M

Definition at line 47 of file KalmanVertexTrackUpdator.h.

◆ AlgebraicSymMatrixOO

template<unsigned int N>
typedef ROOT::Math::SMatrix<double, N + 1, N + 1, ROOT::Math::MatRepSym<double, N + 1> > KalmanVertexTrackUpdator< N >::AlgebraicSymMatrixOO

Definition at line 48 of file KalmanVertexTrackUpdator.h.

◆ RefCountedLinearizedTrackState

Definition at line 20 of file KalmanVertexTrackUpdator.h.

◆ RefCountedRefittedTrackState

Definition at line 21 of file KalmanVertexTrackUpdator.h.

◆ RefCountedVertexTrack

Definition at line 19 of file KalmanVertexTrackUpdator.h.

◆ trackMatrixPair

Definition at line 49 of file KalmanVertexTrackUpdator.h.

Constructor & Destructor Documentation

◆ KalmanVertexTrackUpdator()

template<unsigned int N>
KalmanVertexTrackUpdator< N >::KalmanVertexTrackUpdator ( )
inline

Default constructor

Definition at line 27 of file KalmanVertexTrackUpdator.h.

27 {}

Referenced by KalmanVertexTrackUpdator< 5 >::clone().

◆ ~KalmanVertexTrackUpdator()

template<unsigned int N>
KalmanVertexTrackUpdator< N >::~KalmanVertexTrackUpdator ( )
inlineoverride

Definition at line 29 of file KalmanVertexTrackUpdator.h.

29 {}

Member Function Documentation

◆ clone()

template<unsigned int N>
KalmanVertexTrackUpdator<N>* KalmanVertexTrackUpdator< N >::clone ( void  ) const
inlineoverridevirtual

Clone method

Implements VertexTrackUpdator< N >.

Definition at line 45 of file KalmanVertexTrackUpdator.h.

45 { return new KalmanVertexTrackUpdator(*this); }

◆ trackRefit()

template<unsigned int N>
KalmanVertexTrackUpdator< N >::trackMatrixPair KalmanVertexTrackUpdator< N >::trackRefit ( const VertexState vertex,
RefCountedLinearizedTrackState  linTrackState,
float  weight 
) const

Refit of the track with the vertex constraint.

Parameters
vertexThe vertex which has to be used as constraint.
trackThe track to refit.
Returns
The refitted state with the track-to-vertex covariance.

Definition at line 28 of file KalmanVertexTrackUpdator.cc.

31  {
32  typedef ROOT::Math::SVector<double, N> AlgebraicVectorN;
33  typedef ROOT::Math::SVector<double, N - 2> AlgebraicVectorM;
34  typedef ROOT::Math::SMatrix<double, N, 3, ROOT::Math::MatRepStd<double, N, 3> > AlgebraicMatrixN3;
35  typedef ROOT::Math::SMatrix<double, 3, N, ROOT::Math::MatRepStd<double, 3, N> > AlgebraicMatrix3N;
36  typedef ROOT::Math::SMatrix<double, 3, N - 2, ROOT::Math::MatRepStd<double, 3, N - 2> > AlgebraicMatrix3M;
37  typedef ROOT::Math::SMatrix<double, N, N - 2, ROOT::Math::MatRepStd<double, N, N - 2> > AlgebraicMatrixNM;
38  typedef ROOT::Math::SMatrix<double, N - 2, 3, ROOT::Math::MatRepStd<double, N - 2, 3> > AlgebraicMatrixM3;
39  typedef ROOT::Math::SMatrix<double, N, N, ROOT::Math::MatRepSym<double, N> > AlgebraicSymMatrixNN;
40  // typedef ROOT::Math::SMatrix<double,N+1,N+1,ROOT::Math::MatRepSym<double,N+1> > AlgebraicSymMatrixOO;
41  typedef ROOT::Math::SMatrix<double, N + 1, N + 1, ROOT::Math::MatRepStd<double, N + 1, N + 1> > AlgebraicMatrixOO;
42  typedef ROOT::Math::SMatrix<double, N - 2, N - 2, ROOT::Math::MatRepSym<double, N - 2> > AlgebraicSymMatrixMM;
43 
44  //Vertex position
45  GlobalPoint vertexPosition = vertex.position();
46 
47  AlgebraicVector3 vertexCoord;
48  vertexCoord(0) = vertexPosition.x();
49  vertexCoord(1) = vertexPosition.y();
50  vertexCoord(2) = vertexPosition.z();
51  const AlgebraicSymMatrix33 vertexErrorMatrix = vertex.error().matrix();
52 
53  //track information
54  const AlgebraicMatrixN3 a = linTrackState->positionJacobian();
55  const AlgebraicMatrixNM b = linTrackState->momentumJacobian();
56 
57  // AlgebraicVectorN trackParameters =
58  // linTrackState->predictedStateParameters();
59 
60  int ifail;
61  AlgebraicSymMatrixNN trackParametersWeight = linTrackState->predictedStateWeight(ifail);
62 
63  AlgebraicSymMatrixMM s = ROOT::Math::SimilarityT(b, trackParametersWeight);
64 
65  if (!invertPosDefMatrix(s))
66  throw VertexException("KalmanVertexTrackUpdator::S matrix inversion failed");
67 
68  // NN NM MM
69  AlgebraicMatrixNM twbs = trackParametersWeight * b * s;
70 
71  AlgebraicVectorN vv = linTrackState->predictedStateParameters() - linTrackState->constantTerm() - a * vertexCoord;
72  // MM MN NN
73  // AlgebraicVectorM newTrackMomentumP = s * (ROOT::Math::Transpose(b)) * trackParametersWeight * vv;
74  AlgebraicVectorM newTrackMomentumP = ROOT::Math::Transpose(twbs) * vv;
75 
76  //AlgebraicMatrix3M refittedPositionMomentumConvariance =
77  // 33 3N NN NM MM
78  // -vertexErrorMatrix * (ROOT::Math::Transpose(a)) * trackParametersWeight * b * s;
79 
80  AlgebraicMatrix3N tmpM1 = -vertexErrorMatrix * (ROOT::Math::Transpose(a));
81  AlgebraicMatrix3M refittedPositionMomentumConvariance = tmpM1 * twbs;
82 
83  AlgebraicSymMatrixMM refittedMomentumConvariance =
84  s / weight + ROOT::Math::SimilarityT(refittedPositionMomentumConvariance, vertex.weight().matrix());
85 
86  // int matrixSize = 3+3; //refittedMomentumConvariance.num_col();
87  AlgebraicMatrixOO covMatrix; //(matrixSize, matrixSize);
88  covMatrix.Place_at(refittedPositionMomentumConvariance, 0, 3);
89  covMatrix.Place_at(ROOT::Math::Transpose(refittedPositionMomentumConvariance), 3, 0);
90  covMatrix.Place_at(vertexErrorMatrix, 0, 0);
91  covMatrix.Place_at(refittedMomentumConvariance, 3, 3);
92 
93  AlgebraicSymMatrixOO covSymMatrix(covMatrix.LowerBlock());
94 
95  RefCountedRefittedTrackState refittedTrackState =
96  linTrackState->createRefittedTrackState(vertexPosition, newTrackMomentumP, covSymMatrix);
97 
98  return trackMatrixPair(refittedTrackState, covSymMatrix);
99  // (refittedTrackState, refittedPositionMomentumConvariance);
100 }

Referenced by GsfVertexSmoother::createNewComponent().

◆ update()

template<unsigned int N>
CachingVertex< N >::RefCountedVertexTrack KalmanVertexTrackUpdator< N >::update ( const CachingVertex< N > &  vertex,
RefCountedVertexTrack  track 
) const
override

Refit of the track with the vertex constraint.

Parameters
vertexThe vertex which has to be used as constraint.
trackThe track to refit.
Returns
The VertexTrack containing the refitted track and the track-to-vertex covariance.

Definition at line 12 of file KalmanVertexTrackUpdator.cc.

15 {
16  trackMatrixPair thePair = trackRefit(vertex.vertexState(), track->linearizedTrack(), track->weight());
17 
18  VertexState rVert = updator.positionUpdate(vertex.vertexState(), track->linearizedTrack(), track->weight(), -1);
19 
20  std::pair<bool, double> result = helper.trackParameterChi2(track->linearizedTrack(), thePair.first);
21  float smoothedChi2 = helper.vertexChi2(rVert, vertex.vertexState()) + result.second;
22 
23  return theVTFactory.vertexTrack(
24  track->linearizedTrack(), vertex.vertexState(), thePair.first, smoothedChi2, thePair.second, track->weight());
25 }

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

Member Data Documentation

◆ helper

template<unsigned int N>
KVFHelper<N> KalmanVertexTrackUpdator< N >::helper
private

Definition at line 64 of file KalmanVertexTrackUpdator.h.

◆ theVTFactory

template<unsigned int N>
VertexTrackFactory<N> KalmanVertexTrackUpdator< N >::theVTFactory
private

Definition at line 63 of file KalmanVertexTrackUpdator.h.

◆ updator

template<unsigned int N>
KalmanVertexUpdator<N> KalmanVertexTrackUpdator< N >::updator
private

Definition at line 65 of file KalmanVertexTrackUpdator.h.

AlgebraicVector3
ROOT::Math::SVector< double, 3 > AlgebraicVector3
Definition: AlgebraicROOTObjects.h:12
AlgebraicSymMatrix33
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
Definition: AlgebraicROOTObjects.h:21
VertexException
Common base class.
Definition: VertexException.h:12
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
KalmanVertexTrackUpdator::trackRefit
trackMatrixPair trackRefit(const VertexState &vertex, RefCountedLinearizedTrackState linTrackState, float weight) const
Definition: KalmanVertexTrackUpdator.cc:28
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
alignCSCRings.s
s
Definition: alignCSCRings.py:92
N
#define N
Definition: blowfish.cc:9
Point3DBase< float, GlobalTag >
b
double b
Definition: hdecay.h:118
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
a
double a
Definition: hdecay.h:119
helper
Definition: helper.py:1
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
invertPosDefMatrix
bool invertPosDefMatrix(ROOT::Math::SMatrix< T, N, N, ROOT::Math::MatRepSym< T, N > > &m)
Definition: invertPosDefMatrix.h:10
KalmanVertexTrackUpdator::RefCountedRefittedTrackState
VertexTrack< N >::RefCountedRefittedTrackState RefCountedRefittedTrackState
Definition: KalmanVertexTrackUpdator.h:21
KalmanVertexTrackUpdator::AlgebraicSymMatrixOO
ROOT::Math::SMatrix< double, N+1, N+1, ROOT::Math::MatRepSym< double, N+1 > > AlgebraicSymMatrixOO
Definition: KalmanVertexTrackUpdator.h:48
KalmanVertexTrackUpdator::updator
KalmanVertexUpdator< N > updator
Definition: KalmanVertexTrackUpdator.h:65
VertexState
Definition: VertexState.h:13
KalmanVertexTrackUpdator::theVTFactory
VertexTrackFactory< N > theVTFactory
Definition: KalmanVertexTrackUpdator.h:63
KalmanVertexTrackUpdator::AlgebraicMatrix3M
ROOT::Math::SMatrix< double, 3, N - 2, ROOT::Math::MatRepStd< double, 3, N - 2 > > AlgebraicMatrix3M
Definition: KalmanVertexTrackUpdator.h:47
KalmanVertexTrackUpdator::KalmanVertexTrackUpdator
KalmanVertexTrackUpdator()
Definition: KalmanVertexTrackUpdator.h:27
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
mps_fire.result
result
Definition: mps_fire.py:303
KalmanVertexTrackUpdator::trackMatrixPair
std::pair< RefCountedRefittedTrackState, AlgebraicSymMatrixOO > trackMatrixPair
Definition: KalmanVertexTrackUpdator.h:49
weight
Definition: weight.py:1