File indexing completed on 2025-01-30 09:15:17
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Plugins/Json/DetectorVolumeFinderJsonConverter.hpp"
0010
0011 #include "Acts/Navigation/DetectorVolumeFinders.hpp"
0012 #include "Acts/Navigation/NavigationDelegates.hpp"
0013 #include "Acts/Navigation/PortalNavigation.hpp"
0014 #include "Acts/Plugins/Json/GridJsonConverter.hpp"
0015 #include "Acts/Plugins/Json/UtilitiesJsonConverter.hpp"
0016 #include "Acts/Utilities/GridAxisGenerators.hpp"
0017
0018 #include <array>
0019 #include <memory>
0020 #include <tuple>
0021 #include <vector>
0022
0023 namespace {
0024
0025 struct IndexedVolumesGenerator {
0026 using value_type = std::size_t;
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037 template <typename grid_type>
0038 Acts::Experimental::ExternalNavigationDelegate createUpdater(
0039 grid_type&& grid,
0040 const std::array<Acts::AxisDirection, grid_type::DIM>& bv,
0041 const Acts::Transform3& transform) {
0042 using IndexedDetectorVolumesImpl =
0043 Acts::Experimental::IndexedGridNavigation<
0044 Acts::Experimental::IExternalNavigation, grid_type,
0045 Acts::Experimental::IndexedDetectorVolumeExtractor,
0046 Acts::Experimental::DetectorVolumeFiller>;
0047
0048 auto indexedDetectorVolumeImpl =
0049 std::make_unique<const IndexedDetectorVolumesImpl>(
0050 std::forward<grid_type>(grid), bv, transform);
0051
0052
0053 Acts::Experimental::ExternalNavigationDelegate vFinder;
0054 vFinder.connect<&IndexedDetectorVolumesImpl::update>(
0055 std::move(indexedDetectorVolumeImpl));
0056 return vFinder;
0057 }
0058 };
0059
0060 }
0061
0062 Acts::Experimental::ExternalNavigationDelegate
0063 Acts::DetectorVolumeFinderJsonConverter::fromJson(
0064 const nlohmann::json& jVolumeFinder) {
0065
0066 auto vFinder = IndexedGridJsonHelper::generateFromJson<
0067 Experimental::ExternalNavigationDelegate, IndexedVolumesGenerator>(
0068 jVolumeFinder, "IndexedVolumes");
0069 if (vFinder.connected()) {
0070 return vFinder;
0071 }
0072
0073 return Experimental::tryRootVolumes();
0074 }