File indexing completed on 2025-08-06 08:10:05
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Definitions/Common.hpp"
0013 #include "Acts/Detector/Portal.hpp"
0014 #include "Acts/Navigation/NavigationDelegates.hpp"
0015 #include "Acts/Navigation/NavigationState.hpp"
0016 #include "Acts/Surfaces/Surface.hpp"
0017 #include "Acts/Utilities/BinningType.hpp"
0018 #include "Acts/Utilities/Enumerate.hpp"
0019 #include "Acts/Utilities/GridAccessHelpers.hpp"
0020 #include "Acts/Utilities/IAxis.hpp"
0021 #include "Acts/Utilities/VectorHelpers.hpp"
0022
0023 #include <array>
0024 #include <memory>
0025
0026 namespace Acts::Experimental {
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037 inline void updateCandidates(const GeometryContext& gctx,
0038 NavigationState& nState) {
0039 const auto& position = nState.position;
0040 const auto& direction = nState.direction;
0041
0042 NavigationState::SurfaceCandidates nextSurfaceCandidates;
0043
0044 for (NavigationState::SurfaceCandidate c : nState.surfaceCandidates) {
0045
0046 const Surface& sRep =
0047 c.surface != nullptr ? *c.surface : c.portal->surface();
0048
0049
0050
0051 auto sIntersection = sRep.intersect(gctx, position, direction,
0052 c.boundaryCheck, s_onSurfaceTolerance);
0053 for (auto& si : sIntersection.split()) {
0054 c.objectIntersection = si;
0055 if (c.objectIntersection &&
0056 c.objectIntersection.pathLength() > nState.overstepTolerance) {
0057 nextSurfaceCandidates.emplace_back(c);
0058 }
0059 }
0060 }
0061
0062 nState.surfaceCandidates = std::move(nextSurfaceCandidates);
0063 }
0064
0065
0066
0067
0068 template <typename object_type, typename filler_type>
0069 class SingleObjectImpl : public INavigationDelegate {
0070 public:
0071
0072
0073 SingleObjectImpl(const object_type* so) : object(so) {}
0074
0075
0076
0077
0078
0079
0080
0081 void update([[maybe_unused]] const GeometryContext& gctx,
0082 NavigationState& nState) const {
0083 filler_type::fill(nState, object);
0084 }
0085
0086 private:
0087
0088 const object_type* object = nullptr;
0089 };
0090
0091
0092
0093
0094
0095
0096 template <typename extractor_type, typename filler_type>
0097 class StaticUpdaterImpl : public INavigationDelegate {
0098 public:
0099
0100
0101
0102
0103
0104
0105 void update([[maybe_unused]] const GeometryContext& gctx,
0106 NavigationState& nState) const {
0107 auto extracted = extractor_type::extract(gctx, nState);
0108 filler_type::fill(nState, extracted);
0109 }
0110 };
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123 template <typename grid_t, typename extractor_type, typename filler_type>
0124 class IndexedUpdaterImpl : public INavigationDelegate {
0125 public:
0126
0127 using grid_type = grid_t;
0128
0129
0130 extractor_type extractor;
0131
0132
0133 grid_type grid;
0134
0135
0136 std::array<BinningValue, grid_type::DIM> casts{};
0137
0138
0139 Transform3 transform = Transform3::Identity();
0140
0141
0142
0143
0144
0145 IndexedUpdaterImpl(grid_type&& igrid,
0146 const std::array<BinningValue, grid_type::DIM>& icasts,
0147 const Transform3& itr = Transform3::Identity())
0148 : grid(std::move(igrid)), casts(icasts), transform(itr) {}
0149
0150 IndexedUpdaterImpl() = delete;
0151
0152
0153
0154
0155
0156
0157
0158
0159 void update(const GeometryContext& gctx, NavigationState& nState) const {
0160
0161 const auto& entry =
0162 grid.atPosition(GridAccessHelpers::castPosition<grid_type>(
0163 transform * nState.position, casts));
0164 auto extracted = extractor.extract(gctx, nState, entry);
0165 filler_type::fill(nState, extracted);
0166
0167 updateCandidates(gctx, nState);
0168 }
0169 };
0170
0171
0172
0173
0174
0175
0176 template <typename... updators_t>
0177 class ChainedUpdaterImpl : public INavigationDelegate {
0178 public:
0179
0180 std::tuple<updators_t...> updators;
0181
0182
0183
0184
0185
0186 ChainedUpdaterImpl(const std::tuple<updators_t...>&& upts)
0187 : updators(std::move(upts)) {}
0188
0189
0190
0191
0192
0193
0194 void update(const GeometryContext& gctx, NavigationState& nState) const {
0195
0196 std::apply(
0197 [&](auto&&... updator) { ((updator.update(gctx, nState)), ...); },
0198 updators);
0199 }
0200 };
0201
0202 }