ATLAS Offline Software
Loading...
Searching...
No Matches
MuonReadoutElement.icc
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef MUONGEOMODELR4_MUONREADOUTELEMENT_ICC
5#define MUONGEOMODELR4_MUONREADOUTELEMENT_ICC
6
7#include <ActsGeoUtils/TransformCache.h>
8namespace ActsTrk{
9 template <> inline Amg::Transform3D
10 TransformCacheDetEle<MuonGMR4::MuonReadoutElement>::fetchTransform(const DetectorAlignStore* store) const {
11 return m_parent->toStation(store);
12 }
13}
14
15namespace MuonGMR4 {
16
17inline const GeoAlignableTransform* MuonReadoutElement::alignableTransform() const { return m_args.alignTransform; }
18inline Identifier MuonReadoutElement::identify() const { return m_args.detElId; }
19inline IdentifierHash MuonReadoutElement::identHash() const { return m_detElHash;}
20inline const std::string& MuonReadoutElement::chamberDesign() const { return m_args.chambDesign; }
21inline const Muon::IMuonIdHelperSvc* MuonReadoutElement::idHelperSvc() const { return m_idHelperSvc.get(); }
22inline Muon::MuonStationIndex::ChIndex MuonReadoutElement::chamberIndex() const { return m_chIdx; }
23inline int MuonReadoutElement::stationName() const { return m_stName; }
24inline int MuonReadoutElement::stationEta() const { return m_stEta; }
25inline int MuonReadoutElement::stationPhi() const { return m_stPhi; }
26
27/// Returns the detector center (Which is the same as the detector center of the
28/// first measurement layer)
29inline Amg::Vector3D MuonReadoutElement::center(const ActsTrk::GeometryContext& ctx) const {
30 return localToGlobalTrans(ctx).translation();
31}
32inline Amg::Vector3D MuonReadoutElement::center(const ActsTrk::GeometryContext& ctx,
33 const Identifier& id) const {
34 return localToGlobalTrans(ctx, id).translation();
35}
36inline Amg::Vector3D MuonReadoutElement::center(const ActsTrk::GeometryContext& ctx,
37 const IdentifierHash& hash) const {
38 return localToGlobalTrans(ctx, hash).translation();
39}
40inline Amg::Transform3D MuonReadoutElement::globalToLocalTrans(const ActsTrk::GeometryContext& ctx,
41 const IdentifierHash& hash) const {
42 return localToGlobalTrans(ctx, hash).inverse();
43}
44inline Amg::Transform3D MuonReadoutElement::globalToLocalTrans(const ActsTrk::GeometryContext& ctx,
45 const Identifier& id) const {
46 return globalToLocalTrans(ctx, layerHash(id));
47}
48inline const Amg::Transform3D& MuonReadoutElement::localToGlobalTrans(const ActsTrk::GeometryContext& ctx,
49 const Identifier& id) const {
50 return localToGlobalTrans(ctx, layerHash(id));
51}
52#ifndef SIMULATIONBASE
53inline const SpectrometerSector* MuonReadoutElement::msSector() const { return m_msSectorLink; }
54inline const Chamber* MuonReadoutElement::chamber() const { return m_chambLink; }
55#endif
56
57template<class MuonImpl>
58StatusCode MuonReadoutElement::insertTransform(const IdentifierHash& hash) {
59 TransformCacheMap::const_iterator cache = m_localToGlobalCaches.find(hash);
60 if (cache != m_localToGlobalCaches.end()) {
61 ATH_MSG_FATAL(__FILE__<<":"<<__LINE__<<" - "<<idHelperSvc()->toStringDetEl(identify())
62 <<" has already a transformation cached for hash "<<hash);
63 return StatusCode::FAILURE;
64 }
65 auto newCache = std::make_unique<ActsTrk::TransformCacheDetEle<MuonImpl>>(hash, static_cast<MuonImpl*>(this));
66 m_localToGlobalCaches.insert(std::make_pair(hash, std::move(newCache)));
67 return StatusCode::SUCCESS;
68}
69
70} // namespace MuonGMR4
71#endif