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 }
DDScope.h
DDGeoHistory
std::vector< DDExpandedNode > DDGeoHistory
Geometrical 'path' of the current node up to the root-node.
Definition: DDExpandedNode.h:82
operator<<
std::ostream & operator<<(std::ostream &os, const DDScope &scope)
Definition: DDScope.cc:87
supertree
Definition: DDScope.h:9
DDScope::~DDScope
~DDScope(void)
Definition: DDScope.cc:33
DDScope::setDepth
void setDepth(int)
subtrees of the scope are only transversed down to the given level
Definition: DDScope.cc:81
DDScope::DDScope
DDScope(void)
empty scope
Definition: DDScope.cc:29
DDScope::scope_type
std::vector< DDGeoHistory > scope_type
Definition: DDScope.h:31
dd_scope_class
dd_scope_class
Definition: DDScope.h:9
DDScope::scope
const scope_type & scope(void) const
returns the scope container
Definition: DDScope.cc:85
h
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
DDScopeClassification::operator()
dd_scope_class operator()(const DDGeoHistory &, const DDGeoHistory &) const
Definition: DDScope.cc:5
DDScope::depth_
int depth_
Definition: DDScope.h:59
DDScope::addScope
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
DDScope::subtrees_
scope_type subtrees_
Definition: DDScope.h:57
different_branch
Definition: DDScope.h:9
DDScope::classify_
DDScopeClassification classify_
Definition: DDScope.h:58
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
DDScope
defines subtrees in the expanded-view
Definition: DDScope.h:27
subtree
Definition: DDScope.h:9
ztail.d
d
Definition: ztail.py:151
mps_fire.result
result
Definition: mps_fire.py:303
DDScope::depth
int depth(void) const
return the depth to wich the subtrees are restricted
Definition: DDScope.cc:83