Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-16 08:02:18

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Seeding/BinnedGroupIterator.hpp"
0012 #include "Acts/Utilities/GridBinFinder.hpp"
0013 
0014 #include <vector>
0015 
0016 namespace Acts {
0017 
0018 /// @class BinnedGroup
0019 /// @tparam grid_t Type of the grid the group owns
0020 ///
0021 /// The assumption is that the grid has ownership of the space points and
0022 /// that the grid value_type (i.e. T in Grid<T, Axes ...>) is an iterable
0023 /// object of space points, such as a vector< ... >
0024 template <typename grid_t>
0025 class BinnedGroup {
0026  public:
0027   /// Friend iterator class for accessing private members
0028   friend BinnedGroupIterator<grid_t>;
0029 
0030   /// Dimension of the underlying grid
0031   static constexpr std::size_t DIM = grid_t::DIM;
0032 
0033   /// @brief Default constructor
0034   BinnedGroup() = delete;
0035 
0036   /// brief Constructor
0037   /// @param grid The grid to use for binning
0038   /// @param bottomFinder The bottom bin finder
0039   /// @param topFinder The top bin finder
0040   /// @param navigation The navigation array for grid bins
0041   BinnedGroup(grid_t&& grid, const GridBinFinder<DIM>& bottomFinder,
0042               const GridBinFinder<DIM>& topFinder,
0043               std::array<std::vector<std::size_t>, DIM> navigation =
0044                   std::array<std::vector<std::size_t>, DIM>());
0045 
0046   /// Constructor with grid, mask, and finders
0047   /// @param grid Grid object (moved)
0048   /// @param mask Vector of boolean masks
0049   /// @param bottomFinder Bottom bin finder
0050   /// @param topFinder Top bin finder
0051   /// @param navigation Navigation array (optional)
0052   BinnedGroup(grid_t&& grid, std::vector<bool> mask,
0053               const GridBinFinder<DIM>& bottomFinder,
0054               const GridBinFinder<DIM>& topFinder,
0055               std::array<std::vector<std::size_t>, DIM> navigation =
0056                   std::array<std::vector<std::size_t>, DIM>());
0057 
0058   BinnedGroup(grid_t& grid, const GridBinFinder<DIM>& bottomFinder,
0059               const GridBinFinder<DIM>& topFinder,
0060               std::array<std::vector<std::size_t>, DIM> navigation =
0061                   std::array<std::vector<std::size_t>, DIM>()) = delete;
0062 
0063   /// @brief Copy constructor
0064   /// @param [in] other The BinnedGroup to copy
0065   BinnedGroup(const BinnedGroup<grid_t>& other) = delete;
0066   /// @brief Copy assignment
0067   /// @param [in] other The BinnedGroup to copy
0068   /// @return The copied BinnedGroup
0069   BinnedGroup<grid_t>& operator=(const BinnedGroup<grid_t>& other) = delete;
0070 
0071   /// @brief Move Constructor
0072   /// @param [in] other The BinnedGroup to move
0073   BinnedGroup(BinnedGroup<grid_t>&& other) noexcept = default;
0074   /// @brief Move Assignment
0075   /// @param [in] other The BinnedGroup to move
0076   /// @return The moved BinnedGroup
0077   BinnedGroup<grid_t>& operator=(BinnedGroup<grid_t>&& other) noexcept =
0078       default;
0079 
0080   /// @brief Default destructor
0081   ~BinnedGroup() = default;
0082 
0083   /// @brief Retrieve const reference to the Grid
0084   /// @return Const reference to the stored grid
0085   const grid_t& grid() const;
0086   /// @brief Retrieve mutable reference to the Grid
0087   /// @return Mutable reference to the stored grid
0088   grid_t& grid();
0089 
0090   /// @brief Retrieve the mask
0091   /// Only const accessor is supported
0092   /// @return The mask
0093   const std::vector<bool>& mask() const;
0094 
0095   /// @brief Get the begin iterator
0096   /// @return The iterator
0097   BinnedGroupIterator<grid_t> begin() const;
0098   /// @brief Get the end iterator
0099   /// @return The iterator
0100   BinnedGroupIterator<grid_t> end() const;
0101 
0102  private:
0103   /// @brief The N-dimentional grid
0104   grid_t m_grid;
0105   /// @brief The mask to be applied to the grid. The size of this vector
0106   /// corresponds to the global bins in the grid
0107   std::vector<bool> m_mask{};
0108   /// @brief The Grid Bin Finder for bottom candidates
0109   const GridBinFinder<DIM>* m_bottomBinFinder{nullptr};
0110   /// @brief The Grid Bin Finder for top candidates
0111   const GridBinFinder<DIM>* m_topBinFinder{nullptr};
0112   /// @brief Order of bins to loop over when searching for SPs
0113   std::array<std::vector<std::size_t>, DIM> m_bins{};
0114 };
0115 
0116 }  // namespace Acts
0117 
0118 #include "Acts/Seeding/BinnedGroup.ipp"