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

fix(gx2f): new error UsedUnreachableMeasurements #3653

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
37 changes: 33 additions & 4 deletions Core/include/Acts/TrackFitting/GlobalChiSquareFitter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -609,10 +609,10 @@ class Gx2Fitter {

// Check if we can stop to propagate
if (result.measurementStates == inputMeasurements->size()) {
ACTS_INFO("Actor: finish: All measurements have been found.");
ACTS_DEBUG("Actor: finish: All measurements have been found.");
result.finished = true;
} else if (state.navigation.navigationBreak) {
ACTS_INFO("Actor: finish: navigationBreak.");
ACTS_DEBUG("Actor: finish: navigationBreak.");
result.finished = true;
}

Expand Down Expand Up @@ -1217,7 +1217,7 @@ class Gx2Fitter {

// We only consider states with a measurement (and/or material)
if (!stateHasMeasurement && !doMaterial) {
ACTS_INFO(" Skip state.");
ACTS_DEBUG(" Skip state.");
continue;
}

Expand Down Expand Up @@ -1387,6 +1387,9 @@ class Gx2Fitter {

// Propagate again with the final covariance matrix. This is necessary to
// obtain the propagated covariance for each state.
// We also need to recheck the result and find the tipIndex, because at this
// step, we will not ignore the boundary checks for measurement surfaces. We
// want to create trackstates only on surfaces, that we actually hit.
if (gx2fOptions.nUpdateMax > 0) {
ACTS_VERBOSE("final deltaParams:\n" << deltaParams);
ACTS_VERBOSE("Propagate with the final covariance.");
Expand All @@ -1412,7 +1415,33 @@ class Gx2Fitter {
auto& r = propagatorState.template get<Gx2FitterResult<traj_t>>();
r.fittedStates = &trackContainer.trackStateContainer();

m_propagator.template propagate(propagatorState);
auto propagationResult = m_propagator.template propagate(propagatorState);

// Run the fitter
auto result = m_propagator.template makeResult(std::move(propagatorState),
propagationResult,
propagatorOptions, false);

if (!result.ok()) {
ACTS_ERROR("Propagation failed: " << result.error());
return result.error();
}

auto& propRes = *result;
GX2FResult gx2fResult = std::move(propRes.template get<GX2FResult>());

if (!gx2fResult.result.ok()) {
ACTS_INFO("GlobalChiSquareFitter failed in actor: "
<< gx2fResult.result.error() << ", "
<< gx2fResult.result.error().message());
return gx2fResult.result.error();
}

if (tipIndex != gx2fResult.lastMeasurementIndex) {
ACTS_INFO("Final fit used unreachable measurements.");
return Experimental::GlobalChiSquareFitterError::
UsedUnreachableMeasurements;
}
}

if (!trackContainer.hasColumn(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of the Acts project.
//
// Copyright (C) 2023 CERN for the benefit of the Acts project
// Copyright (C) 2023-2024 CERN for the benefit of the Acts project
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
Expand All @@ -19,6 +19,7 @@ enum class GlobalChiSquareFitterError {
DidNotConverge = 2,
NotEnoughMeasurements = 3,
UpdatePushedToNewVolume = 4,
UsedUnreachableMeasurements = 5,
};

std::error_code make_error_code(
Expand Down
4 changes: 3 additions & 1 deletion Core/src/TrackFitting/GlobalChiSquareFitterError.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of the Acts project.
//
// Copyright (C) 2023 CERN for the benefit of the Acts project
// Copyright (C) 2023-2024 CERN for the benefit of the Acts project
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down Expand Up @@ -32,6 +32,8 @@ class GlobalChiSquareFitterErrorCategory : public std::error_category {
return "Gx2f: Not enough measurements.";
case GlobalChiSquareFitterError::UpdatePushedToNewVolume:
return "Gx2f: Update pushed the parameters to a new volume.";
case GlobalChiSquareFitterError::UsedUnreachableMeasurements:
return "Gx2f: Final fit used unreachable measurements.";
default:
return "unknown";
}
Expand Down
Loading