29 namespace Experimental {
43 std::vector<std::size_t>
binSequence(std::array<std::size_t, 2u> minMaxBins,
44 std::size_t expand, std::size_t nBins,
59 template <
typename gr
id_type>
61 const grid_type&
grid,
62 const std::vector<typename grid_type::point_t>& queries,
63 const std::vector<std::size_t>& expansion = {}) {
65 std::set<typename grid_type::index_t> lIndices;
67 if (queries.empty()) {
68 throw std::runtime_error(
"IndexedSurfaceGridFiller: no query point given.");
71 if (not expansion.empty() and expansion.size() != grid_type::DIM) {
72 throw std::runtime_error(
73 "IndexedSurfaceGridFiller: wrong dimension of bin expansion given.");
77 std::array<Acts::detail::AxisBoundaryType, grid_type::DIM> axisTypes{};
78 std::array<std::size_t, grid_type::DIM> axisBins{};
81 axisTypes[ia] =
a->getBoundaryType();
82 axisBins[ia] =
a->getNBins();
86 std::array<std::array<std::size_t, 2u>, grid_type::DIM> binRanges = {};
87 for (
auto& br : binRanges) {
88 br[0
u] = std::numeric_limits<std::size_t>::max();
92 for (
const auto& q : queries) {
93 auto qbin = grid.localBinsFromPosition(q);
94 for (std::size_t
ib = 0;
ib < grid_type::DIM; ++
ib) {
97 binRanges[
ib][1
u] = std::max(iqb, binRanges[
ib][1
u]);
101 if constexpr (grid_type::DIM == 1
u) {
103 std::size_t expand = expansion.empty() ? 0
u : expansion[0
u];
105 binSequence(binRanges[0
u], expand, axisBins[0u], axisTypes[0u]);
106 for (
auto l0 : localBins0) {
107 typename grid_type::index_t
b;
113 if constexpr (grid_type::DIM == 2
u) {
115 std::size_t expand = expansion.empty() ? 0
u : expansion[0
u];
117 binSequence(binRanges[0
u], expand, axisBins[0u], axisTypes[0u]);
118 expand = expansion.empty() ? 0
u : expansion[1
u];
120 binSequence(binRanges[1
u], expand, axisBins[1u], axisTypes[1u]);
121 for (
auto l0 : localBins0) {
122 for (
auto l1 : localBins1) {
123 typename grid_type::index_t
b;
140 template <
typename local_bin>
188 template <
typename index_grid,
typename indexed_objects,
189 typename reference_generator>
192 const indexed_objects& iObjects,
const reference_generator& rGenerator,
195 for (
auto [io, o] :
enumerate(iObjects)) {
197 if (std::find(aToAll.begin(), aToAll.end(), io) != aToAll.end()) {
201 auto refs = rGenerator.references(gctx, *o);
202 std::vector<typename index_grid::grid_type::point_t> gridQueries;
203 gridQueries.reserve(refs.size());
204 for (
const auto&
ref : refs) {
206 gridQueries.push_back(iGrid.castPosition(
ref));
208 ACTS_DEBUG(gridQueries.size() <<
" reference points generated.");
211 ACTS_DEBUG(lIndices.size() <<
" indices assigned.");
216 for (
const auto& li : lIndices) {
217 auto& bContent = iGrid.grid.atLocalBins(li);
218 if (std::find(bContent.begin(), bContent.end(), io) == bContent.end()) {
219 bContent.push_back(io);
225 if (not aToAll.empty()) {
235 template <
typename index_gr
id,
typename indices>
237 for (std::size_t gi = 0; gi < iGrid.grid.size(
true); ++gi) {
238 auto& bContent = iGrid.grid.at(gi);
239 for (
const auto& io : idcs) {
240 if (std::find(bContent.begin(), bContent.end(), io) == bContent.end()) {
241 bContent.push_back(io);