Skip to content
Snippets Groups Projects
Commit 3bc8efed authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

Merge branch 'geoVFPV-interface' into 'geovfullphysvol-extension'

Introduced two new methods for GeoVFullPhysVol for accessing cached absolute positions

See merge request GeoModelDev/GeoModel!79
parents 8a25c826 ed3f6298
No related branches found
No related tags found
1 merge request!79Introduced two new methods for GeoVFullPhysVol for accessing cached absolute positions
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#ifndef GEOMODELKERNEL_GEOVFULLPHYSVOL_H
......@@ -19,8 +19,22 @@ class GeoVFullPhysVol : public GeoVPhysVol
GeoVFullPhysVol(const GeoVFullPhysVol &right) = delete;
GeoVFullPhysVol & operator=(const GeoVFullPhysVol &right) = delete;
/// Returns the absolute transform of the volume.
/// Returns the (default) absolute transform of the volume.
/// 1. When store=nullptr. This is considered a "serial case" when
/// the cached (default) absolute transform is kept as a data member of the
/// GeoVFullPhysVol class. If the local cache is empty, then it gets computed and stored.
///
/// 2. When store!=nullptr. This is considered a "multithreaded case" when
/// the cached (default) absolute trnasforms of Full Physical Volumes are kept in
/// an external object pointed by store. If the cache for given full physical
/// volume is missing, it gets computed and saved in the store.
const GeoTrf::Transform3D& getAbsoluteTransform(GeoVAlignmentStore* store=nullptr) const;
const GeoTrf::Transform3D& getDefAbsoluteTransform(GeoVAlignmentStore* store=nullptr) const;
/// Returns the previously computed and cached (default) absolute transform of the volume.
/// If the cache has not yet been computed, and exception gets thrown
const GeoTrf::Transform3D& getCachedAbsoluteTransform(const GeoVAlignmentStore* store=nullptr) const;
const GeoTrf::Transform3D& getCachedDefAbsoluteTransform(const GeoVAlignmentStore* store=nullptr) const;
/// Clears the position information. This can be used if
/// the cache is determined to be invalid. The usual client
......@@ -28,9 +42,6 @@ class GeoVFullPhysVol : public GeoVPhysVol
/// There is little need for casual users to call this.
void clearPositionInfo() const;
/// Returns the default absolute transform of the volume.
const GeoTrf::Transform3D& getDefAbsoluteTransform(GeoVAlignmentStore* store=nullptr) const;
/// Returns the absolute name of this node.
const std::string& getAbsoluteName();
......
......@@ -75,6 +75,19 @@ const GeoTrf::Transform3D & GeoVFullPhysVol::getAbsoluteTransform(GeoVAlignmentS
}
}
const GeoTrf::Transform3D& GeoVFullPhysVol::getCachedAbsoluteTransform(const GeoVAlignmentStore* store) const
{
if(store==nullptr) {
if(m_absPosInfo->getAbsTransform()) return *m_absPosInfo->getAbsTransform();
}
else {
const GeoTrf::Transform3D* storedPos = store->getAbsPosition(this);
if(storedPos) return *storedPos;
}
throw std::runtime_error("Failed to find the cached absolute transform for " + getLogVol()->getName());
}
void GeoVFullPhysVol::clearPositionInfo() const
{
delete m_absPosInfo;
......@@ -137,6 +150,18 @@ const GeoTrf::Transform3D& GeoVFullPhysVol::getDefAbsoluteTransform(GeoVAlignmen
}
}
const GeoTrf::Transform3D& GeoVFullPhysVol::getCachedDefAbsoluteTransform(const GeoVAlignmentStore* store) const
{
if(store==nullptr) {
if(m_absPosInfo->getDefAbsTransform()) return *m_absPosInfo->getDefAbsTransform();
}
else {
const GeoTrf::Transform3D* storedPos = store->getDefAbsPosition(this);
if(storedPos) return *storedPos;
}
throw std::runtime_error("Failed to find the cached default absolute transform for " + getLogVol()->getName());
}
const std::string & GeoVFullPhysVol::getAbsoluteName ()
{
//------------------------------------------------------------------------------------------------//
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment