 |
Belle II Software
release-05-02-19
|
13 #include <framework/logging/Logger.h>
22 namespace TrackFindingCDC {
30 template<
typename AX,
typename AY,
class AItem>
35 using This = QuadTreeNode<AX, AY, AItem>;
38 using XSpan = std::array<AX, 2>;
41 using YSpan = std::array<AY, 2>;
63 xSpan[0] + (xSpan[1] - xSpan[0]) / 2,
64 xSpan[1] - (xSpan[1] - xSpan[0]) / 2,
68 ySpan[0] + (ySpan[1] - ySpan[0]) / 2,
69 ySpan[1] - (ySpan[1] - ySpan[0]) / 2,
73 ,
m_parent(level > 0 ? parent :
nullptr)
76 B2ASSERT(
"QuadTree datastructure only supports levels < 255", level < 255);
constexpr int getXNbins() const
Get number of bins in "Theta" direction.
std::array< AY, 2 > YSpan
Type for a span in the Y direction that is covered by the tree.
AX getXMax() const
Get maximal "Theta" value of the node.
std::vector< AItem * > m_items
Vector of items which belongs to the node.
AX getXMin() const
Get minimal "Theta" value of the node.
AY getYBinWidth(int iBin)
Getter for the width of the iBin bin in "r" direction.
XBinBounds m_xBinBounds
bins range on theta
This * m_parent
Pointer to the parent node.
QuadTreeNode< AX, AY, AItem > This
Type of this class.
bool checkFilled() const
Check whether node has been processed, i.e.
int m_level
Level of node in the tree.
AY getYUpperBound(int iBin) const
Get upper "r" value of given bin.
void insertItem(AItem *item)
Insert item into node.
bool m_filled
Is the node has been filled with items.
int getNItems() const
Check if the node passes threshold on number of hits.
std::array< AY, 4 > YBinBounds
Type to store the minimum and maximum of the two bins in Y direction.
void setFilled()
Set status of node to "filled" (children nodes has been filled)
std::vector< This > Children
Type of the child node structure for this node.
Abstract base class for different kinds of events.
AX getXLowerBound(int iBin) const
Get lower "Theta" value of given bin.
AX getXUpperBound(int iBin) const
Get upper "Theta" value of given bin.
AY getYMin() const
Get minimal "r" value of the node.
Children & getChildren()
Returns the children structure of this node.
std::array< AX, 2 > XSpan
Type for a span in the X direction that is covered by the tree.
Class which holds quadtree structure.
std::vector< AItem * > & getItems()
Get items from node.
constexpr int getYNbins() const
Get number of bins in "r" direction.
void reserveItems(int nItems)
Reserve memory for holding items.
YBinBounds m_yBinBounds
bins range on r
std::vector< This > m_children
Pointers to the children nodes.
int getLevel() const
Returns level of the node in tree (i.e., how much ancestors the node has)
void clearChildren()
Clear items which the node holds and destroy all children below this node.
AY getYLowerBound(int iBin) const
Get lower "r" value of given bin.
This * getParent() const
Return pointer to the parent of the node.
std::array< AX, 4 > XBinBounds
Type to store the minimum and maximum of the two bins in X direction.
void clearItems()
Clear items which the node holds.
AX getXBinWidth(int iBin)
Getter for the width of the iBin bin in "Theta" direction.
QuadTreeNode(XSpan xSpan, YSpan ySpan, int level, This *parent)
Constructor setting up the potential division points.
AY getYMax() const
Get maximal "r" value of the node.