5 #include "GeoModelKernel/GeoPhysVol.h" 6 #include "GeoModelKernel/GeoNodeAction.h" 7 #include "GeoModelKernel/GeoTransform.h" 8 #include "GeoModelKernel/GeoCountVolAction.h" 9 #include "GeoModelKernel/GeoCountVolAndSTAction.h" 10 #include "GeoModelKernel/GeoAccessVolumeAction.h" 15 GeoPhysVol::GeoPhysVol(
const GeoLogVol* LogVol)
20 GeoPhysVol::~GeoPhysVol()
22 std::lock_guard<std::mutex> lk(m_muxVec);
23 for(
const GeoGraphNode* daughter : m_daughters) daughter->unref();
28 std::lock_guard<std::mutex> lk(m_muxVec);
29 m_daughters.push_back(graphNode);
31 graphNode->dockTo(
this);
38 return cv.getCount ();
69 action->getPath()->push(
this);
70 if(action->getDepthLimit().isValid()
71 && action->getPath()->getLength() - 1 > action->getDepthLimit()) {
72 action->getPath ()->pop ();
78 action->handlePhysVol(
this);
79 if(action->shouldTerminate()) {
80 action->getPath()->pop();
86 if(action->getDepthLimit().isValid()
87 && action->getPath()->getLength() > action->getDepthLimit()) {
93 for(
size_t c = 0; c < m_daughters.size (); c++) {
94 m_daughters[c]->exec(action);
95 if(action->shouldTerminate()) {
96 action->getPath()->pop();
104 action->getPath()->pop();
125 return cv.getCount();
132 if (isShared())
throw std::runtime_error(
"Transform requested from shared volume");
133 GeoTrf::Transform3D xform(GeoTrf::Transform3D::Identity());
137 const GeoGraphNode *
const * fence = getParent()->getChildNode(0);
138 const GeoGraphNode *
const * node1 = getParent()->findChildNode(
this);
140 for(
const GeoGraphNode *
const * current = node1 - 1; current>=fence; current--) {
144 if(dynamic_cast<const GeoVPhysVol *>(*current))
break;
149 if(dynamic_cast<const GeoSerialTransformer *>(*current))
break;
166 if (isShared())
throw std::runtime_error(
"Transform requested from shared volume");
167 GeoTrf::Transform3D xform(GeoTrf::Transform3D::Identity());
171 const GeoGraphNode *
const * fence = getParent()->getChildNode(0);
172 const GeoGraphNode *
const * node1 = getParent()->findChildNode(
this);
174 for(
const GeoGraphNode *
const * current = node1 - 1; current>=fence; current--) {
178 if (dynamic_cast<const GeoVPhysVol *>(*current))
break;
183 if (dynamic_cast<const GeoSerialTransformer *>(*current))
break;
196 unsigned int GeoPhysVol::getNChildNodes()
const 198 std::lock_guard<std::mutex> lk(m_muxVec);
199 return m_daughters.size();
202 const GeoGraphNode *
const * GeoPhysVol::getChildNode(
unsigned int i)
const 204 std::lock_guard<std::mutex> lk(m_muxVec);
205 return &(m_daughters[i]);
210 std::lock_guard<std::mutex> lk(m_muxVec);
211 std::vector<const GeoGraphNode *>::const_iterator i = std::find(m_daughters.begin(),m_daughters.end(),n);
212 if (i==m_daughters.end()) {
An action to count the number of physical volumes and Serial Transformers.
virtual void exec(GeoNodeAction *action) const override final
Executes a GeoNodeAction.
A Logical Volume, or agglomeration of shape and material. The logical volume increases the reference ...
Abstract base class for GeoModel alignment stores The interface allows to store/retrieve transformati...
virtual GeoTrf::Transform3D getDefXToChildVol(unsigned int index, const GeoVAlignmentStore *store=nullptr) const override final
Returns the default transform to the ith volume.
PVConstLink getVolume() const
Returns the selected physical volume or nullptr if not found.
virtual PVConstLink getChildVol(unsigned int index) const override final
Returns the ith child volume.
const std::string & getName() const
Returns the name of the volume. From nametag or serial denominator.
virtual unsigned int getNChildVolAndST() const override final
Returns the number of child physical volumes and Serial Transformers.
Query< int > getId() const
Returns the id of the volume. From the identifier.
virtual unsigned int getNChildVols() const override final
Returns the number of child physical volumes.
virtual std::string getNameOfChildVol(unsigned int i) const override final
Returns the name of the child.
virtual Query< int > getIdOfChildVol(unsigned int i) const override final
Returns the id of the child.
const GeoTrf::Transform3D & getDefTransform() const
Returns the default ransformation to the volume.
Smart pointer to physical volume... constant.
This type of action sees the geometry graph in full detail, including each transformation and propert...
const GeoTrf::Transform3D & getTransform() const
Returns the transformation to the volume.
Represents Nodes that can be assembled together to make a graph. Subclasses (for now): ...
Accesses volumes, returning the ith volume and also its transformation relative to the parent...
virtual GeoTrf::Transform3D getXToChildVol(unsigned int index, const GeoVAlignmentStore *store=nullptr) const override final
Returns the transform to the ith volume.