LArSoft
v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
|
Class that implements the KDTree partition of 2D space and a closest point search algorithm. More...
#include "PreProcessingAlgorithm.h"
Public Member Functions | |
KDTreeLinkerAlgo () | |
Default constructor. More... | |
~KDTreeLinkerAlgo () | |
Destructor calls clear. More... | |
void | build (std::vector< KDTreeNodeInfoT< DATA, DIM > > &eltList, const KDTreeBoxT< DIM > ®ion) |
Build the KD tree from the "eltList" in the space define by "region". More... | |
void | search (const KDTreeBoxT< DIM > &searchBox, std::vector< KDTreeNodeInfoT< DATA, DIM > > &resRecHitList) |
Search in the KDTree for all points that would be contained in the given searchbox The founded points are stored in resRecHitList. More... | |
void | findNearestNeighbour (const KDTreeNodeInfoT< DATA, DIM > &point, const KDTreeNodeInfoT< DATA, DIM > *&result, float &distance) |
findNearestNeighbour More... | |
bool | empty () |
Whether the tree is empty. More... | |
int | size () |
Return the number of nodes + leaves in the tree (nElements should be (size() +1) / 2) More... | |
void | clear () |
Clear all allocated structures. More... | |
Private Member Functions | |
KDTreeNodeT< DATA, DIM > * | getNextNode () |
Get the next node from the node pool. More... | |
int | medianSearch (int low, int high, int treeDepth) |
Fast median search with Wirth algorithm in eltList between low and high indexes. More... | |
KDTreeNodeT< DATA, DIM > * | recBuild (int low, int high, int depth, const KDTreeBoxT< DIM > ®ion) |
Recursive kdtree builder. Is called by build() More... | |
void | recSearch (const KDTreeNodeT< DATA, DIM > *current, const KDTreeBoxT< DIM > &trackBox) |
Recursive kdtree search. Is called by search() More... | |
void | recNearestNeighbour (unsigned depth, const KDTreeNodeT< DATA, DIM > *current, const KDTreeNodeInfoT< DATA, DIM > &point, const KDTreeNodeT< DATA, DIM > *&best_match, float &best_dist) |
Recursive nearest neighbour search. Is called by findNearestNeighbour() More... | |
void | addSubtree (const KDTreeNodeT< DATA, DIM > *current) |
Add all elements of an subtree to the closest elements. Used during the recSearch(). More... | |
float | dist2 (const KDTreeNodeInfoT< DATA, DIM > &a, const KDTreeNodeInfoT< DATA, DIM > &b) const |
dist2 More... | |
void | clearTree () |
Frees the KDTree. More... | |
Private Attributes | |
KDTreeNodeT< DATA, DIM > * | root_ |
The KDTree root. More... | |
KDTreeNodeT< DATA, DIM > * | nodePool_ |
Node pool allows us to do just 1 call to new for each tree building. More... | |
int | nodePoolSize_ |
The node pool size. More... | |
int | nodePoolPos_ |
The node pool position. More... | |
std::vector< KDTreeNodeInfoT< DATA, DIM > > * | closestNeighbour |
The closest neighbour. More... | |
std::vector< KDTreeNodeInfoT< DATA, DIM > > * | initialEltList |
The initial element list. More... | |
Class that implements the KDTree partition of 2D space and a closest point search algorithm.
Definition at line 16 of file PreProcessingAlgorithm.h.
|
inline |
Default constructor.
Definition at line 162 of file KDTreeLinkerAlgoT.h.
|
inline |
Destructor calls clear.
Definition at line 175 of file KDTreeLinkerAlgoT.h.
References lar_content::KDTreeLinkerAlgo< DATA, DIM >::clear().
|
inlineprivate |
Add all elements of an subtree to the closest elements. Used during the recSearch().
current |
Definition at line 418 of file KDTreeLinkerAlgoT.h.
References lar_content::KDTreeLinkerAlgo< DATA, DIM >::closestNeighbour, lar_content::KDTreeNodeT< DATA, DIM >::info, lar_content::KDTreeNodeT< DATA, DIM >::left, and lar_content::KDTreeNodeT< DATA, DIM >::right.
Referenced by lar_content::KDTreeLinkerAlgo< DATA, DIM >::recSearch().
|
inline |
Build the KD tree from the "eltList" in the space define by "region".
eltList | |
region |
Definition at line 183 of file KDTreeLinkerAlgoT.h.
References lar_content::KDTreeLinkerAlgo< DATA, DIM >::initialEltList, lar_content::KDTreeLinkerAlgo< DATA, DIM >::nodePool_, lar_content::KDTreeLinkerAlgo< DATA, DIM >::nodePoolSize_, lar_content::KDTreeLinkerAlgo< DATA, DIM >::recBuild(), and lar_content::KDTreeLinkerAlgo< DATA, DIM >::root_.
Referenced by lar_content::EventSlicingTool::AssignRemainingHitsToSlices(), lar_content::IsolatedClusterMopUpAlgorithm::GetCaloHitToClusterMap(), lar_content::PreProcessingAlgorithm::GetFilteredCaloHitList(), lar_content::TransverseAssociationAlgorithm::GetNearbyClusterMap(), lar_content::VertexSelectionBaseAlgorithm::InitializeKDTrees(), lar_content::DeltaRayMatchingAlgorithm::InitializeNearbyClusterMap(), lar_content::SvmVertexSelectionAlgorithm::PopulateKdTree(), and lar_content::CrossedTrackSplittingAlgorithm::PreparationStep().
|
inline |
Clear all allocated structures.
Definition at line 483 of file KDTreeLinkerAlgoT.h.
References lar_content::KDTreeLinkerAlgo< DATA, DIM >::clearTree(), and lar_content::KDTreeLinkerAlgo< DATA, DIM >::root_.
Referenced by lar_content::KDTreeLinkerAlgo< DATA, DIM >::~KDTreeLinkerAlgo().
|
inlineprivate |
Frees the KDTree.
Definition at line 455 of file KDTreeLinkerAlgoT.h.
References lar_content::KDTreeLinkerAlgo< DATA, DIM >::nodePool_, lar_content::KDTreeLinkerAlgo< DATA, DIM >::nodePoolPos_, lar_content::KDTreeLinkerAlgo< DATA, DIM >::nodePoolSize_, and lar_content::KDTreeLinkerAlgo< DATA, DIM >::root_.
Referenced by lar_content::KDTreeLinkerAlgo< DATA, DIM >::clear().
|
inlineprivate |
dist2
a | |
b |
Definition at line 439 of file KDTreeLinkerAlgoT.h.
References d, and lar_content::KDTreeNodeInfoT< DATA, DIM >::dims.
Referenced by lar_content::KDTreeLinkerAlgo< DATA, DIM >::recNearestNeighbour().
|
inline |
Whether the tree is empty.
Definition at line 467 of file KDTreeLinkerAlgoT.h.
References lar_content::KDTreeLinkerAlgo< DATA, DIM >::nodePoolPos_.
Referenced by lar_content::VertexSelectionBaseAlgorithm::FilterVertexList(), and lar_content::VertexSelectionBaseAlgorithm::InitializeKDTrees().
|
inline |
findNearestNeighbour
point | |
result | |
distance |
Definition at line 331 of file KDTreeLinkerAlgoT.h.
References lar_content::KDTreeNodeT< DATA, DIM >::info, max, lar_content::KDTreeLinkerAlgo< DATA, DIM >::recNearestNeighbour(), and lar_content::KDTreeLinkerAlgo< DATA, DIM >::root_.
Referenced by lar_content::IsolatedClusterMopUpAlgorithm::GetCaloHitToClusterMap(), and lar_content::EventSlicingTool::MatchClusterToSlice().
|
inlineprivate |
Get the next node from the node pool.
Definition at line 492 of file KDTreeLinkerAlgoT.h.
References lar_content::KDTreeLinkerAlgo< DATA, DIM >::nodePool_, and lar_content::KDTreeLinkerAlgo< DATA, DIM >::nodePoolPos_.
Referenced by lar_content::KDTreeLinkerAlgo< DATA, DIM >::recBuild().
|
inlineprivate |
Fast median search with Wirth algorithm in eltList between low and high indexes.
low | |
high | |
treeDepth |
Definition at line 202 of file KDTreeLinkerAlgoT.h.
References lar_content::KDTreeNodeInfoT< DATA, DIM >::dims, and lar_content::KDTreeLinkerAlgo< DATA, DIM >::initialEltList.
Referenced by lar_content::KDTreeLinkerAlgo< DATA, DIM >::recBuild().
|
inlineprivate |
Recursive kdtree builder. Is called by build()
low | |
high | |
depth | |
region |
Definition at line 506 of file KDTreeLinkerAlgoT.h.
References lar_content::KDTreeBoxT< DIM >::dimmax, lar_content::KDTreeBoxT< DIM >::dimmin, lar_content::KDTreeLinkerAlgo< DATA, DIM >::getNextNode(), lar_content::KDTreeNodeT< DATA, DIM >::info, lar_content::KDTreeLinkerAlgo< DATA, DIM >::initialEltList, lar_content::KDTreeNodeT< DATA, DIM >::left, lar_content::KDTreeLinkerAlgo< DATA, DIM >::medianSearch(), lar_content::KDTreeNodeT< DATA, DIM >::right, and lar_content::KDTreeNodeT< DATA, DIM >::setAttributs().
Referenced by lar_content::KDTreeLinkerAlgo< DATA, DIM >::build().
|
inlineprivate |
Recursive nearest neighbour search. Is called by findNearestNeighbour()
depth | |
current | |
point | |
best_match | |
best_dist |
Definition at line 356 of file KDTreeLinkerAlgoT.h.
References lar_content::KDTreeNodeInfoT< DATA, DIM >::dims, lar_content::KDTreeLinkerAlgo< DATA, DIM >::dist2(), f, lar_content::KDTreeNodeT< DATA, DIM >::info, lar_content::KDTreeNodeT< DATA, DIM >::left, and lar_content::KDTreeNodeT< DATA, DIM >::right.
Referenced by lar_content::KDTreeLinkerAlgo< DATA, DIM >::findNearestNeighbour().
|
inlineprivate |
Recursive kdtree search. Is called by search()
current | |
trackBox |
Definition at line 259 of file KDTreeLinkerAlgoT.h.
References lar_content::KDTreeLinkerAlgo< DATA, DIM >::addSubtree(), lar_content::KDTreeLinkerAlgo< DATA, DIM >::closestNeighbour, lar_content::KDTreeBoxT< DIM >::dimmax, lar_content::KDTreeBoxT< DIM >::dimmin, lar_content::KDTreeNodeT< DATA, DIM >::info, lar_content::KDTreeNodeT< DATA, DIM >::left, and lar_content::KDTreeNodeT< DATA, DIM >::right.
Referenced by lar_content::KDTreeLinkerAlgo< DATA, DIM >::search().
|
inline |
Search in the KDTree for all points that would be contained in the given searchbox The founded points are stored in resRecHitList.
searchBox | |
resRecHitList |
Definition at line 246 of file KDTreeLinkerAlgoT.h.
References lar_content::KDTreeLinkerAlgo< DATA, DIM >::closestNeighbour, lar_content::KDTreeLinkerAlgo< DATA, DIM >::recSearch(), and lar_content::KDTreeLinkerAlgo< DATA, DIM >::root_.
Referenced by lar_content::RPhiFeatureTool::FillKernelEstimate(), lar_content::PreProcessingAlgorithm::GetFilteredCaloHitList(), lar_content::TransverseAssociationAlgorithm::GetNearbyClusterMap(), lar_content::DeltaRayMatchingAlgorithm::InitializeNearbyClusterMap(), lar_content::VertexSelectionBaseAlgorithm::IsVertexOnHit(), lar_content::SvmVertexSelectionAlgorithm::PopulateKdTree(), and lar_content::CrossedTrackSplittingAlgorithm::PreparationStep().
|
inline |
Return the number of nodes + leaves in the tree (nElements should be (size() +1) / 2)
Definition at line 475 of file KDTreeLinkerAlgoT.h.
References lar_content::KDTreeLinkerAlgo< DATA, DIM >::nodePoolPos_.
|
private |
The closest neighbour.
Definition at line 154 of file KDTreeLinkerAlgoT.h.
Referenced by lar_content::KDTreeLinkerAlgo< DATA, DIM >::addSubtree(), lar_content::KDTreeLinkerAlgo< DATA, DIM >::recSearch(), and lar_content::KDTreeLinkerAlgo< DATA, DIM >::search().
|
private |
The initial element list.
Definition at line 155 of file KDTreeLinkerAlgoT.h.
Referenced by lar_content::KDTreeLinkerAlgo< DATA, DIM >::build(), lar_content::KDTreeLinkerAlgo< DATA, DIM >::medianSearch(), and lar_content::KDTreeLinkerAlgo< DATA, DIM >::recBuild().
|
private |
Node pool allows us to do just 1 call to new for each tree building.
Definition at line 150 of file KDTreeLinkerAlgoT.h.
Referenced by lar_content::KDTreeLinkerAlgo< DATA, DIM >::build(), lar_content::KDTreeLinkerAlgo< DATA, DIM >::clearTree(), and lar_content::KDTreeLinkerAlgo< DATA, DIM >::getNextNode().
|
private |
The node pool position.
Definition at line 152 of file KDTreeLinkerAlgoT.h.
Referenced by lar_content::KDTreeLinkerAlgo< DATA, DIM >::clearTree(), lar_content::KDTreeLinkerAlgo< DATA, DIM >::empty(), lar_content::KDTreeLinkerAlgo< DATA, DIM >::getNextNode(), and lar_content::KDTreeLinkerAlgo< DATA, DIM >::size().
|
private |
The node pool size.
Definition at line 151 of file KDTreeLinkerAlgoT.h.
Referenced by lar_content::KDTreeLinkerAlgo< DATA, DIM >::build(), and lar_content::KDTreeLinkerAlgo< DATA, DIM >::clearTree().
|
private |
The KDTree root.
Definition at line 149 of file KDTreeLinkerAlgoT.h.
Referenced by lar_content::KDTreeLinkerAlgo< DATA, DIM >::build(), lar_content::KDTreeLinkerAlgo< DATA, DIM >::clear(), lar_content::KDTreeLinkerAlgo< DATA, DIM >::clearTree(), lar_content::KDTreeLinkerAlgo< DATA, DIM >::findNearestNeighbour(), and lar_content::KDTreeLinkerAlgo< DATA, DIM >::search().