4 #include <Math/SVector.h> 5 #include <Math/SMatrix.h> 6 #include <Math/MatrixFunctions.h> 21 static inline double sqr(
double arg) {
return arg *
arg; }
25 typedef SVector<double, 4> Vector4;
26 typedef SVector<double, 2> Vector2;
28 typedef SMatrix<double, 4, 4, MatRepSym<double, 4> > Matrix4S;
29 typedef SMatrix<double, 3, 3, MatRepSym<double, 3> > Matrix3S;
30 typedef SMatrix<double, 2, 2, MatRepSym<double, 2> > Matrix2S;
31 typedef SMatrix<double, 4, 4> Matrix44;
32 typedef SMatrix<double, 4, 2> Matrix42;
33 typedef SMatrix<double, 2, 4> Matrix24;
34 typedef SMatrix<double, 2, 3> Matrix23;
35 typedef SMatrix<double, 2, 2> Matrix22;
41 Matrix2S measErr, measPredErr;
60 measToLocal(0, 0) = -
dz *
x;
61 measToLocal(0, 1) = -
dz *
y;
62 measToLocal(0, 2) = 1.;
63 measToLocal(1, 0) =
y;
64 measToLocal(1, 1) = -
x;
67 measErr = Similarity(measToLocal,
state.cartesianCovariance());
81 residual[1] = pred.
ip() -
tip;
90 KalmanState kalmanState(pred,
state);
92 if (
state.weight() < 1.0e-3)
96 Matrix2S invErr = kalmanState.measPredErr + (1.0 /
state.weight()) * kalmanState.measErr;
101 Matrix42
gain = pred.
covariance() * Transpose(kalmanState.h) * invErr;
104 Vector4 newPred = pred.
prediction() + (
gain * kalmanState.residual);
105 Matrix44 tmp44 = SMatrixIdentity();
107 Matrix4S newError(tmp44.LowerBlock());
110 Matrix22 tmp22 = SMatrixIdentity();
111 tmp22 = tmp22 - kalmanState.h *
gain;
112 Vector2 filtRes = tmp22 * kalmanState.residual;
113 tmp22 *= kalmanState.measErr;
114 Matrix2S filtResErr(tmp22.LowerBlock());
115 if (!filtResErr.Invert())
119 chi2 +=
state.weight() * Similarity(filtRes, filtResErr);
128 bool withPredError)
const {
131 KalmanState kalmanState(pred,
state);
137 Matrix2S invErr = kalmanState.measErr;
139 invErr += kalmanState.measPredErr;
140 if (!invErr.Invert()) {
146 chi2 = Similarity(kalmanState.residual, invErr);
const Vector & prediction() const
GhostTrackPrediction update(const GhostTrackPrediction &pred, const GhostTrackState &state, double &ndof, double &chi2) const override
Sin< T >::type sin(const T &t)
void contribution(const GhostTrackPrediction &pred, const GhostTrackState &state, double &ndof, double &chi2, bool withPredError=false) const override
Cos< T >::type cos(const T &t)
Square< F >::type sqr(const F &f)
const Error & covariance() const
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point