11 #include <boost/container/flat_set.hpp>
13 template <
typename external_spacepo
int_t>
16 : m_group(group), m_max_localBins(m_group->m_grid->numLocalBins()) {
19 if (index ==
m_group->m_grid->size()) {
27 template <
typename external_spacepo
int_t>
33 ++m_current_localBins[INDEX::PHI];
34 m_current_localBins[
INDEX::Z] = m_group->skipZMiddleBin();
42 template <
typename external_spacepo
int_t>
46 m_current_localBins[INDEX::PHI] ==
51 template <
typename external_spacepo
int_t>
54 return not(*
this == other);
57 template <
typename external_spacepo
int_t>
58 std::tuple<boost::container::small_vector<size_t, 9>, std::size_t,
59 boost::container::small_vector<size_t, 9>>
62 std::size_t global_index = m_group->m_grid->globalBinFromLocalBins(
63 {m_current_localBins[INDEX::PHI],
64 m_group->m_bins[m_current_localBins[
INDEX::Z]]});
66 boost::container::small_vector<size_t, 9> bottoms =
67 m_group->m_bottomBinFinder->findBins(
68 m_current_localBins[INDEX::PHI],
69 m_group->m_bins[m_current_localBins[
INDEX::Z]],
70 m_group->m_grid.get());
71 boost::container::small_vector<size_t, 9> tops =
72 m_group->m_topBinFinder->findBins(
73 m_current_localBins[INDEX::PHI],
74 m_group->m_bins[m_current_localBins[INDEX::Z]],
75 m_group->m_grid.get());
79 #if defined(__GNUC__) && __GNUC__ >= 12 && !defined(__clang__)
80 #pragma GCC diagnostic push
81 #pragma GCC diagnostic ignored "-Wstringop-overread"
84 #if defined(__GNUC__) && __GNUC__ >= 12 && !defined(__clang__)
85 #pragma GCC diagnostic pop
89 template <
typename external_spacepo
int_t>
95 for (std::size_t phiBin(m_current_localBins[INDEX::PHI]);
96 phiBin < m_max_localBins[INDEX::PHI]; ++phiBin) {
102 for (std::size_t zBin(m_current_localBins[
INDEX::Z]);
103 zBin < m_max_localBins[
INDEX::Z]; ++zBin) {
104 std::size_t zBinIndex = m_group->m_bins[zBin];
106 m_group->m_grid->globalBinFromLocalBins({phiBin, zBinIndex});
108 if (m_group->m_grid->at(index).empty()) {
113 m_current_localBins[INDEX::PHI] = phiBin;
114 m_current_localBins[
INDEX::Z] = zBin;
118 m_current_localBins[
INDEX::Z] = m_group->skipZMiddleBin();
122 m_current_localBins = m_max_localBins;
126 template <
typename external_spacepo
int_t>
127 template <
typename spacepo
int_iterator_t,
typename callable_t>
129 spacepoint_iterator_t spBegin, spacepoint_iterator_t spEnd,
130 callable_t&& toGlobal,
138 throw std::runtime_error(
139 "SeedFinderConfig not in ACTS internal units in BinnedSPGroup");
142 throw std::runtime_error(
143 "SeedFinderOptions not in ACTS internal units in BinnedSPGroup");
148 const external_spacepoint_t*>::
value,
149 "Iterator does not contain type this class was templated with");
153 float phiMax = config.
phiMax;
154 float zMin = config.
zMin;
155 float zMax = config.
zMax;
162 size_t numRBins =
static_cast<size_t>((config.
rMax + options.
beamPos.norm()) /
166 boost::container::flat_set<size_t> rBinsIndex;
168 std::size_t counter = 0;
169 for (spacepoint_iterator_t
it = spBegin;
it != spEnd;
it++, ++counter) {
170 if (*
it ==
nullptr) {
173 const external_spacepoint_t& sp = **
it;
174 const auto& [spPosition, variance] =
177 float spX = spPosition[0];
178 float spY = spPosition[1];
179 float spZ = spPosition[2];
182 rRangeSPExtent.
extend({spX, spY, spZ});
185 if (spZ > zMax || spZ < zMin) {
188 float spPhi = std::atan2(spY, spX);
189 if (spPhi > phiMax || spPhi < phiMin) {
193 auto isp = std::make_unique<InternalSpacePoint<external_spacepoint_t>>(
194 counter, sp, spPosition, options.
beamPos, variance);
197 size_t rIndex =
static_cast<size_t>(isp->radius() / config.
binSizeR);
199 if (rIndex >= numRBins) {
205 std::vector<std::unique_ptr<InternalSpacePoint<external_spacepoint_t>>>&
206 rbin =
grid->atPosition(spLocation);
211 if (rbin.size() > 1) {
212 rBinsIndex.insert(
grid->globalBinFromPosition(spLocation));
217 for (
auto& binIndex : rBinsIndex) {
218 std::vector<std::unique_ptr<InternalSpacePoint<external_spacepoint_t>>>&
219 rbin =
grid->atPosition(binIndex);
221 rbin.begin(), rbin.end(),
222 [](std::unique_ptr<InternalSpacePoint<external_spacepoint_t>>&
a,
223 std::unique_ptr<InternalSpacePoint<external_spacepoint_t>>&
b) {
224 return a->radius() <
b->radius();
229 m_bottomBinFinder = botBinFinder;
230 m_topBinFinder = tBinFinder;
234 if (m_bins.empty()) {
235 std::size_t nZbins = m_grid->numLocalBins()[1];
236 m_bins.reserve(nZbins);
237 for (std::size_t
i(0);
i < nZbins; ++
i) {
238 m_bins.push_back(
i + 1);
243 template <
typename external_spacepo
int_t>
245 return m_grid->size();
248 template <
typename external_spacepo
int_t>
254 template <
typename external_spacepo
int_t>
257 return {*
this, m_grid->size()};