CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
KDTreeNodes< DATA, DIM > Struct Template Reference

#include <KDTreeLinkerAlgo.h>

Public Member Functions

void build (int sizeData)
 
void clear ()
 
bool empty () const
 
int getNextNode ()
 
constexpr bool isLeaf (int right) const
 
bool isLeafIndex (int index) const
 
constexpr KDTreeNodes ()
 
int size () const
 

Public Attributes

std::vector< DATA > data
 
std::array< std::vector< float >, DIMdims
 
int poolPos
 
int poolSize
 
std::vector< int > right
 

Detailed Description

template<typename DATA, unsigned DIM = 2>
struct KDTreeNodes< DATA, DIM >

Definition at line 50 of file KDTreeLinkerAlgo.h.

Constructor & Destructor Documentation

◆ KDTreeNodes()

template<typename DATA, unsigned DIM = 2>
constexpr KDTreeNodes< DATA, DIM >::KDTreeNodes ( )
inlineconstexpr

Definition at line 58 of file KDTreeLinkerAlgo.h.

58 : poolSize(-1), poolPos(-1) {}

Member Function Documentation

◆ build()

template<typename DATA, unsigned DIM = 2>
void KDTreeNodes< DATA, DIM >::build ( int  sizeData)
inline

Definition at line 78 of file KDTreeLinkerAlgo.h.

78  {
79  poolSize = sizeData * 2 - 1;
80  for (auto &dim : dims) {
81  dim.resize(poolSize);
82  }
83  right.resize(poolSize);
84  data.resize(poolSize);
85  };

Referenced by psClasses.BuildThread::run().

◆ clear()

template<typename DATA, unsigned DIM = 2>
void KDTreeNodes< DATA, DIM >::clear ( void  )
inline

Definition at line 63 of file KDTreeLinkerAlgo.h.

63  {
64  for (auto &dim : dims) {
65  dim.clear();
66  }
67  right.clear();
68  data.clear();
69  poolSize = -1;
70  poolPos = -1;
71  }

Referenced by BeautifulSoup.Tag::setString().

◆ empty()

template<typename DATA, unsigned DIM = 2>
bool KDTreeNodes< DATA, DIM >::empty ( ) const
inline

Definition at line 60 of file KDTreeLinkerAlgo.h.

60 { return poolPos == -1; }

◆ getNextNode()

template<typename DATA, unsigned DIM = 2>
int KDTreeNodes< DATA, DIM >::getNextNode ( )
inline

Definition at line 73 of file KDTreeLinkerAlgo.h.

73  {
74  ++poolPos;
75  return poolPos;
76  }

◆ isLeaf()

template<typename DATA, unsigned DIM = 2>
constexpr bool KDTreeNodes< DATA, DIM >::isLeaf ( int  right) const
inlineconstexpr

Definition at line 87 of file KDTreeLinkerAlgo.h.

87  {
88  // Valid values of right are always >= 2
89  // index 0 is the root, and 1 is the first left node
90  // Exploit index values 0 and 1 to mark which of dim1/dim2 is the
91  // current one in recSearch() at the depth of the leaf.
92  return right < 2;
93  }

Referenced by KDTreeNodes< reco::PFRecHit const *, 2 >::isLeafIndex().

◆ isLeafIndex()

template<typename DATA, unsigned DIM = 2>
bool KDTreeNodes< DATA, DIM >::isLeafIndex ( int  index) const
inline

Definition at line 95 of file KDTreeLinkerAlgo.h.

95 { return isLeaf(right[index]); }

◆ size()

template<typename DATA, unsigned DIM = 2>
int KDTreeNodes< DATA, DIM >::size ( void  ) const
inline

Definition at line 61 of file KDTreeLinkerAlgo.h.

61 { return poolPos + 1; }

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

Member Data Documentation

◆ data

template<typename DATA, unsigned DIM = 2>
std::vector<DATA> KDTreeNodes< DATA, DIM >::data

◆ dims

template<typename DATA, unsigned DIM = 2>
std::array<std::vector<float>, DIM> KDTreeNodes< DATA, DIM >::dims

◆ poolPos

template<typename DATA, unsigned DIM = 2>
int KDTreeNodes< DATA, DIM >::poolPos

◆ poolSize

template<typename DATA, unsigned DIM = 2>
int KDTreeNodes< DATA, DIM >::poolSize

◆ right

template<typename DATA, unsigned DIM = 2>
std::vector<int> KDTreeNodes< DATA, DIM >::right
KDTreeNodes::isLeaf
constexpr bool isLeaf(int right) const
Definition: KDTreeLinkerAlgo.h:87
KDTreeNodes::dims
std::array< std::vector< float >, DIM > dims
Definition: KDTreeLinkerAlgo.h:51
KDTreeNodes::right
std::vector< int > right
Definition: KDTreeLinkerAlgo.h:52
KDTreeNodes::poolSize
int poolSize
Definition: KDTreeLinkerAlgo.h:55
KDTreeNodes::data
std::vector< DATA > data
Definition: KDTreeLinkerAlgo.h:53
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
KDTreeNodes::poolPos
int poolPos
Definition: KDTreeLinkerAlgo.h:56