CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDScope.cc
Go to the documentation of this file.
1 
2 
4 
6  const DDGeoHistory & right) const
7 {
8 
10  DDGeoHistory::const_iterator lit = left.begin(); // left-iterator
11  DDGeoHistory::const_iterator rit = right.begin(); // right-iterator
12  //DDGeoHistory::size_type depth = 0;
13  while(lit != left.end() && rit!=right.end()) {
14  //DCOUT('s', " classify: a=" << *lit << std::endl << " : b=" << *rit );
15  if (lit->siblingno() != rit->siblingno()) {
16  result = different_branch;
17  break;
18  }
19  //++depth;
20  ++lit;
21  ++rit;
22  }
23 
24  if (result != different_branch) {
25  if(lit==left.end()) { // left history leaf node marks the root of a subtree which contains
26  result=supertree; // the leaf node of the right history or both roots are the same ...
27  }
28  else {
29  result=subtree;
30  }
31  }
32  return result;
33 
34 }
35 
36 
38 
39 
40 DDScope::DDScope(const DDGeoHistory & h, int depth)
41  : depth_(depth)
42 {
43  subtrees_.push_back(h);
44 }
45 
46 
48 { }
49 
50 
52 {
53  bool result = false;
54  //DCOUT('S',"DDScope::addScope()" << h);
55  scope_type::iterator it = subtrees_.begin();
56  scope_type buf;
57  int supertreeCount = 0;
58  bool diffBranch = false;
59  bool subTree = false;
60  //DDGeoHistory::size_type pos = subtree_.size();
61 
62  for(; it != subtrees_.end(); ++it) {
63  dd_scope_class classification = classify_(h,*it);
64  switch (classification) {
65 
66  case different_branch:
67  buf.push_back(*it);
68  diffBranch=true;
69  //buf.push_back(h);
70  //DCOUT('S'," ->different_branch");
71  break;
72 
73  case subtree:
74  buf.push_back(*it);
75  subTree = true;
76  //DCOUT('S'," ->subtree");
77  break;
78 
79  case supertree:
80  //buf.push_back(h);
81  ++supertreeCount;
82  if (supertreeCount==1)
83  buf.push_back(h);
84  //DCOUT('S'," ->supertree");
85  break;
86 
87  default:
88  ;
89  }
90  }
91 
92  if (diffBranch) {
93  if (subTree==false) {
94  buf.push_back(h);
95  }
96  }
97 
98  if (!subtrees_.size())
99  subtrees_.push_back(h);
100  else
101  subtrees_ = buf;
102 
103  //DCOUT('S',"DDScope.size()=" << subtrees_.size() );
104  return result;
105 }
106 
107 
108 void DDScope::setDepth(int d)
109 {
110  depth_ = d;
111 }
112 
113 
114 int DDScope::depth() const
115 {
116  return depth_;
117 }
118 
119 
121 {
122  return subtrees_;
123 }
124 
125 std::ostream & operator<<(std::ostream & os, const DDScope & scope)
126 {
127  DDScope::scope_type::const_iterator it = scope.subtrees_.begin();
128  for (; it!=scope.subtrees_.end(); ++ it) {
129  os << *it << std::endl;
130  }
131  return os;
132 }
133 
scope_type subtrees_
Definition: DDScope.h:57
bool addScope(const DDGeoHistory &s)
Adds a scope. No new scope will be added if s is already contained in one of the subtrees.
Definition: DDScope.cc:51
dd_scope_class
Definition: DDScope.h:7
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
DDScopeClassification classify_
Definition: DDScope.h:58
std::vector< DDGeoHistory > scope_type
Definition: DDScope.h:31
tuple result
Definition: query.py:137
DDScope()
empty scope
Definition: DDScope.cc:37
~DDScope()
Definition: DDScope.cc:47
int depth() const
return the depth to wich the subtrees are restricted
Definition: DDScope.cc:114
std::vector< DDExpandedNode > DDGeoHistory
Geometrical &#39;path&#39; of the current node up to the root-node.
defines subtrees in the expanded-view
Definition: DDScope.h:26
const scope_type & scope() const
returns the scope container
Definition: DDScope.cc:120
void setDepth(int)
subtrees of the scope are only transversed down to the given level
Definition: DDScope.cc:108
Definition: DDScope.h:7
dd_scope_class operator()(const DDGeoHistory &, const DDGeoHistory &) const
Definition: DDScope.cc:5
int depth_
Definition: DDScope.h:59
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4