ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
policies.hpp
1// This file is part of the ACTS project.
2//
3// Copyright (C) 2016 CERN for the benefit of the ACTS project
4//
5// This Source Code Form is subject to the terms of the Mozilla Public
6// License, v. 2.0. If a copy of the MPL was not distributed with this
7// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8
9#pragma once
10
11// detray definitions
12#include "detray/definitions/algebra.hpp"
13#include "detray/definitions/detail/qualifiers.hpp"
14#include "detray/definitions/math.hpp"
15#include "detray/definitions/units.hpp"
16#include "detray/propagator/base_actor.hpp"
17
18// system includes
19#include <climits>
20#include <limits>
21
22namespace detray {
23
26struct always_init : public base_actor {
28 struct state {};
29
34 template <typename propagator_state_t>
35 DETRAY_HOST_DEVICE inline void operator()(
36 const state & /*pol_state*/, propagator_state_t &propagation) const {
37 propagation.navigation().set_no_trust();
38 }
39};
40
45 struct state {};
46
51 template <typename propagator_state_t>
52 DETRAY_HOST_DEVICE inline void operator()(
53 const state & /*pol_state*/, propagator_state_t &propagation) const {
54 propagation.navigation().set_high_trust();
55 }
56};
57
62template <concepts::scalar scalar_t>
65 struct state {
67 scalar_t tol{std::numeric_limits<scalar_t>::epsilon()};
68 };
69
74 template <typename propagator_state_t>
75 DETRAY_HOST_DEVICE inline void operator()(
76 state &pol_state, propagator_state_t &propagation) const {
77 const auto &stepping = propagation.stepping();
78 auto &navigation = propagation.navigation();
79
80 // Not a severe change to track state expected
81 if (math::fabs(stepping.step_size()) <
82 math::fabs(
83 stepping.constraints().template size<>(stepping.direction())) -
84 pol_state.tol) {
85 // Re-evaluate only next candidate
86 navigation.set_high_trust();
87 }
88 // Step size hit a constraint - the track state was probably changed a
89 // lot
90 else {
91 // Re-evaluate all candidates
92 navigation.set_fair_trust();
93 }
94 }
95};
96
100template <concepts::scalar scalar_t>
103 struct state {
105 scalar_t m_threshold_fair_trust{0.05f};
107 scalar_t m_threshold_no_trust{0.1f};
108 };
109
114 template <typename propagator_state_t>
115 DETRAY_HOST_DEVICE inline void operator()(
116 const state &pol_state, propagator_state_t &propagation) const {
117 const auto &stepping = propagation.stepping();
118 auto &navigation = propagation.navigation();
119
120 // In case of an overlap, have navigator re-evaluate the next candidate
121 if (math::fabs(navigation()) <= 1.f * unit<float>::um) {
122 navigation.set_high_trust();
123 return;
124 }
125
126 // How strongly did the RKN algorithm reduce the step size?
127 const scalar_t rel_correction{(stepping.step_size() - navigation()) /
128 navigation()};
129
130 // Large correction to the stepsize - re-initialize the volume
131 if (rel_correction > pol_state.m_threshold_no_trust) {
132 navigation.set_no_trust();
133 }
134 // Medium correction - re-evaluate all current candidates
135 else if (rel_correction > pol_state.m_threshold_fair_trust) {
136 navigation.set_fair_trust();
137 } else {
138 // Small correction - re-evaluate only the next candidate
139 navigation.set_high_trust();
140 }
141 }
142};
143
144} // namespace detray
Detray include(s).
Definition array_operators.hpp:18
Stateless policy state.
Definition policies.hpp:28
Struct that represents the most conservative navigation policy: always re- initialize the current vol...
Definition policies.hpp:26
void operator()(const state &, propagator_state_t &propagation) const
Sets the navigation trust level to 'no trust'.
Definition policies.hpp:35
Base class actor implementation.
Definition base_actor.hpp:20
Stateless policy state.
Definition policies.hpp:45
During guided navigation only the next surface should be re-evaluated.
Definition policies.hpp:43
void operator()(const state &, propagator_state_t &propagation) const
Sets the navigation trust level to 'no trust'.
Definition policies.hpp:52
Tolerance for deciding whether a step reached a constraint.
Definition policies.hpp:65
scalar_t tol
Margin used when comparing the step size with the active constraint.
Definition policies.hpp:67
Default navigation update policy for the steppers: If a constraint has been hit, lower the trustlevel...
Definition policies.hpp:63
void operator()(state &pol_state, propagator_state_t &propagation) const
Sets the navigation trust level depending on the step size limit.
Definition policies.hpp:75
Relative correction thresholds used to choose navigation trust.
Definition policies.hpp:103
scalar_t m_threshold_no_trust
Correction above which navigation loses trust entirely.
Definition policies.hpp:107
scalar_t m_threshold_fair_trust
Correction above which navigation falls to fair trust.
Definition policies.hpp:105
Specific navigation policy for the Runge-Kutta stepper: Use the relative amount of step size correcti...
Definition policies.hpp:101
void operator()(const state &pol_state, propagator_state_t &propagation) const
Sets the navigation trust level depending on the step size correction.
Definition policies.hpp:115
static constexpr scalar_t um
Length, native unit mm.
Definition units.hpp:25