Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(gx2f): support n-dimensional measurements #3264

Merged
merged 20 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions Core/include/Acts/TrackFitting/GlobalChiSquareFitter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -828,10 +828,18 @@ class Gx2Fitter {
} else if (measDim == 2) {
addToGx2fSums<2>(aMatrix, bVector, chi2sum, jacobianFromStart,
trackState, *m_addToSumLogger);
} else if (measDim == 3) {
addToGx2fSums<3>(aMatrix, bVector, chi2sum, jacobianFromStart,
trackState, *m_addToSumLogger);
} else if (measDim == 4) {
addToGx2fSums<4>(aMatrix, bVector, chi2sum, jacobianFromStart,
trackState, *m_addToSumLogger);
} else if (measDim == 5) {
addToGx2fSums<5>(aMatrix, bVector, chi2sum, jacobianFromStart,
trackState, *m_addToSumLogger);
} else {
ACTS_ERROR("Can not process state with measurement with "
<< measDim << " dimensions.")
countNdf -= measDim;
AJPfleger marked this conversation as resolved.
Show resolved Hide resolved
addToGx2fSums<6>(aMatrix, bVector, chi2sum, jacobianFromStart,
trackState, *m_addToSumLogger);
}
} else if (typeFlags.test(TrackStateFlag::HoleFlag)) {
// Handle hole
Expand Down Expand Up @@ -910,7 +918,7 @@ class Gx2Fitter {
// Calculate covariance of the fitted parameters with inverse of [a]
BoundMatrix fullCovariancePredicted = BoundMatrix::Identity();
bool aMatrixIsInvertible = false;
if (gx2fOptions.zeroField) {
if (aMatrix(4, 4) == 0) {
constexpr std::size_t reducedMatrixSize = 4;

auto safeReducedCovariance = safeInverse(
Expand All @@ -921,9 +929,20 @@ class Gx2Fitter {
.topLeftCorner<reducedMatrixSize, reducedMatrixSize>() =
*safeReducedCovariance;
}
} else {
} else if (aMatrix(5, 5) == 0) {
constexpr std::size_t reducedMatrixSize = 5;

auto safeReducedCovariance = safeInverse(
aMatrix.topLeftCorner<reducedMatrixSize, reducedMatrixSize>().eval());
if (safeReducedCovariance) {
aMatrixIsInvertible = true;
fullCovariancePredicted
.topLeftCorner<reducedMatrixSize, reducedMatrixSize>() =
*safeReducedCovariance;
}
} else {
constexpr std::size_t reducedMatrixSize = 6;

auto safeReducedCovariance = safeInverse(
aMatrix.topLeftCorner<reducedMatrixSize, reducedMatrixSize>().eval());
if (safeReducedCovariance) {
Expand Down
12 changes: 9 additions & 3 deletions Core/src/TrackFitting/GlobalChiSquareFitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,27 @@

namespace Acts::Experimental {

BoundVector calculateDeltaParams(bool zeroField, const BoundMatrix& aMatrix,
BoundVector calculateDeltaParams(bool /*zeroField*/, const BoundMatrix& aMatrix,
const BoundVector& bVector) {
BoundVector deltaParams = BoundVector::Zero();
if (zeroField) {
if (aMatrix(4, 4) == 0) {
constexpr std::size_t reducedMatrixSize = 4;
deltaParams.topLeftCorner<reducedMatrixSize, 1>() =
aMatrix.topLeftCorner<reducedMatrixSize, reducedMatrixSize>()
.colPivHouseholderQr()
.solve(bVector.topLeftCorner<reducedMatrixSize, 1>());
} else {
} else if (aMatrix(5, 5) == 0) {
constexpr std::size_t reducedMatrixSize = 5;
deltaParams.topLeftCorner<reducedMatrixSize, 1>() =
aMatrix.topLeftCorner<reducedMatrixSize, reducedMatrixSize>()
.colPivHouseholderQr()
.solve(bVector.topLeftCorner<reducedMatrixSize, 1>());
} else {
constexpr std::size_t reducedMatrixSize = 6;
deltaParams.topLeftCorner<reducedMatrixSize, 1>() =
aMatrix.topLeftCorner<reducedMatrixSize, reducedMatrixSize>()
.colPivHouseholderQr()
.solve(bVector.topLeftCorner<reducedMatrixSize, 1>());
}

return deltaParams;
Expand Down
Loading