Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:54:55

0001 #ifndef DDCore_DDScope_h
0002 #define DDCore_DDScope_h
0003 
0004 #include <iosfwd>
0005 #include <vector>
0006 
0007 #include "DetectorDescription/Core/interface/DDExpandedNode.h"
0008 
0009 enum dd_scope_class { different_branch, subtree, supertree, delete_action };
0010 
0011 //! Classification of scope describe by A towards B
0012 /**
0013   The leaf-node of A defines the root of a subtree in the DDExpandedView, so does the 
0014   leaf-node of B.
0015   - returns different_branch, if the leaf-node of A defines a different subtree than the leaf-node of B
0016   - returns subtree, if the leaf-node of A is in the subtree rooted by the leaf-node of B
0017   - returns supertree, if the leaf-node of B is in the subtree rooted by the leaf-node of A
0018 */
0019 struct DDScopeClassification {
0020   dd_scope_class operator()(const DDGeoHistory &, const DDGeoHistory &) const;
0021 };
0022 
0023 //! defines subtrees in the expanded-view
0024 /**
0025   One scope is defined by a set of DDGeoHistory. 
0026 */
0027 class DDScope {
0028   friend std::ostream &operator<<(std::ostream &, const DDScope &);
0029 
0030 public:
0031   typedef std::vector<DDGeoHistory> scope_type;
0032 
0033   //! empty scope
0034   DDScope(void);
0035 
0036   //! scope with a single subtree
0037   DDScope(const DDGeoHistory &, int depth = 0);
0038 
0039   ~DDScope(void);
0040 
0041   //! Adds a scope. No new scope will be added if s is already contained in one of the subtrees
0042   /**
0043     returns true, if scope has changed, else false.
0044   */
0045   bool addScope(const DDGeoHistory &s);
0046 
0047   //! subtrees of the scope are only transversed down to the given level
0048   void setDepth(int);
0049 
0050   //! return the depth to wich the subtrees are restricted
0051   int depth(void) const;
0052 
0053   //! returns the scope container
0054   const scope_type &scope(void) const;
0055 
0056 protected:
0057   scope_type subtrees_;
0058   DDScopeClassification classify_;
0059   int depth_;
0060 };
0061 
0062 std::ostream &operator<<(std::ostream &, const DDScope &);
0063 
0064 #endif