Skip to content

Guard against use of invalid pattern track 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.

Merge request reports