Skip to content

Commit

Permalink
Merge branch 'main' into refactor-comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Dec 5, 2023
2 parents 4d8efc5 + 04544d9 commit c3b546c
Showing 1 changed file with 38 additions and 8 deletions.
46 changes: 38 additions & 8 deletions Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "Acts/Propagator/ConstrainedStep.hpp"
#include "Acts/Propagator/Propagator.hpp"
#include "Acts/Propagator/StandardAborters.hpp"
#include "Acts/Propagator/detail/LoopProtection.hpp"
#include "Acts/Propagator/detail/PointwiseMaterialInteraction.hpp"
#include "Acts/Surfaces/BoundaryCheck.hpp"
#include "Acts/TrackFinding/CombinatorialKalmanFilterError.hpp"
Expand Down Expand Up @@ -392,6 +393,13 @@ class CombinatorialKalmanFilter {

ACTS_VERBOSE("CombinatorialKalmanFilter step");

// Initialize path limit reached aborter
if (result.pathLimitReached.internalLimit ==
std::numeric_limits<double>::max()) {
detail::setupLoopProtection(state, stepper, result.pathLimitReached,
true, logger());
}

if (!result.filtered &&
filterTargetReached(state, stepper, navigator, logger())) {
navigator.navigationBreak(state.navigation, true);
Expand Down Expand Up @@ -488,12 +496,19 @@ class CombinatorialKalmanFilter {
}
}

if (endOfWorldReached(state, stepper, navigator, logger()) ||
result.pathLimitReached(state, stepper, navigator, logger())) {
navigator.targetReached(state.navigation, false);
if (result.activeTips.empty()) {
// we are already done
} else if (result.activeTips.size() == 1) {
bool isEndOfWorldReached =
endOfWorldReached(state, stepper, navigator, logger());
bool isPathLimitReached =
result.pathLimitReached(state, stepper, navigator, logger());
if (isEndOfWorldReached || isPathLimitReached) {
if (isEndOfWorldReached) {
ACTS_VERBOSE("End of world reached");
}
if (isPathLimitReached) {
ACTS_VERBOSE("Path limit reached");
}

if (result.activeTips.size() <= 1) {
// this was the last track - we are done
ACTS_VERBOSE("Kalman filtering finds "
<< result.lastTrackIndices.size() << " tracks");
Expand Down Expand Up @@ -553,7 +568,7 @@ class CombinatorialKalmanFilter {
// track parameters for found track indexed with iSmoothed
bool isTargetReached =
smoothingTargetReached(state, stepper, navigator, logger());
bool isPathLimitReached =
isPathLimitReached =
result.pathLimitReached(state, stepper, navigator, logger());
if (result.smoothed && (isTargetReached || isPathLimitReached)) {
ACTS_VERBOSE(
Expand Down Expand Up @@ -1357,6 +1372,20 @@ class CombinatorialKalmanFilter {
}
};

/// Void path limit reached aborter to replace the default since the path
/// limit is handled in the CKF actor internally.
struct StubPathLimitReached {
double internalLimit{};

template <typename propagator_state_t, typename stepper_t,
typename navigator_t>
bool operator()(propagator_state_t& /*unused*/, const stepper_t& /*unused*/,
const navigator_t& /*unused*/,
const Logger& /*unused*/) const {
return false;
}
};

public:
/// Combinatorial Kalman Filter implementation, calls the Kalman filter
/// and smoother
Expand Down Expand Up @@ -1443,7 +1472,8 @@ class CombinatorialKalmanFilter {
r.stateBuffer = stateBuffer;
r.stateBuffer->clear();

auto result = m_propagator.template propagate(
auto result = m_propagator.template propagate<
start_parameters_t, decltype(propOptions), PathLimitReached>(
initialParameters, propOptions, false, std::move(inputResult));

if (!result.ok()) {
Expand Down

0 comments on commit c3b546c

Please sign in to comment.