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

refactor: Combine GSF actor and aborter #3984

Merged
merged 3 commits into from
Dec 16, 2024
Merged
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
19 changes: 2 additions & 17 deletions Core/include/Acts/TrackFitting/GaussianSumFitter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,6 @@ struct GaussianSumFitter {
/// The actor type
using GsfActor = detail::GsfActor<bethe_heitler_approx_t, traj_t>;

/// This allows to break the propagation by setting the navigationBreak
/// TODO refactor once we can do this more elegantly
struct NavigationBreakAborter {
NavigationBreakAborter() = default;

template <typename propagator_state_t, typename stepper_t,
typename navigator_t>
bool checkAbort(propagator_state_t& state, const stepper_t& /*stepper*/,
const navigator_t& navigator,
const Logger& /*logger*/) const {
return navigator.navigationBreak(state.navigation);
}
};

/// @brief The fit function for the Direct navigator
template <typename source_link_it_t, typename start_parameters_t,
TrackContainerFrontend track_container_t>
Expand All @@ -105,7 +91,7 @@ struct GaussianSumFitter {

// Initialize the forward propagation with the DirectNavigator
auto fwdPropInitializer = [&sSequence, this](const auto& opts) {
using Actors = ActorList<GsfActor, NavigationBreakAborter>;
using Actors = ActorList<GsfActor>;
using PropagatorOptions = typename propagator_t::template Options<Actors>;

PropagatorOptions propOptions(opts.geoContext, opts.magFieldContext);
Expand Down Expand Up @@ -151,8 +137,7 @@ struct GaussianSumFitter {

// Initialize the forward propagation with the DirectNavigator
auto fwdPropInitializer = [this](const auto& opts) {
using Actors =
ActorList<GsfActor, EndOfWorldReached, NavigationBreakAborter>;
using Actors = ActorList<GsfActor, EndOfWorldReached>;
using PropagatorOptions = typename propagator_t::template Options<Actors>;

PropagatorOptions propOptions(opts.geoContext, opts.magFieldContext);
Expand Down
11 changes: 9 additions & 2 deletions Core/include/Acts/TrackFitting/detail/GsfActor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,20 @@ struct GsfActor {
applyMultipleScattering(state, stepper, navigator,
MaterialUpdateStage::PostUpdate);
}
}

// Break the navigation if we found all measurements
template <typename propagator_state_t, typename stepper_t,
typename navigator_t>
bool checkAbort(propagator_state_t& /*state*/, const stepper_t& /*stepper*/,
const navigator_t& /*navigator*/, const result_type& result,
const Logger& /*logger*/) const {
if (m_cfg.numberMeasurements &&
result.measurementStates == m_cfg.numberMeasurements) {
ACTS_VERBOSE("Stop navigation because all measurements are found");
navigator.navigationBreak(state.navigation, true);
return true;
}

return false;
}

template <typename propagator_state_t, typename stepper_t,
Expand Down
Loading