Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BinnedSPGroup.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file BinnedSPGroup.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2023 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 
11 #include "Acts/Geometry/Extent.hpp"
14 #include "Acts/Seeding/Seed.hpp"
18 
19 #include <memory>
20 #include <vector>
21 
22 #include <boost/container/small_vector.hpp>
23 
24 namespace Acts {
25 template <typename external_spacepoint_t>
27 
30 
34 template <typename external_spacepoint_t>
36  private:
37  enum INDEX : int { PHI = 0, Z = 1 };
38 
39  public:
40  // Never take ownerships
42  std::size_t) = delete;
44  std::size_t index);
45 
48 
50  BinnedSPGroupIterator& operator=(BinnedSPGroupIterator&&) noexcept = default;
51 
52  ~BinnedSPGroupIterator() = default;
53 
54  BinnedSPGroupIterator& operator++();
55 
56  bool operator==(const BinnedSPGroupIterator& other) const;
57  bool operator!=(const BinnedSPGroupIterator& other) const;
58 
59  std::tuple<boost::container::small_vector<size_t, 9>, std::size_t,
60  boost::container::small_vector<size_t, 9>>
61  operator*() const;
62 
63  private:
64  void findNotEmptyBin();
65 
66  private:
67  // The group, it contains the grid and the bin finders
68  Acts::detail::RefHolder<BinnedSPGroup<external_spacepoint_t>> m_group;
69  // Max Local Bins - limits of the grid
70  std::array<std::size_t, 2> m_max_localBins;
71  // Current Local Bins
72  std::array<std::size_t, 2> m_current_localBins{0, 0};
73 };
74 
78 template <typename external_spacepoint_t>
80 #ifndef DOXYGEN
82 #endif
83 
84  public:
85  BinnedSPGroup() = delete;
86 
87  template <typename spacepoint_iterator_t, typename callable_t>
89  spacepoint_iterator_t spBegin, spacepoint_iterator_t spEnd,
90  callable_t&& toGlobal,
91  std::shared_ptr<const Acts::BinFinder<external_spacepoint_t>>
92  botBinFinder,
93  std::shared_ptr<const Acts::BinFinder<external_spacepoint_t>> tBinFinder,
95  Acts::Extent& rRangeSPExtent,
97  const SeedFinderOptions& _options);
98 
99  BinnedSPGroup(const BinnedSPGroup&) = delete;
100  BinnedSPGroup& operator=(const BinnedSPGroup&) = delete;
101 
102  BinnedSPGroup(BinnedSPGroup&&) noexcept = default;
103  BinnedSPGroup& operator=(BinnedSPGroup&&) noexcept = default;
104 
105  ~BinnedSPGroup() = default;
106 
107  size_t size() const;
108 
109  BinnedSPGroupIterator<external_spacepoint_t> begin();
110  BinnedSPGroupIterator<external_spacepoint_t> end();
111 
112  Acts::SpacePointGrid<external_spacepoint_t>& grid() {
113  return *m_grid.get();
114  }
115 
116  std::size_t skipZMiddleBin() {
117  return m_skipZMiddleBin;
118  }
119 
120  private:
121  // grid with ownership of all InternalSpacePoint
122  std::unique_ptr<Acts::SpacePointGrid<external_spacepoint_t>> m_grid;
123 
124  // BinFinder must return std::vector<Acts::Seeding::Bin> with content of
125  // each bin sorted in r (ascending)
126  std::shared_ptr<const BinFinder<external_spacepoint_t>> m_topBinFinder;
127  std::shared_ptr<const BinFinder<external_spacepoint_t>> m_bottomBinFinder;
128 
129  // Order of z bins to loop over when searching for SPs
130  std::vector<size_t> m_bins;
131  // Number of Z bins to skip the search for middle SP
132  std::size_t m_skipZMiddleBin;
133 };
134 
135 } // namespace Acts