10#include <tracking/trackFindingCDC/utilities/Product.h>
12#include <framework/utilities/Utils.h>
23 namespace TrackFindingCDC {
45 template<
class ABox, std::size_t... divisions>
54 static constexpr std::size_t
s_divisions[
sizeof...(divisions)] = {divisions...};
59 int sectorLevelSkip = 0)
67 template <
class ANode>
70 const ABox& box = node;
72 std::vector<ABox> result =
makeSubBoxes(box, std::make_index_sequence<s_nSubBoxes>());
75 std::vector<ABox> sectoredBoxes;
77 for (
const ABox& boxToDivide : result) {
78 for (
const ABox& dividedBox :
makeSubBoxes(boxToDivide, std::make_index_sequence<s_nSubBoxes>())) {
79 sectoredBoxes.push_back(dividedBox);
82 result = std::move(sectoredBoxes);
87 return makeSubBoxes(box, std::make_index_sequence<s_nSubBoxes>());
91 template<std::size_t... Is>
95 return {{
makeSubBox(box, Is, std::make_index_sequence<
sizeof...(divisions)>())... }};
99 template <std::size_t... Is>
100 ABox
makeSubBox(
const ABox& box, std::size_t globalISubBox, std::index_sequence<Is...> )
102 std::array<std::size_t,
sizeof...(divisions)> indices;
103 for (
size_t c_Index = 0 ; c_Index <
sizeof...(divisions); ++c_Index) {
104 indices[c_Index] = globalISubBox %
s_divisions[c_Index];
107 assert(globalISubBox == 0);
108 return ABox(box.template getDivisionBoundsWithOverlap<Is>(std::get<Is>(
m_overlaps),
122 template<
class ABox, std::size_t... divisions>
Factory object that constructs sub boxes from a given box with optional overlaps.
std::vector< ABox > operator()(const ANode &node)
Factory method to construct the subboxes with overlap from the given box.
int m_sectorLevelSkip
Number of levels to be skipped to form the finer binning at level 1.
static constexpr std::size_t s_divisions[sizeof...(divisions)]
Array of the number of divisions for each dimension.
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::vector< ABox > makeSubBoxes(const ABox &box, std::index_sequence< Is... >)
Make all subboxs with overlap of 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.
SectoredLinearDivision(const typename ABox::Delta &overlaps=typename ABox::Delta(), int sectorLevelSkip=0)
Initialise the sub box factory with specific overlaps.
#define branch_unlikely(x)
A macro to tell the compiler that the argument x will be very likely be false.
Abstract base class for different kinds of events.
Template class for compile time computation of products.