File indexing completed on 2025-01-18 09:10:55
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
0100
0101 inline void update(const GeometryContext& gctx,
0102 NavigationState& nState) const {
0103 fill(gctx, nState);
0104 intitializeCandidates(gctx, nState);
0105 }
0106 };
0107
0108
0109
0110
0111 inline static InternalNavigationDelegate tryAllPortals() {
0112 auto ap = std::make_unique<const AllPortalsNavigation>();
0113 InternalNavigationDelegate nStateUpdater;
0114 nStateUpdater.connect<&AllPortalsNavigation::update>(std::move(ap));
0115 return nStateUpdater;
0116 }
0117
0118
0119
0120
0121
0122
0123
0124 inline static InternalNavigationDelegate tryAllPortalsAndSurfaces() {
0125 auto aps = std::make_unique<const AllPortalsAndSurfacesNavigation>();
0126 InternalNavigationDelegate nStateUpdater;
0127 nStateUpdater.connect<&AllPortalsAndSurfacesNavigation::update>(
0128 std::move(aps));
0129 return nStateUpdater;
0130 }
0131
0132
0133
0134
0135
0136 struct AdditionalSurfacesNavigation : public IInternalNavigation {
0137
0138 std::vector<const Surface*> surfaces = {};
0139
0140
0141
0142
0143
0144
0145
0146 inline void fill([[maybe_unused]] const GeometryContext& gctx,
0147 NavigationState& nState) const {
0148 SurfacesFiller::fill(nState, surfaces);
0149 }
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161 inline void update(const GeometryContext& gctx,
0162 NavigationState& nState) const {
0163 fill(gctx, nState);
0164 intitializeCandidates(gctx, nState);
0165 }
0166 };
0167
0168
0169
0170
0171 template <typename grid_type>
0172 using IndexedSurfacesNavigation =
0173 IndexedGridNavigation<IInternalNavigation, grid_type,
0174 IndexedSurfacesExtractor, SurfacesFiller>;
0175
0176
0177
0178
0179 template <typename grid_type>
0180 using MultiLayerSurfacesNavigation =
0181 MultiLayerNavigation<grid_type, PathGridSurfacesGenerator>;
0182
0183
0184
0185
0186 template <typename grid_type, template <typename> class indexed_updator>
0187 using IndexedSurfacesAllPortalsNavigation =
0188 ChainedNavigation<IInternalNavigation, AllPortalsNavigation,
0189 indexed_updator<grid_type>>;
0190
0191 }