10#include <tracking/trackFindingCDC/utilities/Product.h>
23 namespace TrackFindingCDC {
30 template<
class ABox, std::size_t... divisions>
39 static constexpr std::size_t
s_divisions[
sizeof...(divisions)] = {divisions...};
43 explicit LinearDivision(
const typename ABox::Delta& overlaps =
typename ABox::Delta())
49 std::array<ABox, s_nSubBoxes>
operator()(
const ABox& box)
51 return makeSubBoxes(box, std::make_index_sequence<s_nSubBoxes>());
55 template<std::size_t... Is>
57 std::array<ABox, s_nSubBoxes>
60 return {{
makeSubBox(box, Is, std::make_index_sequence<
sizeof...(divisions)>())... }};
65 template<std::size_t... Is>
68 std::size_t globalISubBox,
69 std::index_sequence<Is...> )
71 std::array<std::size_t,
sizeof...(divisions)> indices;
72 for (
size_t c_Index = 0 ; c_Index <
sizeof...(divisions); ++c_Index) {
73 indices[c_Index] = globalISubBox %
s_divisions[c_Index];
76 assert(globalISubBox == 0);
77 return ABox(box.template getDivisionBoundsWithOverlap<Is>(std::get<Is>(
m_overlaps),
89 template<
class ABox, std::size_t... divisions>
90 constexpr std::size_t
LinearDivision<ABox, divisions...>::s_divisions[
sizeof...(divisions)];
Factory object that constructs sub boxes from a given box with optional overlaps.
std::array< ABox, s_nSubBoxes > makeSubBoxes(const ABox &box, std::index_sequence< Is... >)
Make all subboxs with overlap of the given box.
static constexpr std::size_t s_divisions[sizeof...(divisions)]
Array of the number of divisions for each dimension.
LinearDivision(const typename ABox::Delta &overlaps=typename ABox::Delta())
Initialise the sub box factory with specific overlaps.
ABox makeSubBox(const ABox &box, std::size_t globalISubBox, std::index_sequence< Is... >)
Make the subbox with overlaps of the given box at global index.
std::array< ABox, s_nSubBoxes > operator()(const ABox &box)
Factory method to construct the subboxes with overlap from the given box.
static const std::size_t s_nSubBoxes
Number of sub boxes produced by this factory facility.
ABox::Delta m_overlaps
Custom overlaps of the bounds at each division for each dimension.
Abstract base class for different kinds of events.
Template class for compile time computation of products.