Belle II Software development
SectoredLinearDivision< ABox, divisions > Class Template Reference

Factory object that constructs sub boxes from a given box with optional overlaps. More...

#include <SectoredLinearDivision.h>

Public Member Functions

 SectoredLinearDivision (const typename ABox::Delta &overlaps=typename ABox::Delta(), int sectorLevelSkip=0)
 Initialise the sub box factory with specific overlaps.
 
template<class ANode >
std::vector< ABox > operator() (const ANode &node)
 Factory method to construct the subboxes with overlap from the given box.
 
template<std::size_t... Is>
std::vector< ABox > makeSubBoxes (const ABox &box, std::index_sequence< Is... >)
 Make all subboxs with overlap of the given box.
 
template<std::size_t... Is>
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.
 

Static Public Attributes

static const std::size_t s_nSubBoxes = Product<divisions...>::value
 Number of sub boxes produced by this factory facility.
 

Private Attributes

ABox::Delta m_overlaps
 Custom overlaps of the bounds at each division for each dimension.
 
int m_sectorLevelSkip
 Number of levels to be skipped to form the finer binning at level 1.
 

Static Private Attributes

static constexpr std::size_t s_divisions [sizeof...(divisions)] = {divisions...}
 Array of the number of divisions for each dimension.
 

Detailed Description

template<class ABox, std::size_t... divisions>
class Belle2::TrackFindingCDC::SectoredLinearDivision< ABox, divisions >

Factory object that constructs sub boxes from a given box with optional overlaps.

In contrast to the bare LinearDivsion this division strategy may introduce a finer division on the first level leading to finer 'sectors' to be searched from the start. It effectively skips a number of levels a yields the binning further down the usual division level as level 1.

In this way some repeated computations in the first levels are abolished and a better overview which part of the hough space is more densely populated is acquired. The latter means that a better search space prioritisation can be expected compared to deciding the priority from coarse first level nodes.

Note since the tree using this division strategy is generally unaware of the fast forward the division granularity and the level number have a different relation. Essentially the sectorLevelSkip parameter set here has to be added to the level number to know at which granularity one currently is in the tree. Alternatively the search depth can be reduced by sectorLevelSkip, which is what we do in the application.

Definition at line 46 of file SectoredLinearDivision.h.

Constructor & Destructor Documentation

◆ SectoredLinearDivision()

SectoredLinearDivision ( const typename ABox::Delta &  overlaps = typename ABox::Delta(),
int  sectorLevelSkip = 0 
)
inlineexplicit

Initialise the sub box factory with specific overlaps.

Definition at line 58 of file SectoredLinearDivision.h.

60 : m_overlaps(overlaps)
61 , m_sectorLevelSkip(sectorLevelSkip)
62 {
63 }
int m_sectorLevelSkip
Number of levels to be skipped to form the finer binning at level 1.
ABox::Delta m_overlaps
Custom overlaps of the bounds at each division for each dimension.

Member Function Documentation

◆ makeSubBox()

ABox makeSubBox ( const ABox &  box,
std::size_t  globalISubBox,
std::index_sequence< Is... >   
)
inline

Make the subbox with overlaps of the given box at global index.

Definition at line 100 of file SectoredLinearDivision.h.

101 {
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];
105 globalISubBox /= s_divisions[c_Index];
106 }
107 assert(globalISubBox == 0);
108 return ABox(box.template getDivisionBoundsWithOverlap<Is>(std::get<Is>(m_overlaps),
109 s_divisions[Is],
110 indices[Is]) ...);
111 }
static constexpr std::size_t s_divisions[sizeof...(divisions)]
Array of the number of divisions for each dimension.

◆ makeSubBoxes()

std::vector< ABox > makeSubBoxes ( const ABox &  box,
std::index_sequence< Is... >   
)
inline

Make all subboxs with overlap of the given box.

Definition at line 93 of file SectoredLinearDivision.h.

94 {
95 return {{ makeSubBox(box, Is, std::make_index_sequence<sizeof...(divisions)>())... }};
96 }
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.

◆ operator()()

std::vector< ABox > operator() ( const ANode &  node)
inline

Factory method to construct the subboxes with overlap from the given box.

Definition at line 68 of file SectoredLinearDivision.h.

69 {
70 const ABox& box = node;
71 if (branch_unlikely(node.getLevel() == 0)) {
72 std::vector<ABox> result = makeSubBoxes(box, std::make_index_sequence<s_nSubBoxes>());
73 // Apply further divisions sectorLevelSkip times and return all boxes.
74 for (int iSkipped = 0; iSkipped < m_sectorLevelSkip; ++iSkipped) {
75 std::vector<ABox> sectoredBoxes;
76 sectoredBoxes.reserve(result.size() * s_nSubBoxes);
77 for (const ABox& boxToDivide : result) {
78 for (const ABox& dividedBox : makeSubBoxes(boxToDivide, std::make_index_sequence<s_nSubBoxes>())) {
79 sectoredBoxes.push_back(dividedBox);
80 }
81 }
82 result = std::move(sectoredBoxes);
83 }
84
85 return result;
86 }
87 return makeSubBoxes(box, std::make_index_sequence<s_nSubBoxes>());
88 }
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.
#define branch_unlikely(x)
A macro to tell the compiler that the argument x will be very likely be false.
Definition: Utils.h:134

Member Data Documentation

◆ m_overlaps

ABox::Delta m_overlaps
private

Custom overlaps of the bounds at each division for each dimension.

Definition at line 115 of file SectoredLinearDivision.h.

◆ m_sectorLevelSkip

int m_sectorLevelSkip
private

Number of levels to be skipped to form the finer binning at level 1.

Definition at line 118 of file SectoredLinearDivision.h.

◆ s_divisions

constexpr std::size_t s_divisions = {divisions...}
staticconstexprprivate

Array of the number of divisions for each dimension.

Definition at line 54 of file SectoredLinearDivision.h.

◆ s_nSubBoxes

const std::size_t s_nSubBoxes = Product<divisions...>::value
static

Number of sub boxes produced by this factory facility.

Definition at line 50 of file SectoredLinearDivision.h.


The documentation for this class was generated from the following file: