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

Merge branch 'ConnectTransformCacheRe' into 'main'

ActsTransformCache - Establish link to parents

See merge request atlas/athena!69617
parents 53e46bcd 2c8568a4
No related branches found
No related tags found
No related merge requests found
...@@ -78,11 +78,11 @@ StatusCode MuonReadoutElement::insertTransform(const IdentifierHash& hash, ...@@ -78,11 +78,11 @@ StatusCode MuonReadoutElement::insertTransform(const IdentifierHash& hash,
<<" has already a transformation cached for hash "<<hash); <<" has already a transformation cached for hash "<<hash);
return StatusCode::FAILURE; 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, m_globalToLocalCaches.insert(std::make_unique<ActsTrk::TransformCache>(hash,
[make](RawGeomAlignStore* store, const IdentifierHash& hash){ [make](RawGeomAlignStore* store, const IdentifierHash& hash){
return make(store,hash).inverse(); return make(store,hash).inverse();
})); }, this));
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
bool MuonReadoutElement::storeAlignment(RawGeomAlignStore& store) const{ bool MuonReadoutElement::storeAlignment(RawGeomAlignStore& store) const{
......
...@@ -43,6 +43,8 @@ namespace ActsTrk { ...@@ -43,6 +43,8 @@ namespace ActsTrk {
/// Hash of the SurfaceCache which is the same as the one of the TransformCache. /// Hash of the SurfaceCache which is the same as the one of the TransformCache.
IdentifierHash hash() const; IdentifierHash hash() const;
/// Returns the associated transform cache
const TransformCache* transformCache() const;
private: private:
const TransformCache* m_transformCache{nullptr}; const TransformCache* m_transformCache{nullptr};
ActsTrk::DetectorType m_type{ActsTrk::DetectorType::UnDefined}; ActsTrk::DetectorType m_type{ActsTrk::DetectorType::UnDefined};
......
/* /*
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 #ifndef ActsGeoUtils_TransformCache_H
#define ActsGeoUtils_TransformCache_H #define ActsGeoUtils_TransformCache_H
#include <ActsGeoUtils/Defs.h> #include <ActsGeoUtils/Defs.h>
#include <ActsGeometryInterfaces/IDetectorElement.h>
#include <CxxUtils/CachedUniquePtr.h> #include <CxxUtils/CachedUniquePtr.h>
#include <Identifier/IdentifierHash.h> #include <Identifier/IdentifierHash.h>
...@@ -27,7 +28,8 @@ namespace ActsTrk { ...@@ -27,7 +28,8 @@ namespace ActsTrk {
/** @brief: Standard constructor taking the hash of the sensor element and /** @brief: Standard constructor taking the hash of the sensor element and
* and the TransformMaker expressed usually as a lambda function * 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. /** @brief Returns the matching transformation from the alignment store.
* If a nullptr is given, then it's equivalent to the case that the transformation * If a nullptr is given, then it's equivalent to the case that the transformation
...@@ -41,10 +43,13 @@ namespace ActsTrk { ...@@ -41,10 +43,13 @@ namespace ActsTrk {
IdentifierHash hash() const; IdentifierHash hash() const;
/** @brief Returns the transform maker function of this transformation cache*/ /** @brief Returns the transform maker function of this transformation cache*/
const TransformMaker& transformMaker() const; const TransformMaker& transformMaker() const;
/** @brief Returns the parent IDetectorElement owning the cache*/
const IDetectorElement* parent() const;
private: private:
IdentifierHash m_hash{0}; IdentifierHash m_hash{0};
TransformMaker m_transform{}; TransformMaker m_transform{};
mutable CxxUtils::CachedUniquePtr<Amg::Transform3D> m_nomCache ATLAS_THREAD_SAFE{}; mutable CxxUtils::CachedUniquePtr<Amg::Transform3D> m_nomCache ATLAS_THREAD_SAFE{};
const IDetectorElement* m_parent{nullptr};
}; };
inline bool operator<(const std::unique_ptr<TransformCache>& a, inline bool operator<(const std::unique_ptr<TransformCache>& a,
......
...@@ -19,6 +19,7 @@ namespace ActsTrk{ ...@@ -19,6 +19,7 @@ namespace ActsTrk{
m_transformCache{transformCache}, m_transformCache{transformCache},
m_type{type} {} m_type{type} {}
const TransformCache* SurfaceCache::transformCache() const { return m_transformCache; }
const Acts::Transform3& SurfaceCache::transform(const Acts::GeometryContext& anygctx) const { const Acts::Transform3& SurfaceCache::transform(const Acts::GeometryContext& anygctx) const {
const ActsGeometryContext* gctx = anygctx.get<const ActsGeometryContext*>(); const ActsGeometryContext* gctx = anygctx.get<const ActsGeometryContext*>();
// unpack the alignment store from the context // unpack the alignment store from the context
......
/* /*
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> #include <ActsGeoUtils/TransformCache.h>
...@@ -13,10 +13,16 @@ ...@@ -13,10 +13,16 @@
} }
namespace ActsTrk { namespace ActsTrk {
TransformCache::TransformCache(const IdentifierHash& hash, TransformCache::TransformCache(const IdentifierHash& hash,
TransformMaker maker): TransformMaker maker,
const IDetectorElement* parentEle):
m_hash{hash}, 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 { const Amg::Transform3D& TransformCache::getTransform(const ActsTrk::AlignmentStore* alignStore) const {
/// Valid alignment store is given -> Take the transformation from the cache there /// Valid alignment store is given -> Take the transformation from the cache there
if (alignStore){ if (alignStore){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment