1 #ifndef FastSimulation_Tracking_SeedingTree_h 2 #define FastSimulation_Tracking_SeedingTree_h 7 #include <unordered_set> 23 allNodes.push_back(
this);
43 allNodes.push_back(
this);
44 for (
unsigned int ichild = 0; ichild <
_children.size(); ++ichild) {
50 if (
_depth + 1 >= dataList.size()) {
53 for (
unsigned int ichild = 0; ichild <
_children.size(); ++ichild) {
55 return allNodes[
_children[ichild]]->insert(dataList, allNodes);
59 if (node->
getDepth() + 1 >= dataList.size()) {
62 return node->
insert(dataList, allNodes);
100 for (
unsigned int i = 0;
i <
_depth; ++
i) {
103 printf(
"[%s, %s] \r\n",
_data.toString().c_str(),
_data.toIdString().c_str());
107 for (
unsigned int ichild = 0; ichild <
_children.size(); ++ichild) {
113 template <
class DATA>
116 typedef std::unordered_set<DATA, typename DATA::hashfct, typename DATA::eqfct>
SingleSet;
126 bool insert(
const std::vector<DATA>& dataList) {
127 for (
unsigned int i = 0;
i < dataList.size(); ++
i) {
131 if (dataList.empty()) {
134 for (
unsigned int iroot = 0; iroot <
_roots.size(); ++iroot) {
148 std::vector<SeedingNode<DATA>*> allNodes;
149 for (
unsigned int iroot = 0; iroot <
_roots.size(); ++iroot) {
150 _roots[iroot]->sort(allNodes, -1);
168 for (
unsigned int iroot = 0; iroot <
_roots.size(); ++iroot) {
169 _roots[iroot]->printRecursive();
174 for (
unsigned int inode = 0; inode <
_allNodes.size(); ++inode) {
181 for (
unsigned int inode = 0; inode <
_allNodes.size(); ++inode) {
187 for (
unsigned int iroot = 0; iroot <
_roots.size(); ++iroot) {
const SeedingNode< DATA > * getChild(unsigned int ichild) const
const SeedingNode< DATA > * firstChild() const
std::vector< SeedingNode< DATA > * > _roots
bool insert(const std::vector< DATA > &dataList)
void sort(std::vector< SeedingNode< DATA > *> &allNodes, unsigned int parentIndex)
const SeedingNode< DATA > * getRoot(unsigned int i) const
unsigned int numberOfNodes() const
unsigned int getIndex() const
unsigned int getChildIndex() const
std::unordered_set< DATA, typename DATA::hashfct, typename DATA::eqfct > SingleSet
void printRecursive() const
void printRecursive() const
std::vector< unsigned int > _children
unsigned int getDepth() const
bool insert(const std::vector< DATA > &dataList, std::vector< SeedingNode< DATA > *> &allNodes)
void printOrdered() const
const SeedingNode * getParent() const
SeedingNode(const DATA &data, std::vector< SeedingNode *> &allNodes, int parentIndex=-1)
std::vector< SeedingNode< DATA > * > _allNodes
unsigned int getChildrenSize() const
char data[epos_bytes_allocation]
const std::vector< SeedingNode< DATA > * > & _allNodes
const DATA & getData() const
const SingleSet & getSingleSet() const
unsigned int numberOfRoots() const
const SeedingNode< DATA > * next() const