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.
2 
4  const DDGeoHistory & right ) const
5 {
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  {
12  if( lit->siblingno() != rit->siblingno())
13  {
14  result = different_branch;
15  break;
16  }
17  ++lit;
18  ++rit;
19  }
20 
21  if( result != different_branch )
22  {
23  if( lit == left.end()) { // left history leaf node marks the root of a subtree which contains
24  result = supertree; // the leaf node of the right history or both roots are the same ...
25  }
26  else
27  {
28  result = subtree;
29  }
30  }
31  return result;
32 }
33 
35  : depth_( 0 )
36 {}
37 
39  : depth_( depth )
40 {
41  subtrees_.push_back( h );
42 }
43 
45 {}
46 
47 bool
49 {
50  bool result = false;
51  scope_type::iterator it = subtrees_.begin();
52  scope_type buf;
53  int supertreeCount = 0;
54  bool diffBranch = false;
55  bool subTree = false;
56 
57  for(; it != subtrees_.end(); ++it )
58  {
59  dd_scope_class classification = classify_( h, *it );
60  switch( classification )
61  {
62  case different_branch:
63  buf.push_back( *it );
64  diffBranch = true;
65  break;
66 
67  case subtree:
68  buf.push_back( *it );
69  subTree = true;
70  break;
71 
72  case supertree:
73  ++supertreeCount;
74  if( supertreeCount == 1 )
75  buf.push_back(h);
76  break;
77 
78  default:
79  break;
80  }
81  }
82 
83  if( diffBranch )
84  {
85  if( subTree == false )
86  {
87  buf.push_back(h);
88  }
89  }
90 
91  if( !subtrees_.size())
92  subtrees_.push_back( h );
93  else
94  subtrees_ = buf;
95 
96  return result;
97 }
98 
99 void
101 {
102  depth_ = d;
103 }
104 
105 int
106 DDScope::depth( void ) const
107 {
108  return depth_;
109 }
110 
111 const DDScope::scope_type &
112 DDScope::scope( void ) const
113 {
114  return subtrees_;
115 }
116 
117 std::ostream & operator<<( std::ostream & os, const DDScope & scope )
118 {
119  DDScope::scope_type::const_iterator it = scope.subtrees_.begin();
120  for(; it != scope.subtrees_.end(); ++ it )
121  {
122  os << *it << std::endl;
123  }
124  return os;
125 }
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:48
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
tuple d
Definition: ztail.py:151
std::vector< DDGeoHistory > scope_type
Definition: DDScope.h:31
int depth(void) const
return the depth to wich the subtrees are restricted
Definition: DDScope.cc:106
tuple result
Definition: query.py:137
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
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
void setDepth(int)
subtrees of the scope are only transversed down to the given level
Definition: DDScope.cc:100
Definition: DDScope.h:7
dd_scope_class operator()(const DDGeoHistory &, const DDGeoHistory &) const
Definition: DDScope.cc:3
~DDScope(void)
Definition: DDScope.cc:44
DDScope(void)
empty scope
Definition: DDScope.cc:34
int depth_
Definition: DDScope.h:59
const scope_type & scope(void) const
returns the scope container
Definition: DDScope.cc:112