Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BinFinder.ipp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file BinFinder.ipp
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 template <typename external_spacepoint_t>
11  const std::vector<std::pair<int, int>>& zBinNeighbors, int numPhiNeighbors)
12  : m_zBinNeighbors(zBinNeighbors), m_numPhiNeighbors(numPhiNeighbors) {}
13 
14 template <typename external_spacepoint_t>
15 boost::container::small_vector<size_t, 9>
17  size_t phiBin, size_t zBin,
18  const Acts::SpacePointGrid<external_spacepoint_t>* binnedSP) const {
19  // if zBinNeighbors is not defined, get the indices using
20  // neighborHoodIndices
21  if (m_zBinNeighbors->empty()) {
22  return binnedSP->neighborHoodIndices({phiBin, zBin}).collect();
23  }
24  // if the zBinNeighbors is defined, get the indices from there
25  std::array<std::pair<int, int>, 2> sizePerAxis;
26  sizePerAxis.at(0) = std::make_pair(-m_numPhiNeighbors, m_numPhiNeighbors);
27  sizePerAxis.at(1) = (*m_zBinNeighbors)[zBin - 1];
28  return binnedSP->neighborHoodIndices({phiBin, zBin}, sizePerAxis).collect();
29 }