DDScope

DDScopeClassification

dd_scope_class

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
#ifndef DDCore_DDScope_h
#define DDCore_DDScope_h

#include <iosfwd>
#include <vector>

#include "DetectorDescription/Core/interface/DDExpandedNode.h"

enum dd_scope_class { different_branch, subtree, supertree, delete_action };

//! Classification of scope describe by A towards B
/**
  The leaf-node of A defines the root of a subtree in the DDExpandedView, so does the 
  leaf-node of B.
  - returns different_branch, if the leaf-node of A defines a different subtree than the leaf-node of B
  - returns subtree, if the leaf-node of A is in the subtree rooted by the leaf-node of B
  - returns supertree, if the leaf-node of B is in the subtree rooted by the leaf-node of A
*/
struct DDScopeClassification {
  dd_scope_class operator()(const DDGeoHistory &, const DDGeoHistory &) const;
};

//! defines subtrees in the expanded-view
/**
  One scope is defined by a set of DDGeoHistory. 
*/
class DDScope {
  friend std::ostream &operator<<(std::ostream &, const DDScope &);

public:
  typedef std::vector<DDGeoHistory> scope_type;

  //! empty scope
  DDScope(void);

  //! scope with a single subtree
  DDScope(const DDGeoHistory &, int depth = 0);

  ~DDScope(void);

  //! 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.
  */
  bool addScope(const DDGeoHistory &s);

  //! subtrees of the scope are only transversed down to the given level
  void setDepth(int);

  //! return the depth to wich the subtrees are restricted
  int depth(void) const;

  //! returns the scope container
  const scope_type &scope(void) const;

protected:
  scope_type subtrees_;
  DDScopeClassification classify_;
  int depth_;
};

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

#endif