diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonReadoutElement.cxx b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonReadoutElement.cxx index c8309cb246372736828f88dc720905a2bbe0971b..ca926e5bef614c67fe41a9abedb903148d9338ef 100644 --- a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonReadoutElement.cxx +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonReadoutElement.cxx @@ -78,11 +78,11 @@ StatusCode MuonReadoutElement::insertTransform(const IdentifierHash& hash, <<" has already a transformation cached for hash "<<hash); return StatusCode::FAILURE; } - m_localToGlobalCaches.insert(std::make_unique<ActsTrk::TransformCache>(hash, make)); + m_localToGlobalCaches.insert(std::make_unique<ActsTrk::TransformCache>(hash, make, this)); m_globalToLocalCaches.insert(std::make_unique<ActsTrk::TransformCache>(hash, [make](RawGeomAlignStore* store, const IdentifierHash& hash){ return make(store,hash).inverse(); - })); + }, this)); return StatusCode::SUCCESS; } bool MuonReadoutElement::storeAlignment(RawGeomAlignStore& store) const{ diff --git a/Tracking/Acts/ActsGeoUtils/ActsGeoUtils/SurfaceCache.h b/Tracking/Acts/ActsGeoUtils/ActsGeoUtils/SurfaceCache.h index d097fba798609b2fcd3447875168c15cc9116f1e..04ca44c947d3365ec7dc4b513a8e0ed04fc6fc3a 100644 --- a/Tracking/Acts/ActsGeoUtils/ActsGeoUtils/SurfaceCache.h +++ b/Tracking/Acts/ActsGeoUtils/ActsGeoUtils/SurfaceCache.h @@ -43,6 +43,8 @@ namespace ActsTrk { /// Hash of the SurfaceCache which is the same as the one of the TransformCache. IdentifierHash hash() const; + /// Returns the associated transform cache + const TransformCache* transformCache() const; private: const TransformCache* m_transformCache{nullptr}; ActsTrk::DetectorType m_type{ActsTrk::DetectorType::UnDefined}; diff --git a/Tracking/Acts/ActsGeoUtils/ActsGeoUtils/TransformCache.h b/Tracking/Acts/ActsGeoUtils/ActsGeoUtils/TransformCache.h index f4361ad8a9c06bf79cbbaef2d63c60c87a7aeaca..cb0199c54db8411e07356b97b34c2fe83711603e 100644 --- a/Tracking/Acts/ActsGeoUtils/ActsGeoUtils/TransformCache.h +++ b/Tracking/Acts/ActsGeoUtils/ActsGeoUtils/TransformCache.h @@ -1,10 +1,11 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef ActsGeoUtils_TransformCache_H #define ActsGeoUtils_TransformCache_H #include <ActsGeoUtils/Defs.h> +#include <ActsGeometryInterfaces/IDetectorElement.h> #include <CxxUtils/CachedUniquePtr.h> #include <Identifier/IdentifierHash.h> @@ -27,7 +28,8 @@ namespace ActsTrk { /** @brief: Standard constructor taking the hash of the sensor element and * and the TransformMaker expressed usually as a lambda function **/ - TransformCache(const IdentifierHash& hash, TransformMaker maker); + TransformCache(const IdentifierHash& hash, TransformMaker maker, + const IDetectorElement* parentEle = nullptr); /** @brief Returns the matching transformation from the alignment store. * If a nullptr is given, then it's equivalent to the case that the transformation @@ -41,10 +43,13 @@ namespace ActsTrk { IdentifierHash hash() const; /** @brief Returns the transform maker function of this transformation cache*/ const TransformMaker& transformMaker() const; + /** @brief Returns the parent IDetectorElement owning the cache*/ + const IDetectorElement* parent() const; private: IdentifierHash m_hash{0}; TransformMaker m_transform{}; mutable CxxUtils::CachedUniquePtr<Amg::Transform3D> m_nomCache ATLAS_THREAD_SAFE{}; + const IDetectorElement* m_parent{nullptr}; }; inline bool operator<(const std::unique_ptr<TransformCache>& a, diff --git a/Tracking/Acts/ActsGeoUtils/src/SurfaceCache.cxx b/Tracking/Acts/ActsGeoUtils/src/SurfaceCache.cxx index 7bf848e7572d4cac5a7377b336333ae879237fa4..180582632d10afc60eda51723e046330a5fdb70f 100644 --- a/Tracking/Acts/ActsGeoUtils/src/SurfaceCache.cxx +++ b/Tracking/Acts/ActsGeoUtils/src/SurfaceCache.cxx @@ -19,6 +19,7 @@ namespace ActsTrk{ m_transformCache{transformCache}, m_type{type} {} + const TransformCache* SurfaceCache::transformCache() const { return m_transformCache; } const Acts::Transform3& SurfaceCache::transform(const Acts::GeometryContext& anygctx) const { const ActsGeometryContext* gctx = anygctx.get<const ActsGeometryContext*>(); // unpack the alignment store from the context diff --git a/Tracking/Acts/ActsGeoUtils/src/TransformCache.cxx b/Tracking/Acts/ActsGeoUtils/src/TransformCache.cxx index f8ee34e4f085b40318c12057ce644e9b35dc3d12..a0e643c8c5a088fa8ac80998bc50598497a33e28 100644 --- a/Tracking/Acts/ActsGeoUtils/src/TransformCache.cxx +++ b/Tracking/Acts/ActsGeoUtils/src/TransformCache.cxx @@ -1,6 +1,6 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include <ActsGeoUtils/TransformCache.h> @@ -13,10 +13,16 @@ } namespace ActsTrk { TransformCache::TransformCache(const IdentifierHash& hash, - TransformMaker maker): + TransformMaker maker, + const IDetectorElement* parentEle): m_hash{hash}, - m_transform{maker} {} + m_transform{maker}, + m_parent{parentEle} {} + const IDetectorElement* TransformCache::parent() const{ + return m_parent; + } + const Amg::Transform3D& TransformCache::getTransform(const ActsTrk::AlignmentStore* alignStore) const { /// Valid alignment store is given -> Take the transformation from the cache there if (alignStore){