ATLAS Offline Software
Loading...
Searching...
No Matches
StripDesign.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef MUONREADOUTGEOMETRYR4_STRIPDESIGN_H
5#define MUONREADOUTGEOMETRYR4_STRIPDESIGN_H
6
10#include <optional>
12
13namespace MuonGMR4 {
14 /*
15 * Generic class describing the layout of a Muon strip detector (E.g. the Rpcs, Micromegas, Tgc, sTgc)
16 * The local coordinate system is defined such that the strip lanes are parallel to the y-axis and the
17 * positive x-axis points to the next adjacent strip. The StripDesign also describes the stereo layers of the
18 * Micromega detectors. There, the strips are rotated around their nominal strip center. The center position is then
19 * adapted accordingly to always return the geometrical bisect of each strip lane
20 *
21 * In terms of geometrical layout it is assumed that the strips are mounted onto a trapezoid where the two parallel edges are
22 * parallel to the strip lanes. Its center is the origin of the local coordinate system. Further it's assumed that there is no
23 * passivation w.r.t. to the slopy edges. i.e. the strips end with the edge of the panel.
24 * By specifing the position of the first strip center w.r.t. trapezoid center, the strip pitch, the number of all strips and
25 * the global number of the first strip w.r.t. the global strip numbering scheme, the layout of the strip detector is completely
26 * determined.
27 */
28 class StripDesign;
30 class StripDesign: public AthMessaging {
31 public:
33 virtual ~StripDesign() = default;
34
36 double stripPitch() const;
38 double stripWidth() const;
40 virtual int numStrips() const;
44 void defineStripLayout(Amg::Vector2D&& posFirst,
45 const double stripPitch,
46 const double stripWidth,
47 const int numStrips,
48 const int numFirst = 1);
49
51 double halfWidth() const;
53 double shortHalfHeight() const;
55 double longHalfHeight() const;
56
58 bool hasStereoAngle() const;
60 double stereoAngle() const;
62 bool isFlipped() const;
63
65 void defineTrapezoid(double HalfShortY, double HalfLongY, double HalfHeight);
68 void defineTrapezoid(double HalfShortY, double HalfLongY, double HalfHeight, double sAngle);
70 void flipTrapezoid();
71
73 double distanceToStrip(const Amg::Vector2D& pos, int strip) const;
74
77 virtual int stripNumber(const Amg::Vector2D& pos) const;
78
80 int firstStripNumber() const;
81
82 using CheckVector2D = std::optional<Amg::Vector2D>;
84 CheckVector2D leftEdge(int stripNumb) const;
86 CheckVector2D rightEdge(int stripNumb) const;
88 CheckVector2D center(int stripNumb) const;
90 bool operator<(const StripDesign& other) const;
92 virtual double stripLength(int stripNumb) const;
94 virtual void print(std::ostream&ostr) const;
96 bool insideTrapezoid(const Amg::Vector2D& extPos) const;
97 protected:
99 bool insideBoundaries(const Amg::Vector2D& pos) const;
101 virtual Amg::Vector2D stripPosition(int stripNum) const;
105 virtual CheckVector2D leftInterSect(int stripNum, bool uncapped = false) const;
106 virtual CheckVector2D rightInterSect(int stripNum, bool uncapped = false) const;
107
108 CheckVector2D leftInterSect(const Amg::Vector2D& stripPos, bool uncapped = false) const;
109 CheckVector2D rightInterSect(const Amg::Vector2D& stripPos, bool uncapped = false) const;
111 CheckVector2D stripCenter(int stripNum) const;
112 public:
124 const Amg::Vector2D& edgeDirTop() const;
129 public:
133 const Amg::Vector2D& stripDir() const;
137 double lenTopEdge() const;
139 double lenLeftEdge() const ;
141 double lenBottomEdge() const;
143 double lenRightEdge() const;
144
145 private:
146 void setStereoAngle(double stereo);
148 void resetDirCache();
154 double m_stripPitch{0.};
156 double m_stripWidth{0.};
158 Amg::Vector2D m_firstStripPos{Amg::Vector2D::Zero()};
159
161 Amg::Vector2D m_stripDir{Amg::Vector2D::UnitY()};
163 Amg::Vector2D m_stripNormal{Amg::Vector2D::UnitX()};
164
166 bool m_isFlipped{false};
168 bool m_hasStereo{false};
170 double m_stereoAngle{0.};
171
173 AmgSymMatrix(2) m_etaToStereo{AmgSymMatrix(2)::Identity()};
175 AmgSymMatrix(2) m_stereoToEta{AmgSymMatrix(2)::Identity()};
177 Amg::Vector2D m_bottomLeft{Amg::Vector2D::Zero()};
179 Amg::Vector2D m_topLeft{Amg::Vector2D::Zero()};
181 Amg::Vector2D m_topRight{Amg::Vector2D::Zero()};
183 Amg::Vector2D m_bottomRight{Amg::Vector2D::Zero()};
184
194 double m_lenSlopEdge{0.};
196 double m_shortHalfY{0.};
197 double m_longHalfY{0.};
198 double m_halfX{0.};
199
201 double m_yCutout{0.};
204 double m_cutLongEdge{0.};
205
206 public:
208 void defineDiamond(double HalfShortY, double HalfLongY, double HalfHeight, double yCutout);
210 double yCutout() const;
211 };
212
214 bool operator()(const StripDesignPtr&a, const StripDesignPtr& b) const {
215 return (*a) < (*b);
216 }
217 bool operator()(const StripDesign&a ,const StripDesign& b) const {
218 return a < b;
219 }
220 };
221
222 std::ostream& operator<<(std::ostream& ostr, const StripDesign& design);
223}
225#endif
Cached unique_ptr with atomic update.
static Double_t a
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
The TransientConstSharedPtr allows non-const access if the pointer itself is non-const but in the con...
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.
const Amg::Vector2D & edgeDirRight() const
Returns the unit vector pointing from the right bottom -> right top corner.
Amg::Vector2D m_topLeft
Top right point of the trapezoid.
const Amg::Vector2D & edgeDirTop() const
Returns the unit vector pointing from the top left -> top right corner.
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.
virtual ~StripDesign()=default
bool isFlipped() const
Returns whether the trapezoid is flipped.
double lenRightEdge() const
Length of the dge from bottom right -> top right.
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)
AmgSymMatrix(2) m_etaToStereo
Matrix to translate from nominal -> stereo frame.
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 lenTopEdge() const
Length of the the edge from top left -> top right.
std::optional< Amg::Vector2D > CheckVector2D
Definition StripDesign.h:82
virtual double stripLength(int stripNumb) const
Returns length of the strip.
double distanceToStrip(const Amg::Vector2D &pos, int strip) const
Returns the distance to the strip center along x.
CheckVector2D leftInterSect(const Amg::Vector2D &stripPos, bool uncapped=false) const
const Amg::Vector2D & edgeDirLeft() const
Returns the unit vector pointing from the left bottom -> left top corner.
virtual CheckVector2D rightInterSect(int stripNum, bool uncapped=false) const
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.
CheckVector2D leftEdge(int stripNumb) const
Returns the left edge of the strip (Global numbering scheme)
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.
const Amg::Vector2D & firstStripPos() const
Vector indicating the first strip position.
double lenLeftEdge() const
Length of the edge from bottom left -> top left.
AmgSymMatrix(2) m_stereoToEta
Matrixt to translate from stereo -> nominal frame.
int m_numStrips
Number of all strips.
virtual CheckVector2D leftInterSect(int stripNum, bool uncapped=false) const
Returns the intersection of a given strip with the left or right edge of the trapezoid If uncapped is...
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.
virtual Amg::Vector2D stripPosition(int stripNum) const
Calculates the position of a given strip (Local numbering scheme)
void flipTrapezoid()
Flips the edges of the trapezoid boundaries by 90 degrees clockwise.
double stripWidth() const
Width of a strip.
const Amg::Vector2D & edgeDirBottom() const
Returns the unit vector pointing from the bottom left -> bottom right corner.
double lenBottomEdge() const
Length of the edge from bottom left -> bottom right.
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.
bool insideTrapezoid(const Amg::Vector2D &extPos) const
Checks whether an external point is inside the trapezoidal area.
virtual int stripNumber(const Amg::Vector2D &pos) const
Calculates the number of the strip whose center is closest to the given point.
CheckVector2D rightEdge(int stripNumb) const
Returns the right edge of the strip (Global numbering scheme)
CheckVector2D rightInterSect(const Amg::Vector2D &stripPos, bool uncapped=false) const
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.
bool insideBoundaries(const Amg::Vector2D &pos) const
Checks wheather the internal point is inside hte trapezoidal area.
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.
CheckVector2D stripCenter(int stripNum) const
Returns the geometrical center of a given strip.
const Amg::Vector2D & stripDir() const
Vector pointing along the strip.
virtual int numStrips() const
Number of strips on the panel.
const Amg::Vector2D & stripNormal() const
Vector pointing to the next strip.
Eigen::Matrix< double, 2, 1 > Vector2D
CachedUniquePtrT< const T > CachedUniquePtr
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
GeoModel::TransientConstSharedPtr< StripDesign > StripDesignPtr
Definition StripDesign.h:29
bool operator()(const StripDesignPtr &a, const StripDesignPtr &b) const
bool operator()(const StripDesign &a, const StripDesign &b) const