Belle II Software development
|
This abstract class serves as a base class for all implementations of track processors. More...
#include <QuadTreeProcessor.h>
Public Types | |
using | Item = QuadTreeItem< AData > |
The QuadTree will only see items of this type. | |
using | QuadTree = QuadTreeNode< AX, AY, Item > |
The used QuadTree. | |
using | XSpan = typename QuadTree::XSpan |
This pair describes the span in X for a node. | |
using | YSpan = typename QuadTree::YSpan |
This pair describes the span in Y for a node. | |
using | XYSpans = std::pair< XSpan, YSpan > |
This pair of spans describes the span of a node. | |
using | QuadTreeChildren = typename QuadTree::Children |
Alias for the QuadTree Children. | |
using | CandidateReceiver = std::function< void(const std::vector< AData * > &, QuadTree *)> |
This lambda function can be used for postprocessing. | |
Public Member Functions | |
QuadTreeProcessor (int lastLevel, int seedLevel, const XYSpans &xySpans, bool debugOutput=false) | |
Constructor is very simple. | |
virtual | ~QuadTreeProcessor () |
Destructor deletes the quad tree. | |
void | clear () |
Delete all the QuadTreeItems in the tree and clear the tree. | |
void | seed (const std::vector< AData * > &datas) |
Fill in the items in the given vector. | |
std::vector< AData * > | getAssignedItems () |
Get items that have been assigned to the seed level The returned elements are unique even if items are assigned multiple times. | |
void | fill (const CandidateReceiver &candidateReceiver, int nHitsThreshold) |
Start filling the already created tree. | |
void | fill (const CandidateReceiver &candidateReceiver, int nHitsThreshold, float yLimit) |
Fill vector of QuadTree instances with hits. | |
virtual void | afterFillDebugHook (QuadTreeChildren &children) |
Override that function if you want to receive debug output whenever the children of a node are filled the first time Maybe you want to make some nice plots or statistics. | |
const std::map< std::pair< AX, AY >, std::vector< Item * > > & | getDebugInformation () const |
Return the debug information if collected. | |
Protected Member Functions | |
virtual XYSpans | createChild (QuadTree *node, int iX, int iY) const |
Implement that function if you want to provide a new processor. | |
virtual bool | isInNode (QuadTree *node, AData *item) const =0 |
Implement that function if you want to provide a new processor. | |
virtual bool | isLeaf (QuadTree *node) const |
Function which checks if given node is leaf Implemented as virtual to keep possibility of changing lastLevel values depending on region is phase-space (i.e. | |
int | getLastLevel () const |
Return the parameter last level. | |
Protected Attributes | |
std::unique_ptr< QuadTree > | m_quadTree |
The quad tree we work with. | |
std::deque< Item > | m_items |
Storage space for the items that are referenced by the quad tree nodes. | |
std::vector< QuadTree * > | m_seededTrees |
Vector of QuadTrees QuadTree instances (which are filled in the vector) cover the whole Legendre phase-space; each instance is processes independently. | |
Private Member Functions | |
void | fillGivenTree (QuadTree *node, const CandidateReceiver &candidateReceiver, int nItemsThreshold, AY yLimit) |
Internal function to do the real quad tree search: fill the nodes, check which of the n*m bins we need to process further and go one level deeper. | |
void | createChildren (QuadTree *node, QuadTreeChildren &m_children) const |
Creates the sub node of a given node. | |
void | fillChildren (QuadTree *node, const std::vector< Item * > &items) |
This function is called by fillGivenTree and fills the items into the corresponding children. | |
void | callResultFunction (QuadTree *node, const CandidateReceiver &candidateReceiver) const |
When a node is accepted as a result, we extract a vector with the items (back transformed to AData*) and pass it together with the result node to the candidate receiver function. | |
Private Attributes | |
int | m_lastLevel |
The last level to be filled. | |
int | m_seedLevel |
The first level to be filled, effectively skip forward to this higher granularity level. | |
bool | m_debugOutput |
A flag to control the creation of the debug output. | |
std::map< std::pair< AX, AY >, std::vector< Item * > > | m_debugOutputMap |
The calculated debug map. | |
This abstract class serves as a base class for all implementations of track processors.
It provides some functions to create, fill, clear and postprocess a quad tree. If you want to use your own class as a quad tree item, you have to overload this processor. You have provide only the two functions isInNode and createChild.
Definition at line 37 of file QuadTreeProcessor.h.
using CandidateReceiver = std::function<void(const std::vector<AData*>&, QuadTree*)> |
This lambda function can be used for postprocessing.
Definition at line 59 of file QuadTreeProcessor.h.
using Item = QuadTreeItem<AData> |
The QuadTree will only see items of this type.
Definition at line 41 of file QuadTreeProcessor.h.
using QuadTree = QuadTreeNode<AX, AY, Item> |
The used QuadTree.
Definition at line 44 of file QuadTreeProcessor.h.
using QuadTreeChildren = typename QuadTree::Children |
Alias for the QuadTree Children.
Definition at line 56 of file QuadTreeProcessor.h.
using XSpan = typename QuadTree::XSpan |
This pair describes the span in X for a node.
Definition at line 47 of file QuadTreeProcessor.h.
This pair of spans describes the span of a node.
Definition at line 53 of file QuadTreeProcessor.h.
using YSpan = typename QuadTree::YSpan |
This pair describes the span in Y for a node.
Definition at line 50 of file QuadTreeProcessor.h.
|
inline |
Constructor is very simple.
The QuadTree has to be constructed elsewhere.
lastLevel | describing the last search level for the quad tree creation |
seedLevel | first level to be filled, effectively skip forward to this higher granularity level |
xySpans | pair of spans describing the span of a node |
debugOutput | enable debug output |
Definition at line 69 of file QuadTreeProcessor.h.
|
inlinevirtual |
Destructor deletes the quad tree.
Definition at line 84 of file QuadTreeProcessor.h.
|
inlinevirtual |
Override that function if you want to receive debug output whenever the children of a node are filled the first time Maybe you want to make some nice plots or statistics.
Definition at line 356 of file QuadTreeProcessor.h.
|
inlineprivate |
When a node is accepted as a result, we extract a vector with the items (back transformed to AData*) and pass it together with the result node to the candidate receiver function.
Definition at line 288 of file QuadTreeProcessor.h.
|
inline |
Delete all the QuadTreeItems in the tree and clear the tree.
Definition at line 92 of file QuadTreeProcessor.h.
Implement that function if you want to provide a new processor.
It decides which node-spans the n * m children of the node should have. It is called when creating the nodes. The two indices iX and iY tell you where the new node will be created (as node.children[iX][iY]). You can check some information on the level or the x- or y-values by using the methods implemented for node.
Definition at line 311 of file QuadTreeProcessor.h.
|
inlineprivate |
Creates the sub node of a given node.
This function is called by fillGivenTree. To calculate the spans of the children nodes the user-defined function createChiildWithParent is used.
Definition at line 249 of file QuadTreeProcessor.h.
|
inline |
Start filling the already created tree.
candidateReceiver | the lambda function to call after a node was selected |
nHitsThreshold | the threshold on the number of items |
Definition at line 168 of file QuadTreeProcessor.h.
|
inline |
Fill vector of QuadTree instances with hits.
candidateReceiver | the lambda function to call after a node was selected |
nHitsThreshold | the threshold on the number of items |
yLimit | the threshold in the rho (curvature) variable |
Definition at line 179 of file QuadTreeProcessor.h.
This function is called by fillGivenTree and fills the items into the corresponding children.
For this the user-defined method isInNode is called.
Definition at line 265 of file QuadTreeProcessor.h.
|
inlineprivate |
Internal function to do the real quad tree search: fill the nodes, check which of the n*m bins we need to process further and go one level deeper.
Definition at line 197 of file QuadTreeProcessor.h.
|
inline |
Get items that have been assigned to the seed level The returned elements are unique even if items are assigned multiple times.
Definition at line 149 of file QuadTreeProcessor.h.
|
inline |
Return the debug information if collected.
Definition at line 368 of file QuadTreeProcessor.h.
|
inlineprotected |
Return the parameter last level.
Definition at line 346 of file QuadTreeProcessor.h.
|
protectedpure virtual |
Implement that function if you want to provide a new processor.
It is called when filling the quad tree after creation. For every item in a node and every child node this function gets called and should decide, if the item should go into this child node or not.
node | child node |
item | item to be filled into the child node or not |
|
inlineprotectedvirtual |
Function which checks if given node is leaf Implemented as virtual to keep possibility of changing lastLevel values depending on region is phase-space (i.e.
setting lastLevel as a function of Y-variable)
Definition at line 334 of file QuadTreeProcessor.h.
|
inline |
Fill in the items in the given vector.
They are transformed to QuadTreeItems internally.
Definition at line 103 of file QuadTreeProcessor.h.
|
private |
A flag to control the creation of the debug output.
Definition at line 395 of file QuadTreeProcessor.h.
|
private |
The calculated debug map.
Definition at line 398 of file QuadTreeProcessor.h.
|
protected |
Storage space for the items that are referenced by the quad tree nodes.
Definition at line 378 of file QuadTreeProcessor.h.
|
private |
The last level to be filled.
Definition at line 389 of file QuadTreeProcessor.h.
|
protected |
The quad tree we work with.
Definition at line 375 of file QuadTreeProcessor.h.
|
protected |
Vector of QuadTrees QuadTree instances (which are filled in the vector) cover the whole Legendre phase-space; each instance is processes independently.
Definition at line 385 of file QuadTreeProcessor.h.
|
private |
The first level to be filled, effectively skip forward to this higher granularity level.
Definition at line 392 of file QuadTreeProcessor.h.