5 #include "GeoModelKernel/GeoFullPhysVol.h" 6 #include "GeoModelKernel/GeoTransform.h" 7 #include "GeoModelKernel/GeoNodeAction.h" 8 #include "GeoModelKernel/GeoCountVolAction.h" 9 #include "GeoModelKernel/GeoCountVolAndSTAction.h" 10 #include "GeoModelKernel/GeoAccessVolumeAction.h" 14 GeoFullPhysVol::GeoFullPhysVol (
const GeoLogVol* LogVol)
16 , m_cloneOrigin(nullptr)
20 GeoFullPhysVol::~GeoFullPhysVol()
22 for(
const GeoGraphNode* daughter : m_daughters) daughter->unref();
23 if(m_cloneOrigin && m_cloneOrigin!=
this) m_cloneOrigin->unref();
28 if(m_cloneOrigin)
throw std::runtime_error(
"Attempt to modify contents of a cloned FPV");
30 m_daughters.push_back(graphNode);
32 graphNode->dockTo(
this);
68 action->getPath()->push(
this);
69 if(action->getDepthLimit().isValid()
70 && action->getPath()->getLength()-1 > action->getDepthLimit()) {
71 action->getPath()->pop();
77 action->handleFullPhysVol(
this);
78 if(action->shouldTerminate()) {
79 action->getPath()->pop();
86 if(action->getDepthLimit().isValid()
87 && action->getPath()->getLength() > action->getDepthLimit()) {
90 for(
size_t c = 0; c<m_daughters.size(); c++) {
91 m_daughters[c]->exec(action);
92 if(action->shouldTerminate()) {
93 action->getPath()->pop();
102 action->getPath()->pop();
123 return cv.getCount();
136 for(
unsigned int ind = 0; ind < this->m_daughters.size(); ind++) {
138 clone->
add(daughter);
142 if(this->m_cloneOrigin==0) {
143 this->m_cloneOrigin =
this;
145 clone->m_cloneOrigin = this->m_cloneOrigin;
146 this->m_cloneOrigin->ref();
154 return m_cloneOrigin;
162 for(
size_t i=0; i<m_daughters.size(); i++)
163 m_daughters[i]->unref();
171 if (isShared())
throw std::runtime_error(
"Transform requested from shared volume");
172 GeoTrf::Transform3D xform(GeoTrf::Transform3D::Identity());
176 const GeoGraphNode *
const * fence = getParent()->getChildNode(0);
177 const GeoGraphNode *
const * node1 = getParent()->findChildNode(
this);
179 for(
const GeoGraphNode *
const * current = node1 - 1; current>=fence; current--) {
183 if (dynamic_cast<const GeoVPhysVol *>(*current))
break;
188 if (dynamic_cast<const GeoSerialTransformer *>(*current))
break;
205 if (isShared())
throw std::runtime_error(
"Transform requested from shared volume");
206 GeoTrf::Transform3D xform(GeoTrf::Transform3D::Identity());
210 const GeoGraphNode *
const * fence = getParent()->getChildNode(0);
211 const GeoGraphNode *
const * node1 = getParent()->findChildNode(
this);
213 for(
const GeoGraphNode *
const * current = node1 - 1; current>=fence; current--) {
217 if (dynamic_cast<const GeoVPhysVol *>(*current))
break;
222 if (dynamic_cast<const GeoSerialTransformer *>(*current))
break;
236 unsigned int GeoFullPhysVol::getNChildNodes()
const 238 return m_daughters.size();
241 const GeoGraphNode *
const * GeoFullPhysVol::getChildNode(
unsigned int i)
const 243 return &(m_daughters[i]);
247 std::vector<const GeoGraphNode *>::const_iterator i = std::find(m_daughters.begin(),m_daughters.end(),n);
248 if (i==m_daughters.end()) {
virtual GeoTrf::Transform3D getXToChildVol(unsigned int index, const GeoVAlignmentStore *store=nullptr) const override
Returns the transform to the ith volume.
An action to count the number of physical volumes and Serial Transformers.
GeoFullPhysVol * clone(bool attached=true)
virtual PVConstLink getChildVol(unsigned int index) const override
Returns the ith child volume.
virtual unsigned int getNChildVols() const override
Returns the number of child physical volumes.
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...
PVConstLink getVolume() const
Returns the selected physical volume or nullptr if not found.
This class represent a physical volume whose absolute default and aligned positions are known and hel...
virtual std::string getNameOfChildVol(unsigned int i) const override
Returns the name of the child.
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.
virtual unsigned int getNChildVolAndST() const override
Returns the number of child physical volumes and Serial Transformers.
virtual GeoTrf::Transform3D getDefXToChildVol(unsigned int index, const GeoVAlignmentStore *store=nullptr) const override
Returns the default transform to the ith volume.
virtual Query< int > getIdOfChildVol(unsigned int i) const override
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...
virtual void exec(GeoNodeAction *action) const override
Executes a GeoNodeAction.
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): ...
void add(GeoGraphNode *graphNode)
Adds a Graph Node to the Geometry Graph.
Accesses volumes, returning the ith volume and also its transformation relative to the parent...