Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
AJPfleger committed Oct 24, 2023
1 parent 9113d59 commit f36bdb7
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Core/include/Acts/TrackFitting/GlobalChiSquareFitter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -745,32 +745,34 @@ class Gx2Fitter {

// Calculate covariance of the fitted parameters with inverse of [a]
BoundMatrix fullCovariancePredicted = BoundMatrix::Identity();
bool detAisZero = true;
if (gx2fOptions.zeroField) {
const size_t reducedMatrixSize = 4;
if (aMatrix.topLeftCorner<reducedMatrixSize, reducedMatrixSize>()
.determinant() != 0) {
detAisZero = false;
fullCovariancePredicted
.template topLeftCorner<reducedMatrixSize, reducedMatrixSize>() =
aMatrix.topLeftCorner<reducedMatrixSize, reducedMatrixSize>()
.inverse();
} else if (gx2fOptions.nUpdateMax > 0) {
ACTS_ERROR("det(a) == 0. This should not happen ever.");
return Experimental::GlobalChiSquareFitterError::DetAIsZero;
}
} else {
const size_t reducedMatrixSize = 5;
if (aMatrix.topLeftCorner<reducedMatrixSize, reducedMatrixSize>()
.determinant() != 0) {
detAisZero = false;
fullCovariancePredicted
.template topLeftCorner<reducedMatrixSize, reducedMatrixSize>() =
aMatrix.topLeftCorner<reducedMatrixSize, reducedMatrixSize>()
.inverse();
} else if (gx2fOptions.nUpdateMax > 0) {
ACTS_ERROR("det(a) == 0. This should not happen ever.");
return Experimental::GlobalChiSquareFitterError::DetAIsZero;
}
}

if (detAisZero && gx2fOptions.nUpdateMax > 0) {
ACTS_ERROR("det(a) == 0. This should not happen ever.");
return Experimental::GlobalChiSquareFitterError::DetAIsZero;
}

// Prepare track for return
auto track = trackContainer.getTrack(trackContainer.addTrack());
track.tipIndex() = tipIndex;
Expand Down

0 comments on commit f36bdb7

Please sign in to comment.