ATLAS Offline Software
Loading...
Searching...
No Matches
MuonDetDescr/MuonReadoutGeometry/src/MuonReadoutElement.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5/***************************************************************************
6 A Muon GeoVDetectorElement
7 -----------------------------------------
8***************************************************************************/
9
11
12#include "GeoModelKernel/GeoDefinitions.h"
13#include "GeoModelKernel/GeoPhysVol.h"
14#include "GeoModelKernel/GeoTransform.h"
20
21namespace {
22 std::string to_string(const Trk::DetectorElemType type ) {
23 if (type == Trk::DetectorElemType::Mdt) return "Mdt";
24 else if (type == Trk::DetectorElemType::Rpc) return "Rpc";
25 else if (type == Trk::DetectorElemType::Tgc) return "Tgc";
26 else if (type == Trk::DetectorElemType::sTgc) return "sTgc";
27 else if (type == Trk::DetectorElemType::MM) return "Mm";
28 else if (type == Trk::DetectorElemType::Csc) return "Csc";
29 return "Unknown";
30 }
31}
32namespace MuonGM {
33
36 AthMessaging{to_string(detType)+"MuonReadoutElement"},
37 m_type{detType},
38 m_muon_mgr{mgr} {
39 if (!m_idHelperSvc.retrieve().isSuccess()) {
40 ATH_MSG_FATAL("Failed to retrieve the MuonIdHelperSvc");
41 throw std::runtime_error("Invalid MuonIdHelperSvc");
42 }
43 }
44
46
47 const Amg::Vector3D MuonReadoutElement::globalPosition() const { return absTransform().translation(); }
48
50 // this doesn't apply to TGC
51 if(m_statname.size() >= 3){
52 char c = m_statname[2];
53 if (c == 'L')
54 return true;
55 else if (c == 'S')
56 return false;
57 else {
58 if (c == 'E' || c == 'F' || c == 'G') return false;
59 if (c == 'M' || c == 'R') return true;
60 }
61 }
62 ATH_MSG_FATAL(__FILE__<<":"<<__LINE__<<" largeSector() - is this station a larger sector answer is no for readout element "<<m_idHelperSvc->toStringDetEl(identify()));
63 throw std::runtime_error("Unknown sector");
64 return false;
65 }
66
68 // this doesn't apply to TGC
69 return (!largeSector());
70 }
71
73 return getMaterialGeom()->getX();
74 }
75
79
81
85
89
93
97
102 m_id = id;
103 if (!m_idHelperSvc->isMuon(id)) {
104 ATH_MSG_FATAL("The Identifier "<<m_idHelperSvc->toString(id)<<" is not a muon one.");
105 throw std::runtime_error("Invalid Identifier set");
106 }
107 m_stIdx = m_idHelperSvc->stationName(id);
108 m_eta = m_idHelperSvc->stationEta(id);
109 m_phi = m_idHelperSvc->stationPhi(id);
110 m_idhash = m_idHelperSvc->moduleHash(id);
111 m_detectorElIdhash = m_idHelperSvc->detElementHash(id);
112 }
114 void MuonReadoutElement::setStationName(const std::string& str) { m_statname = str; }
119 void MuonReadoutElement::setSsize(double v) { m_Ssize = v; }
120 void MuonReadoutElement::setRsize(double v) { m_Rsize = v; }
121 void MuonReadoutElement::setZsize(double v) { m_Zsize = v; }
126} // namespace MuonGM
#define ATH_MSG_FATAL(x)
static std::string to_string(const std::vector< T > &v)
#define x
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
void setIdentifier(const Identifier &id)
Sets the Identifier, hashes & station names.
MuonReadoutElement(GeoVFullPhysVol *pv, MuonDetectorManager *mgr, Trk::DetectorElemType detType)
virtual void fillCache()=0
virtual Amg::Vector3D AmdbLRSToGlobalCoords(const Amg::Vector3D &x) const
virtual Amg::Vector3D GlobalToAmdbLRSCoords(const Amg::Vector3D &x) const
virtual void clearCache()=0
std::string m_techname
MDT or RPC or TGC or CSC plus a two digits subtype; example RPC17.
Identifier identify() const override final
Returns the ATLAS Identifier of the MuonReadOutElement.
const Amg::Transform3D & getNativeToAmdbLRS() const
Amg::Transform3D getTransform() const
TrkDetElementBase(const GeoVFullPhysVol *fullPhysVol)
Constructor from GeoVFullPhysVolume.
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
Ensure that the Athena extensions are properly loaded.
Definition GeoMuonHits.h:27