ATLAS Offline Software
TransformCache.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 #ifndef ActsGeoUtils_TransformCache_H
5 #define ActsGeoUtils_TransformCache_H
6 
7 #include <shared_mutex>
8 #include <type_traits>
9 #include <ActsGeoUtils/Defs.h>
13 
14 namespace ActsTrk {
15  /*** @brief: The TransformCache holds the local -> global transformations associated with a tracking surface
16  * from the Readout geometry. The cache establishes the connection with the ActsGeometryContext or more
17  * precisely with its DetectorAlignStore to provide the transformations of an aligned surface.
18  * As soon as the alignment store is accessed, the nominal surface is released from memory.
19  * In order to be used for each detector technology, the virtual <fetchTransform> needs to
20  * be defined further downstream. The method is called everytime when a new cache is invoked. */
22  public:
23  TransformCache(const IdentifierHash& cacheHash,
24  const DetectorType type);
25 
28 
29  virtual ~TransformCache();
30 
31 
33  virtual Identifier identify() const = 0;
37  virtual const IDetectorElement* parent() const = 0;
38 
45 
46 #ifndef SIMULATIONBASE
47 
48  const Amg::Transform3D& transform(const Acts::GeometryContext& gctx) const;
49 #endif
50 
51  void releaseNominalCache() const;
53  DetectorType detectorType() const;
54  protected:
56  private:
61  mutable std::shared_mutex m_mutex ATLAS_THREAD_SAFE{};
63  };
64 
65 
66 
67  template<typename CachingDetectorEle>
68  class TransformCacheDetEle: public TransformCache {
69  public:
74  const CachingDetectorEle* parentEle);
75 
76  const IDetectorElement* parent() const override final;
77  Identifier identify() const override final;
78  private:
80  const CachingDetectorEle* m_parent{nullptr};
81  };
82 
83 }
85 #endif
ActsTrk::TransformCache::ATLAS_THREAD_SAFE
std::shared_mutex m_mutex ATLAS_THREAD_SAFE
Definition: TransformCache.h:61
SGTest::store
TestStore store
Definition: TestStore.cxx:23
ActsTrk::TransformCacheDetEle::identify
Identifier identify() const override final
ActsTrk::DetectorType
DetectorType
Simple enum to Identify the Type of the ACTS sub detector.
Definition: GeometryDefs.h:17
ActsTrk::DetectorAlignStore::TrackingAlignStore
Store holding the transfomations used by the Acts algorithms.
Definition: DetectorAlignStore.h:33
ActsTrk::TransformCache::parent
virtual const IDetectorElement * parent() const =0
Returns the parent IDetectorElement owning the cache.
ActsTrk::DetectorAlignStore
Definition: DetectorAlignStore.h:20
ActsTrk::TransformCache::operator=
TransformCache & operator=(const TransformCache &other)=delete
CxxUtils::CachedUniquePtrT< Amg::Transform3D >
ActsTrk::DetectorType::UnDefined
@ UnDefined
Small Thing Gap chambers (NSW)
ActsTrk::TransformCache::identify
virtual Identifier identify() const =0
Returns the Identifier of the transform cache.
ActsTrk::TransformCache::releaseNominalCache
void releaseNominalCache() const
resets the nominal cache associated with the detector element
Definition: TransformCache.cxx:17
ActsTrk::TransformCache::~TransformCache
virtual ~TransformCache()
Definition: TransformCache.cxx:9
ActsTrk::TransformCacheDetEle::parent
const IDetectorElement * parent() const override final
TransformCache.icc
ActsTrk::TransformCacheDetEle::m_parent
const CachingDetectorEle * m_parent
Definition: TransformCache.h:80
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
ActsTrk::TransformCache::fetchTransform
virtual Amg::Transform3D fetchTransform(const DetectorAlignStore *store) const =0
ActsTrk::TransformCache::TransformCache
TransformCache(const TransformCache &other)=delete
Defs.h
ActsTrk::TransformCache::m_clientNo
const unsigned int m_clientNo
Definition: TransformCache.h:60
ActsTrk::TransformCache::m_type
const DetectorType m_type
Definition: TransformCache.h:58
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
CachedUniquePtr.h
Cached unique_ptr with atomic update.
ActsTrk::TransformCacheDetEle::TransformCacheDetEle
TransformCacheDetEle(const IdentifierHash &hash, const CachingDetectorEle *parentEle)
: Standard constructor taking the hash of the sensor element and and the TransformMaker expressed usu...
ActsTrk::IDetectorElement
Base class interface for the actual readout elements.
Definition: IDetectorElement.h:43
ActsTrk::TransformCache::hash
IdentifierHash hash() const
Returns the sensor hash of this transformation cache.
ActsTrk::DetectorAlignStore::TrackingAlignStore::drawTicket
static unsigned int drawTicket(const DetectorType detType)
Returns a unique ID to the client under which the client can store its transformation inside the cont...
Definition: DetectorAlignStore.cxx:24
ActsTrk::TransformCache::TransformCache
TransformCache(const IdentifierHash &cacheHash, const DetectorType type)
Definition: TransformCache.cxx:12
Amg
Definition of ATLAS Math & Geometry primitives (Amg)
Definition: AmgStringHelpers.h:19
private
#define private
Definition: DetDescrConditionsDict_dict_fixes.cxx:13
IdentifierHash.h
ActsTrk::TransformCache::getTransform
const Amg::Transform3D & getTransform(const DetectorAlignStore *store) const
Returns the matching transformation from the alignment store.
ActsTrk::TransformCache::m_hash
const IdentifierHash m_hash
Definition: TransformCache.h:57
ActsTrk::TransformCache::detectorType
DetectorType detectorType() const
returns the detector type of the cache
Definition: TransformCache.cxx:23
ActsTrk::TransformCacheDetEle::fetchTransform
Amg::Transform3D fetchTransform(const DetectorAlignStore *store) const override final
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
IDetectorElement.h
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MuonDetectorBuilderTool.cxx:54
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
ActsTrk::TransformCache
Definition: TransformCache.h:21
ActsTrk::TransformCache::transform
const Amg::Transform3D & transform(const Acts::GeometryContext &gctx) const
returns the cached transform from the Acts Geometry context
Identifier
Definition: IdentifierFieldParser.cxx:14