File indexing completed on 2025-01-18 09:27:33
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Detector/detail/IndexedGridFiller.hpp"
0013 #include "Acts/Navigation/InternalNavigation.hpp"
0014 #include "Acts/Utilities/Enumerate.hpp"
0015
0016 #include <algorithm>
0017 #include <array>
0018 #include <memory>
0019
0020 namespace Acts::Experimental::detail {
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 template <typename surface_container, template <typename> class indexed_updator>
0034 struct IndexedSurfacesGenerator {
0035
0036
0037 surface_container surfaces = {};
0038
0039 std::vector<std::size_t> assignToAll = {};
0040
0041 std::vector<BinningValue> bValues = {};
0042
0043 std::vector<std::size_t> binExpansion = {};
0044
0045 Transform3 transform = Transform3::Identity();
0046
0047 std::unique_ptr<const Logger> oLogger =
0048 getDefaultLogger("IndexedSurfacesGenerator", Logging::INFO);
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060 template <typename axis_generator, typename reference_generator>
0061 InternalNavigationDelegate operator()(
0062 const GeometryContext& gctx, const axis_generator& aGenerator,
0063 const reference_generator& rGenerator) const {
0064 ACTS_DEBUG("Indexing " << surfaces.size() << " surface, "
0065 << assignToAll.size() << " of which into all bins.");
0066
0067 using GridType =
0068 typename axis_generator::template grid_type<std::vector<std::size_t>>;
0069 GridType grid(std::move(aGenerator()));
0070
0071 std::array<BinningValue, decltype(grid)::DIM> bvArray = {};
0072 for (auto [ibv, bv] : enumerate(bValues)) {
0073 bvArray[ibv] = bv;
0074 }
0075
0076 indexed_updator<GridType> indexedSurfaces(std::move(grid), bvArray,
0077 transform);
0078
0079 IndexedGridFiller filler{binExpansion};
0080 filler.oLogger = oLogger->cloneWithSuffix("_filler");
0081 filler.fill(gctx, indexedSurfaces, surfaces, rGenerator, assignToAll);
0082
0083
0084 AllPortalsNavigation allPortals;
0085
0086
0087 using DelegateType =
0088 IndexedSurfacesAllPortalsNavigation<decltype(grid), indexed_updator>;
0089 auto indexedSurfacesAllPortals = std::make_unique<const DelegateType>(
0090 std::tie(allPortals, indexedSurfaces));
0091
0092
0093 InternalNavigationDelegate nStateUpdater;
0094 nStateUpdater.connect<&DelegateType::update>(
0095 std::move(indexedSurfacesAllPortals));
0096 return nStateUpdater;
0097 }
0098
0099
0100
0101
0102 const Logger& logger() const { return *oLogger; }
0103 };
0104
0105 }