test
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 () const
 
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 173 of file SeedingTree.h.

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

Definition at line 266 of file SeedingTree.h.

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

Member Function Documentation

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

Definition at line 231 of file SeedingTree.h.

Referenced by SeedFinder::iterateHits().

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

Definition at line 203 of file SeedingTree.h.

Referenced by SeedFinder::iterateHits().

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

Definition at line 178 of file SeedingTree.h.

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

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

Definition at line 226 of file SeedingTree.h.

Referenced by SeedFinder::getSeed().

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

Definition at line 221 of file SeedingTree.h.

Referenced by SeedFinder::iterateHits().

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

Definition at line 257 of file SeedingTree.h.

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

Definition at line 248 of file SeedingTree.h.

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

Definition at line 240 of file SeedingTree.h.

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

Definition at line 208 of file SeedingTree.h.

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

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