ATLAS Offline Software
Loading...
Searching...
No Matches
MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MdtReadoutElement.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 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 virtual 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 virtual 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
185
187 Amg::Transform3D tubeToMultilayerTransf(const int tubeLayer, const int tube) const;
188
189
190 private:
191 // Called from MuonChamber
192 void geoInitDone();
193
194
195 double getTubeLengthForCaching(const int tubeLayer, const int tube) const;
196 double getNominalTubeLengthWoCutouts(const int tubeLayer, const int tube) const;
197 Amg::Vector3D localNominalTubePosWoCutouts(const int tubelayer, const int tube) const;
198 // methods handling deformations
199 const Amg::Transform3D& fromIdealToDeformed(const int tubelayer, const int tube) const;
200
201
203 const double width_narrow,
204 const double width_wide,
205 const double height,
206 const double thickness,
207 const Amg::Vector3D& fixedPoint) const;
208 void wireEndpointsAsBuilt(Amg::Vector3D& locAMDBWireEndP, Amg::Vector3D& locAMDBWireEndN, const int tubelayer,
209 const int tube) const;
210
212 const int m_stIdx_BIS{m_idHelper.stationNameIndex("BIS")};
213 const int m_stIdx_BOL{m_idHelper.stationNameIndex("BOL")};
214
215 unsigned int m_nMDTinStation{0};
217 int m_nlayers{-1};
218 double m_tubepitch{-9999.};
219 double m_tubelayerpitch{-9999.};
221 int m_nsteps{-1};
223 double m_tubelenStepSize{-9999.};
224 double m_cutoutShift{-9999.};
225 double m_endpluglength{-9999.};
226 double m_deadlength{-9999.};
227 bool m_inBarrel{false};
228 std::array<double, maxnsteps> m_tubelength{make_array<double, maxnsteps>(-9999.)};
229 std::array<double, maxnlayers> m_firstwire_x{make_array<double, maxnlayers>(-9999.)};
230 std::array<double, maxnlayers> m_firstwire_y{make_array<double, maxnlayers>(-9999.)};
231 double m_innerRadius{-9999.};
232 double m_tubeWallThickness{-9999.};
233 CxxUtils::CachedValue<int> m_zsignRO_tubeFrame{}; // comes from AMDB CRO location in the station
234
236 const Amg::Transform3D& toDeform) const;
237
238
240 const Amg::Transform3D& toDeform) ;
241
242
243 struct GeoInfo {
245 Amg::Transform3D m_transform{Amg::Transform3D::Identity()};
246 Amg::Vector3D m_center{Amg::Vector3D::Zero()};
247 };
248 std::unique_ptr<GeoInfo> makeGeoInfo(const int tubelayer, const int tube) const;
249 const GeoInfo& geoInfo(const int tubeLayer, const int tube) const;
250 Amg::Transform3D deformedTransform(const int tubelayer, const int tube) const;
251
252 std::vector<CxxUtils::CachedUniquePtr<GeoInfo> > m_tubeGeo{}; // one per tube
253 std::vector<CxxUtils::CachedUniquePtr<GeoInfo> > m_backupTubeGeo{}; // one per tube
254 std::vector<CxxUtils::CachedUniquePtr<Amg::Transform3D> > m_deformTransf{}; // one per tube
255
256 const BLinePar* m_BLinePar{nullptr};
258 std::vector<CxxUtils::CachedUniquePtr<Trk::StraightLineSurface> > m_tubeSurfaces{}; // one per tube
259 std::vector<CxxUtils::CachedUniquePtr<Trk::CylinderBounds> > m_tubeBounds{}; // one per step in tube-length
260
265 mutable std::atomic<bool> m_haveTubeSurfaces{false};
266 mutable std::atomic<bool> m_haveTubeGeo{false};
267 mutable std::atomic<bool> m_haveTubeBounds{false};
268 mutable std::atomic<bool> m_haveDeformTransf{false};
269
270 // the single surface information representing the DetElement
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.
std::vector< CxxUtils::CachedUniquePtr< Trk::StraightLineSurface > > m_tubeSurfaces
Amg::Vector3D localTubePos(const Identifier &id) const
std::atomic< bool > m_haveTubeSurfaces
Flag whether any elements have been inserted into the corresponding vectors.
std::unique_ptr< GeoInfo > makeGeoInfo(const int tubelayer, const int tube) 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.
std::vector< CxxUtils::CachedUniquePtr< Amg::Transform3D > > m_deformTransf
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
Amg::Vector3D ROPos(const Identifier &id) const
Amg::Vector3D tubeFrame_localROPos(const int tubelayer, const int tube) const
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
std::vector< CxxUtils::CachedUniquePtr< Trk::CylinderBounds > > m_tubeBounds
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.
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.
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
CachedUniquePtrT< const T > CachedUniquePtr
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