GeoModel - GeoModelCore
Public Member Functions | Private Attributes | List of all members
GeoVPhysVol Class Referenceabstract
Inheritance diagram for GeoVPhysVol:
GeoGraphNode RCBase GeoPhysVol GeoVFullPhysVol GeoFullPhysVol

Public Member Functions

 GeoVPhysVol (const GeoLogVol *LogVol)
 
 GeoVPhysVol (const GeoVPhysVol &right)=delete
 
GeoVPhysVol & operator= (const GeoVPhysVol &right)=delete
 
bool isShared () const
 
Query< unsigned int > indexOf (PVConstLink daughter) const
 
PVConstLink getParent () const
 Gets the parent, if the parent is unique, and otherwise returns a nullptr pointer.
 
const GeoLogVol * getLogVol () const
 Returns the logical volume.
 
virtual unsigned int getNChildVols () const =0
 Returns the number of child physical volumes.
 
virtual PVConstLink getChildVol (unsigned int index) const =0
 Returns the ith child volume.
 
virtual GeoTrf::Transform3D getXToChildVol (unsigned int index, const GeoVAlignmentStore *store=nullptr) const =0
 Returns the transform to the ith volume.
 
virtual GeoTrf::Transform3D getDefXToChildVol (unsigned int index, const GeoVAlignmentStore *store=nullptr) const =0
 Returns the default transform to the ith volume.
 
virtual std::string getNameOfChildVol (unsigned int i) const =0
 Returns the name of the child.
 
void apply (GeoVolumeAction *action) const
 
virtual void dockTo (GeoVPhysVol *parent)
 
virtual Query< int > getIdOfChildVol (unsigned int i) const =0
 Returns the id of the child.
 
virtual unsigned int getNChildVolAndST () const =0
 Returns the number of child physical volumes and Serial Transformers.
 
virtual GeoTrf::Transform3D getX (const GeoVAlignmentStore *store=nullptr) const =0
 
virtual GeoTrf::Transform3D getDefX (const GeoVAlignmentStore *store=nullptr) const =0
 
virtual unsigned int getNChildNodes () const =0
 
virtual const GeoGraphNode *const * getChildNode (unsigned int i) const =0
 
virtual const GeoGraphNode *const * findChildNode (const GeoGraphNode *n) const =0
 
- Public Member Functions inherited from GeoGraphNode
virtual void exec (GeoNodeAction *action) const
 
- Public Member Functions inherited from RCBase
void ref () const
 
void unref () const
 
unsigned int refCount () const
 

Private Attributes

const GeoVPhysVol * m_parentPtr
 
const GeoLogVol * m_logVol
 

Detailed Description

Definition at line 28 of file GeoVPhysVol.h.

Member Function Documentation

void GeoVPhysVol::apply ( GeoVolumeAction *  action) const

Applies an action to the volume. The volume executes the action and the applies it to the children, either from the top down or the bottom up, depending upon the configuration of the action.

Definition at line 44 of file GeoVPhysVol.cxx.

45 {
46  int nVols(0);
47  switch(action->getType()) {
48  case GeoVolumeAction::TOP_DOWN:
49  action->handleVPhysVol(this);
50  if(action->shouldTerminate()) return;
51 
52  action->getState()->nextLevel(this);
53  nVols = getNChildVols();
54  for(int d = 0; d < nVols; d++) {
55  GeoAccessVolumeAction av(d,nullptr);
56  exec (&av);
57 
58  action->getState()->setTransform(av.getTransform());
59  action->getState()->setDefTransform(av.getDefTransform());
60  action->getState()->setId(av.getId());
61  action->getState()->setName(av.getName());
62 
63  av.getVolume()->apply(action);
64  if(action->shouldTerminate()) break;
65  }
66  action->getState()->previousLevel();
67  break;
68  case GeoVolumeAction::BOTTOM_UP:
69  action->getState()->nextLevel(this);
70  nVols = getNChildVols();
71  for(int d = 0; d < nVols; d++) {
72  GeoAccessVolumeAction av(d,nullptr);
73  exec(&av);
74 
75  action->getState()->setTransform(av.getTransform());
76  action->getState()->setDefTransform(av.getDefTransform());
77  action->getState()->setId(av.getId());
78  action->getState()->setName(av.getName());
79 
80  av.getVolume()->apply(action);
81  if(action->shouldTerminate()) break;
82  }
83  action->getState()->previousLevel();
84 
85  action->handleVPhysVol(this);
86  if(action->shouldTerminate()) return; // To Do: do I need this?
87  break;
88  default:
89  throw std::runtime_error("GeoVPhysVol::apply(). Unsupported GeoVolumeAction type " + std::to_string((unsigned)action->getType()));
90  }
91 }
Accesses volumes, returning the ith volume and also its transformation relative to the parent...
virtual unsigned int getNChildVols() const =0
Returns the number of child physical volumes.
void GeoVPhysVol::dockTo ( GeoVPhysVol *  parent)
virtual

When a node is added to a parent in the graph, the node is always notified. What happens at that time is up to the node. Most nodes do not need to do anything. Some–the alignable transforms in particular–need to take some actions, such as adding the parent volume to a list.

Reimplemented from GeoGraphNode.

Definition at line 93 of file GeoVPhysVol.cxx.

94 {
95  if(m_parentPtr) {
96  m_parentPtr = this;
97  }
98  else {
99  m_parentPtr = parent;
100  }
101 }
const GeoVPhysVol * m_parentPtr
Definition: GeoVPhysVol.h:96
Query< unsigned int > GeoVPhysVol::indexOf ( PVConstLink  daughter) const

Returns the index of a specific daughter volume. The Query class can be used just like an unsigned int, but it provides and isValid() method to determine whether it is valid and throws an exception if an invalid value is blithely used.

Definition at line 24 of file GeoVPhysVol.cxx.

25 {
26  unsigned int nChildVols{getNChildVols()};
27  for(unsigned int i=0; i<nChildVols; i++) { // To Do: replace this with Volume Iterator!
28  if(getChildVol(i) == daughter) return i;
29  }
30  return Query<unsigned int >();
31 }
virtual PVConstLink getChildVol(unsigned int index) const =0
Returns the ith child volume.
virtual unsigned int getNChildVols() const =0
Returns the number of child physical volumes.
bool GeoVPhysVol::isShared ( ) const
inline

Returns true if the physical volume is accessed by more than one parent. Should check this before trusting the parent pointer.

Definition at line 101 of file GeoVPhysVol.h.

102 {
103  return m_parentPtr == this;
104 }
const GeoVPhysVol * m_parentPtr
Definition: GeoVPhysVol.h:96

Member Data Documentation

const GeoVPhysVol* GeoVPhysVol::m_parentPtr
private

If one parent ...pointer=PARENT; If no parent ...pointer=nullptr. If more than one parent ...pointer=this;

Definition at line 96 of file GeoVPhysVol.h.


The documentation for this class was generated from the following files: