ATLAS Offline Software
Loading...
Searching...
No Matches
MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MdtReadoutElement.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef MUONREADOUTGEOMETRY_MDTREADOUTELEMENT_H
6#define MUONREADOUTGEOMETRY_MDTREADOUTELEMENT_H
7
15class BLinePar;
16namespace MuonGMR4{
18}
19namespace Trk {
20 class CylinderBounds;
21 class SurfaceBounds;
22} // namespace Trk
23
24namespace MuonGM {
25
47
48 constexpr int maxnlayers = 4;
49 constexpr int maxnsteps = 10;
50
53 friend class MuonChamber;
54 friend class MuonChamberLite;
55
56 public:
57 MdtReadoutElement(GeoVFullPhysVol* pv, const std::string& stName,MuonDetectorManager* mgr);
58
59 ~MdtReadoutElement() = default;
60
62 unsigned int nMDTinStation() const {
63 return m_nMDTinStation;
64 }
65 void setNMdtInStation(unsigned int numMdt) { m_nMDTinStation = numMdt;}
66
69 bool barrel() const;
71 bool endcap() const;
73 int getMultilayer() const;
75 int getNLayers() const;
77 int getNtubesperlayer() const;
79 int getNtubesinastep() const;
81 void setMultilayer(const int ml);
83 void setNLayers(const int nl);
84
85 bool getWireFirstLocalCoordAlongZ(int tubeLayer, double& coord) const;
86 bool getWireFirstLocalCoordAlongR(int tubeLayer, double& coord) const;
87
88 bool containsId(const Identifier& id) const override;
89
90 // detector specific
91 double tubeLength(const int tubeLayer, const int tube) const;
92 double getActiveTubeLength(const int tubeLayer, const int tube) const;
93 double getWireLength(const int tubeLayer, const int tube) const;
94 double tubeLength(const Identifier& id) const;
96 double innerTubeRadius() const;
98 double outerTubeRadius() const;
100 double tubePitch() const;
101
102
104 const Amg::Transform3D& localToGlobalTransf(const int tubeLayer, const int tube) const;
105
107 Amg::Transform3D nodeform_localToGlobalTransf(const int tubeLayer, const int tube) const;
108
109 // global to local(tube frame) coord.
110 Amg::Transform3D globalToLocalTransf(const int tubeLayer, const int tube) const;
112
114 Amg::Transform3D nodeform_globalToLocalTransf(const int tubeLayer, const int tube) const;
115
116 // in the native MDT reference system
118 Amg::Vector3D localTubePos(const int tubelayer, const int tube) const;
119
121 Amg::Vector3D nodeform_localTubePos(const int tubelayer, const int tube) const;
122
125 Amg::Vector3D tubePos(const int tubelayer, const int tube) const;
128 Amg::Vector3D nodeform_tubePos(const int tubelayer, const int tube) const;
129
130
131 // Readout / HV side
133 double signedRODistanceFromTubeCentre(const int tubeLayer, const int tube) const;
134
135 double RODistanceFromTubeCentre(const Identifier& id) const;
136 double RODistanceFromTubeCentre(const int tubeLayer, const int tube) const;
137
138 double distanceFromRO(const Amg::Vector3D& GlobalHitPosition, const Identifier& id) const;
139 double distanceFromRO(const Amg::Vector3D& GlobalHitPosition, const int tubelayer, const int tube) const;
140
141 int isAtReadoutSide(const Amg::Vector3D& GlobalHitPosition, const Identifier& id) const;
142 int isAtReadoutSide(const Amg::Vector3D& GlobalHitPosition, const int tubelayer, const int tube) const;
143
145 Amg::Vector3D localROPos(const int tubelayer, const int tube) const;
146
147 Amg::Vector3D ROPos(const int tubelayer, const int tube) const;
149
150 Amg::Vector3D tubeFrame_localROPos(const int tubelayer, const int tube) const;
152
153 // defining B-line parameters
154 void setBLinePar(const BLinePar* bLine);
155 void clearBLinePar();
156 const BLinePar* getBLinePar() const { return m_BLinePar; }
157
161
162 void clearCache() override final;
163 void fillCache() override final;
164
165 virtual const Trk::Surface& surface() const override final;
166 virtual const Trk::StraightLineSurface& surface(const Identifier& id) const override final;
167 const Trk::StraightLineSurface& surface(const int tubeLayer, const int tube) const;
168 virtual const Trk::SurfaceBounds& bounds() const override final;
169 virtual const Trk::CylinderBounds& bounds(const Identifier& id) const override final;
170 const Trk::CylinderBounds& bounds(const int tubeLayer, const int tube) const;
171
172 virtual const Amg::Transform3D& transform(const Identifier& id) const override final;
173 virtual const Amg::Transform3D& transform() const override final;
174 const Amg::Transform3D& transform(const int tubeLayer, const int tube) const;
175
176 virtual const Amg::Vector3D& center(const Identifier&) const override final;
177 virtual const Amg::Vector3D& center() const override final;
178 const Amg::Vector3D& center(const int tubeLayer, const int tube) const;
179
180 virtual const Amg::Vector3D& normal(const Identifier&) const override final;
181 virtual const Amg::Vector3D& normal() const override final;
182
184 std::vector<const Trk::Surface*> surfaces() const;
185
187 Amg::Transform3D tubeToMultilayerTransf(const int tubeLayer, const int tube) const;
188
189
190 private:
191 // Called from MuonChamber
192 void geoInitDone();
193
195 unsigned boundHash(const int tubeLayer, const int tube) const;
196
197
198 double getTubeLengthForCaching(const int tubeLayer, const int tube) const;
199 double getNominalTubeLengthWoCutouts(const int tubeLayer, const int tube) const;
200 Amg::Vector3D localNominalTubePosWoCutouts(const int tubelayer, const int tube) const;
201 // methods handling deformations
202 const Amg::Transform3D& fromIdealToDeformed(const int tubelayer, const int tube) const;
203
204
206 const double width_narrow,
207 const double width_wide,
208 const double height,
209 const double thickness,
210 const Amg::Vector3D& fixedPoint) const;
211 void wireEndpointsAsBuilt(Amg::Vector3D& locAMDBWireEndP, Amg::Vector3D& locAMDBWireEndN, const int tubelayer,
212 const int tube) const;
213
215 const int m_stIdx_BIS{m_idHelper.stationNameIndex("BIS")};
216 const int m_stIdx_BOL{m_idHelper.stationNameIndex("BOL")};
217
218 unsigned int m_nMDTinStation{0};
220 int m_nlayers{-1};
221 double m_tubepitch{-9999.};
222 double m_tubelayerpitch{-9999.};
224 int m_nsteps{-1};
226 double m_tubelenStepSize{-9999.};
227 double m_cutoutShift{-9999.};
228 double m_endpluglength{-9999.};
229 double m_deadlength{-9999.};
230 bool m_inBarrel{false};
231 std::array<double, maxnsteps> m_tubelength{make_array<double, maxnsteps>(-9999.)};
232 std::array<double, maxnlayers> m_firstwire_x{make_array<double, maxnlayers>(-9999.)};
233 std::array<double, maxnlayers> m_firstwire_y{make_array<double, maxnlayers>(-9999.)};
234 double m_innerRadius{-9999.};
235 double m_tubeWallThickness{-9999.};
236 CxxUtils::CachedValue<int> m_zsignRO_tubeFrame{}; // comes from AMDB CRO location in the station
237
239 const Amg::Transform3D& toDeform) const;
240
241
243 const Amg::Transform3D& toDeform) ;
244
245
246 struct GeoInfo {
247 GeoInfo() = default;
251 Amg::Transform3D m_transform{Amg::Transform3D::Identity()};
253
254 std::unique_ptr<Amg::Transform3D> deformedTrf{};
255 bool isValid{false};
256 };
257 GeoInfo makeGeoInfo(const int tubelayer, const int tube) const;
258 const GeoInfo& geoInfo(const int tubeLayer, const int tube) const;
259 Amg::Transform3D deformedTransform(const int tubelayer, const int tube) const;
260
261 std::vector<GeoInfo> m_tubeGeo{}; // one per tube
262
263 const BLinePar* m_BLinePar{nullptr};
265 std::vector<std::unique_ptr<Trk::StraightLineSurface>> m_tubeSurfaces{}; // one per tube
266 std::vector<std::unique_ptr<Trk::CylinderBounds> > m_tubeBounds{}; // one per step in tube-length
267
268 // the single surface information representing the DetElement
269 std::unique_ptr<Trk::Surface> m_associatedSurface{};
270 std::shared_ptr<Trk::SurfaceBounds> m_associatedBounds{};
272 bool m_builtFromCnv{false};
273 };
274
275} // namespace MuonGM
277#endif // MUONREADOUTGEOMETRY_MDTREADOUTELEMENT_H
constexpr std::array< T, N > make_array(const T &def_val)
Helper function to initialize in-place arrays with non-zero values.
Definition ArrayHelper.h:10
Cached unique_ptr with atomic update.
Cached value with atomic update.
Eigen::Affine3d Transform3D
double coord
Type of coordination system.
Eigen::Matrix< double, 3, 1 > Vector3D
Cached value with atomic update.
Definition CachedValue.h:55
Amg::Transform3D tubeToMultilayerTransf(const Identifier &id) const
double getTubeLengthForCaching(const int tubeLayer, const int tube) const
unsigned int nMDTinStation() const
How many MDT chambers are in the station.
int isAtReadoutSide(const Amg::Vector3D &GlobalHitPosition, const Identifier &id) const
double getActiveTubeLength(const int tubeLayer, const int tube) const
bool endcap() const
Returns whether the chamber is in the endcap.
void setMultilayer(const int ml)
Sets the multilayer number.
Amg::Vector3D localTubePos(const Identifier &id) const
double tubeLength(const Identifier &id) const
void wireEndpointsAsBuilt(Amg::Vector3D &locAMDBWireEndP, Amg::Vector3D &locAMDBWireEndN, const int tubelayer, const int tube) const
double signedRODistanceFromTubeCentre(const Identifier &id) const
Amg::Vector3D tubePos(const Identifier &id) const
Returns the global position of the given tube.
Amg::Vector3D ROPos(const int tubelayer, const int tube) const
Amg::Transform3D nodeform_globalToLocalTransf(const Identifier &id) const
Amg::Transform3D globalToLocalTransf(const Identifier &id) const
double getNominalTubeLengthWoCutouts(const int tubeLayer, const int tube) const
Amg::Vector3D localROPos(const Identifier &id) const
Amg::Transform3D globalTransform(const Amg::Vector3D &tubePos, const Amg::Transform3D &toDeform) const
Amg::Vector3D localNominalTubePosWoCutouts(const int tubelayer, const int tube) const
Amg::Vector3D nodeform_localTubePos(const Identifier &id) const
Amg::Transform3D nodeform_localToGlobalTransf(const Identifier &id) const
unsigned boundHash(const int tubeLayer, const int tube) const
Return the hash for the bounds.
Amg::Vector3D ROPos(const Identifier &id) const
Amg::Vector3D tubeFrame_localROPos(const int tubelayer, const int tube) const
bool m_builtFromCnv
Flag indicating whether the RE is built by the ReadoutGeomCnvAlg.
std::vector< std::unique_ptr< Trk::StraightLineSurface > > m_tubeSurfaces
int getNLayers() const
Returns the number of tube layers inside the multilayer.
int getNtubesinastep() const
Returns the number of tubes in the endcap trapezoid sharing the same length.
virtual const Amg::Vector3D & normal(const Identifier &) const override final
Return the normal of the surface associated with this identifier In the case of silicon it returns th...
int getMultilayer() const
Returns the multilayer represented by the readout element.
Amg::Vector3D posOnDefChamWire(const Amg::Vector3D &locAMDBPos, const double width_narrow, const double width_wide, const double height, const double thickness, const Amg::Vector3D &fixedPoint) const
const Amg::Transform3D & fromIdealToDeformed(const int tubelayer, const int tube) const
virtual const Trk::SurfaceBounds & bounds() const override final
Return the boundaries of the element.
virtual const Amg::Transform3D & transform(const Identifier &id) const override final
Return local to global transform associated with this identifier.
double distanceFromRO(const Amg::Vector3D &GlobalHitPosition, const Identifier &id) const
double RODistanceFromTubeCentre(const Identifier &id) const
const Amg::Transform3D & localToGlobalTransf(const int tubeLayer, const int tube) const
double outerTubeRadius() const
Returns the tube radius taking the thickness of the tubes into account.
const GeoInfo & geoInfo(const int tubeLayer, const int tube) const
int getNtubesperlayer() const
Returns the number of tubes in each tube layer.
GeoInfo makeGeoInfo(const int tubelayer, const int tube) const
double tubePitch() const
Returns the distance between 2 tubes in a tube layer.
bool getWireFirstLocalCoordAlongR(int tubeLayer, double &coord) const
Amg::Vector3D nodeform_tubePos(const Identifier &id) const
Returns the global position of the tube excluding the B-line & As-built corrections.
bool barrel() const
Returns whether the chamber is in the barrel (Assement on first later in stationName).
virtual const Trk::Surface & surface() const override final
Return surface associated with this detector element.
double innerTubeRadius() const
Returns the inner tube radius excluding the aluminium walls.
std::vector< std::unique_ptr< Trk::CylinderBounds > > m_tubeBounds
const Amg::Transform3D & localToGlobalTransf(const Identifier &id) const
double tubeLength(const int tubeLayer, const int tube) const
Amg::Transform3D deformedTransform(const int tubelayer, const int tube) const
Amg::Vector3D tubeFrame_localROPos(const Identifier &id) const
std::vector< const Trk::Surface * > surfaces() const
returns all the surfaces contained in this detector element
virtual const Amg::Vector3D & center(const Identifier &) const override final
Return the center of the surface associated with this identifier In the case of silicon it returns th...
bool getWireFirstLocalCoordAlongZ(int tubeLayer, double &coord) const
double getWireLength(const int tubeLayer, const int tube) const
void setNLayers(const int nl)
Sets the number of layers.
Amg::Transform3D globalToLocalTransf(const int tubeLayer, const int tube) const
MdtReadoutElement(GeoVFullPhysVol *pv, const std::string &stName, MuonDetectorManager *mgr)
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
MuonReadoutElement(GeoVFullPhysVol *pv, MuonDetectorManager *mgr, Trk::DetectorElemType detType)
virtual const MdtIdHelper & mdtIdHelper() const =0
access to MdtIdHelper
Bounds for a cylindrical Surface.
Abstract base class for surface bounds to be specified.
Definition of ATLAS Math & Geometry primitives (Amg).
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
The ReadoutGeomCnvAlg converts the Run4 Readout geometry build from the GeoModelXML into the legacy M...
Ensure that the Athena extensions are properly loaded.
Definition GeoMuonHits.h:27
constexpr int maxnlayers
An MdtReadoutElement corresponds to a single MDT multilayer; therefore typicaly a MDT chamber consist...
Ensure that the ATLAS eigen extensions are properly loaded.
STL namespace.
#define private