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

ref: Move the full jacobian and bound track parameters to the parameter_transporter and merge it with the parameter_resetter #880

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
4 changes: 2 additions & 2 deletions core/include/detray/navigation/policies.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ struct stepper_default_policy : actor {

// Not a severe change to track state expected
// Policy is called after stepsize update -> use prev. step size
if (math::fabs(stepping.prev_step_size()) <
if (math::fabs(stepping.step_size()) <
math::fabs(
stepping.constraints().template size<>(stepping.direction())) -
pol_state.tol) {
Expand Down Expand Up @@ -112,7 +112,7 @@ struct stepper_rk_policy : actor {
auto &navigation = propagation._navigation;

// Policy is called after stepsize update -> use prev. step size
const scalar rel_correction{(stepping.prev_step_size() - navigation()) /
const scalar rel_correction{(stepping.step_size() - navigation()) /
navigation()};

// Large correction to the stepsize - re-initialize the volume
Expand Down
57 changes: 49 additions & 8 deletions core/include/detray/propagator/actor_chain.hpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
/** Detray library, part of the ACTS project (R&D line)
*
* (c) 2022 CERN for the benefit of the ACTS project
* (c) 2022-2024 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

#pragma once

#include <type_traits>
#include <utility>

// Project include(s)
#include "detray/definitions/detail/containers.hpp"
#include "detray/definitions/detail/qualifiers.hpp"
#include "detray/propagator/base_actor.hpp"
#include "detray/utils/tuple_helpers.hpp"

// System include(s)
#include <concepts>
#include <optional>
#include <type_traits>
#include <utility>

namespace detray {

/// The interface to the actors and aborters in the propagation.
Expand Down Expand Up @@ -44,7 +49,29 @@ class actor_chain {
}

/// @returns the actor list
DETRAY_HOST_DEVICE const actor_list_type &actors() const { return _actors; }
DETRAY_HOST_DEVICE const actor_list_type &actors() const {
return m_actors;
}

/// @returns a tuple of default constructible actor states and a
/// corresponding tuple of references
DETRAY_HOST_DEVICE
static constexpr auto make_actor_states() {
// Only possible if each state is default initializable
if constexpr ((std::default_initializable<typename actors_t::state> &&
...)) {
return tuple_t<typename actors_t::state...>{};
} else {
return std::nullopt;
}
}

/// @returns a tuple of reference for every state in the tuple @param t
DETRAY_HOST_DEVICE static constexpr state make_ref_tuple(
tuple_t<typename actors_t::state...> &t) {
return make_ref_tuple(t,
std::make_index_sequence<sizeof...(actors_t)>{});
}

private:
/// Call the actors. Either single actor or composition.
Expand All @@ -58,7 +85,13 @@ class actor_chain {
actor_states_t &states,
propagator_state_t &p_state) const {
if constexpr (!typename actor_t::is_comp_actor()) {
actr(detail::get<typename actor_t::state &>(states), p_state);
// No actor state defined (empty)
if constexpr (std::same_as<typename actor_t::state,
detray::actor::state>) {
actr(p_state);
} else {
actr(detail::get<typename actor_t::state &>(states), p_state);
}
} else {
actr(states, p_state);
}
Expand All @@ -73,11 +106,19 @@ class actor_chain {
DETRAY_HOST_DEVICE inline void run(
actor_states_t &states, propagator_state_t &p_state,
std::index_sequence<indices...> /*ids*/) const {
(run(detail::get<indices>(_actors), states, p_state), ...);
(run(detail::get<indices>(m_actors), states, p_state), ...);
}

/// @returns a tuple of reference for every state in the tuple @param t
template <std::size_t... indices>
DETRAY_HOST_DEVICE static constexpr state make_ref_tuple(
tuple_t<typename actors_t::state...> &t,
std::index_sequence<indices...> /*ids*/) {
return detray::tie(detail::get<indices>(t)...);
}

/// Tuple of actors
actor_list_type _actors = {};
actor_list_type m_actors = {};
};

/// Empty actor chain (placeholder)
Expand Down
24 changes: 0 additions & 24 deletions core/include/detray/propagator/actors/aborters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,28 +95,4 @@ struct target_aborter : actor {
}
};

/// Aborter triggered when the next surface is reached
struct next_surface_aborter : actor {
struct state {
// minimal step length to prevent from staying on the same surface
scalar min_step_length = 0.f;
bool success = false;
};

template <typename propagator_state_t>
DETRAY_HOST_DEVICE void operator()(state &abrt_state,
propagator_state_t &prop_state) const {

auto &navigation = prop_state._navigation;
auto &stepping = prop_state._stepping;

// Abort at the next sensitive surface
if (navigation.is_on_sensitive() &&
stepping.path_from_surface() > abrt_state.min_step_length) {
prop_state._heartbeat &= navigation.abort();
abrt_state.success = true;
}
}
};

} // namespace detray
82 changes: 0 additions & 82 deletions core/include/detray/propagator/actors/parameter_resetter.hpp

This file was deleted.

Loading
Loading