ATLAS Offline Software
Loading...
Searching...
No Matches
TransformCache.icc
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef ActsGeoUtils_TransformCache_ICC
5#define ActsGeoUtils_TransformCache_ICC
6
7#include <CxxUtils/inline_hints.h>
8
9namespace ActsTrk {
10 ATH_FLATTEN
11 inline const Amg::Transform3D&
12 TransformCacheBase::getTransform(const ActsTrk::DetectorAlignStore* alignStore) const {
13 /// Valid alignment store is given -> Take the transformation from the cache there
14 if (alignStore) {
15 const Amg::Transform3D* cache = alignStore->trackingAlignment->getTransform(m_clientNo);
16 if (cache) return *cache;
17 const Amg::Transform3D& trf{alignStore->trackingAlignment->setTransform(m_clientNo, fetchTransform(alignStore))};
18 /// If an external alignment store is presented release the nominal transformation
19 releaseNominalCache();
20 return trf;
21 }
22 /// Fall back solution to go onto the nominal cache
23 if (!m_nomCache) {
24 std::unique_lock guard{m_mutex};
25 m_nomCache.set(std::make_unique<Amg::Transform3D>(fetchTransform(alignStore)));
26 return (*m_nomCache);
27 }
28 std::shared_lock guard{m_mutex};
29 return (*m_nomCache);
30 }
31 inline IdentifierHash TransformCacheBase::hash() const { return m_hash; }
32#ifndef SIMULATIONBASE
33 ATH_FLATTEN
34 inline const Amg::Transform3D& TransformCacheBase::getTransform(const Acts::GeometryContext& anygctx) const {
35 const GeometryContext* gctx = anygctx.get<const GeometryContext*>();
36 // unpack the alignment store from the context
37 return getTransform(gctx->getStore(m_type).get());
38
39 }
40#endif
41
42
43template<typename CachingDetectorEle>
44 TransformCacheDetEle<CachingDetectorEle>::TransformCacheDetEle(const IdentifierHash& hash,
45 const CachingDetectorEle* parentEle):
46 TransformCache{hash, parentEle->detectorType()},
47 m_parent{parentEle} {}
48template<typename CachingDetectorEle>
49 const IDetectorElement* TransformCacheDetEle<CachingDetectorEle>::parent() const {
50 return m_parent;
51 }
52template <typename CachingDetectorEle>
53 Identifier TransformCacheDetEle<CachingDetectorEle>::identify() const {
54 return parent()->identify();
55 }
56}
57#endif