5 #include "GeoModelKernel/GeoVPhysVol.h" 6 #include "GeoModelKernel/GeoVolumeAction.h" 7 #include "GeoModelKernel/GeoAccessVolumeAction.h" 12 GeoVPhysVol::GeoVPhysVol(
const GeoLogVol* LogVol)
13 : m_parentPtr(nullptr)
16 if(m_logVol) m_logVol->ref();
19 GeoVPhysVol::~GeoVPhysVol()
21 if(m_logVol) m_logVol->unref();
26 unsigned int nChildVols{getNChildVols()};
27 for(
unsigned int i=0; i<nChildVols; i++) {
28 if(getChildVol(i) == daughter)
return i;
35 if(m_parentPtr !=
this)
return m_parentPtr;
47 switch(action->getType()) {
48 case GeoVolumeAction::TOP_DOWN:
49 action->handleVPhysVol(
this);
50 if(action->shouldTerminate())
return;
52 action->getState()->nextLevel(
this);
53 nVols = getNChildVols();
54 for(
int d = 0; d < nVols; d++) {
60 action->getState()->setId(av.
getId());
61 action->getState()->setName(av.
getName());
64 if(action->shouldTerminate())
break;
66 action->getState()->previousLevel();
68 case GeoVolumeAction::BOTTOM_UP:
69 action->getState()->nextLevel(
this);
70 nVols = getNChildVols();
71 for(
int d = 0; d < nVols; d++) {
77 action->getState()->setId(av.
getId());
78 action->getState()->setName(av.
getName());
81 if(action->shouldTerminate())
break;
83 action->getState()->previousLevel();
85 action->handleVPhysVol(
this);
86 if(action->shouldTerminate())
return;
89 throw std::runtime_error(
"GeoVPhysVol::apply(). Unsupported GeoVolumeAction type " + std::to_string((
unsigned)action->getType()));
A Logical Volume, or agglomeration of shape and material. The logical volume increases the reference ...
This type of action sees and traverses a simpler tree of positioned volumes. It does not descend into...
PVConstLink getVolume() const
Returns the selected physical volume or nullptr if not found.
const std::string & getName() const
Returns the name of the volume. From nametag or serial denominator.
Query< int > getId() const
Returns the id of the volume. From the identifier.
void apply(GeoVolumeAction *action) const
virtual void dockTo(GeoVPhysVol *parent)
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.
const GeoTrf::Transform3D & getDefTransform() const
Returns the default ransformation to the volume.
Smart pointer to physical volume... constant.
Query< unsigned int > indexOf(PVConstLink daughter) const
const GeoTrf::Transform3D & getTransform() const
Returns the transformation to the volume.
Accesses volumes, returning the ith volume and also its transformation relative to the parent...