CMS 3D CMS Logo

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