CMS 3D CMS Logo

DDScope.cc
Go to the documentation of this file.
2 
3 #include <ostream>
4 
7  DDGeoHistory::const_iterator lit = left.begin(); // left-iterator
8  DDGeoHistory::const_iterator rit = right.begin(); // right-iterator
9 
10  while (lit != left.end() && rit != right.end()) {
11  if (lit->siblingno() != rit->siblingno()) {
13  break;
14  }
15  ++lit;
16  ++rit;
17  }
18 
19  if (result != different_branch) {
20  if (lit == left.end()) { // left history leaf node marks the root of a subtree which contains
21  result = supertree; // the leaf node of the right history or both roots are the same ...
22  } else {
23  result = subtree;
24  }
25  }
26  return result;
27 }
28 
29 DDScope::DDScope(void) : depth_(0) {}
30 
31 DDScope::DDScope(const DDGeoHistory& h, int depth) : depth_(depth) { subtrees_.emplace_back(h); }
32 
34 
36  bool result = false;
37  scope_type::iterator it = subtrees_.begin();
39  int supertreeCount = 0;
40  bool diffBranch = false;
41  bool subTree = false;
42 
43  for (; it != subtrees_.end(); ++it) {
44  dd_scope_class classification = classify_(h, *it);
45  switch (classification) {
46  case different_branch:
47  buf.emplace_back(*it);
48  diffBranch = true;
49  break;
50 
51  case subtree:
52  buf.emplace_back(*it);
53  subTree = true;
54  break;
55 
56  case supertree:
57  ++supertreeCount;
58  if (supertreeCount == 1)
59  buf.emplace_back(h);
60  break;
61 
62  default:
63  break;
64  }
65  }
66 
67  if (diffBranch) {
68  if (subTree == false) {
69  buf.emplace_back(h);
70  }
71  }
72 
73  if (subtrees_.empty())
74  subtrees_.emplace_back(h);
75  else
76  subtrees_ = buf;
77 
78  return result;
79 }
80 
81 void DDScope::setDepth(int d) { depth_ = d; }
82 
83 int DDScope::depth(void) const { return depth_; }
84 
85 const DDScope::scope_type& DDScope::scope(void) const { return subtrees_; }
86 
87 std::ostream& operator<<(std::ostream& os, const DDScope& scope) {
88  DDScope::scope_type::const_iterator it = scope.subtrees_.begin();
89  for (; it != scope.subtrees_.end(); ++it) {
90  os << *it << std::endl;
91  }
92  return os;
93 }
dd_scope_class operator()(const DDGeoHistory &, const DDGeoHistory &) const
Definition: DDScope.cc:5
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:35
dd_scope_class
Definition: DDScope.h:9
int depth(void) const
return the depth to wich the subtrees are restricted
Definition: DDScope.cc:83
std::ostream & operator<<(std::ostream &os, const DDScope &scope)
Definition: DDScope.cc:87
DDScopeClassification classify_
Definition: DDScope.h:58
std::vector< DDGeoHistory > scope_type
Definition: DDScope.h:31
const scope_type & scope(void) const
returns the scope container
Definition: DDScope.cc:85
d
Definition: ztail.py:151
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:27
void setDepth(int)
subtrees of the scope are only transversed down to the given level
Definition: DDScope.cc:81
Definition: DDScope.h:9
~DDScope(void)
Definition: DDScope.cc:33
DDScope(void)
empty scope
Definition: DDScope.cc:29
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