2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
5 #ifndef MUONREADOUTGEOMETRY_MDTREADOUTELEMENT_ICC
6 #define MUONREADOUTGEOMETRY_MDTREADOUTELEMENT_ICC
9 #define CHECK_IDVALID(ID) \
10 {if (idHelperSvc()->detElId(ID) != identify()) {\
11 ATH_MSG_FATAL(__FILE__<<":"<<__LINE__<<" "<<__func__<<"() -- The detector element "<<idHelperSvc()->toStringDetEl(identify())<<" is not suited for measurement " \
12 <<idHelperSvc()->toString(ID)); \
13 throw std::runtime_error("Wrong detector element"); \
15 const int tube{m_idHelper.tube(ID)}, layer{m_idHelper.tubeLayer(ID)}; \
16 if (tube < 1 || tube > m_ntubesperlayer) { \
17 ATH_MSG_FATAL(__FILE__<<":"<<__LINE__<<" "<<__func__<<"() -- Invalid tube "<<tube<<" was given. Allowed 1-"<<m_ntubesperlayer); \
18 throw std::runtime_error("Tube is out of range"); \
20 if (layer <1 || layer > m_nlayers) { \
21 ATH_MSG_FATAL(__FILE__<<":"<<__LINE__<<" "<<__func__<<"() -- Invalid layer "<<layer<<" was given. Allowed 1-"<<m_ntubesperlayer); \
22 throw std::runtime_error("Layer is out of range"); \
25 #define CHECK_IDVALID(ID) \
29 inline const Amg::Transform3D& MdtReadoutElement::transform() const { return absTransform(); }
30 inline const Amg::Vector3D& MdtReadoutElement::normal(const Identifier&) const {return normal();}
31 inline bool MdtReadoutElement::barrel() const { return m_inBarrel;}
32 inline bool MdtReadoutElement::endcap() const { return !barrel(); }
33 inline double MdtReadoutElement::innerTubeRadius() const { return m_innerRadius; }
34 inline double MdtReadoutElement::outerTubeRadius() const { return m_innerRadius + m_tubeWallThickness; }
37 inline int MdtReadoutElement::getMultilayer() const { return m_multilayer; }
38 inline int MdtReadoutElement::getNLayers() const { return m_nlayers; }
39 inline int MdtReadoutElement::getNtubesperlayer() const { return m_ntubesperlayer; }
40 inline int MdtReadoutElement::getNtubesinastep() const { return m_ntubesinastep; }
41 inline double MdtReadoutElement::tubePitch() const { return m_tubepitch; }
42 inline double MdtReadoutElement::getWireLength(const int tubeLayer, const int tube) const {
43 return tubeLength(tubeLayer, tube) - 2. * m_endpluglength;
45 inline double MdtReadoutElement::tubeLength(const int tubeLayer, const int tube) const {
46 return getActiveTubeLength(tubeLayer, tube) + 2. * m_deadlength;
48 inline double MdtReadoutElement::getActiveTubeLength(const int tubeLayer, const int tube) const {
49 return 2. * (bounds(tubeLayer, tube).halflengthZ());
51 inline const Amg::Transform3D& MdtReadoutElement::transform(const Identifier& id) const {
53 return transform(m_idHelper.tubeLayer(id), m_idHelper.tube(id));
55 inline Amg::Transform3D MdtReadoutElement::globalToLocalTransf(const Identifier& id) const {
56 return transform(id).inverse();
59 //// <Global <--> Local transformation without deformations
60 inline Amg::Transform3D MdtReadoutElement::nodeform_localToGlobalTransf(const Identifier& id) const {
62 return nodeform_localToGlobalTransf(m_idHelper.tubeLayer(id), m_idHelper.tube(id));
64 inline Amg::Transform3D MdtReadoutElement::nodeform_globalToLocalTransf(const Identifier& id) const {
65 return nodeform_localToGlobalTransf(id).inverse();
67 inline const Amg::Transform3D& MdtReadoutElement::localToGlobalTransf(const Identifier&id) const {
69 return localToGlobalTransf(m_idHelper.tubeLayer(id), m_idHelper.tube(id));
71 inline const Amg::Transform3D& MdtReadoutElement::localToGlobalTransf(int tubeLayer, int tube) const {
72 return transform(tubeLayer, tube);
77 inline Amg::Transform3D MdtReadoutElement::tubeToMultilayerTransf(const Identifier& id) const {
79 return tubeToMultilayerTransf(m_idHelper.tubeLayer(id), m_idHelper.tube(id));
81 inline double MdtReadoutElement::tubeLength(const Identifier& id) const {
83 return tubeLength(m_idHelper.tubeLayer(id), m_idHelper.tube(id));
85 inline double MdtReadoutElement::RODistanceFromTubeCentre(const Identifier& id) const {
87 return RODistanceFromTubeCentre(m_idHelper.tubeLayer(id), m_idHelper.tube(id));
89 inline double MdtReadoutElement::signedRODistanceFromTubeCentre(const Identifier& id) const {
91 return signedRODistanceFromTubeCentre(m_idHelper.tubeLayer(id), m_idHelper.tube(id));
93 inline Amg::Vector3D MdtReadoutElement::tubeFrame_localROPos(const Identifier& id) const {
95 return tubeFrame_localROPos(m_idHelper.tubeLayer(id), m_idHelper.tube(id));
97 inline Amg::Vector3D MdtReadoutElement::localROPos(const Identifier& id) const {
99 const int tubeLayer = m_idHelper.tubeLayer(id);
100 const int tube = m_idHelper.tube(id);
101 return tubeToMultilayerTransf(tubeLayer, tube) * tubeFrame_localROPos(tubeLayer, tube);
103 inline Amg::Vector3D MdtReadoutElement::ROPos(const Identifier& id) const {
105 return ROPos(m_idHelper.tubeLayer(id), m_idHelper.tube(id));
107 inline Amg::Vector3D MdtReadoutElement::localTubePos(const Identifier& id) const {
109 return localTubePos(m_idHelper.tubeLayer(id), m_idHelper.tube(id));
111 inline Amg::Vector3D MdtReadoutElement::nodeform_localTubePos(const Identifier& id) const {
113 return nodeform_localTubePos(m_idHelper.tubeLayer(id), m_idHelper.tube(id));
115 inline Amg::Vector3D MdtReadoutElement::nodeform_tubePos(const Identifier& id) const {
117 return nodeform_tubePos(m_idHelper.tubeLayer(id), m_idHelper.tube(id));
119 inline Amg::Vector3D MdtReadoutElement::tubePos(const Identifier& id) const {
121 return tubePos(m_idHelper.tubeLayer(id), m_idHelper.tube(id));
123 inline double MdtReadoutElement::distanceFromRO(const Amg::Vector3D& x, const Identifier& id) const {
125 return distanceFromRO(x, m_idHelper.tubeLayer(id), m_idHelper.tube(id));
127 inline int MdtReadoutElement::isAtReadoutSide(const Amg::Vector3D& GlobalHitPosition, const Identifier& id) const {
129 return isAtReadoutSide(GlobalHitPosition, m_idHelper.tubeLayer(id), m_idHelper.tube(id));
131 inline const Trk::SaggedLineSurface& MdtReadoutElement::surface(const Identifier& id) const {
133 return surface(m_idHelper.tubeLayer(id), m_idHelper.tube(id));
135 inline const Trk::CylinderBounds& MdtReadoutElement::bounds(const Identifier& id) const {
137 return bounds(m_idHelper.tubeLayer(id), m_idHelper.tube(id));
139 inline const Amg::Vector3D& MdtReadoutElement::center(const Identifier& id) const {
141 return center(m_idHelper.tubeLayer(id), m_idHelper.tube(id));
145 #endif // MUONREADOUTGEOMETRY_MDTREADOUTELEMENT_H