File indexing completed on 2025-01-18 09:27:41
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
0035
0036
0037 inline void update(const GeometryContext& gctx,
0038 NavigationState& nState) const {
0039 if (nState.currentVolume == nullptr) {
0040 throw std::runtime_error(
0041 "AllPortalsNavigation: no detector volume set to navigation state.");
0042 }
0043
0044 if (nState.surfaceCandidates.empty()) {
0045
0046 for (const auto v : nState.currentVolume->volumes()) {
0047 const auto& iPortals = v->portals();
0048 PortalsFiller::fill(nState, iPortals);
0049 }
0050
0051 const auto& portals = nState.currentVolume->portals();
0052 PortalsFiller::fill(nState, portals);
0053 }
0054
0055 updateCandidates(gctx, nState);
0056 }
0057 };
0058
0059 struct AllPortalsAndSurfacesNavigation : public IInternalNavigation {
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069 inline void update(const GeometryContext& gctx,
0070 NavigationState& nState) const {
0071 if (nState.currentDetector == nullptr) {
0072 throw std::runtime_error(
0073 "AllPortalsAndSurfacesNavigation: no detector volume set to "
0074 "navigation "
0075 "state.");
0076 }
0077
0078 if (nState.surfaceCandidates.empty()) {
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 updateCandidates(gctx, nState);
0092 }
0093 };
0094
0095
0096
0097
0098 inline static InternalNavigationDelegate tryAllPortals() {
0099 auto ap = std::make_unique<const AllPortalsNavigation>();
0100 InternalNavigationDelegate nStateUpdater;
0101 nStateUpdater.connect<&AllPortalsNavigation::update>(std::move(ap));
0102 return nStateUpdater;
0103 }
0104
0105
0106
0107
0108
0109
0110
0111 inline static InternalNavigationDelegate tryAllPortalsAndSurfaces() {
0112 auto aps = std::make_unique<const AllPortalsAndSurfacesNavigation>();
0113 InternalNavigationDelegate nStateUpdater;
0114 nStateUpdater.connect<&AllPortalsAndSurfacesNavigation::update>(
0115 std::move(aps));
0116 return nStateUpdater;
0117 }
0118
0119
0120
0121
0122
0123 struct AdditionalSurfacesNavigation : public IInternalNavigation {
0124
0125 std::vector<const Surface*> surfaces = {};
0126
0127
0128
0129
0130
0131
0132 inline void update([[maybe_unused]] const GeometryContext& gctx,
0133 NavigationState& nState) const {
0134 SurfacesFiller::fill(nState, surfaces);
0135 }
0136 };
0137
0138
0139
0140
0141 template <typename grid_type>
0142 using IndexedSurfacesNavigation =
0143 IndexedGridNavigation<IInternalNavigation, grid_type,
0144 IndexedSurfacesExtractor, SurfacesFiller>;
0145
0146
0147
0148
0149 template <typename grid_type>
0150 using MultiLayerSurfacesNavigation =
0151 MultiLayerNavigation<grid_type, PathGridSurfacesGenerator>;
0152
0153
0154
0155
0156 template <typename grid_type, template <typename> class indexed_updator>
0157 using IndexedSurfacesAllPortalsNavigation =
0158 ChainedNavigation<IInternalNavigation, AllPortalsNavigation,
0159 indexed_updator<grid_type>>;
0160
0161 }