ATLAS Offline Software
Loading...
Searching...
No Matches
StripDesign.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include <GeoModelHelpers/TransformSorter.h>
7#include <GaudiKernel/SystemOfUnits.h>
8#include <climits>
9namespace {
10 constexpr double tolerance = 0.001 * Gaudi::Units::mm;
11}
13#define ORDER_PROP(PROP) \
14 { \
15 if (std::abs(1.*PROP - 1.*other.PROP) > tolerance) { \
16 return PROP < other.PROP; \
17 } \
18 }
19
20namespace MuonGMR4{
22 AthMessaging{"MuonStripDesign"} {}
23 bool operator<(const StripDesignPtr&a, const StripDesignPtr& b) {
24 return (*a) < (*b);
25 }
26 bool StripDesign::operator<(const StripDesign& other) const {
36 static const GeoTrf::TransformSorter trfSorter{};
37 return trfSorter(m_firstStripPos, other.m_firstStripPos);
38 }
39 std::ostream& operator<<(std::ostream& ostr, const StripDesign& design) {
40 design.print(ostr);
41 return ostr;
42 }
43 void StripDesign::print(std::ostream& ostr) const {
44 ostr<<"Strip -- number: "<<numStrips()<<", ";
45 ostr<<"pitch: "<<stripPitch()<<", ";
46 ostr<<"width: "<<stripWidth()<<", ";
47 ostr<<"Dimension -- width x height [mm]: "<<halfWidth() * Gaudi::Units::mm<<" x ";
48 ostr<<shortHalfHeight()<<"/"<<longHalfHeight()<<" [mm], ";
49 if (hasStereoAngle()) ostr<<"stereo angle: "<<stereoAngle() / Gaudi::Units::deg<<", ";
50 ostr<<"position first strip "<<Amg::toString(center(firstStripNumber()).value_or(Amg::Vector2D::Zero()),1);
51 ostr<<" *** Trapezoid edges "<<Amg::toString(cornerBotLeft(),1)<<" - "<<Amg::toString(cornerBotRight(), 1)<<" --- ";
53 }
54 void StripDesign::defineTrapezoid(double HalfShortY, double HalfLongY, double HalfHeight, double sAngle){
55 defineTrapezoid(HalfShortY,HalfLongY, HalfHeight);
56 setStereoAngle(sAngle);
57 }
58
59 void StripDesign::setStereoAngle(double sAngle) {
60 if (std::abs(sAngle) < std::numeric_limits<float>::epsilon()) {
61 return;
62 }
63 m_stereoAngle = sAngle;
64 m_hasStereo = true;
65 m_etaToStereo = Eigen::Rotation2D{-stereoAngle()};
66 m_stereoToEta = Eigen::Rotation2D{stereoAngle()};
67 m_stripDir = m_stereoToEta * m_stripDir;
68 m_stripNormal = m_stereoToEta * m_stripNormal;
69 }
70
71 void StripDesign::defineTrapezoid(double HalfShortY, double HalfLongY, double HalfHeight) {
72 m_bottomLeft = Amg::Vector2D{-HalfHeight, -HalfShortY};
73 m_bottomRight = Amg::Vector2D{HalfHeight, -HalfLongY};
74 m_topLeft = Amg::Vector2D{-HalfHeight, HalfShortY};
75 m_topRight = Amg::Vector2D{HalfHeight, HalfLongY};
76
77 m_shortHalfY = HalfShortY;
78 m_longHalfY = HalfLongY;
79 m_halfX = HalfHeight;
80 m_lenSlopEdge = std::hypot(2.*HalfHeight, HalfShortY - HalfLongY);
82 m_isFlipped = false;
83 }
84 void StripDesign::defineDiamond(double HalfShortY, double HalfLongY,
85 double HalfHeight, double yCutout) {
87 double HalfLongYuncut = HalfLongY + yCutout * (HalfLongY - HalfShortY)/(2*HalfHeight - yCutout);
88 defineTrapezoid(HalfShortY, HalfLongYuncut, HalfHeight);
90 m_longHalfY = HalfLongY;
92 }
94 if (m_isFlipped) {
95 ATH_MSG_WARNING("It's impossible to flip a trapezoid twice. Swap short and long lengths");
96 return;
97 }
98 m_isFlipped = true;
99
107 }
108
110 const double stripPitch,
111 const double stripWidth,
112 const int numStrips,
113 const int numFirst) {
114 m_channelShift = numFirst;
118 m_firstStripPos = std::move(posFirst);
119 }
121 m_dirTopEdge.release();
122 m_dirBotEdge.release();
123 m_dirLeftEdge.release();
124 m_dirRightEdge.release();
125 }
126
127}
128#undef ORDER_PROP
#define ATH_MSG_WARNING(x)
static Double_t a
#define ORDER_PROP(PROP)
Helper macro to facilliate the ordering.
Definition PadDesign.cxx:10
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
void defineDiamond(double HalfShortY, double HalfLongY, double HalfHeight, double yCutout)
Defines the edges of the sTGC diamond L3 sector.
double halfWidth() const
Returns the half height of the strip panel.
Amg::Vector2D m_topLeft
Top right point of the trapezoid.
double stereoAngle() const
Returns the value of the stereo angle.
void defineStripLayout(Amg::Vector2D &&posFirst, const double stripPitch, const double stripWidth, const int numStrips, const int numFirst=1)
Defines the layout of the strip detector by specifing the position of the first strip w....
double m_stripWidth
Width of each strip line.
bool isFlipped() const
Returns whether the trapezoid is flipped.
const Amg::Vector2D & cornerTopLeft() const
Returns the top left corner of the trapezoid.
Amg::Vector2D m_bottomRight
Bottom right point of the trapezoid.
Amg::Vector2D m_bottomLeft
Bottom left point of the trapezoid.
bool operator<(const StripDesign &other) const
Odering operator.
int firstStripNumber() const
Returns the number of the first strip.
CxxUtils::CachedUniquePtr< Amg::Vector2D > m_dirRightEdge
Vector describing the right edge of the trapezoid (bottom right -> top right)
double m_cutLongEdge
Lenght of the line segment that's cut from the long edge to make the trapezoid diamond shaped.
CheckVector2D center(int stripNumb) const
Returns the bisector of the strip (Global numbering scheme)
bool m_hasStereo
Flag telling whether the strip design has a stereo angle or not.
double m_lenSlopEdge
Length of the edge connecting the short with the long egde.
const Amg::Vector2D & cornerTopRight() const
Returns the top right corner of the trapezoid.
void resetDirCache()
Resets the cache of the directions.
Amg::Vector2D m_stripDir
Orientiation of the strips along the panel.
void defineTrapezoid(double HalfShortY, double HalfLongY, double HalfHeight)
Defines the edges of the trapezoid.
int m_numStrips
Number of all strips.
double m_yCutout
Stores the diamond cutout length from the SQLite DB file.
CxxUtils::CachedUniquePtr< Amg::Vector2D > m_dirLeftEdge
Vector describing the left adge of the trapezoid (bottom left -> top left)
double yCutout() const
Returns the cutout of the diamond.
double stripPitch() const
Distance between two adjacent strips.
void flipTrapezoid()
Flips the edges of the trapezoid boundaries by 90 degrees clockwise.
double stripWidth() const
Width of a strip.
bool m_isFlipped
Flag telling whether the trapezoid has been flipped.
double m_shortHalfY
Trapezoid dimensions.
void setStereoAngle(double stereo)
Amg::Vector2D m_firstStripPos
First strip position.
Amg::Vector2D m_topRight
Bottom right point of the trapezoid.
double m_stripPitch
Distance between 2 adjacent strip centers.
CxxUtils::CachedUniquePtr< Amg::Vector2D > m_dirBotEdge
Vector describing the bottom edge of the trapezoid (bottom left -> bottom right)
int m_channelShift
Shift between the 0-th readout channel and the first strip described by the panel.
double shortHalfHeight() const
Returns the shorter half height of the panel.
double m_stereoAngle
Stereo angle of the strip design.
double longHalfHeight() const
Returns the longer half height of the panel.
Amg::Vector2D m_stripNormal
Vector pointing from strip N to the next strip.
virtual void print(std::ostream &ostr) const
Dump properties to the ostr.
CxxUtils::CachedUniquePtr< Amg::Vector2D > m_dirTopEdge
Vector describing the top edge of the trapzoid (top left -> top right)
bool hasStereoAngle() const
Returns whether a stereo angle is defined.
const Amg::Vector2D & cornerBotRight() const
Returns the bottom right corner of the trapezoid.
const Amg::Vector2D & cornerBotLeft() const
Returns the bottom left corner of the trapezoid.
virtual int numStrips() const
Number of strips on the panel.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Eigen::Matrix< double, 2, 1 > Vector2D
The ReadoutGeomCnvAlg converts the Run4 Readout geometry build from the GeoModelXML into the legacy M...
std::ostream & operator<<(std::ostream &ostr, const Chamber::defineArgs &args)
Definition Chamber.cxx:14
bool operator<(const MdtTubeLayer::CutTubes &a, const unsigned int tube)
GeoModel::TransientConstSharedPtr< StripDesign > StripDesignPtr
Definition StripDesign.h:29