Skip to content

Commit

Permalink
Automatize the actor state construction for default constructible act…
Browse files Browse the repository at this point in the history
…or states
  • Loading branch information
niermann999 committed Nov 4, 2024
1 parent f42b90b commit 3ddb1ce
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 27 deletions.
29 changes: 19 additions & 10 deletions core/src/finding/find_tracks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,36 +310,45 @@ track_candidate_container_types::host find_tracks(
.template set_constraint<detray::step::constraint::e_accuracy>(
config.propagation.stepping.step_constraint);

detray::pathlimit_aborter::state s0;
typename detray::parameter_transporter<algebra_type>::state s1;
typename interactor_type::state s2;
typename ckf_aborter::state s3;
s3.min_step_length = config.min_step_length_for_next_surface;
s3.max_count = config.max_step_counts_for_next_surface;
// Generate actor states and references to the states
auto [actors_states, actor_chain_state] =
actor_type::make_actor_states();

auto& path_abrt_state =
detray::detail::get<detray::pathlimit_aborter::state>(
actors_states);
path_abrt_state.set_path_limit(
config.propagation.stepping.path_limit);

auto& ckf_abrt_state =
detray::detail::get<ckf_aborter::state>(actors_states);
ckf_abrt_state.min_step_length =
config.min_step_length_for_next_surface;
ckf_abrt_state.max_count = config.max_step_counts_for_next_surface;

// @TODO: Should be removed once detray is fixed to set the
// volume in the constructor
propagation._navigation.set_volume(param.surface_link().volume());

// Propagate to the next surface
propagator.propagate_sync(propagation, detray::tie(s0, s1, s2, s3));
propagator.propagate_sync(propagation, actor_chain_state);

// If a surface found, add the parameter for the next
// step
if (s3.success) {
if (ckf_abrt_state.success) {
out_params.push_back(propagation._stepping.bound_params());
param_to_link[step].push_back(link_id);
}
// Unless the track found a surface, it is considered a
// tip
else if (!s3.success &&
else if (!ckf_abrt_state.success &&
(step >= (config.min_track_candidates_per_track - 1u))) {
tips.push_back({step, link_id});
}

// If no more CKF step is expected, current candidate is
// kept as a tip
if (s3.success &&
if (ckf_abrt_state.success &&
(step == (config.max_track_candidates_per_track - 1u))) {
tips.push_back({step, link_id});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace traccc::device {
template <typename propagator_t, typename bfield_t, typename config_t>
TRACCC_DEVICE inline void propagate_to_next_surface(
std::size_t globalIndex, const config_t cfg,
const propagate_to_next_surface_payload<propagator_t, bfield_t>& payload) {
const propagate_to_next_surface_payload<propagator_t, bfield_t> &payload) {

if (globalIndex >= payload.n_in_params) {
return;
Expand Down Expand Up @@ -91,30 +91,29 @@ TRACCC_DEVICE inline void propagate_to_next_surface(
.template set_constraint<detray::step::constraint::e_accuracy>(
cfg.propagation.stepping.step_constraint);

// Actor state
// @TODO: simplify the syntax here
// @NOTE: Post material interaction might be required here
using actor_list_type =
typename propagator_t::actor_chain_type::actor_list_type;
typename detray::detail::tuple_element<0, actor_list_type>::type::state
s0{};
typename detray::detail::tuple_element<1, actor_list_type>::type::state
s1{};
typename detray::detail::tuple_element<2, actor_list_type>::type::state
s2{};
typename detray::detail::tuple_element<3, actor_list_type>::type::state s3;
s3.min_step_length = cfg.min_step_length_for_next_surface;
s3.max_count = cfg.max_step_counts_for_next_surface;
// Generate actor states and references to the states
using actor_chain_t = typename propagator_t::actor_chain_type;
auto [actors_states, actor_chain_state] =
actor_chain_t::make_actor_states();

auto &path_abrt_state =
detray::detail::get<detray::pathlimit_aborter::state>(actors_states);
path_abrt_state.set_path_limit(cfg.propagation.stepping.path_limit);

auto &ckf_abrt_state =
detray::detail::get<ckf_aborter::state>(actors_states);
ckf_abrt_state.min_step_length = cfg.min_step_length_for_next_surface;
ckf_abrt_state.max_count = cfg.max_step_counts_for_next_surface;

// @TODO: Should be removed once detray is fixed to set the volume in the
// constructor
propagation._navigation.set_volume(in_par.surface_link().volume());

// Propagate to the next surface
propagator.propagate_sync(propagation, detray::tie(s0, s1, s2, s3));
propagator.propagate_sync(propagation, actor_chain_state);

// If a surface found, add the parameter for the next step
if (s3.success) {
if (ckf_abrt_state.success) {
params[param_id] = propagation._stepping.bound_params();

if (payload.step == cfg.max_track_candidates_per_track - 1) {
Expand Down

0 comments on commit 3ddb1ce

Please sign in to comment.