5 #include "GeoModelKernel/GeoVFullPhysVol.h" 6 #include "GeoModelKernel/GeoVAlignmentStore.h" 9 GeoVFullPhysVol::GeoVFullPhysVol(
const GeoLogVol* logVol)
12 , m_absPosInfo(nullptr)
16 GeoVFullPhysVol::~GeoVFullPhysVol()
28 static std::string errorMessage(
"Full Physical Volume errroneously placed in a shared portion of a detector description graph.\nName of shared volume: ");
31 if(isShared())
throw std::runtime_error(errorMessage);
39 if(m_absPosInfo->getAbsTransform())
return *m_absPosInfo->getAbsTransform();
42 const GeoTrf::Transform3D* storedPos = store->getAbsPosition(
this);
43 if(storedPos!=
nullptr)
return *storedPos;
48 GeoTrf::Transform3D tProd(GeoTrf::Transform3D::Identity());
52 int index = parent->
indexOf (child);
53 GeoTrf::Transform3D transform = parent->
getXToChildVol(index,store);
55 GeoTrf::Transform3D transform = child->getX(store);
57 tProd = transform * tProd;
59 if(child->isShared()) {
60 throw std::runtime_error(errorMessage);
68 m_absPosInfo->setAbsTransform(tProd);
69 return *m_absPosInfo->getAbsTransform();
72 store->setAbsPosition(
this,tProd);
73 const GeoTrf::Transform3D* storedPosition = store->getAbsPosition(
this);
74 return *storedPosition;
81 m_absPosInfo =
nullptr;
90 static std::string errorMessage(
"Full Physical Volume errroneously placed in a shared portion of a detector description graph.\nName of shared volume: ");
93 if(isShared())
throw std::runtime_error(errorMessage);
101 if(m_absPosInfo->getDefAbsTransform())
return *m_absPosInfo->getDefAbsTransform();
104 const GeoTrf::Transform3D* storedPos = store->getDefAbsPosition(
this);
105 if(storedPos!=
nullptr)
return *storedPos;
110 GeoTrf::Transform3D tProd(GeoTrf::Transform3D::Identity());
114 int index = parent->
indexOf (child);
117 GeoTrf::Transform3D transform = child->getDefX(store);
119 tProd = transform * tProd;
121 if(child->isShared()) {
122 throw std::runtime_error(errorMessage);
130 m_absPosInfo->setDefAbsTransform(tProd);
131 return *m_absPosInfo->getDefAbsTransform();
134 store->setDefAbsPosition(
this,tProd);
135 const GeoTrf::Transform3D* storedPosition = store->getDefAbsPosition(
this);
136 return *storedPosition;
146 static std::string errorMessage(
"Full Physical Volume errroneously placed in a shared portion of a detector description graph.\nName of shared volume: ");
150 if(m_absName ==
"") {
151 if(isShared())
throw std::runtime_error(errorMessage);
161 int index = parent->
indexOf (child);
164 tProd = tProd +
"/" + name;
166 if (child->isShared ()) {
167 throw std::runtime_error(errorMessage);
185 static std::string errorMessage(
"Full Physical Volume errroneously placed in a shared portion of a detector description graph.\nName of shared volume: ");
190 if(isShared())
throw std::runtime_error(errorMessage);
198 throw std::runtime_error(errorMessage);
204 int index = parent->
indexOf(child);
205 m_id =
new Query<int>(parent->getIdOfChildVol(index));
const std::string & getAbsoluteName()
Returns the absolute name of this node.
void clearPositionInfo() const
virtual GeoTrf::Transform3D getXToChildVol(unsigned int index, const GeoVAlignmentStore *store=nullptr) const =0
Returns the transform to the ith volume.
unsigned int getId() const
Returns the identification bits.
A Logical Volume, or agglomeration of shape and material. The logical volume increases the reference ...
virtual std::string getNameOfChildVol(unsigned int i) const =0
Returns the name of the child.
Abstract base class for GeoModel alignment stores The interface allows to store/retrieve transformati...
const GeoTrf::Transform3D & getAbsoluteTransform(GeoVAlignmentStore *store=nullptr) const
Returns the absolute transform of the volume.
PVConstLink getParent() const
Gets the parent, if the parent is unique, and otherwise returns a nullptr pointer.
virtual GeoTrf::Transform3D getDefXToChildVol(unsigned int index, const GeoVAlignmentStore *store=nullptr) const =0
Returns the default transform to the ith volume.
Smart pointer to physical volume... constant.
Query< unsigned int > indexOf(PVConstLink daughter) const
const GeoTrf::Transform3D & getDefAbsoluteTransform(GeoVAlignmentStore *store=nullptr) const
Returns the default absolute transform of the volume.
This class represents anything whose default and aligned postions are known and cached.