CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Attributes
SeedingNode< DATA > Class Template Reference

#include <SeedingTree.h>

Public Member Functions

const SeedingNode< DATA > * firstChild () const
 
const SeedingNode< DATA > * getChild (unsigned int ichild) const
 
unsigned int getChildIndex () const
 
unsigned int getChildrenSize () const
 
const DATA & getData () const
 
unsigned int getDepth () const
 
unsigned int getIndex () const
 
const SeedingNodegetParent () const
 
bool insert (const std::vector< DATA > &dataList, std::vector< SeedingNode< DATA > * > &allNodes)
 
const SeedingNode< DATA > * next () const
 
void print () const
 
void printRecursive () const
 
 SeedingNode (const DATA &data, std::vector< SeedingNode * > &allNodes, int parentIndex=-1)
 
void sort (std::vector< SeedingNode< DATA > * > &allNodes, unsigned int parentIndex)
 

Protected Attributes

const std::vector< SeedingNode
< DATA > * > & 
_allNodes
 
int _childIndex
 
std::vector< unsigned int > _children
 
const DATA _data
 
unsigned int _depth
 
unsigned int _index
 
int _parentIndex
 

Detailed Description

template<class DATA>
class SeedingNode< DATA >

Definition at line 10 of file SeedingTree.h.

Constructor & Destructor Documentation

template<class DATA>
SeedingNode< DATA >::SeedingNode ( const DATA &  data,
std::vector< SeedingNode< DATA > * > &  allNodes,
int  parentIndex = -1 
)
inline

Definition at line 22 of file SeedingTree.h.

References SeedingNode< DATA >::_childIndex, SeedingNode< DATA >::_children, SeedingNode< DATA >::_depth, SeedingNode< DATA >::_index, SeedingNode< DATA >::_parentIndex, and SpecificationBuilder_cfi::parent().

22  :
23  _data(data),
24  _allNodes(allNodes),
25  _index(allNodes.size()),
26  _parentIndex(parentIndex)
27  {
28  allNodes.push_back(this);
29 
30  if (_parentIndex>=0)
31  {
32  SeedingNode* parent = allNodes[_parentIndex];
33  _depth=parent->_depth+1;
34  _childIndex=parent->_children.size();
35  parent->_children.push_back(_index);
36 
37  }
38  else
39  {
40  _depth=0;
41  _childIndex=-1;
42  }
43  }
int _childIndex
Definition: SeedingTree.h:17
int _parentIndex
Definition: SeedingTree.h:16
unsigned int _depth
Definition: SeedingTree.h:18
const DATA _data
Definition: SeedingTree.h:13
std::vector< unsigned int > _children
Definition: SeedingTree.h:19
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
const std::vector< SeedingNode< DATA > * > & _allNodes
Definition: SeedingTree.h:14
unsigned int _index
Definition: SeedingTree.h:15

Member Function Documentation

template<class DATA>
const SeedingNode<DATA>* SeedingNode< DATA >::firstChild ( ) const
inline

Definition at line 95 of file SeedingTree.h.

References SeedingNode< DATA >::_allNodes, and SeedingNode< DATA >::_children.

96  {
97  if (_children.size()>0)
98  {
99  return _allNodes[_children[0]];
100  }
101  return nullptr;
102  }
std::vector< unsigned int > _children
Definition: SeedingTree.h:19
const std::vector< SeedingNode< DATA > * > & _allNodes
Definition: SeedingTree.h:14
template<class DATA>
const SeedingNode<DATA>* SeedingNode< DATA >::getChild ( unsigned int  ichild) const
inline

Definition at line 123 of file SeedingTree.h.

References SeedingNode< DATA >::_allNodes, and SeedingNode< DATA >::_children.

Referenced by SeedFinder::insertHit().

124  {
125  return _allNodes[_children[ichild]];
126  }
std::vector< unsigned int > _children
Definition: SeedingTree.h:19
const std::vector< SeedingNode< DATA > * > & _allNodes
Definition: SeedingTree.h:14
template<class DATA>
unsigned int SeedingNode< DATA >::getChildIndex ( ) const
inline

Definition at line 128 of file SeedingTree.h.

References SeedingNode< DATA >::_childIndex.

129  {
130  return _childIndex;
131  }
int _childIndex
Definition: SeedingTree.h:17
template<class DATA>
unsigned int SeedingNode< DATA >::getChildrenSize ( ) const
inline

Definition at line 118 of file SeedingTree.h.

References SeedingNode< DATA >::_children.

Referenced by SeedFinder::insertHit().

119  {
120  return _children.size();
121  }
std::vector< unsigned int > _children
Definition: SeedingTree.h:19
template<class DATA>
const DATA& SeedingNode< DATA >::getData ( void  ) const
inline

Definition at line 133 of file SeedingTree.h.

References SeedingNode< DATA >::_data.

Referenced by SeedingNode< DATA >::insert(), and SeedFinder::insertHit().

134  {
135  return _data;
136  }
const DATA _data
Definition: SeedingTree.h:13
template<class DATA>
unsigned int SeedingNode< DATA >::getDepth ( void  ) const
inline

Definition at line 81 of file SeedingTree.h.

References SeedingNode< DATA >::_depth.

Referenced by SeedingNode< DATA >::insert(), SeedFinder::insertHit(), and SeedFinder::iterateHits().

82  {
83  return _depth;
84  }
unsigned int _depth
Definition: SeedingTree.h:18
template<class DATA>
unsigned int SeedingNode< DATA >::getIndex ( ) const
inline

Definition at line 104 of file SeedingTree.h.

References SeedingNode< DATA >::_index.

Referenced by SeedFinder::insertHit(), and SeedFinder::iterateHits().

105  {
106  return _index;
107  }
unsigned int _index
Definition: SeedingTree.h:15
template<class DATA>
const SeedingNode* SeedingNode< DATA >::getParent ( ) const
inline

Definition at line 109 of file SeedingTree.h.

References SeedingNode< DATA >::_allNodes, and SeedingNode< DATA >::_parentIndex.

Referenced by SeedFinder::insertHit(), and SeedFinder::iterateHits().

110  {
111  if (_parentIndex>=0)
112  {
113  return _allNodes[_parentIndex];
114  }
115  return nullptr;
116  }
int _parentIndex
Definition: SeedingTree.h:16
const std::vector< SeedingNode< DATA > * > & _allNodes
Definition: SeedingTree.h:14
template<class DATA>
bool SeedingNode< DATA >::insert ( const std::vector< DATA > &  dataList,
std::vector< SeedingNode< DATA > * > &  allNodes 
)
inline

Definition at line 60 of file SeedingTree.h.

References SeedingNode< DATA >::_children, SeedingNode< DATA >::_depth, SeedingNode< DATA >::_index, SeedingNode< DATA >::getData(), SeedingNode< DATA >::getDepth(), and SeedingNode< DATA >::insert().

Referenced by BeautifulSoup.PageElement::_invert(), SeedingNode< DATA >::insert(), and SeedingTree< TrackingLayer >::insert().

61  {
62  if (_depth+1>=dataList.size())
63  {
64  return false;
65  }
66  for (unsigned int ichild=0; ichild<_children.size();++ichild)
67  {
68  if (allNodes[_children[ichild]]->getData()==dataList[_depth+1])
69  {
70  return allNodes[_children[ichild]]->insert(dataList,allNodes);
71  }
72  }
73  SeedingNode<DATA>* node = new SeedingNode<DATA>(dataList[_depth+1],allNodes,_index);
74  if (node->getDepth()+1>=dataList.size())
75  {
76  return true;
77  }
78  return node->insert(dataList,allNodes);
79  }
const DATA & getData() const
Definition: SeedingTree.h:133
unsigned int getDepth() const
Definition: SeedingTree.h:81
unsigned int _depth
Definition: SeedingTree.h:18
bool insert(const std::vector< DATA > &dataList, std::vector< SeedingNode< DATA > * > &allNodes)
Definition: SeedingTree.h:60
std::vector< unsigned int > _children
Definition: SeedingTree.h:19
unsigned int _index
Definition: SeedingTree.h:15
template<class DATA>
const SeedingNode<DATA>* SeedingNode< DATA >::next ( void  ) const
inline

Definition at line 86 of file SeedingTree.h.

References SeedingNode< DATA >::_allNodes, and SeedingNode< DATA >::_index.

Referenced by BeautifulSoup.PageElement::_invert().

87  {
88  if (_index+1<_allNodes.size())
89  {
90  return _allNodes[_index+1];
91  }
92  return nullptr;
93  }
const std::vector< SeedingNode< DATA > * > & _allNodes
Definition: SeedingTree.h:14
unsigned int _index
Definition: SeedingTree.h:15
template<class DATA>
void SeedingNode< DATA >::print ( void  ) const
inline

Definition at line 138 of file SeedingTree.h.

References SeedingNode< DATA >::_childIndex, SeedingNode< DATA >::_data, SeedingNode< DATA >::_depth, SeedingNode< DATA >::_index, gather_cfg::cout, and i.

Referenced by SeedingNode< DATA >::printRecursive().

139  {
140 
141  printf("index=%3i, depth=%2i, childIndex=%2i: ",_index,_depth,_childIndex);
142  for (unsigned int i=0;i<_depth;++i)
143  {
144  std::cout<<" -- ";
145  }
146  printf("[%s, %s] \r\n",_data.toString().c_str(),_data.toIdString().c_str());
147 
148  }
int i
Definition: DBlmapReader.cc:9
int _childIndex
Definition: SeedingTree.h:17
unsigned int _depth
Definition: SeedingTree.h:18
const DATA _data
Definition: SeedingTree.h:13
tuple cout
Definition: gather_cfg.py:145
unsigned int _index
Definition: SeedingTree.h:15
template<class DATA>
void SeedingNode< DATA >::printRecursive ( ) const
inline

Definition at line 149 of file SeedingTree.h.

References SeedingNode< DATA >::_allNodes, SeedingNode< DATA >::_children, and SeedingNode< DATA >::print().

150  {
151  print();
152  for (unsigned int ichild=0; ichild<_children.size(); ++ichild)
153  {
154  _allNodes[_children[ichild]]->printRecursive();
155  }
156  }
std::vector< unsigned int > _children
Definition: SeedingTree.h:19
void print() const
Definition: SeedingTree.h:138
const std::vector< SeedingNode< DATA > * > & _allNodes
Definition: SeedingTree.h:14
template<class DATA>
void SeedingNode< DATA >::sort ( std::vector< SeedingNode< DATA > * > &  allNodes,
unsigned int  parentIndex 
)
inline

Definition at line 45 of file SeedingTree.h.

References SeedingNode< DATA >::_allNodes, SeedingNode< DATA >::_childIndex, SeedingNode< DATA >::_children, SeedingNode< DATA >::_index, and SeedingNode< DATA >::_parentIndex.

46  {
47  _parentIndex=parentIndex;
48  _index=allNodes.size();
49  if (_parentIndex>=0)
50  {
51  allNodes[_parentIndex]->_children[_childIndex]=_index;
52  }
53  allNodes.push_back(this);
54  for (unsigned int ichild=0; ichild<_children.size();++ichild)
55  {
56  _allNodes[_children[ichild]]->sort(allNodes,_index);
57  }
58  }
int _childIndex
Definition: SeedingTree.h:17
int _parentIndex
Definition: SeedingTree.h:16
std::vector< unsigned int > _children
Definition: SeedingTree.h:19
const std::vector< SeedingNode< DATA > * > & _allNodes
Definition: SeedingTree.h:14
unsigned int _index
Definition: SeedingTree.h:15

Member Data Documentation

template<class DATA>
const std::vector<SeedingNode<DATA>*>& SeedingNode< DATA >::_allNodes
protected
template<class DATA>
int SeedingNode< DATA >::_childIndex
protected
template<class DATA>
std::vector<unsigned int> SeedingNode< DATA >::_children
protected
template<class DATA>
const DATA SeedingNode< DATA >::_data
protected
template<class DATA>
unsigned int SeedingNode< DATA >::_depth
protected
template<class DATA>
unsigned int SeedingNode< DATA >::_index
protected

Definition at line 15 of file SeedingTree.h.

Referenced by ntuple._Object::__getattr__(), python.cmstools.EventTree::__getitem__(), python.cmstools.EventTree::__iter__(), python.cmstools.EventBranch::__readData(), python.cmstools.EventTree::__setBranchIndicies(), ntuple._TrackingParticleMatchAdaptor::_nMatchedTrackingParticles(), ntuple.TrackingParticle::_nMatchedTracks(), Vispa.Share.FindAlgorithm.FindAlgorithm::currentNumber(), ntuple.TrackingVertex::daughterTrackingParticles(), ntuple.TrackingParticle::decayVertices(), Vispa.Share.FindAlgorithm.FindAlgorithm::findUsingFindDialog(), SeedingNode< DATA >::getIndex(), ntuple._Object::index(), python.cmstools.EventTree::index(), ntuple.Seed::indexWithinAlgo(), SeedingNode< DATA >::insert(), ntuple._Object::isValid(), ntuple._LayerStrAdaptor::layerStr(), ntuple.InvalidHit::layerStr(), ntuple.TrackingParticle::matchedTrackInfos(), ntuple._TrackingParticleMatchAdaptor::matchedTrackingParticleInfos(), ntuple.GluedHit::monoHit(), ntuple.TrackingVertex::nDaughterTrackingParticles(), SeedingNode< DATA >::next(), Vispa.Share.FindAlgorithm.FindAlgorithm::next(), ntuple.SimHit::nRecHits(), ntuple._HitObject::nseeds(), ntuple.GluedHit::nseeds(), ntuple.TrackingVertex::nSourceTrackingParticles(), ntuple._HitObject::ntracks(), ntuple.Vertex::nTracks(), ntuple.TrackingParticle::parentVertex(), Vispa.Share.FindAlgorithm.FindAlgorithm::previous(), SeedingNode< DATA >::print(), ntuple.Track::seed(), SeedingNode< DATA >::SeedingNode(), ntuple._HitObject::seeds(), ntuple.GluedHit::seeds(), python.cmstools.EventBranch::setIndex(), SeedingNode< DATA >::sort(), ntuple.TrackingVertex::sourceTrackingParticles(), ntuple.GluedHit::stereoHit(), ntuple.TrackMatchInfo::track(), ntuple.Seed::track(), ntuple.TrackingParticleMatchInfo::trackingParticle(), ntuple.SimHit::trackingParticle(), ntuple._HitObject::tracks(), ntuple.Vertex::tracks(), ntuple.Track::vertex(), and html.HtmlReport::write().

template<class DATA>
int SeedingNode< DATA >::_parentIndex
protected