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  }

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.

159  {
160  if (i < _roots.size()) {
161  return _roots[i];
162  }
163  return nullptr;
164  }

Referenced by SeedFinder::iterateHits().

◆ getSingleSet()

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

Definition at line 144 of file SeedingTree.h.

144 { return _singleSet; }

Referenced by SeedFinder::iterateHits().

◆ insert()

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

Definition at line 126 of file SeedingTree.h.

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  }

Referenced by TrajectorySeedProducer::TrajectorySeedProducer().

◆ numberOfNodes()

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

Definition at line 157 of file SeedingTree.h.

157 { return _allNodes.size(); }

Referenced by SeedFinder::getSeed().

◆ numberOfRoots()

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

Definition at line 155 of file SeedingTree.h.

155 { return _roots.size(); }

Referenced by SeedFinder::iterateHits().

◆ 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  }

◆ 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  }

◆ 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  }

◆ 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  }

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
mps_fire.i
i
Definition: mps_fire.py:428
gather_cfg.cout
cout
Definition: gather_cfg.py:144
printContent_cfi.getData
getData
Definition: printContent_cfi.py:16
SeedingTree::_roots
std::vector< SeedingNode< DATA > * > _roots
Definition: SeedingTree.h:119
SeedingTree::_allNodes
std::vector< SeedingNode< DATA > * > _allNodes
Definition: SeedingTree.h:120
SeedingNode::insert
bool insert(const std::vector< DATA > &dataList, std::vector< SeedingNode< DATA > * > &allNodes)
Definition: SeedingTree.h:49
SeedingNode
Definition: SeedingTree.h:10
SeedingTree::_singleSet
SingleSet _singleSet
Definition: SeedingTree.h:122