10#ifndef MUONREADOUTGEOMETRY_MUONCHANNELDESIGN_H
11#define MUONREADOUTGEOMETRY_MUONCHANNELDESIGN_H
14#include "GaudiKernel/MsgStream.h"
62 void defineTrapezoid(
double HalfShortY,
double HalfLongY,
double HalfHeight);
63 void defineTrapezoid(
double HalfShortY,
double HalfLongY,
double HalfHeight,
double sAngle);
64 void defineDiamond(
double HalfShortY,
double HalfLongY,
double HalfHeight,
double ycutout);
101 double xSize()
const;
180 if (!
center(chNum, cen))
return std::numeric_limits<float>::max();
182 return (pos - cen).x();
188 throw std::runtime_error(
"MuonChannelDesign::distanceToReadout() - is not properly defined");
206 chNum =
static_cast<int>(std::floor( xMid /
inputPitch)) + missedBottom + 2;
218 if (chNum < 1 || chNum >
nch) chNum = -1;
249 if (grNumber < 1 || grNumber >
nGroups)
return -1;
265 if (wire_number < 1 || wire_number >
nch) {
267 if (log.level() <= MSG::DEBUG) {
268 log << MSG::DEBUG <<
"sTGC wire number out of range: wire number = " << wire_number <<
" local pos = (" << pos.x() <<
", " << pos.y() <<
")" <<
endmsg;
286 if (istrip < 0)
return istrip;
293 chan_pos = rotation() * chan_pos;
298 edge_pos = rotation() * edge_pos;
301 rel_pos[1] = (lpos - chan_pos).
y() / std::abs( edge_pos.y() - chan_pos.y() );
312 if (st < 1 || st >
nch)
return false;
317 if (st >
nGroups || st == 63)
return false;
334 double wireOffset{0.};
350 if (st <= nMissedBottom || st > nMissedBottom +
nch)
return false;
357 if (st < 1 || st >
nch)
return false;
374 Amg::Vector2D cen{Amg::Vector2D::Zero()}, side{Amg::Vector2D::Zero()};
378 return (cen - side).mag();
384 Amg::Vector2D left{Amg::Vector2D::Zero()}, right{Amg::Vector2D::Zero()};
386 return (left - right).mag();
404 Amg::Vector2D l_pos{Amg::Vector2D::Zero()}, r_pos{Amg::Vector2D::Zero()};
406 pos = 0.5 * (l_pos + r_pos);
423 if (!lambda)
return false;
452 if (!lambda)
return false;
478 pos = m_rotMat * pos;
485 pos = m_rotMat * pos;
492 pos = m_rotMat * pos;
506 return passivHeight*std::abs(edge_pcb?
m_stereoDir.x() : 1.);
singleton-like access to IMessageSvc via open function and helper
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.
Eigen::Matrix< double, 2, 1 > Vector2D
IMessageSvc * getMessageSvc(bool quiet=false)
Ensure that the Athena extensions are properly loaded.
double m_firstPos
Position of the first measurement.
bool isConvertedFromPhaseII
double stereoAngle() const
returns the stereo angle
bool rightInterSect(int channel, Amg::Vector2D &pos, bool uncapped=false) const
Returns the right edge of the strip.
bool center(int channel, Amg::Vector2D &pos) const
STRIPS ONLY: Returns the center on the strip.
void setStereoAngle(double sAngle)
calculate local stereo angle
double channelHalfLength(int st, bool left) const
STRIPS ONLY: calculate channel length on the given side of the x axis (for MM stereo strips)
bool leftEdge(int channel, Amg::Vector2D &pos) const
STRIPS ONLY: Returns the left edge of the strip.
Amg::Vector2D m_topEdge
Vector describing the right edge of the trapzoid.
int numberOfMissingBottomStrips() const
Returns the number of missing bottom strips.
bool rightEdge(int channel, Amg::Vector2D &pos) const
STRIPS ONLY: Returns the right edge of the strip.
Amg::Vector2D m_bottomLeft
Bottom left point of the trapezoid.
void defineDiamond(double HalfShortY, double HalfLongY, double HalfHeight, double ycutout)
Amg::Vector2D m_bottomRight
Bottom right point of the trapezoid.
int wireGroupNumber(const Amg::Vector2D &pos) const
calculate local wire group number, range 1=64 like identifiers. Returns -1 if out of range
double channelWidth() const
calculate local channel width
double hasStereoAngle() const
returns whether the stereo angle is non-zero
Amg::Vector2D m_topLeft
Top right point of the trapezoid.
Amg::Vector2D m_bottomEdge
Vector describing the left edge of the trapezoid.
int wireNumber(const Amg::Vector2D &pos) const
calculate the sTGC wire number. The method can return a value outside the range [1,...
double distanceToReadout(const Amg::Vector2D &pos) const
distance to readout
double firstPos() const
Returns the position of the first strip along the x-axis.
bool channelPosition(int channel, Amg::Vector2D &pos) const
calculate local channel position for a given channel number
void defineTrapezoid(double HalfShortY, double HalfLongY, double HalfHeight)
set the trapezoid dimensions
int positionRelativeToStrip(const Amg::Vector2D &lpos, Amg::Vector2D &rel_pos) const
STRIPS ONLY.
double passivatedLength(double passivWidth, bool left) const
top edge -> left edge bottom edge -> right edge a rectangle with height H parallel to the inclined ed...
void setFirstPos(const double pos)
Set the position of the first strip along the x-axis.
int numberOfMissingTopStrips() const
Returns the number of missing top strips.
Amg::Vector2D m_topRight
Bottom right point of the trapezoid.
double channelLength(int channel) const
STRIPS ONLY: calculate channel length for a given strip number.
Amg::Vector2D m_stereoNormal
Direction pointing to the next strips.
double passivatedHeight(double passivHeight, bool edge) const
Passivation is applied parallel to.
double gasGapThickness() const
thickness of gas gap
double distanceToChannel(const Amg::Vector2D &pos, int nChannel) const
distance to channel - residual
const AmgSymMatrix(2) &rotation() const
returns the rotation matrix between eta <-> phi layer
bool geomCenter(int channel, Amg::Vector2D &pos) const
Returns the geometrical strip center.
bool leftInterSect(int channel, Amg::Vector2D &pos, bool uncapped=false) const
Returns the intersection of the strip with the left edge of the trapezoid. Special cases:
int channelNumber(const Amg::Vector2D &pos) const
calculate local channel number, range 1=nstrips like identifiers. Returns -1 if out of range
Amg::Vector2D m_stereoDir
Direction of the strips.
double isDiamondShape() const
returns whether it's a diamond shape (sTGC QL3)