CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Attributes
SeedingTree< DATA > Class Template Reference

#include <SeedingTree.h>

Public Types

typedef std::unordered_set< DATA, typename DATA::hashfct, typename DATA::eqfct > SingleSet
 

Public Member Functions

const SeedingNode< DATA > * getRoot (unsigned int i) const
 
const SingleSetgetSingleSet () const
 
bool insert (const std::vector< DATA > &dataList)
 
unsigned int numberOfNodes () const
 
unsigned int numberOfRoots () const
 
void print () const
 
void printOrdered () const
 
void printRecursive () const
 
void sort ()
 
 ~SeedingTree ()
 

Protected Attributes

std::vector< SeedingNode< DATA > * > _allNodes
 
std::vector< SeedingNode< DATA > * > _roots
 
SingleSet _singleSet
 

Detailed Description

template<class DATA>
class SeedingTree< DATA >

Definition at line 114 of file SeedingTree.h.

Member Typedef Documentation

◆ SingleSet

template<class DATA>
typedef std::unordered_set<DATA, typename DATA::hashfct, typename DATA::eqfct> SeedingTree< DATA >::SingleSet

Definition at line 116 of file SeedingTree.h.

Constructor & Destructor Documentation

◆ ~SeedingTree()

template<class DATA>
SeedingTree< DATA >::~SeedingTree ( )
inline

Definition at line 186 of file SeedingTree.h.

186  {
187  for (unsigned int iroot = 0; iroot < _roots.size(); ++iroot) {
188  delete _roots[iroot];
189  }
190  _roots.clear();
191  }
std::vector< SeedingNode< DATA > * > _roots
Definition: SeedingTree.h:119

Member Function Documentation

◆ getRoot()

template<class DATA>
const SeedingNode<DATA>* SeedingTree< DATA >::getRoot ( unsigned int  i) const
inline

Definition at line 159 of file SeedingTree.h.

Referenced by SeedFinder::iterateHits().

159  {
160  if (i < _roots.size()) {
161  return _roots[i];
162  }
163  return nullptr;
164  }
std::vector< SeedingNode< DATA > * > _roots
Definition: SeedingTree.h:119

◆ getSingleSet()

template<class DATA>
const SingleSet& SeedingTree< DATA >::getSingleSet ( ) const
inline

Definition at line 144 of file SeedingTree.h.

Referenced by SeedFinder::iterateHits().

144 { return _singleSet; }
SingleSet _singleSet
Definition: SeedingTree.h:122

◆ insert()

template<class DATA>
bool SeedingTree< DATA >::insert ( const std::vector< DATA > &  dataList)
inline

Definition at line 126 of file SeedingTree.h.

Referenced by SequenceTypes.Schedule::_replaceIfHeldDirectly(), and TrajectorySeedProducer::TrajectorySeedProducer().

126  {
127  for (unsigned int i = 0; i < dataList.size(); ++i) {
128  _singleSet.insert(dataList[i]);
129  }
130 
131  if (dataList.empty()) {
132  return false;
133  }
134  for (unsigned int iroot = 0; iroot < _roots.size(); ++iroot) {
135  if (_roots[iroot]->getData() == dataList[0]) {
136  return _roots[iroot]->insert(dataList, _allNodes);
137  }
138  }
139  SeedingNode<DATA>* node = new SeedingNode<DATA>(dataList[0], _allNodes);
140  _roots.push_back(node);
141  return node->insert(dataList, _allNodes);
142  }
std::vector< SeedingNode< DATA > * > _roots
Definition: SeedingTree.h:119
bool insert(const std::vector< DATA > &dataList, std::vector< SeedingNode< DATA > *> &allNodes)
Definition: SeedingTree.h:49
std::vector< SeedingNode< DATA > * > _allNodes
Definition: SeedingTree.h:120
SingleSet _singleSet
Definition: SeedingTree.h:122

◆ numberOfNodes()

template<class DATA>
unsigned int SeedingTree< DATA >::numberOfNodes ( ) const
inline

Definition at line 157 of file SeedingTree.h.

Referenced by SeedFinder::getSeed().

157 { return _allNodes.size(); }
std::vector< SeedingNode< DATA > * > _allNodes
Definition: SeedingTree.h:120

◆ numberOfRoots()

template<class DATA>
unsigned int SeedingTree< DATA >::numberOfRoots ( ) const
inline

Definition at line 155 of file SeedingTree.h.

Referenced by SeedFinder::iterateHits().

155 { return _roots.size(); }
std::vector< SeedingNode< DATA > * > _roots
Definition: SeedingTree.h:119

◆ print()

template<class DATA>
void SeedingTree< DATA >::print ( void  ) const
inline

Definition at line 179 of file SeedingTree.h.

179  {
180  std::cout << "SeedingTree: n=" << _allNodes.size() << std::endl;
181  for (unsigned int inode = 0; inode < _allNodes.size(); ++inode) {
182  _allNodes[inode]->print();
183  }
184  }
std::vector< SeedingNode< DATA > * > _allNodes
Definition: SeedingTree.h:120

◆ printOrdered()

template<class DATA>
void SeedingTree< DATA >::printOrdered ( ) const
inline

Definition at line 172 of file SeedingTree.h.

172  {
173  std::cout << "SeedingTree: n=" << _allNodes.size() << " [ordered]" << std::endl;
174  for (unsigned int inode = 0; inode < _allNodes.size(); ++inode) {
175  _allNodes[inode]->print();
176  }
177  }
std::vector< SeedingNode< DATA > * > _allNodes
Definition: SeedingTree.h:120

◆ printRecursive()

template<class DATA>
void SeedingTree< DATA >::printRecursive ( ) const
inline

Definition at line 166 of file SeedingTree.h.

166  {
167  std::cout << "SeedingTree: n=" << _allNodes.size() << " [recursive]" << std::endl;
168  for (unsigned int iroot = 0; iroot < _roots.size(); ++iroot) {
169  _roots[iroot]->printRecursive();
170  }
171  }
std::vector< SeedingNode< DATA > * > _roots
Definition: SeedingTree.h:119
std::vector< SeedingNode< DATA > * > _allNodes
Definition: SeedingTree.h:120

◆ sort()

template<class DATA>
void SeedingTree< DATA >::sort ( )
inline

Definition at line 146 of file SeedingTree.h.

146  {
147  //this setups depth first ordered indexes.
148  std::vector<SeedingNode<DATA>*> allNodes;
149  for (unsigned int iroot = 0; iroot < _roots.size(); ++iroot) {
150  _roots[iroot]->sort(allNodes, -1);
151  }
152  _allNodes = allNodes;
153  }
std::vector< SeedingNode< DATA > * > _roots
Definition: SeedingTree.h:119
std::vector< SeedingNode< DATA > * > _allNodes
Definition: SeedingTree.h:120

Member Data Documentation

◆ _allNodes

template<class DATA>
std::vector<SeedingNode<DATA>*> SeedingTree< DATA >::_allNodes
protected

◆ _roots

template<class DATA>
std::vector<SeedingNode<DATA>*> SeedingTree< DATA >::_roots
protected

◆ _singleSet

template<class DATA>
SingleSet SeedingTree< DATA >::_singleSet
protected