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 160 of file SeedingTree.h.

Member Typedef Documentation

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

Definition at line 163 of file SeedingTree.h.

Constructor & Destructor Documentation

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

Definition at line 258 of file SeedingTree.h.

259  {
260  for (unsigned int iroot=0; iroot<_roots.size();++iroot)
261  {
262  delete _roots[iroot];
263  }
264  _roots.clear();
265  }
std::vector< SeedingNode< DATA > * > _roots
Definition: SeedingTree.h:165

Member Function Documentation

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

Definition at line 223 of file SeedingTree.h.

Referenced by SeedFinder::iterateHits().

224  {
225  if (i<_roots.size())
226  {
227  return _roots[i];
228  }
229  return nullptr;
230  }
std::vector< SeedingNode< DATA > * > _roots
Definition: SeedingTree.h:165
template<class DATA>
const SingleSet& SeedingTree< DATA >::getSingleSet ( ) const
inline

Definition at line 195 of file SeedingTree.h.

Referenced by SeedFinder::iterateHits().

196  {
197  return _singleSet;
198  }
SingleSet _singleSet
Definition: SeedingTree.h:168
template<class DATA>
bool SeedingTree< DATA >::insert ( const std::vector< DATA > &  dataList)
inline

Definition at line 172 of file SeedingTree.h.

Referenced by TrajectorySeedProducer::TrajectorySeedProducer().

173  {
174  for (unsigned int i = 0; i< dataList.size(); ++i)
175  {
176  _singleSet.insert(dataList[i]);
177  }
178 
179  if (dataList.size()==0)
180  {
181  return false;
182  }
183  for (unsigned int iroot=0; iroot<_roots.size();++iroot)
184  {
185  if (_roots[iroot]->getData()==dataList[0])
186  {
187  return _roots[iroot]->insert(dataList,_allNodes);
188  }
189  }
190  SeedingNode<DATA>* node = new SeedingNode<DATA>(dataList[0],_allNodes);
191  _roots.push_back(node);
192  return node->insert(dataList,_allNodes);
193  }
def getData(doc, options, dataset, site)
std::vector< SeedingNode< DATA > * > _roots
Definition: SeedingTree.h:165
bool insert(const std::vector< DATA > &dataList, std::vector< SeedingNode< DATA > * > &allNodes)
Definition: SeedingTree.h:60
std::vector< SeedingNode< DATA > * > _allNodes
Definition: SeedingTree.h:166
SingleSet _singleSet
Definition: SeedingTree.h:168
template<class DATA>
unsigned int SeedingTree< DATA >::numberOfNodes ( ) const
inline

Definition at line 218 of file SeedingTree.h.

Referenced by SeedFinder::getSeed().

219  {
220  return _allNodes.size();
221  }
std::vector< SeedingNode< DATA > * > _allNodes
Definition: SeedingTree.h:166
template<class DATA>
unsigned int SeedingTree< DATA >::numberOfRoots ( ) const
inline

Definition at line 213 of file SeedingTree.h.

Referenced by SeedFinder::iterateHits().

214  {
215  return _roots.size();
216  }
std::vector< SeedingNode< DATA > * > _roots
Definition: SeedingTree.h:165
template<class DATA>
void SeedingTree< DATA >::print ( void  ) const
inline

Definition at line 249 of file SeedingTree.h.

250  {
251  std::cout<<"SeedingTree: n="<<_allNodes.size()<<std::endl;
252  for (unsigned int inode=0; inode<_allNodes.size();++inode)
253  {
254  _allNodes[inode]->print();
255  }
256  }
std::vector< SeedingNode< DATA > * > _allNodes
Definition: SeedingTree.h:166
template<class DATA>
void SeedingTree< DATA >::printOrdered ( ) const
inline

Definition at line 240 of file SeedingTree.h.

241  {
242  std::cout<<"SeedingTree: n="<<_allNodes.size()<<" [ordered]"<<std::endl;
243  for (unsigned int inode=0; inode<_allNodes.size();++inode)
244  {
245  _allNodes[inode]->print();
246  }
247  }
std::vector< SeedingNode< DATA > * > _allNodes
Definition: SeedingTree.h:166
template<class DATA>
void SeedingTree< DATA >::printRecursive ( ) const
inline

Definition at line 232 of file SeedingTree.h.

233  {
234  std::cout<<"SeedingTree: n="<<_allNodes.size()<<" [recursive]"<<std::endl;
235  for (unsigned int iroot=0; iroot<_roots.size();++iroot)
236  {
237  _roots[iroot]->printRecursive();
238  }
239  }
std::vector< SeedingNode< DATA > * > _roots
Definition: SeedingTree.h:165
std::vector< SeedingNode< DATA > * > _allNodes
Definition: SeedingTree.h:166
template<class DATA>
void SeedingTree< DATA >::sort ( )
inline

Definition at line 200 of file SeedingTree.h.

201  {
202  //this setups depth first ordered indexes.
203  std::vector<SeedingNode<DATA>*> allNodes;
204  for (unsigned int iroot=0; iroot<_roots.size();++iroot)
205  {
206  _roots[iroot]->sort(allNodes,-1);
207  }
208  _allNodes=allNodes;
209  }
std::vector< SeedingNode< DATA > * > _roots
Definition: SeedingTree.h:165
std::vector< SeedingNode< DATA > * > _allNodes
Definition: SeedingTree.h:166

Member Data Documentation

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

Definition at line 165 of file SeedingTree.h.

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

Definition at line 168 of file SeedingTree.h.