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/Geometry/GeometryContext.hpp"
0012 #include "Acts/Navigation/NavigationDelegates.hpp"
0013 #include "Acts/Navigation/NavigationState.hpp"
0014 #include "Acts/Navigation/NavigationStateFillers.hpp"
0015 #include "Acts/Navigation/NavigationStateUpdaters.hpp"
0016 #include "Acts/Utilities/Grid.hpp"
0017 #include "Acts/Utilities/detail/Axis.hpp"
0018
0019 #include <stdexcept>
0020
0021 namespace Acts::Experimental {
0022
0023 class DetectorVolume;
0024
0025
0026
0027
0028 struct EndOfWorld : public IExternalNavigation {
0029
0030
0031
0032 inline void update(const GeometryContext& ,
0033 NavigationState& nState) const {
0034 nState.currentVolume = nullptr;
0035 }
0036 };
0037
0038
0039 using SingleDetectorVolumeNavigation =
0040 SingleObjectNavigation<IExternalNavigation, DetectorVolume,
0041 DetectorVolumeFiller>;
0042
0043 using SingleIndex = std::size_t;
0044
0045 using VariableBoundAxis =
0046 Acts::detail::Axis<Acts::detail::AxisType::Variable,
0047 Acts::detail::AxisBoundaryType::Bound>;
0048 using VariableBoundIndexGrid1 = Acts::Grid<SingleIndex, VariableBoundAxis>;
0049
0050
0051
0052
0053
0054
0055 struct DetectorVolumesCollection {
0056
0057 std::vector<const DetectorVolume*> dVolumes = {};
0058
0059
0060
0061
0062
0063
0064
0065 inline const DetectorVolume* extract(const GeometryContext& ,
0066 const NavigationState& ,
0067 const SingleIndex& index) const {
0068 return dVolumes[index];
0069 }
0070 };
0071
0072
0073
0074
0075
0076 struct BoundVolumesGrid1Navigation : public IExternalNavigation {
0077 using IndexedUpdater =
0078 IndexedGridNavigation<IExternalNavigation, VariableBoundIndexGrid1,
0079 DetectorVolumesCollection, DetectorVolumeFiller>;
0080
0081 IndexedUpdater indexedUpdater;
0082
0083
0084
0085
0086
0087
0088
0089 BoundVolumesGrid1Navigation(
0090 const std::vector<ActsScalar>& gBoundaries, BinningValue bValue,
0091 const std::vector<const DetectorVolume*>& cVolumes,
0092 const Transform3& bTransform = Transform3::Identity()) noexcept(false)
0093 : indexedUpdater(IndexedUpdater(VariableBoundIndexGrid1(std::make_tuple(
0094 VariableBoundAxis(gBoundaries))),
0095 {bValue}, bTransform)) {
0096 indexedUpdater.extractor.dVolumes = cVolumes;
0097
0098 if (gBoundaries.size() != cVolumes.size() + 1u) {
0099 throw std::invalid_argument(
0100 "ExternalNavigationDelegates: mismatching boundaries and volume "
0101 "numbers");
0102 }
0103
0104 for (std::size_t ib = 1u; ib < gBoundaries.size(); ++ib) {
0105 indexedUpdater.grid.at(ib) = ib - 1;
0106 }
0107 }
0108
0109 BoundVolumesGrid1Navigation() = delete;
0110
0111
0112
0113
0114
0115 inline void update(const GeometryContext& gctx,
0116 NavigationState& nState) const {
0117 indexedUpdater.update(gctx, nState);
0118 }
0119 };
0120
0121 }