Skip to content
Snippets Groups Projects
Verified Commit ad24668b authored by Stephen Nicholas Swatman's avatar Stephen Nicholas Swatman
Browse files

Guard against invalid pattern parameter covariance

The `Trk::PatternTrackParameters` class contains, like the other track
parameter classes, an optional covariance matrix. In other track
parameter classes, the nullability of the covariance matrix is modelled
using pointers. The pattern track parameters, on the contrary, always
contain a covariance matrix, and use a boolean flag to indicate whether
the data stored in this covariance matrix data member is valid or not.

The pattern track parameters class provides a `newCovarianceMatrix`
method which updates the covariance matrix of the current instance
according to a Jacobian matrix and the covariance matrix of a second set
of track parameters. The implementation of this method assumes that the
covariance matrix stored in the second set of parameters is valid, and
also marks the covariance of the object on which it is called as valid.
It follows from this that the method should only be called if the second
parameter has a valid and properly initialized covariance matrix.

I was able to find two cases in which the validity of the covariance
matrix is not checked: in the Runge-Kutta propagator and in the SI
trajectory element. This may lead to unsanitary behaviour, and I believe
this to be a bug in terms of physics performance. Investigation reveals
that there are indeed cases where this method is called for parameters
with invalid covariance matrices.

To counteract this effect, I have added additional safeguards to prevent
the execution of the aforementioned method in cases where the second set
of track parameters has an invalid covariance matrix, thereby ensuring
that invalid covariance information is not propagated to other parts of
the code base.

This commit introduces slight changes in physics output, but these
changes are accounted for and I believe them to be improvements over the
old output.
parent 95330f6d
6 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42417Draft: DIRE and VINCIA Base Fragments for Pythia 8.3,!37151Guard against use of invalid pattern track parameter covariance
......@@ -1111,6 +1111,10 @@ bool InDet::SiTrajectoryElement_xk::transformGlobalToPlane
Jac[19] =(C*P[40]-s4*C44)*n; // dThe/dCM
Jac[20] = 1.; // dCM /dCM
if (!Ta.iscovariance()) {
return false;
}
Tb.newCovarianceMatrix(Ta,Jac);
const double* t = &Tb.cov()[0];
if(t[0]<=0. || t[2]<=0. || t[5]<=0. || t[9]<=0. || t[14]<=0.) return false;
......
......@@ -1578,6 +1578,10 @@ bool Trk::RungeKuttaPropagator::propagateRungeKutta
//
Tb.setParameters(&Su,p);
if(useJac) {
if (!Ta.iscovariance()) {
return false;
}
Tb.newCovarianceMatrix(Ta,Jac);
const double* cv = Tb.cov();
if( cv[0]<=0. || cv[2]<=0. || cv[5]<=0. || cv[9]<=0. || cv[14]<=0.) return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment