CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
void printOrdered () const
 
void printRecursive () const
 
 SeedingTree ()
 
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 163 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 166 of file SeedingTree.h.

Constructor & Destructor Documentation

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

Definition at line 174 of file SeedingTree.h.

175  {
176  }
template<class DATA>
SeedingTree< DATA >::~SeedingTree ( )
inline

Definition at line 267 of file SeedingTree.h.

268  {
269  for (unsigned int iroot=0; iroot<_roots.size();++iroot)
270  {
271  delete _roots[iroot];
272  }
273  _roots.clear();
274  }
std::vector< SeedingNode< DATA > * > _roots
Definition: SeedingTree.h:169

Member Function Documentation

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

Definition at line 232 of file SeedingTree.h.

Referenced by TrajectorySeedProducer::iterateHits().

233  {
234  if (i<_roots.size())
235  {
236  return _roots[i];
237  }
238  return nullptr;
239  }
int i
Definition: DBlmapReader.cc:9
std::vector< SeedingNode< DATA > * > _roots
Definition: SeedingTree.h:169
template<class DATA>
const SingleSet& SeedingTree< DATA >::getSingleSet ( ) const
inline

Definition at line 204 of file SeedingTree.h.

Referenced by TrajectorySeedProducer::produce().

205  {
206  return _singleSet;
207  }
SingleSet _singleSet
Definition: SeedingTree.h:172
template<class DATA>
bool SeedingTree< DATA >::insert ( const std::vector< DATA > &  dataList)
inline

Definition at line 179 of file SeedingTree.h.

Referenced by BeautifulSoup.PageElement::_invert(), and TrajectorySeedProducer::TrajectorySeedProducer().

180  {
181  for (unsigned int i = 0; i< dataList.size(); ++i)
182  {
183  _singleSet.insert(dataList[i]);
184  }
185 
186  if (dataList.size()==0)
187  {
188  return false;
189  }
190  for (unsigned int iroot=0; iroot<_roots.size();++iroot)
191  {
192  if (_roots[iroot]->getData()==dataList[0])
193  {
194  //std::cout<<"\tfound root: "<<dataList[0].print()<<std::endl;
195  return _roots[iroot]->insert(dataList,_allNodes);
196  }
197  }
198  //std::cout<<"\tnew root: "<<dataList[0].print()<<std::endl;
200  _roots.push_back(node);
201  return node->insert(dataList,_allNodes);
202  }
int i
Definition: DBlmapReader.cc:9
tuple node
Definition: Node.py:50
std::vector< SeedingNode< DATA > * > _roots
Definition: SeedingTree.h:169
bool insert(const std::vector< DATA > &dataList, std::vector< SeedingNode< DATA > * > &allNodes)
Definition: SeedingTree.h:60
std::vector< SeedingNode< DATA > * > _allNodes
Definition: SeedingTree.h:170
SingleSet _singleSet
Definition: SeedingTree.h:172
template<class DATA>
unsigned int SeedingTree< DATA >::numberOfNodes ( ) const
inline

Definition at line 227 of file SeedingTree.h.

Referenced by TrajectorySeedProducer::produce().

228  {
229  return _allNodes.size();
230  }
std::vector< SeedingNode< DATA > * > _allNodes
Definition: SeedingTree.h:170
template<class DATA>
unsigned int SeedingTree< DATA >::numberOfRoots ( ) const
inline

Definition at line 222 of file SeedingTree.h.

Referenced by TrajectorySeedProducer::iterateHits().

223  {
224  return _roots.size();
225  }
std::vector< SeedingNode< DATA > * > _roots
Definition: SeedingTree.h:169
template<class DATA>
void SeedingTree< DATA >::print ( void  )
inline

Definition at line 258 of file SeedingTree.h.

259  {
260  std::cout<<"SeedingTree: n="<<_allNodes.size()<<std::endl;
261  for (unsigned int inode=0; inode<_allNodes.size();++inode)
262  {
263  _allNodes[inode]->print();
264  }
265  }
std::vector< SeedingNode< DATA > * > _allNodes
Definition: SeedingTree.h:170
tuple cout
Definition: gather_cfg.py:121
template<class DATA>
void SeedingTree< DATA >::printOrdered ( ) const
inline

Definition at line 249 of file SeedingTree.h.

250  {
251  std::cout<<"SeedingTree: n="<<_allNodes.size()<<" [ordered]"<<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:170
tuple cout
Definition: gather_cfg.py:121
template<class DATA>
void SeedingTree< DATA >::printRecursive ( ) const
inline

Definition at line 241 of file SeedingTree.h.

242  {
243  std::cout<<"SeedingTree: n="<<_allNodes.size()<<" [recursive]"<<std::endl;
244  for (unsigned int iroot=0; iroot<_roots.size();++iroot)
245  {
246  _roots[iroot]->printRecursive();
247  }
248  }
std::vector< SeedingNode< DATA > * > _roots
Definition: SeedingTree.h:169
std::vector< SeedingNode< DATA > * > _allNodes
Definition: SeedingTree.h:170
tuple cout
Definition: gather_cfg.py:121
template<class DATA>
void SeedingTree< DATA >::sort ( )
inline

Definition at line 209 of file SeedingTree.h.

210  {
211  //this setups depth first ordered indexes.
212  std::vector<SeedingNode<DATA>*> allNodes;
213  for (unsigned int iroot=0; iroot<_roots.size();++iroot)
214  {
215  _roots[iroot]->sort(allNodes,-1);
216  }
217  _allNodes=allNodes;
218  }
std::vector< SeedingNode< DATA > * > _roots
Definition: SeedingTree.h:169
std::vector< SeedingNode< DATA > * > _allNodes
Definition: SeedingTree.h:170

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
template<class DATA>
SingleSet SeedingTree< DATA >::_singleSet
protected