7#include <GaudiKernel/IMessageSvc.h>
24#define THROW_EXCEPT(MESSAGE) \
26 std::stringstream except_sstr{}; \
27 except_sstr<<__FILE__<<":"<<__LINE__<<" ("; \
28 except_sstr<<idHelperSvc()->toString(identify())<<") "; \
29 except_sstr<<MESSAGE; \
30 throw std::runtime_error(except_sstr.str()); \
50 return m_gasPlaneZ[gg - 1] * Amg::Vector3D::UnitX();
58 if (!
validGang(gasGap, gang))
THROW_EXCEPT(
"Invalid gasGap "<<gasGap<<
" & wire gang "<<gang<<
" given.");
65 if (!
validGang(gasGap, gang))
THROW_EXCEPT(
"Invalid gasGap "<<gasGap<<
" & wire gang "<<gang<<
" given.");
74 if (!
validGang(gasGap, gang))
THROW_EXCEPT(
"Invalid gasGap "<<gasGap<<
" & wire gang "<<gang<<
" given.");
81 if (!
validGang(gasGap, gang))
THROW_EXCEPT(
"Invalid gasGap "<<gasGap<<
" & wire gang "<<gang<<
" given.");
88 if (!
validGang(gasGap, gang))
THROW_EXCEPT(
"Invalid gasGap "<<gasGap<<
" & wire gang "<<gang<<
" given.");
94 if (!
validGang(gasGap, gang))
THROW_EXCEPT(
"Invalid gasGap "<<gasGap<<
" & wire gang "<<gang<<
" given.");
101 constexpr std::array<double, 4> nDivInChamberPhi{29.5, 29.5, 29.5, 31.5};
106 dphi = 360. * CLHEP::degree / (
nPhiChambers()) / nDivInChamberPhi[iStation - 1];
108 dphi = 360. * CLHEP::degree / 36. / nDivInChamberPhi[iStation - 1];
136 <<
", gasGap: "<<gasGap<<
", strip: "<<
strip<<
", pickStrip: "<<pickStrip);
144 const int nextStrip =
strip +1;
146 pickStrip += (nextStrip != pickStrip);
148 <<
", gasGap: "<<gasGap<<
", strip: "<<
strip<<
", pickStrip: "<<pickStrip);
195 return std::max(stripNextCen - stripCurrCen , stripCurrCen - stripPrevCen);
196 }
else if (
strip == 1) {
198 }
else if (
strip == 32) {
209 double z = localPos.z();
210 for (
int gang = 1; gang <=
nWireGangs(gasGap); ++gang) {
220 double x = localPos.x();
221 double z = localPos.z();
255 for (
int gp = 1; gp <=
nGasGaps(); ++gp) {
257 for (
bool isStrip : {
false,
true}) {
263 surfaceTRotation.col(0) = muonTRotation.col(1);
264 surfaceTRotation.col(1) = muonTRotation.col(2);
265 surfaceTRotation.col(2) = muonTRotation.col(0);
269 trans.pretranslate(trans3D.translation());
270 m_surfaceData->m_layerTransforms.push_back(std::move(trans));
271 m_surfaceData->m_layerSurfaces.emplace_back(std::make_unique<Trk::PlaneSurface>(*
this,
id));
283 m_surfaceData->m_surfBounds.emplace_back(std::make_unique<Trk::RotatedTrapezoidBounds>(
getRsize() / 2.,
290 if (gasGap < 1 || gasGap >
nGasGaps())
return false;
295 if (ch < 1 || ch >
nWireGangs(gasGap))
return false;
296 }
else if (isStrip == 1) {
297 if (ch < 1 || ch >
nStrips(gasGap))
return false;
305 THROW_EXCEPT(
"distanceToReadout() -- method not implemented");
309 THROW_EXCEPT(
"stripNumber() -- method not implemented");
315 if (!
surface(
id).globalToLocal(gpos, gpos, pos)) {
335 Amg::intersect<3>(lEtaHitPos, Amg::Vector3D::UnitX(), lPhiHitPos, phiHitDir).value_or(0) * phiHitDir;
341 !
surface(phiId).globalToLocal(gpos, gpos, pos)) {
351 pos = Amg::Vector3D::Zero();
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
#define THROW_EXCEPT(MESSAGE)
virtual const Trk::PlaneSurface & surface() const override
access to chamber surface (phi orientation), uses the first gas gap
std::unique_ptr< SurfaceData > m_surfaceData
MuonClusterReadoutElement(GeoVFullPhysVol *pv, MuonDetectorManager *mgr, Trk::DetectorElemType detType)
virtual const Amg::Transform3D & transform() const override
Return local to global transform.
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
const Muon::IMuonIdHelperSvc * idHelperSvc() const
const Amg::Transform3D & absTransform() const
void setStationName(const std::string &)
int getStationEta() const
double getLongSsize() const
Identifier identify() const override final
Returns the ATLAS Identifier of the MuonReadOutElement.
std::string getStationType() const
int findGang(int gasGap, const Amg::Vector3D &extPos) const
Returns the gang number that's closest to the given external position.
double stripDeltaPhi() const
double stripShortWidth(int, int) const
GeoModel::TransientConstSharedPtr< TgcReadoutParams > m_readoutParams
std::array< double, s_maxGasGap > m_gasPlaneZ
int nWireGangs(int gasGap) const
Returns the number of wire gangs (Random grouping of wires) in a given gas gap.
void setReadOutParams(GeoModel::TransientConstSharedPtr< TgcReadoutParams > pars)
void setFrameThickness(const double frameH, const double frameAB)
void setReadOutName(const std::string &rName)
virtual double distanceToReadout(const Amg::Vector2D &pos, const Identifier &id) const override
distance to readout.
virtual bool stripPosition(const Identifier &id, Amg::Vector2D &pos) const override
strip position If the strip number is outside the range of valid strips, the function will return fal...
std::pair< double, int > stripNumberToFetch(int gasGap, int inStrip) const
Returns whether a strip needs to be flipped and the final strip number parsed to the TgcReadoutParams...
Amg::Vector3D channelPos(const Identifier &id) const
Returns the position of the active channel (wireGang or strip)
double stripLocalX(const int gasGap, const int stripNum, const double locY, const double refPoint) const
Returns the local X given the reference point E.g.
double stripHighEdgeLocX(int gasGap, int strip, double radialPos) const
Returns the local X of the right edge of the strip at a given local radial position.
int findStrip(int gasGap, const Amg::Vector3D &extPos) const
Returns the strip number that's closest to the given external position.
double stripPitch(int gasGap, int strip) const
Returns the pitch of the given strip in gasGap i.
virtual bool spacePointPosition(const Identifier &phiId, const Identifier &etaId, Amg::Vector2D &pos) const override
space point position for a given pair of phi and eta identifiers The LocalPosition is expressed in th...
double stripPosOnShortBase(int strip, int gasGap) const
double stripLongWidth(int, int) const
virtual int stripNumber(const Amg::Vector2D &pos, const Identifier &id) const override final
strip number corresponding to local position.
double gangShortWidth(int gasGap, int gang) const
Returns the length of the most bottom wire in the gang.
double chamberWidth(double z) const
virtual void fillCache() override
double wireGangLocalX(const int gasGap, const int gangNum) const
Returns the local X of the wire gang in gasGap i.
bool validStrip(int gasGap, int strip) const
Returns whether the strip in the given gasgap is within the allowed range.
double gangCentralWidth(int gasGap, int gang) const
Returns the length of the central wire in the gang.
Amg::Vector3D localSpacePoint(const Identifier &stripId, const Amg::Vector3D &etaHitPos, const Amg::Vector3D &phiHitPos) const
double frameZwidth() const
const TgcIdHelper & m_idHelper
double m_stripSlope
Cache of the function call 1.
double stripWidth(int gasGap, int strip) const
Returns the width of a given strip in the gasGap i.
double stripPosOnLargeBase(int strip, int gasGap) const
Amg::Vector3D localStripDir(int gasGap, int strip) const
Returns the local strip direction of a strip.
double stripLowEdgeLocX(int gasGap, int strip, double radialPos) const
Returns the local X of the left edge of the strip at a given local radial position.
std::string m_readout_name
TgcReadoutElement(GeoVFullPhysVol *pv, const std::string &stName, MuonDetectorManager *mgr)
double gangLongWidth(int gasGap, int gang) const
Returns the length of the most top wire in the gang.
double stripCenterLocX(int gasGap, int strip, double radialPos) const
Returns the local X of the strip center at a given local radial position.
double gangRadialLength(int gasGap, int gang) const
Returns the length of the wire gang along the radial direction [pitch x N_{wire}^{gang}...
int nGasGaps() const
Returns the number of gas gaps associated with the readout element (2 or 3)
int nWires(int gasGap) const
Returns the total number of wires in a given gas gap.
bool validGang(int gasGap, int wireGang) const
Returns whether the wire gang in the given gasgap is within the allowed range.
double frameXwidth() const
double wireGangTopX(int gasGap, int gangNum) const
Returns the local X of the top wire in the wireGang i in gasGap j.
Amg::Vector3D localGasGapPos(int gg) const
Returns the local position of the gasGap in the AMDB coordinate system.
double physicalDistanceFromBase() const
double wireGangBottomX(int gasGap, int gangNum) const
Returns the local X of the bottom wire in the wireGang i in gasGap j.
int nStrips(int gasGap) const
Returns the number of strips in a given gas gap.
virtual bool containsId(const Identifier &id) const override
void setPlaneZ(double value, int gasGap)
Set the local Z coordinate of the i-th gasGap [1-3].
double wirePitch() const
Returns the pitch of the wires.
bool validGap(int gasGap) const
Returns whether the gasGap is within the allowed range [1-nGasGaps()].
std::optional< double > intersect(const AmgVector(N)&posA, const AmgVector(N)&dirA, const AmgVector(N)&posB, const AmgVector(N)&dirB)
Calculates the point B' along the line B that's closest to a second line A.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Eigen::Matrix< double, 3, 3 > RotationMatrix3D
Amg::Transform3D getRotateZ3D(double angle)
get a rotation transformation around Z-axis
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
Eigen::Translation< double, 3 > Translation3D
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
Ensure that the Athena extensions are properly loaded.
Ensure that the ATLAS eigen extensions are properly loaded.