CMS 3D CMS Logo

Public Types | Public Member Functions | Protected Attributes | Friends

DDScope Class Reference

defines subtrees in the expanded-view More...

#include <DDScope.h>

List of all members.

Public Types

typedef std::vector< DDGeoHistoryscope_type

Public Member Functions

bool addScope (const DDGeoHistory &s)
 Adds a scope. No new scope will be added if s is already contained in one of the subtrees.
 DDScope ()
 empty scope
 DDScope (const DDGeoHistory &, int depth=0)
 scope with a single subtree
int depth () const
 return the depth to wich the subtrees are restricted
const scope_typescope () const
 returns the scope container
void setDepth (int)
 subtrees of the scope are only transversed down to the given level
 ~DDScope ()

Protected Attributes

DDScopeClassification classify_
int depth_
scope_type subtrees_

Friends

std::ostream & operator<< (std::ostream &, const DDScope &)

Detailed Description

defines subtrees in the expanded-view

One scope is defined by a set of DDGeoHistory.

Definition at line 26 of file DDScope.h.


Member Typedef Documentation

typedef std::vector<DDGeoHistory> DDScope::scope_type

Definition at line 31 of file DDScope.h.


Constructor & Destructor Documentation

DDScope::DDScope ( )

empty scope

Definition at line 37 of file DDScope.cc.

{ }
DDScope::DDScope ( const DDGeoHistory h,
int  depth = 0 
)

scope with a single subtree

Definition at line 40 of file DDScope.cc.

References subtrees_.

 : depth_(depth)
{
  subtrees_.push_back(h);
}
DDScope::~DDScope ( )

Definition at line 47 of file DDScope.cc.

{ }

Member Function Documentation

bool DDScope::addScope ( const DDGeoHistory s)

Adds a scope. No new scope will be added if s is already contained in one of the subtrees.

returns true, if scope has changed, else false.

Definition at line 51 of file DDScope.cc.

References classify_, different_branch, query::result, subtree, subtrees_, and supertree.

{
   bool result = false;
   //DCOUT('S',"DDScope::addScope()" << h);
   scope_type::iterator it = subtrees_.begin();
   scope_type buf;
   int supertreeCount = 0;
   bool diffBranch = false;
   bool subTree = false;
   //DDGeoHistory::size_type pos = subtree_.size();
   
   for(; it != subtrees_.end(); ++it) {
     dd_scope_class classification = classify_(h,*it);
     switch (classification) {
     
     case different_branch:
       buf.push_back(*it);
       diffBranch=true;
       //buf.push_back(h);
       //DCOUT('S',"  ->different_branch");
       break;
     
     case subtree:
       buf.push_back(*it);
       subTree = true;
       //DCOUT('S',"  ->subtree");
       break;
     
     case supertree:
       //buf.push_back(h);   
       ++supertreeCount;
       if (supertreeCount==1)
         buf.push_back(h);
       //DCOUT('S',"  ->supertree");
       break;
       
     default:
      ;  
     }
   }
   
   if (diffBranch) {
     if (subTree==false) {
       buf.push_back(h);
     }  
   }
   
   if (!subtrees_.size()) 
     subtrees_.push_back(h);
   else  
     subtrees_ = buf;
   
   //DCOUT('S',"DDScope.size()=" << subtrees_.size() );  
   return result;
}
int DDScope::depth ( ) const

return the depth to wich the subtrees are restricted

Definition at line 114 of file DDScope.cc.

References depth_.

Referenced by DDQuery::exec().

{
  return depth_;
}
const DDScope::scope_type & DDScope::scope ( ) const

returns the scope container

Definition at line 120 of file DDScope.cc.

References subtrees_.

Referenced by DDQuery::exec().

{
   return subtrees_;
}
void DDScope::setDepth ( int  d)

subtrees of the scope are only transversed down to the given level

Definition at line 108 of file DDScope.cc.

References depth_.

{
  depth_ = d;
}

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const DDScope scope 
) [friend]

Definition at line 125 of file DDScope.cc.

{
   DDScope::scope_type::const_iterator it = scope.subtrees_.begin();
   for (; it!=scope.subtrees_.end(); ++ it) {
     os << *it << std::endl;
   }
   return os;
}

Member Data Documentation

Definition at line 58 of file DDScope.h.

Referenced by addScope().

int DDScope::depth_ [protected]

Definition at line 59 of file DDScope.h.

Referenced by depth(), and setDepth().

Definition at line 57 of file DDScope.h.

Referenced by addScope(), DDScope(), operator<<(), and scope().