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/DetectorVolume.hpp"
0014 #include "Acts/Detector/Portal.hpp"
0015 #include "Acts/Geometry/GeometryContext.hpp"
0016 #include "Acts/Navigation/MultiLayerSurfacesUpdater.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 AllPortalsImpl : public INavigationDelegate {
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 "AllPortalsImpl: 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 AllPortalsAndSurfacesImpl : public INavigationDelegate {
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 "AllPortalsAndSurfacesImpl: no detector volume set to navigation "
0074 "state.");
0075 }
0076
0077 if (nState.surfaceCandidates.empty()) {
0078
0079 for (const auto v : nState.currentVolume->volumes()) {
0080 const auto& iPortals = v->portals();
0081 PortalsFiller::fill(nState, iPortals);
0082 }
0083
0084 const auto& portals = nState.currentVolume->portals();
0085 const auto& surfaces = nState.currentVolume->surfaces();
0086 PortalsFiller::fill(nState, portals);
0087 SurfacesFiller::fill(nState, surfaces);
0088 }
0089
0090 updateCandidates(gctx, nState);
0091 }
0092 };
0093
0094
0095
0096
0097 inline static SurfaceCandidatesUpdater tryAllPortals() {
0098 auto ap = std::make_unique<const AllPortalsImpl>();
0099 SurfaceCandidatesUpdater nStateUpdater;
0100 nStateUpdater.connect<&AllPortalsImpl::update>(std::move(ap));
0101 return nStateUpdater;
0102 }
0103
0104
0105
0106
0107
0108
0109
0110 inline static SurfaceCandidatesUpdater tryAllPortalsAndSurfaces() {
0111 auto aps = std::make_unique<const AllPortalsAndSurfacesImpl>();
0112 SurfaceCandidatesUpdater nStateUpdater;
0113 nStateUpdater.connect<&AllPortalsAndSurfacesImpl::update>(std::move(aps));
0114 return nStateUpdater;
0115 }
0116
0117
0118
0119
0120
0121 struct AdditionalSurfacesImpl : public INavigationDelegate {
0122
0123 std::vector<const Surface*> surfaces = {};
0124
0125
0126
0127
0128
0129
0130 inline void update([[maybe_unused]] const GeometryContext& gctx,
0131 NavigationState& nState) const {
0132 SurfacesFiller::fill(nState, surfaces);
0133 }
0134 };
0135
0136
0137
0138
0139 template <typename grid_type>
0140 using IndexedSurfacesImpl =
0141 IndexedUpdaterImpl<grid_type, IndexedSurfacesExtractor, SurfacesFiller>;
0142
0143
0144
0145
0146 template <typename grid_type>
0147 using MultiLayerSurfacesImpl =
0148 MultiLayerSurfacesUpdaterImpl<grid_type, PathGridSurfacesGenerator>;
0149
0150
0151
0152
0153 template <typename grid_type, template <typename> class indexed_updator>
0154 using IndexedSurfacesAllPortalsImpl =
0155 ChainedUpdaterImpl<AllPortalsImpl, indexed_updator<grid_type>>;
0156
0157 }