File indexing completed on 2025-11-01 07:53:20
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/DetectorVolume.hpp"
0014 #include "Acts/Detector/Portal.hpp"
0015 #include "Acts/Geometry/GeometryContext.hpp"
0016 #include "Acts/Navigation/MultiLayerNavigation.hpp"
0017 #include "Acts/Navigation/NavigationState.hpp"
0018 #include "Acts/Navigation/NavigationStateFillers.hpp"
0019 #include "Acts/Navigation/NavigationStateUpdaters.hpp"
0020 #include "Acts/Surfaces/Surface.hpp"
0021
0022 #include <memory>
0023 #include <tuple>
0024
0025 namespace Acts::Experimental {
0026
0027 struct AllPortalsNavigation : public IInternalNavigation {
0028
0029
0030
0031
0032
0033
0034 inline void fill([[maybe_unused]] const GeometryContext& gctx,
0035 NavigationState& nState) const {
0036 if (nState.currentVolume == nullptr) {
0037 throw std::runtime_error(
0038 "AllPortalsNavigation: no detector volume set to navigation state.");
0039 }
0040
0041 for (const auto v : nState.currentVolume->volumes()) {
0042 const auto& iPortals = v->portals();
0043 PortalsFiller::fill(nState, iPortals);
0044 }
0045
0046 const auto& portals = nState.currentVolume->portals();
0047 PortalsFiller::fill(nState, portals);
0048 }
0049
0050
0051
0052
0053
0054
0055
0056
0057 inline void update(const GeometryContext& gctx,
0058 NavigationState& nState) const {
0059 fill(gctx, nState);
0060 intitializeCandidates(gctx, nState);
0061 }
0062 };
0063
0064 struct AllPortalsAndSurfacesNavigation : public IInternalNavigation {
0065
0066
0067
0068
0069
0070
0071 inline void fill([[maybe_unused]] const GeometryContext& gctx,
0072 NavigationState& nState) const {
0073 if (nState.currentDetector == nullptr) {
0074 throw std::runtime_error(
0075 "AllPortalsAndSurfacesNavigation: no detector volume set to "
0076 "navigation "
0077 "state.");
0078 }
0079
0080 for (const auto v : nState.currentVolume->volumes()) {
0081 const auto& iPortals = v->portals();
0082 PortalsFiller::fill(nState, iPortals);
0083 }
0084
0085 const auto& portals = nState.currentVolume->portals();
0086 const auto& surfaces = nState.currentVolume->surfaces();
0087 PortalsFiller::fill(nState, portals);
0088 SurfacesFiller::fill(nState, surfaces);
0089 }
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099 inline void update(const GeometryContext& gctx,
0100 NavigationState& nState) const {
0101 fill(gctx, nState);
0102 intitializeCandidates(gctx, nState);
0103 }
0104 };
0105
0106
0107
0108
0109 inline static InternalNavigationDelegate tryAllPortals() {
0110 auto ap = std::make_unique<const AllPortalsNavigation>();
0111 InternalNavigationDelegate nStateUpdater;
0112 nStateUpdater.connect<&AllPortalsNavigation::update>(std::move(ap));
0113 return nStateUpdater;
0114 }
0115
0116
0117
0118
0119
0120
0121
0122 inline static InternalNavigationDelegate tryAllPortalsAndSurfaces() {
0123 auto aps = std::make_unique<const AllPortalsAndSurfacesNavigation>();
0124 InternalNavigationDelegate nStateUpdater;
0125 nStateUpdater.connect<&AllPortalsAndSurfacesNavigation::update>(
0126 std::move(aps));
0127 return nStateUpdater;
0128 }
0129
0130
0131
0132
0133
0134 struct AdditionalSurfacesNavigation : public IInternalNavigation {
0135
0136 std::vector<const Surface*> surfaces = {};
0137
0138
0139
0140
0141
0142
0143
0144 inline void fill([[maybe_unused]] const GeometryContext& gctx,
0145 NavigationState& nState) const {
0146 SurfacesFiller::fill(nState, surfaces);
0147 }
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157 inline void update(const GeometryContext& gctx,
0158 NavigationState& nState) const {
0159 fill(gctx, nState);
0160 intitializeCandidates(gctx, nState);
0161 }
0162 };
0163
0164
0165
0166
0167 template <typename grid_type>
0168 using IndexedSurfacesNavigation =
0169 IndexedGridNavigation<IInternalNavigation, grid_type,
0170 IndexedSurfacesExtractor, SurfacesFiller>;
0171
0172
0173
0174
0175 template <typename grid_type>
0176 using MultiLayerSurfacesNavigation =
0177 MultiLayerNavigation<grid_type, PathGridSurfacesGenerator>;
0178
0179
0180
0181
0182 template <typename grid_type, template <typename> class indexed_updator>
0183 using IndexedSurfacesAllPortalsNavigation =
0184 ChainedNavigation<IInternalNavigation, AllPortalsNavigation,
0185 indexed_updator<grid_type>>;
0186
0187 }