Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-11 08:05:39

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 Per axis, the bins to visit and in which order, as
0041   ///        1-based local bin indices in [1, nBins]. May be a subset to skip
0042   ///        bins, but must not repeat one. Empty means all bins in order.
0043   /// @throw std::invalid_argument on an out of range or repeated entry
0044   BinnedGroup(grid_t&& grid, const GridBinFinder<DIM>& bottomFinder,
0045               const GridBinFinder<DIM>& topFinder,
0046               std::array<std::vector<std::size_t>, DIM> navigation =
0047                   std::array<std::vector<std::size_t>, DIM>());
0048 
0049   /// Constructor with grid, mask, and finders
0050   /// @param grid Grid object (moved)
0051   /// @param mask Vector of boolean masks
0052   /// @param bottomFinder Bottom bin finder
0053   /// @param topFinder Top bin finder
0054   /// @param navigation Bins to visit per axis, see the constructor above
0055   /// @throw std::invalid_argument if the mask does not match the grid, or on an
0056   ///        out of range or repeated navigation entry
0057   BinnedGroup(grid_t&& grid, std::vector<bool> mask,
0058               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>());
0062 
0063   BinnedGroup(grid_t& grid, const GridBinFinder<DIM>& bottomFinder,
0064               const GridBinFinder<DIM>& topFinder,
0065               std::array<std::vector<std::size_t>, DIM> navigation =
0066                   std::array<std::vector<std::size_t>, DIM>()) = delete;
0067 
0068   /// @brief Copy constructor
0069   /// @param [in] other The BinnedGroup to copy
0070   BinnedGroup(const BinnedGroup<grid_t>& other) = delete;
0071   /// @brief Copy assignment
0072   /// @param [in] other The BinnedGroup to copy
0073   /// @return The copied BinnedGroup
0074   BinnedGroup<grid_t>& operator=(const BinnedGroup<grid_t>& other) = delete;
0075 
0076   /// @brief Move Constructor
0077   /// @param [in] other The BinnedGroup to move
0078   BinnedGroup(BinnedGroup<grid_t>&& other) noexcept = default;
0079   /// @brief Move Assignment
0080   /// @param [in] other The BinnedGroup to move
0081   /// @return The moved BinnedGroup
0082   BinnedGroup<grid_t>& operator=(BinnedGroup<grid_t>&& other) noexcept =
0083       default;
0084 
0085   /// @brief Default destructor
0086   ~BinnedGroup() = default;
0087 
0088   /// @brief Retrieve const reference to the Grid
0089   /// @return Const reference to the stored grid
0090   const grid_t& grid() const;
0091   /// @brief Retrieve mutable reference to the Grid
0092   /// @return Mutable reference to the stored grid
0093   grid_t& grid();
0094 
0095   /// @brief Retrieve the mask
0096   /// Only const accessor is supported
0097   /// @return The mask
0098   const std::vector<bool>& mask() const;
0099 
0100   /// @brief Get the begin iterator
0101   /// @return The iterator
0102   BinnedGroupIterator<grid_t> begin() const;
0103   /// @brief Get the end iterator
0104   /// @return The iterator
0105   BinnedGroupIterator<grid_t> end() const;
0106 
0107  private:
0108   /// @brief The N-dimentional grid
0109   grid_t m_grid;
0110   /// @brief The mask to be applied to the grid. The size of this vector
0111   /// corresponds to the global bins in the grid
0112   std::vector<bool> m_mask{};
0113   /// @brief The Grid Bin Finder for bottom candidates
0114   const GridBinFinder<DIM>* m_bottomBinFinder{nullptr};
0115   /// @brief The Grid Bin Finder for top candidates
0116   const GridBinFinder<DIM>* m_topBinFinder{nullptr};
0117   /// @brief Order of bins to loop over when searching for SPs, as 1-based
0118   /// local bin indices
0119   std::array<std::vector<std::size_t>, DIM> m_bins{};
0120 };
0121 
0122 }  // namespace Acts
0123 
0124 #include "Acts/Seeding/BinnedGroup.ipp"