Skip to content

Commit

Permalink
refactor!: Give CKF BranchStopper access to TrackState (acts-project#…
Browse files Browse the repository at this point in the history
…2714)

This is needed if we want the branch stopper to check things like "did we just encounter the second hole in a row".

BREAKING CHANGE: The interface of the `BranchStopper` delegate in the CKF extensions goes from
```cpp
bool(const CombinatorialKalmanFilterTipState&);
```
to
```cpp
bool(const CombinatorialKalmanFilterTipState&, TrackStateProxy&);
```
  • Loading branch information
paulgessinger authored Nov 30, 2023
1 parent 5151436 commit 6e58732
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ struct CombinatorialKalmanFilterExtensions {
Delegate<Result<std::pair<typename candidate_container_t::iterator,
typename candidate_container_t::iterator>>(
candidate_container_t& trackStates, bool&, const Logger&)>;
using BranchStopper =
Delegate<bool(const CombinatorialKalmanFilterTipState&)>;
using BranchStopper = Delegate<bool(const CombinatorialKalmanFilterTipState&,
typename traj_t::TrackStateProxy&)>;

/// The Calibrator is a dedicated calibration algorithm that allows
/// to calibrate measurements using track information, this could be
Expand All @@ -109,7 +109,7 @@ struct CombinatorialKalmanFilterExtensions {
calibrator.template connect<&detail::voidFitterCalibrator<traj_t>>();
updater.template connect<&detail::voidFitterUpdater<traj_t>>();
smoother.template connect<&detail::voidFitterSmoother<traj_t>>();
branchStopper.connect<voidBranchStopper>();
branchStopper.template connect<voidBranchStopper>();
measurementSelector.template connect<voidMeasurementSelector>();
}

Expand All @@ -133,8 +133,10 @@ struct CombinatorialKalmanFilterExtensions {
/// @param tipState The tip state to decide whether to stop (unused)
/// @return false
static bool voidBranchStopper(
const CombinatorialKalmanFilterTipState& tipState) {
const CombinatorialKalmanFilterTipState& tipState,
typename traj_t::TrackStateProxy& trackState) {
(void)tipState;
(void)trackState;
return false;
}
};
Expand Down Expand Up @@ -818,8 +820,11 @@ class CombinatorialKalmanFilter {
currentTip = addNonSourcelinkState(stateMask, boundState, result,
isSensitive, prevTip);

auto nonSourcelinkState =
result.fittedStates->getTrackState(currentTip);

// Check the branch
if (!m_extensions.branchStopper(tipState)) {
if (!m_extensions.branchStopper(tipState, nonSourcelinkState)) {
// Remember the active tip and its state
result.activeTips.emplace_back(currentTip, tipState);
} else {
Expand Down Expand Up @@ -1037,7 +1042,7 @@ class CombinatorialKalmanFilter {
}

// Check if need to stop this branch
if (!m_extensions.branchStopper(tipState)) {
if (!m_extensions.branchStopper(tipState, trackState)) {
// Put tipstate back into active tips to continue with it
result.activeTips.emplace_back(currentTip, tipState);
// Record the number of branches on surface
Expand Down

0 comments on commit 6e58732

Please sign in to comment.