ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
navigation_state.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// Project include(s)
12#include "detray/core/concepts.hpp"
13#include "detray/core/detail/container_views.hpp"
14#include "detray/definitions/containers.hpp"
15#include "detray/definitions/detail/qualifiers.hpp"
16#include "detray/definitions/indexing.hpp"
17#include "detray/definitions/navigation.hpp"
18#include "detray/geometry/identifier.hpp"
19#include "detray/geometry/tracking_surface.hpp"
20#include "detray/geometry/tracking_volume.hpp"
21#include "detray/navigation/detail/intersection_kernel.hpp"
22#include "detray/navigation/detail/print_state.hpp"
23#include "detray/navigation/intersection/intersection.hpp"
24#include "detray/navigation/intersection/ray_intersector.hpp"
25#include "detray/navigation/navigation_config.hpp"
26#include "detray/utils/invalid_values.hpp"
27#include "detray/utils/logging.hpp"
28#include "detray/utils/ranges.hpp"
29
30// System include(s)
31#include <limits>
32
33namespace detray::navigation {
34
38struct void_inspector {
40 struct void_view : public detray::detail::dbase_view {};
41
46
47 constexpr void_inspector() = default;
48
50 DETRAY_HOST_DEVICE
51 constexpr explicit void_inspector(
52 const void_view & /*ignored*/) { /*Do nothing*/ }
53
55 template <typename state_t>
56 DETRAY_HOST_DEVICE constexpr void operator()(const state_t & /*ignored*/,
57 const char * /*ignored*/) const {
58 /*Do nothing*/
59 }
60};
61
76template <typename derived_t, concepts::detector detector_t,
77 std::size_t k_cache_capacity, typename inspector_t,
78 typename intersection_t>
80 base_state<derived_t, detector_t, k_cache_capacity,
81 inspector_t, intersection_t>> {
83 static_assert(k_cache_capacity >= 2u,
84 "Navigation cache needs to have a capacity larger than 1");
85
88 DETRAY_HOST_DEVICE
89 constexpr auto cast_impl() -> derived_t & {
90 return static_cast<derived_t &>(*this);
91 }
92 DETRAY_HOST_DEVICE
93 constexpr auto cast_impl() const -> const derived_t & {
94 return static_cast<const derived_t &>(*this);
95 }
97
98 protected:
99 // Linear algebra types
101 using algebra_t = typename detector_t::algebra_type;
108
109 // Result of a geometry object evaluation
111 using candidate_t = intersection_t;
115 using candidate_itr_t = typename candidate_cache_t::iterator;
117 using candidate_const_itr_t = typename candidate_cache_t::const_iterator;
119 using dist_t = std::int_least8_t;
120
121 // Link type to the next detector volume
123 using nav_link_t = typename detector_t::surface_type::navigation_link;
124
125 public:
127 using detector_type = detector_t;
128
130 base_state() = delete;
131
133 DETRAY_HOST_DEVICE
134 constexpr explicit base_state(const detector_t &det) : m_detector(&det) {}
135
137 template <concepts::device_view view_t>
138 DETRAY_HOST_DEVICE constexpr base_state(const detector_t &det, view_t view)
139 : m_detector(&det), m_inspector(view) {}
140
142 DETRAY_HOST_DEVICE
143 constexpr auto detector() const -> const detector_t & {
144 return (*m_detector);
145 }
146
148 DETRAY_HOST_DEVICE
149 constexpr auto begin() const -> candidate_const_itr_t {
150 candidate_const_itr_t itr = m_candidates.cbegin();
151 const dist_t idx{next_index()};
152 detray::ranges::advance(itr,
153 (is_on_surface() && (idx >= 1)) ? idx - 1 : idx);
154 return itr;
155 }
156
158 DETRAY_HOST_DEVICE
159 constexpr auto cbegin() const -> candidate_const_itr_t {
160 return std::as_const(*this).begin();
161 }
162
164 DETRAY_HOST_DEVICE
165 constexpr auto end() const -> candidate_const_itr_t {
166 candidate_const_itr_t itr = m_candidates.cbegin();
167 detray::ranges::advance(itr, m_last + 1);
168 return itr;
169 }
170
172 DETRAY_HOST_DEVICE
173 constexpr auto cend() const -> candidate_const_itr_t {
174 return std::as_const(*this).end();
175 }
176
178 DETRAY_HOST_DEVICE
179 constexpr auto last() const -> const candidate_t & {
180 assert(!cache_exhausted());
181 assert(m_last >= 0);
182 return m_candidates[static_cast<std::size_t>(m_last)];
183 }
184
186 static consteval std::size_t capacity() { return k_cache_capacity; }
187
189 DETRAY_HOST_DEVICE
190 constexpr auto status() const -> navigation::status { return m_status; }
191
193 DETRAY_HOST_DEVICE
194 constexpr bool is_alive() const {
195 return cast_impl().status() > navigation::status::e_unknown;
196 }
197
199 DETRAY_HOST_DEVICE
200 constexpr auto direction() const -> navigation::direction {
201 return m_direction;
202 }
203
206 DETRAY_HOST_DEVICE
207 constexpr void set_direction(const navigation::direction dir) {
208 if (m_direction != dir) {
209 // Force renavigation after direction change
210 cast_impl().set_no_trust();
211 DETRAY_VERBOSE_HOST_DEVICE("Re-navigate after explicit direction change");
212
213 m_direction = dir;
214 }
215 }
216
218 DETRAY_HOST_DEVICE
219 constexpr scalar_t external_tol() const { return m_external_mask_tol; }
220
223 DETRAY_HOST_DEVICE
224 constexpr void set_external_tol(const scalar_t tol) {
225 DETRAY_VERBOSE_HOST("Setting external mask tolerance: " << tol);
226 m_external_mask_tol = tol;
227 }
228
230 DETRAY_HOST_DEVICE
231 constexpr auto trust_level() const -> navigation::trust_level {
232 return m_trust_level;
233 }
234
237 DETRAY_HOST_DEVICE
238 constexpr void set_no_trust() {
239 DETRAY_VERBOSE_HOST_DEVICE("Flagging re-navigation: \"no trust\"");
240 m_trust_level = navigation::trust_level::e_no_trust;
241 }
242
244 DETRAY_HOST_DEVICE
245 constexpr void set_high_trust() { cast_impl().set_no_trust(); }
246
248 DETRAY_HOST_DEVICE
249 constexpr void set_fair_trust() { cast_impl().set_no_trust(); }
251
254 DETRAY_HOST_DEVICE
255 constexpr auto is_on_surface() const -> bool {
256 return (m_status == navigation::status::e_on_object ||
257 m_status == navigation::status::e_on_portal);
258 }
259
262 DETRAY_HOST_DEVICE
263 constexpr auto is_on_sensitive() const -> bool {
264 return (m_status == navigation::status::e_on_object) &&
265 (cast_impl().geometry_identifier().id() == surface_id::e_sensitive);
266 }
267
270 DETRAY_HOST_DEVICE
271 constexpr auto is_on_passive() const -> bool {
272 return (m_status == navigation::status::e_on_object) &&
273 (cast_impl().geometry_identifier().id() == surface_id::e_passive);
274 }
275
278 DETRAY_HOST_DEVICE
279 constexpr auto is_on_portal() const -> bool {
280 return m_status == navigation::status::e_on_portal;
281 }
282
285 DETRAY_HOST_DEVICE
286 constexpr auto encountered_sf_material() const -> bool {
287 return (cast_impl().is_on_surface()) &&
288 (cast_impl().current().surface().has_material());
289 }
290
292 DETRAY_HOST_DEVICE
293 constexpr bool finished() const {
294 // Normal exit for this navigation?
295 return (m_status == navigation::status::e_exit);
296 }
297
299 DETRAY_HOST_DEVICE
300 constexpr auto volume() const -> nav_link_t { return m_volume_index; }
301
303 DETRAY_HOST_DEVICE
304 constexpr void set_volume(dindex v) {
305 assert(detray::detail::is_invalid_value(static_cast<nav_link_t>(v)) ||
306 v < cast_impl().detector().volumes().size());
307 if (v != m_volume_index) {
308 DETRAY_VERBOSE_HOST_DEVICE("Setting new volume %d", v);
309 // Make sure the new volume is properly initialized
310 cast_impl().set_no_trust();
311 }
312 m_volume_index = static_cast<nav_link_t>(v);
313 }
314
316 DETRAY_HOST_DEVICE
317 constexpr auto candidates() const -> const candidate_cache_t & {
318 return m_candidates;
319 }
320
322 DETRAY_HOST_DEVICE
323 constexpr auto n_candidates() const -> dindex {
324 assert(m_last - cast_impl().next_index() + 1 >= 0);
325 return static_cast<dindex>(m_last - cast_impl().next_index() + 1);
326 }
327
329 DETRAY_HOST_DEVICE
330 constexpr bool cache_exhausted() const {
331 return cast_impl().n_candidates() == 0u;
332 }
333
335 DETRAY_HOST_DEVICE
336 constexpr auto current() const -> const candidate_t & {
337 assert(cast_impl().is_on_surface() || cast_impl().finished());
338 assert(m_next > 0);
339 return m_candidates[static_cast<std::size_t>(m_next - 1)];
340 }
341
343 DETRAY_HOST_DEVICE
344 constexpr auto target() const -> const candidate_t & {
345 assert(m_next >= 0);
346 return m_candidates[static_cast<std::size_t>(m_next)];
347 }
348
351 DETRAY_HOST_DEVICE
352 constexpr auto geometry_identifier() const -> geometry::identifier {
353 return cast_impl().current().surface().identifier();
354 }
355
357 DETRAY_HOST_DEVICE
358 constexpr bool is_edge_candidate() const {
359 assert(cast_impl().is_on_surface());
360 return cast_impl().current().is_edge();
361 }
362
364 DETRAY_HOST_DEVICE
365 constexpr bool is_good_candidate() const {
366 assert(cast_impl().is_on_surface());
367 return cast_impl().current().is_inside();
368 }
369
372 DETRAY_HOST_DEVICE
373 constexpr bool is_probably_candidate() const {
374 assert(cast_impl().is_on_surface());
375 return cast_impl().current().is_probably_inside();
376 }
377
380 DETRAY_HOST_DEVICE
381 constexpr scalar_t operator()() const {
382 assert(math::isfinite(cast_impl().target().path()));
383 return static_cast<scalar_t>(cast_impl().direction()) *
384 cast_impl().target().path();
385 }
386
389 template <template <typename> class surface_t = tracking_surface>
390 DETRAY_HOST_DEVICE constexpr auto current_surface() const {
391 assert(cast_impl().is_on_surface() || cast_impl().finished());
392 return surface_t<detector_t>{*m_detector, current().surface()};
393 }
394
397 template <template <typename> class volume_t = tracking_volume>
398 DETRAY_HOST_DEVICE constexpr auto current_volume() const {
399 return volume_t<detector_t>{*m_detector, m_volume_index};
400 }
401
404 template <template <typename> class surface_t = tracking_surface>
405 DETRAY_HOST_DEVICE constexpr auto next_surface() const {
406 return surface_t<detector_t>{*m_detector, cast_impl().target().surface()};
407 }
408
411 template <template <typename> class volume_t = tracking_volume>
412 DETRAY_HOST_DEVICE constexpr auto next_volume() const {
413 return volume_t<detector_t>{*m_detector,
414 cast_impl().target().surface().volume()};
415 }
416
419 DETRAY_HOST_DEVICE constexpr void exit() {
420 m_status = navigation::status::e_exit;
421 DETRAY_VERBOSE_HOST_DEVICE("Exited");
422 cast_impl().run_inspector({}, point3_t{0.f, 0.f, 0.f},
423 vector3_t{0.f, 0.f, 0.f}, "Exited: ");
424 }
425
428 DETRAY_HOST_DEVICE constexpr void pause() {
429 DETRAY_VERBOSE_HOST_DEVICE("Paused by actor");
430 cast_impl().run_inspector({}, point3_t{0.f, 0.f, 0.f},
431 vector3_t{0.f, 0.f, 0.f}, "Paused by actor: ");
432 }
433
438 DETRAY_HOST_DEVICE constexpr void abort(
439 const char *custom_msg = "Navigator (unknown reason)") {
440 m_status = navigation::status::e_abort;
441
444 struct message_wrapper {
445 const char *const m_msg{nullptr};
446
447 DETRAY_HOST_DEVICE
448 constexpr const char *operator()() const { return m_msg; }
449 };
450
451 assert(custom_msg != nullptr);
452 DETRAY_ERROR_HOST("Aborted: " << custom_msg);
453
454 cast_impl().run_inspector({}, point3_t{0.f, 0.f, 0.f},
455 vector3_t{0.f, 0.f, 0.f},
456 "Aborted: ", message_wrapper{custom_msg});
457 }
458
464 template <typename debug_msg_generator_t>
465 requires(!std::same_as<char *, debug_msg_generator_t>)
466 DETRAY_HOST_DEVICE constexpr void abort(
467 const debug_msg_generator_t &debug_msg_generator) {
468 m_status = navigation::status::e_abort;
469
470 DETRAY_ERROR_HOST("Aborted: " << debug_msg_generator());
471
472 cast_impl().run_inspector({}, point3_t{0.f, 0.f, 0.f},
473 vector3_t{0.f, 0.f, 0.f},
474 "Aborted: ", debug_msg_generator);
475 }
476
478 DETRAY_HOST_DEVICE
479 constexpr const auto &inspector() const { return m_inspector; }
480
482 DETRAY_HOST_DEVICE
483 constexpr auto &inspector() { return m_inspector; }
484
485 protected:
487 DETRAY_HOST_DEVICE
488 constexpr auto begin() -> candidate_itr_t {
489 candidate_itr_t itr = m_candidates.begin();
490 const dist_t idx{cast_impl().next_index()};
491 detray::ranges::advance(
492 itr, (cast_impl().is_on_surface() && (idx >= 1)) ? idx - 1 : idx);
493 return itr;
494 }
495
497 DETRAY_HOST_DEVICE
498 constexpr auto end() -> candidate_itr_t {
499 candidate_itr_t itr = m_candidates.begin();
500 detray::ranges::advance(itr, m_last + 1);
501 return itr;
502 }
503
505 DETRAY_HOST_DEVICE
506 constexpr auto last() -> candidate_t & {
507 assert(static_cast<std::size_t>(m_last) < m_candidates.size());
508 return m_candidates[static_cast<std::size_t>(m_last)];
509 }
510
513 DETRAY_HOST_DEVICE
514 constexpr void set_next(candidate_const_itr_t new_next) {
515 const auto new_idx{
516 detray::ranges::distance(m_candidates.cbegin(), new_next)};
517 cast_impl().next_index(static_cast<dist_t>(new_idx));
518 assert(cast_impl().next_index() <= m_last + 1);
519 }
520
523 DETRAY_HOST_DEVICE
524 constexpr void set_last(candidate_const_itr_t new_last) {
525 const auto new_idx{
526 detray::ranges::distance(m_candidates.cbegin(), new_last) - 1};
527 last_index(static_cast<dist_t>(new_idx));
528 assert(m_last < static_cast<dist_t>(k_cache_capacity));
529 }
530
532 DETRAY_HOST_DEVICE
533 constexpr dist_t next_index() const { return m_next; }
534
536 DETRAY_HOST_DEVICE
537 constexpr dist_t last_index() const { return m_last; }
538
541 DETRAY_HOST_DEVICE
542 constexpr void next_index(dist_t pos) {
543 m_next = pos;
544 assert(m_next >= 0);
545 assert(m_next < static_cast<dist_t>(k_cache_capacity) + 1);
546 }
547
550 DETRAY_HOST_DEVICE
551 constexpr void last_index(dist_t pos) {
552 m_last = pos;
553 assert(m_last >= -1);
554 assert(m_last < static_cast<dist_t>(k_cache_capacity));
555 }
556
558 DETRAY_HOST_DEVICE
559 constexpr auto advance() -> void {
560 ++m_next;
561 assert(m_next < static_cast<dist_t>(k_cache_capacity) + 1);
562 assert(cast_impl().next_index() <= cast_impl().last_index() + 1);
563 }
564
566 DETRAY_HOST_DEVICE
567 constexpr auto candidates() -> candidate_cache_t & { return m_candidates; }
568
570 DETRAY_HOST_DEVICE
571 constexpr auto current() -> candidate_t & {
572 assert(cast_impl().is_on_surface() || cast_impl().finished());
573 assert(m_next > 0);
574 return m_candidates[static_cast<std::size_t>(m_next - 1)];
575 }
576
578 DETRAY_HOST_DEVICE
579 constexpr auto target() -> candidate_t & {
580 assert(static_cast<std::size_t>(m_next) < m_candidates.size());
581 return m_candidates[static_cast<std::size_t>(m_next)];
582 }
583
585 DETRAY_HOST_DEVICE
586 constexpr void status(navigation::status s) {
587 DETRAY_DEBUG_HOST("Setting nav. status: " << s);
588 m_status = s;
589 }
590
592 DETRAY_HOST_DEVICE
593 constexpr void trust_level(navigation::trust_level t) {
594 DETRAY_DEBUG_HOST("Setting trust level: " << t);
595 m_trust_level = t;
596 }
597
599 DETRAY_HOST_DEVICE
600 constexpr void clear_cache() {
601 // Mark all data in the cache as unreachable
602 for (std::size_t i = 0u; i < k_cache_capacity; ++i) {
603 m_candidates[i].set_path(std::numeric_limits<scalar_t>::max());
604 }
605 m_next = 0;
606 m_last = -1;
607 }
608
614 DETRAY_HOST_DEVICE constexpr void run_inspector(
615 [[maybe_unused]] const navigation::config &cfg,
616 [[maybe_unused]] const point3_t &track_pos,
617 [[maybe_unused]] const vector3_t &track_dir,
618 [[maybe_unused]] const char *message) {
619 [[maybe_unused]] auto derived = static_cast<const derived_t &>(*this);
620
621 if constexpr (!std::is_same_v<inspector_t, navigation::void_inspector>) {
622 cast_impl().inspector()(derived, cfg, track_pos, track_dir, message);
623 }
624
625 DETRAY_DEBUG_HOST("" << message << "\n"
626 << detray::navigation::print_state(derived)
627 << detray::navigation::print_candidates(
628 derived, cfg, track_pos, track_dir));
629 }
630
638 template <typename debug_msg_generator_t>
639 DETRAY_HOST_DEVICE constexpr void run_inspector(
640 [[maybe_unused]] const navigation::config &cfg,
641 [[maybe_unused]] const point3_t &track_pos,
642 [[maybe_unused]] const vector3_t &track_dir,
643 [[maybe_unused]] const char *message,
644 [[maybe_unused]] const debug_msg_generator_t &msg_gen) {
645 [[maybe_unused]] auto derived = static_cast<const derived_t &>(*this);
646
647 if constexpr (!std::is_same_v<inspector_t, navigation::void_inspector>) {
648 cast_impl().inspector()(derived, cfg, track_pos, track_dir, message,
649 msg_gen);
650 }
651
652 DETRAY_DEBUG_HOST("" << message << msg_gen() << "\n"
653 << detray::navigation::print_state(derived)
654 << detray::navigation::print_candidates(
655 derived, cfg, track_pos, track_dir));
656 }
657
658 private:
660 DETRAY_HOST
661 friend std::ostream &operator<<(std::ostream &os, const derived_t &s) {
662 os << detray::navigation::print_state(s)
663 << detray::navigation::print_candidates(s, {}, point3_t{0.f, 0.f, 0.f},
664 vector3_t{0.f, 0.f, 0.f});
665 return os;
666 }
667
669 candidate_cache_t m_candidates;
670
672 const detector_t *m_detector{nullptr};
673
675 navigation::status m_status{navigation::status::e_unknown};
676
678 navigation::direction m_direction{navigation::direction::e_forward};
679
682 navigation::trust_level m_trust_level{navigation::trust_level::e_no_trust};
683
685 scalar_t m_external_mask_tol{0.f * unit<scalar_t>::mm};
686
689 dist_t m_next{0};
690
693 dist_t m_last{-1};
694
696 nav_link_t m_volume_index{0u};
697
699 DETRAY_NO_UNIQUE_ADDRESS inspector_t m_inspector;
700};
701
702} // namespace detray::navigation
darray< candidate_t, k_cache_capacity > candidate_cache_t
Definition navigation_state.hpp:113
constexpr void clear_cache()
Clear the state.
Definition navigation_state.hpp:600
constexpr void abort(const char *custom_msg="Navigator (unknown reason)")
Navigation state that cannot be recovered from.
Definition navigation_state.hpp:438
constexpr bool cache_exhausted() const
Definition navigation_state.hpp:330
constexpr auto next_surface() const
Definition navigation_state.hpp:405
constexpr bool is_alive() const
Definition navigation_state.hpp:194
static consteval std::size_t capacity()
Definition navigation_state.hpp:186
constexpr scalar_t external_tol() const
Definition navigation_state.hpp:219
constexpr void last_index(dist_t pos)
Set the next surface that we want to reach (update target).
Definition navigation_state.hpp:551
typename detector_t::surface_type::navigation_link nav_link_t
Definition navigation_state.hpp:123
constexpr auto candidates() const -> const candidate_cache_t &
Definition navigation_state.hpp:317
constexpr auto end() const -> candidate_const_itr_t
Definition navigation_state.hpp:165
constexpr auto advance() -> void
Set the next surface that we want to reach (update target).
Definition navigation_state.hpp:559
constexpr void next_index(dist_t pos)
Set the next surface that we want to reach (update target).
Definition navigation_state.hpp:542
constexpr auto is_on_surface() const -> bool
Helper method to check the track has reached a module surface.
Definition navigation_state.hpp:255
constexpr auto last() const -> const candidate_t &
Definition navigation_state.hpp:179
constexpr void status(navigation::status s)
Set the status to.
Definition navigation_state.hpp:586
constexpr base_state(const detector_t &det)
Constructor using a given detector.
Definition navigation_state.hpp:134
constexpr auto last() -> candidate_t &
Definition navigation_state.hpp:506
constexpr bool is_probably_candidate() const
Definition navigation_state.hpp:373
constexpr auto cend() const -> candidate_const_itr_t
Definition navigation_state.hpp:173
constexpr auto n_candidates() const -> dindex
Definition navigation_state.hpp:323
constexpr auto target() -> candidate_t &
Definition navigation_state.hpp:579
constexpr void set_fair_trust()
Definition navigation_state.hpp:249
constexpr void pause()
Navigation is being paused by actor: Maintain the navigation state and resume later.
Definition navigation_state.hpp:428
constexpr const auto & inspector() const
Definition navigation_state.hpp:479
constexpr bool is_edge_candidate() const
Definition navigation_state.hpp:358
constexpr void set_direction(const navigation::direction dir)
Set direction in which the navigator should search for candidates.
Definition navigation_state.hpp:207
constexpr void set_no_trust()
Update navigation trust level to 'no trust'.
Definition navigation_state.hpp:238
constexpr auto current() -> candidate_t &
Definition navigation_state.hpp:571
constexpr auto is_on_sensitive() const -> bool
Helper method to check the track has reached a sensitive surface.
Definition navigation_state.hpp:263
constexpr auto is_on_portal() const -> bool
Helper method to check the track has reached a portal surface.
Definition navigation_state.hpp:279
constexpr void run_inspector(const navigation::config &cfg, const point3_t &track_pos, const vector3_t &track_dir, const char *message, const debug_msg_generator_t &msg_gen)
Call the navigation inspector.
Definition navigation_state.hpp:639
constexpr auto target() const -> const candidate_t &
Definition navigation_state.hpp:344
constexpr auto direction() const -> navigation::direction
Definition navigation_state.hpp:200
constexpr auto cbegin() const -> candidate_const_itr_t
Definition navigation_state.hpp:159
constexpr auto current() const -> const candidate_t &
Definition navigation_state.hpp:336
typename candidate_cache_t::iterator candidate_itr_t
Definition navigation_state.hpp:115
constexpr auto current_volume() const
Definition navigation_state.hpp:398
constexpr auto begin() const -> candidate_const_itr_t
Definition navigation_state.hpp:149
constexpr bool is_good_candidate() const
Definition navigation_state.hpp:365
base_state()=delete
Default constructor (needs a detector).
constexpr auto volume() const -> nav_link_t
Definition navigation_state.hpp:300
constexpr void set_volume(dindex v)
Set start/new volume from volume index.
Definition navigation_state.hpp:304
constexpr void set_external_tol(const scalar_t tol)
Set externally provided mask tolerance according to noise prediction.
Definition navigation_state.hpp:224
constexpr auto encountered_sf_material() const -> bool
Helper method to check the track has encountered material.
Definition navigation_state.hpp:286
constexpr auto begin() -> candidate_itr_t
Definition navigation_state.hpp:488
friend std::ostream & operator<<(std::ostream &os, const derived_t &s)
Definition navigation_state.hpp:661
constexpr auto current_surface() const
Definition navigation_state.hpp:390
constexpr auto end() -> candidate_itr_t
Definition navigation_state.hpp:498
constexpr base_state(const detector_t &det, view_t view)
Construct from detector.
Definition navigation_state.hpp:138
constexpr auto detector() const -> const detector_t &
Definition navigation_state.hpp:143
constexpr scalar_t operator()() const
Scalar representation of the navigation state,.
Definition navigation_state.hpp:381
constexpr dist_t last_index() const
Definition navigation_state.hpp:537
constexpr bool finished() const
Definition navigation_state.hpp:293
constexpr auto status() const -> navigation::status
Definition navigation_state.hpp:190
constexpr dist_t next_index() const
Definition navigation_state.hpp:533
constexpr auto trust_level() const -> navigation::trust_level
Definition navigation_state.hpp:231
constexpr auto & inspector()
Definition navigation_state.hpp:483
constexpr void set_high_trust()
Definition navigation_state.hpp:245
constexpr void exit()
Navigation reaches final target or leaves detector world.
Definition navigation_state.hpp:419
constexpr void run_inspector(const navigation::config &cfg, const point3_t &track_pos, const vector3_t &track_dir, const char *message)
Call the navigation inspector.
Definition navigation_state.hpp:614
constexpr void set_next(candidate_const_itr_t new_next)
Set the next surface that we want to reach (update target).
Definition navigation_state.hpp:514
constexpr void set_last(candidate_const_itr_t new_last)
Updates the position of the last valid candidate.
Definition navigation_state.hpp:524
constexpr void trust_level(navigation::trust_level t)
Reset the trustlevel to.
Definition navigation_state.hpp:593
typename candidate_cache_t::const_iterator candidate_const_itr_t
Definition navigation_state.hpp:117
constexpr void abort(const debug_msg_generator_t &debug_msg_generator)
Navigation state that cannot be recovered from.
Definition navigation_state.hpp:466
constexpr auto geometry_identifier() const -> geometry::identifier
Definition navigation_state.hpp:352
constexpr auto is_on_passive() const -> bool
Helper method to check the track has reached a passive surface.
Definition navigation_state.hpp:271
constexpr auto next_volume() const
Definition navigation_state.hpp:412
constexpr auto candidates() -> candidate_cache_t &
Definition navigation_state.hpp:567
Defines a detray 'view'.
Definition ranges.hpp:190
Facade for a detray detector surface with extra tracking capabilities.
Definition tracking_surface.hpp:25
Facade for a detray detector volume.
Definition tracking_volume.hpp:44
Check if a type can be used as a detector.
Definition concepts.hpp:47
constexpr double u
atomic mass unit u
Definition Units.hpp:155
get_scalar_t< A, T > dscalar
Scalar type for algebra A and value type T.
Definition algebra.hpp:64
unsigned int dindex
Default index type.
Definition indexing.hpp:18
std::array< value_t, kDIM > darray
Fixed-size array container.
Definition containers.hpp:30
get_vector3D_t< A, T > dvector3D
Three-dimensional vector type for algebra A and value type T.
Definition algebra.hpp:80
get_point3D_t< A, T > dpoint3D
Three-dimensional point type for algebra A and value type T.
Definition algebra.hpp:72
Navigation configuration.
Definition navigation_config.hpp:24
Empty view accepted by the no-op inspector.
Definition navigation_state.hpp:40
void_view view_type
View type used by this inspector.
Definition navigation_state.hpp:43
constexpr void_inspector(const void_view &)
Construct from an unused inspector view.
Definition navigation_state.hpp:51
const void_view const_view_type
Const view type used by this inspector.
Definition navigation_state.hpp:45
constexpr void operator()(const state_t &, const char *) const
Ignore navigation state notifications.
Definition navigation_state.hpp:56
static constexpr scalar_t mm
Native length unit, the millimetre.
Definition units.hpp:27