CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 >
, DIM
dims
 
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

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

Definition at line 58 of file KDTreeLinkerAlgo.h.

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

Member Function Documentation

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

Definition at line 78 of file KDTreeLinkerAlgo.h.

Referenced by psClasses.BuildThread::run().

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  };
std::array< std::vector< float >, DIM > dims
std::vector< DATA > data
std::vector< int > right
template<typename DATA, unsigned DIM = 2>
void KDTreeNodes< DATA, DIM >::clear ( void  )
inline

Definition at line 63 of file KDTreeLinkerAlgo.h.

Referenced by BeautifulSoup.Tag::setString().

63  {
64  for (auto &dim : dims) {
65  dim.clear();
66  }
67  right.clear();
68  data.clear();
69  poolSize = -1;
70  poolPos = -1;
71  }
std::array< std::vector< float >, DIM > dims
std::vector< DATA > data
std::vector< int > right
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; }
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  }
template<typename DATA, unsigned DIM = 2>
constexpr bool KDTreeNodes< DATA, DIM >::isLeaf ( int  right) const
inline

Definition at line 87 of file KDTreeLinkerAlgo.h.

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

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  }
std::vector< int > right
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]); }
constexpr bool isLeaf(int right) const
std::vector< int > right
template<typename DATA, unsigned DIM = 2>
int KDTreeNodes< DATA, DIM >::size ( void  ) const
inline

Definition at line 61 of file KDTreeLinkerAlgo.h.

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

61 { return poolPos + 1; }

Member Data Documentation

template<typename DATA, unsigned DIM = 2>
std::vector<DATA> KDTreeNodes< DATA, DIM >::data
template<typename DATA, unsigned DIM = 2>
std::array<std::vector<float>, DIM> KDTreeNodes< DATA, DIM >::dims
template<typename DATA, unsigned DIM = 2>
int KDTreeNodes< DATA, DIM >::poolPos
template<typename DATA, unsigned DIM = 2>
int KDTreeNodes< DATA, DIM >::poolSize
template<typename DATA, unsigned DIM = 2>
std::vector<int> KDTreeNodes< DATA, DIM >::right