GENFIT  Rev:NoNumberAvailable
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
Functions
genfit::tools Namespace Reference

Functions

void invertMatrix (const TMatrixDSym &mat, TMatrixDSym &inv, double *determinant=NULL)
 Invert a matrix, throwing an Exception when inversion fails. Optional calculation of determinant. More...
 
void invertMatrix (TMatrixDSym &mat, double *determinant=NULL)
 Same, replacing its argument. More...
 
bool transposedForwardSubstitution (const TMatrixD &R, TVectorD &b)
 Solves R^t x = b, replacing b with the solution for x. R is assumed to be upper diagonal. More...
 
bool transposedForwardSubstitution (const TMatrixD &R, TMatrixD &b, int nCol)
 Same, for a column of the matrix b. More...
 
bool transposedInvert (const TMatrixD &R, TMatrixD &inv)
 Inverts the transpose of the upper right matrix R into inv. More...
 
void QR (TMatrixD &A)
 Replaces A with an upper right matrix connected to A by an orthongonal transformation. I.e., it computes R from a QR decomposition of A = QR, replacing A. More...
 
void QR (TMatrixD &A, TVectorD &b)
 Replaces A with an upper right matrix connected to A by an orthongonal transformation. I.e., it computes R from a QR decomposition of A = QR, replacing A. Also replaces b by Q'b where Q' is the transposed of Q. More...
 
void safeAverage (const TMatrixDSym &C1, const TMatrixDSym &C2, TMatrixDSym &result)
 This averages the covariance matrices C1, C2 in a numerically stable way by using matrix square roots. This code is in no way optimized so use with care if speed is a concern. More...
 
void noiseMatrixSqrt (const TMatrixDSym &noise, TMatrixD &noiseSqrt)
 Calculate a sqrt for the positive semidefinite noise matrix. Rows corresponding to zero eigenvalues are omitted. This gives the transposed of the square root, i.e. noise = noiseSqrt * noiseSqrt'. More...
 
void kalmanPrediction (const TVectorD &x, const TVectorD &delta, const TMatrixD &F, TVectorD &xNew)
 Transport the state. More...
 
void kalmanPredictionCovSqrt (const TMatrixD &S, const TMatrixD &F, const TMatrixD &Q, TMatrixD &Snew)
 Calculates the square root of the covariance matrix after the Kalman prediction (i.e. extrapolation) with transport matrix F and the noise square root Q. Gives the new covariance square root. More...
 
void kalmanUpdateSqrt (const TMatrixD &S, const TVectorD &res, const TMatrixD &R, const AbsHMatrix *H, TVectorD &update, TMatrixD &SNew)
 Calculate the Kalman measurement update with no transport. x, S : state prediction, covariance square root res, R, H : residual, measurement covariance square root, H matrix of the measurement. More...
 
void kalmanPredictionUpdateSqrt (const TMatrixD &S, const TMatrixD &F, const TMatrixD &Q, const TVectorD &res, const TMatrixD &R, const AbsHMatrix *H, TVectorD &update, TMatrixD &SNew)
 

Function Documentation

void genfit::tools::invertMatrix ( const TMatrixDSym &  mat,
TMatrixDSym &  inv,
double *  determinant = NULL 
)
void genfit::tools::invertMatrix ( TMatrixDSym &  mat,
double *  determinant = NULL 
)

Same, replacing its argument.

Definition at line 118 of file Tools.cc.

References genfit::Exception::setFatal(), and useCramer.

void genfit::tools::kalmanPrediction ( const TVectorD &  x,
const TVectorD &  delta,
const TMatrixD &  F,
TVectorD &  xNew 
)

Transport the state.

Definition at line 477 of file Tools.cc.

void genfit::tools::kalmanPredictionCovSqrt ( const TMatrixD &  S,
const TMatrixD &  F,
const TMatrixD &  Q,
TMatrixD &  Snew 
)

Calculates the square root of the covariance matrix after the Kalman prediction (i.e. extrapolation) with transport matrix F and the noise square root Q. Gives the new covariance square root.

Definition at line 492 of file Tools.cc.

References QR().

Referenced by genfit::KalmanFitterRefTrack::processTrackPointSqrt().

void genfit::tools::kalmanPredictionUpdateSqrt ( const TMatrixD &  S,
const TMatrixD &  F,
const TMatrixD &  Q,
const TVectorD &  res,
const TMatrixD &  R,
const AbsHMatrix *  H,
TVectorD &  update,
TMatrixD &  SNew 
)

Definition at line 548 of file Tools.cc.

References genfit::AbsHMatrix::MHt(), QR(), and transposedForwardSubstitution().

void genfit::tools::kalmanUpdateSqrt ( const TMatrixD &  S,
const TVectorD &  res,
const TMatrixD &  R,
const AbsHMatrix *  H,
TVectorD &  update,
TMatrixD &  SNew 
)

Calculate the Kalman measurement update with no transport. x, S : state prediction, covariance square root res, R, H : residual, measurement covariance square root, H matrix of the measurement.

Definition at line 517 of file Tools.cc.

References genfit::AbsHMatrix::MHt(), QR(), and transposedForwardSubstitution().

Referenced by genfit::KalmanFitter::processTrackPoint(), and genfit::KalmanFitterRefTrack::processTrackPointSqrt().

void genfit::tools::noiseMatrixSqrt ( const TMatrixDSym &  noise,
TMatrixD &  noiseSqrt 
)

Calculate a sqrt for the positive semidefinite noise matrix. Rows corresponding to zero eigenvalues are omitted. This gives the transposed of the square root, i.e. noise = noiseSqrt * noiseSqrt'.

Definition at line 443 of file Tools.cc.

Referenced by genfit::KalmanFitterRefTrack::processTrackPointSqrt().

void genfit::tools::QR ( TMatrixD &  A)

Replaces A with an upper right matrix connected to A by an orthongonal transformation. I.e., it computes R from a QR decomposition of A = QR, replacing A.

Definition at line 260 of file Tools.cc.

Referenced by genfit::calcAverageState(), kalmanPredictionCovSqrt(), kalmanPredictionUpdateSqrt(), kalmanUpdateSqrt(), and safeAverage().

void genfit::tools::QR ( TMatrixD &  A,
TVectorD &  b 
)

Replaces A with an upper right matrix connected to A by an orthongonal transformation. I.e., it computes R from a QR decomposition of A = QR, replacing A. Also replaces b by Q'b where Q' is the transposed of Q.

Definition at line 321 of file Tools.cc.

void genfit::tools::safeAverage ( const TMatrixDSym &  C1,
const TMatrixDSym &  C2,
TMatrixDSym &  result 
)

This averages the covariance matrices C1, C2 in a numerically stable way by using matrix square roots. This code is in no way optimized so use with care if speed is a concern.

Definition at line 390 of file Tools.cc.

References QR(), and transposedInvert().

bool genfit::tools::transposedForwardSubstitution ( const TMatrixD &  R,
TVectorD &  b 
)

Solves R^t x = b, replacing b with the solution for x. R is assumed to be upper diagonal.

Definition at line 201 of file Tools.cc.

Referenced by kalmanPredictionUpdateSqrt(), kalmanUpdateSqrt(), and transposedInvert().

bool genfit::tools::transposedForwardSubstitution ( const TMatrixD &  R,
TMatrixD &  b,
int  nCol 
)

Same, for a column of the matrix b.

Definition at line 221 of file Tools.cc.

bool genfit::tools::transposedInvert ( const TMatrixD &  R,
TMatrixD &  inv 
)

Inverts the transpose of the upper right matrix R into inv.

Definition at line 240 of file Tools.cc.

References transposedForwardSubstitution().

Referenced by genfit::calcAverageState(), and safeAverage().