1 #ifndef FastSimulation_Tracking_SeedingTree_h
2 #define FastSimulation_Tracking_SeedingTree_h
7 #include <unordered_set>
28 allNodes.push_back(
this);
53 allNodes.push_back(
this);
54 for (
unsigned int ichild=0; ichild<
_children.size();++ichild)
62 if (
_depth+1>=dataList.size())
67 for (
unsigned int ichild=0; ichild<
_children.size();++ichild)
72 return allNodes[
_children[ichild]]->insert(dataList,allNodes);
77 if (node->
getDepth()+1>=dataList.size())
81 return node->
insert(dataList,allNodes);
149 printf(
"[%s, %s] \r\n",
_data.toString().c_str(),
_data.toIdString().c_str());
155 for (
unsigned int ichild=0; ichild<
_children.size(); ++ichild)
166 typedef std::unordered_set<DATA,typename DATA:: hashfct, typename DATA:: eqfct>
SingleSet;
178 bool insert(
const std::vector<DATA>& dataList)
180 for (
unsigned int i = 0;
i< dataList.size(); ++
i)
185 if (dataList.size()==0)
189 for (
unsigned int iroot=0; iroot<
_roots.size();++iroot)
211 std::vector<SeedingNode<DATA>*> allNodes;
212 for (
unsigned int iroot=0; iroot<
_roots.size();++iroot)
214 _roots[iroot]->sort(allNodes,-1);
243 for (
unsigned int iroot=0; iroot<
_roots.size();++iroot)
245 _roots[iroot]->printRecursive();
251 for (
unsigned int inode=0; inode<
_allNodes.size();++inode)
260 for (
unsigned int inode=0; inode<
_allNodes.size();++inode)
268 for (
unsigned int iroot=0; iroot<
_roots.size();++iroot)
const SeedingNode< DATA > * next() const
const SingleSet & getSingleSet() const
void printRecursive() const
const SeedingNode< DATA > * firstChild() const
SeedingNode(const DATA &data, std::vector< SeedingNode * > &allNodes, int parentIndex=-1)
const DATA & getData() const
unsigned int getChildrenSize() const
unsigned int getDepth() const
const SeedingNode * getParent() const
std::vector< SeedingNode< DATA > * > _roots
bool insert(const std::vector< DATA > &dataList)
unsigned int numberOfNodes() const
unsigned int numberOfRoots() const
std::unordered_set< DATA, typename DATA::hashfct, typename DATA::eqfct > SingleSet
void sort(std::vector< SeedingNode< DATA > * > &allNodes, unsigned int parentIndex)
void printRecursive() const
bool insert(const std::vector< DATA > &dataList, std::vector< SeedingNode< DATA > * > &allNodes)
std::vector< unsigned int > _children
std::vector< SeedingNode< DATA > * > _allNodes
const SeedingNode< DATA > * getRoot(unsigned int i) const
void printOrdered() const
const std::vector< SeedingNode< DATA > * > & _allNodes
unsigned int getIndex() const
tuple size
Write out results.
unsigned int getChildIndex() const
const SeedingNode< DATA > * getChild(unsigned int ichild) const