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