ATLAS Offline Software
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 
13 namespace 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:
32  StripDesign();
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:
113 
115  const Amg::Vector2D& cornerBotLeft() const;
119  const Amg::Vector2D& cornerTopLeft() const;
122 
124  const Amg::Vector2D& edgeDirBottom() const;
126  const Amg::Vector2D& edgeDirTop() const;
128  const Amg::Vector2D& edgeDirLeft() const;
130  const Amg::Vector2D& edgeDirRight() const;
131 
133  double lenTopEdge() const;
135  double lenLeftEdge() const ;
137  double lenBottomEdge() const;
139  double lenRightEdge() const;
140 
142  const Amg::Vector2D& stripNormal() const;
144  const Amg::Vector2D& stripDir() const;
146  const Amg::Vector2D& firstStripPos() const;
147  private:
148  void setStereoAngle(double stereo);
150  void resetDirCache();
154  int m_numStrips{0};
156  double m_stripPitch{0.};
158  double m_stripWidth{0.};
161 
163  Amg::Vector2D m_stripDir{Amg::Vector2D::UnitY()};
165  Amg::Vector2D m_stripNormal{Amg::Vector2D::UnitX()};
166 
168  bool m_isFlipped{false};
170  bool m_hasStereo{false};
172  double m_stereoAngle{0.};
173 
175  AmgSymMatrix(2) m_etaToStereo{AmgSymMatrix(2)::Identity()};
177  AmgSymMatrix(2) m_stereoToEta{AmgSymMatrix(2)::Identity()};
186 
196  double m_lenSlopEdge{0.};
198  double m_shortHalfY{0.};
199  double m_longHalfY{0.};
200  double m_halfX{0.};
201 
203  double m_yCutout{0.};
206  double m_cutLongEdge{0.};
207 
208  public:
210  void defineDiamond(double HalfShortY, double HalfLongY, double HalfHeight, double yCutout);
212  double yCutout() const;
213  };
214 
216  bool operator()(const StripDesignPtr&a, const StripDesignPtr& b) const {
217  return (*a) < (*b);
218  }
219  bool operator()(const StripDesign&a ,const StripDesign& b) const {
220  return a < b;
221  }
222  };
223 
224  std::ostream& operator<<(std::ostream& ostr, const StripDesign& design);
225 }
227 #endif
MuonGMR4::StripDesign::cornerTopLeft
const Amg::Vector2D & cornerTopLeft() const
Returns the top left corner of the trapezoid.
MuonGMR4::StripDesign::m_cutLongEdge
double m_cutLongEdge
Lenght of the line segment that's cut from the long edge to make the trapezoid diamond shaped.
Definition: StripDesign.h:206
GeoModel::TransientConstSharedPtr< StripDesign >
MuonGMR4::StripDesign::stereoAngle
double stereoAngle() const
Returns the value of the stereo angle.
MuonGMR4::StripDesign::m_lenSlopEdge
double m_lenSlopEdge
Length of the edge connecting the short with the long egde.
Definition: StripDesign.h:196
MuonGMR4::StripDesign::m_channelShift
int m_channelShift
Shift between the 0-th readout channel and the first strip described by the panel.
Definition: StripDesign.h:152
MuonGMR4::StripDesign::isFlipped
bool isFlipped() const
Returns whether the trapezoid is flipped.
MuonGMR4::StripDesign::stripNumber
virtual int stripNumber(const Amg::Vector2D &pos) const
Calculates the number of the strip whose center is closest to the given point.
MuonGMR4::StripDesign
Definition: StripDesign.h:30
StripDesign.icc
MuonGMR4::StripDesign::defineStripLayout
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....
Definition: StripDesign.cxx:107
MuonGMR4::StripDesign::m_shortHalfY
double m_shortHalfY
Trapezoid dimensions.
Definition: StripDesign.h:198
MuonGMR4::StripDesign::cornerBotLeft
const Amg::Vector2D & cornerBotLeft() const
Returns the bottom left corner of the trapezoid.
MuonGMR4::StripDesign::lenBottomEdge
double lenBottomEdge() const
Length of the edge from bottom left -> bottom right.
MuonGMR4::StripDesign::setStereoAngle
void setStereoAngle(double stereo)
Definition: StripDesign.cxx:59
MuonGMR4::StripDesign::AmgSymMatrix
AmgSymMatrix(2) m_stereoToEta
Matrixt to translate from stereo -> nominal frame.
Definition: StripDesign.h:177
MuonGMR4::StripDesign::m_stereoAngle
double m_stereoAngle
Stereo angle of the strip design.
Definition: StripDesign.h:172
MuonGMR4::StripDesign::stripLength
virtual double stripLength(int stripNumb) const
Returns length of the strip.
MuonGMR4::StripDesign::leftEdge
CheckVector2D leftEdge(int stripNumb) const
Returns the left edge of the strip (Global numbering scheme)
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
MuonGMR4::StripDesign::numStrips
virtual int numStrips() const
Number of strips on the panel.
CxxUtils::CachedUniquePtrT
Cached pointer with atomic update.
Definition: CachedUniquePtr.h:54
MuonGMR4::StripDesign::defineDiamond
void defineDiamond(double HalfShortY, double HalfLongY, double HalfHeight, double yCutout)
Defines the edges of the sTGC diamond L3 sector.
Definition: StripDesign.cxx:82
MuonGMR4::StripDesignSorter::operator()
bool operator()(const StripDesignPtr &a, const StripDesignPtr &b) const
Definition: StripDesign.h:216
MuonGMR4::StripDesign::m_dirRightEdge
CxxUtils::CachedUniquePtr< Amg::Vector2D > m_dirRightEdge
Vector describing the right edge of the trapezoid (bottom right -> top right)
Definition: StripDesign.h:194
MuonGMR4::StripDesign::m_stripNormal
Amg::Vector2D m_stripNormal
Vector pointing from strip N to the next strip.
Definition: StripDesign.h:165
MuonGMR4::StripDesign::m_topLeft
Amg::Vector2D m_topLeft
Top right point of the trapezoid.
Definition: StripDesign.h:181
MuonGMR4::StripDesign::m_stripPitch
double m_stripPitch
Distance between 2 adjacent strip centers.
Definition: StripDesign.h:156
MuonGMR4::StripDesign::longHalfHeight
double longHalfHeight() const
Returns the longer half height of the panel.
MuonGMR4::StripDesign::StripDesign
StripDesign()
Definition: StripDesign.cxx:21
MuonGMR4::StripDesign::edgeDirBottom
const Amg::Vector2D & edgeDirBottom() const
Returns the unit vector pointing from the bottom left -> right corner.
MuonGMR4::StripDesign::stripPosition
virtual Amg::Vector2D stripPosition(int stripNum) const
Calculates the position of a given strip (Local numbering scheme)
MuonGMR4::StripDesign::leftInterSect
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...
MuonGMR4::StripDesign::m_bottomRight
Amg::Vector2D m_bottomRight
Bottom right point of the trapezoid.
Definition: StripDesign.h:185
MuonGMR4::StripDesign::shortHalfHeight
double shortHalfHeight() const
Returns the shorter half height of the panel.
MuonGMR4::StripDesign::leftInterSect
CheckVector2D leftInterSect(const Amg::Vector2D &stripPos, bool uncapped=false) const
MuonGMR4::StripDesign::insideBoundaries
bool insideBoundaries(const Amg::Vector2D &pos) const
Checks wheather the internal point is inside hte trapezoidal area.
MuonGMR4::StripDesign::stripDir
const Amg::Vector2D & stripDir() const
Vector pointing along the strip.
MuonGMR4::StripDesign::stripNormal
const Amg::Vector2D & stripNormal() const
Vector pointing to the next strip.
MuonGMR4::StripDesign::m_firstStripPos
Amg::Vector2D m_firstStripPos
First strip position.
Definition: StripDesign.h:160
MuonGMR4
The ReadoutGeomCnvAlg converts the Run4 Readout geometry build from the GeoModelXML into the legacy M...
Definition: MdtCalibInput.h:20
MuonGMR4::StripDesign::m_dirLeftEdge
CxxUtils::CachedUniquePtr< Amg::Vector2D > m_dirLeftEdge
Vector describing the left adge of the trapezoid (bottom left -> top left)
Definition: StripDesign.h:192
MuonGMR4::StripDesign::stripCenter
CheckVector2D stripCenter(int stripNum) const
Returns the geometrical center of a given strip.
MuonGMR4::StripDesign::insideTrapezoid
bool insideTrapezoid(const Amg::Vector2D &extPos) const
Checks whether an external point is inside the trapezoidal area.
MuonGMR4::StripDesign::yCutout
double yCutout() const
Returns the cutout of the diamond.
MuonGMR4::StripDesignSorter::operator()
bool operator()(const StripDesign &a, const StripDesign &b) const
Definition: StripDesign.h:219
MuonGMR4::StripDesign::~StripDesign
virtual ~StripDesign()=default
CachedUniquePtr.h
Cached unique_ptr with atomic update.
MuonGMR4::StripDesign::m_yCutout
double m_yCutout
Stores the diamond cutout length from the SQLite DB file.
Definition: StripDesign.h:203
MuonGMR4::StripDesign::stripWidth
double stripWidth() const
Width of a strip.
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
MuonGMR4::StripDesign::defineTrapezoid
void defineTrapezoid(double HalfShortY, double HalfLongY, double HalfHeight)
Defines the edges of the trapezoid.
Definition: StripDesign.cxx:69
MuonGMR4::StripDesign::firstStripNumber
int firstStripNumber() const
Returns the number of the first strip.
MuonGMR4::StripDesign::lenRightEdge
double lenRightEdge() const
Length of the dge from bottom right -> top right.
MuonGMR4::StripDesign::rightInterSect
virtual CheckVector2D rightInterSect(int stripNum, bool uncapped=false) const
MuonGMR4::StripDesign::cornerTopRight
const Amg::Vector2D & cornerTopRight() const
Returns the top right corner of the trapezoid.
MuonGMR4::StripDesign::rightInterSect
CheckVector2D rightInterSect(const Amg::Vector2D &stripPos, bool uncapped=false) const
MuonGMR4::StripDesign::flipTrapezoid
void flipTrapezoid()
Flips the edges of the trapezoid boundaries by 90 degrees clockwise.
Definition: StripDesign.cxx:91
MuonGMR4::StripDesign::center
CheckVector2D center(int stripNumb) const
Returns the bisector of the strip (Global numbering scheme)
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
MuonGMR4::StripDesign::m_dirBotEdge
CxxUtils::CachedUniquePtr< Amg::Vector2D > m_dirBotEdge
Vector describing the bottom edge of the trapezoid (bottom left -> bottom right)
Definition: StripDesign.h:190
MuonGMR4::StripDesign::m_hasStereo
bool m_hasStereo
Flag telling whether the strip design has a stereo angle or not.
Definition: StripDesign.h:170
MuonGMR4::StripDesign::print
virtual void print(std::ostream &ostr) const
Dump properties to the ostr.
Definition: StripDesign.cxx:43
MuonGMR4::StripDesign::m_stripWidth
double m_stripWidth
Width of each strip line.
Definition: StripDesign.h:158
MuonGMR4::StripDesign::m_longHalfY
double m_longHalfY
Definition: StripDesign.h:199
MuonGMR4::StripDesign::AmgSymMatrix
AmgSymMatrix(2) m_etaToStereo
Matrix to translate from nominal -> stereo frame.
Definition: StripDesign.h:175
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
MuonGMR4::StripDesign::halfWidth
double halfWidth() const
Returns the half height of the strip panel.
MuonGMR4::StripDesign::m_isFlipped
bool m_isFlipped
Flag telling whether the trapezoid has been flipped.
Definition: StripDesign.h:168
MuonGMR4::StripDesign::m_dirTopEdge
CxxUtils::CachedUniquePtr< Amg::Vector2D > m_dirTopEdge
Vector describing the top edge of the trapzoid (top left -> top right)
Definition: StripDesign.h:188
MuonGMR4::StripDesign::cornerBotRight
const Amg::Vector2D & cornerBotRight() const
Returns the bottom right corner of the trapezoid.
MuonGMR4::StripDesign::edgeDirLeft
const Amg::Vector2D & edgeDirLeft() const
Returns the unit vector pointing from the left bottom -> top corner.
a
TList * a
Definition: liststreamerinfos.cxx:10
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
TransientConstSharedPtr.h
MuonGMR4::StripDesign::resetDirCache
void resetDirCache()
Resets the cache of the directions.
Definition: StripDesign.cxx:118
MuonGMR4::StripDesign::m_bottomLeft
Amg::Vector2D m_bottomLeft
Bottom left point of the trapezoid.
Definition: StripDesign.h:179
MuonGMR4::StripDesign::m_stripDir
Amg::Vector2D m_stripDir
Orientiation of the strips along the panel.
Definition: StripDesign.h:163
MuonGMR4::StripDesignSorter
Definition: StripDesign.h:215
MuonGMR4::StripDesign::lenLeftEdge
double lenLeftEdge() const
Length of the edge from bottom left -> top left.
AthMessaging.h
MuonGMR4::StripDesign::edgeDirRight
const Amg::Vector2D & edgeDirRight() const
Returns the unit vector pointing from the right bottom -> top corner.
MuonGMR4::StripDesign::hasStereoAngle
bool hasStereoAngle() const
Returns whether a stereo angle is defined.
MuonDetectorDefs.h
MuonGMR4::StripDesign::rightEdge
CheckVector2D rightEdge(int stripNumb) const
Returns the right edge of the strip (Global numbering scheme)
MuonGMR4::StripDesign::edgeDirTop
const Amg::Vector2D & edgeDirTop() const
Returns the unit vector pointing from the top left -> right corner.
MuonGMR4::StripDesign::stripPitch
double stripPitch() const
Distance between two adjacent strips.
MuonGMR4::StripDesign::m_halfX
double m_halfX
Definition: StripDesign.h:200
MuonGMR4::StripDesign::lenTopEdge
double lenTopEdge() const
Length of the the edge from top left -> top right.
MuonGMR4::StripDesign::distanceToStrip
double distanceToStrip(const Amg::Vector2D &pos, int strip) const
Returns the distance to the strip center along x.
MuonGMR4::operator<<
std::ostream & operator<<(std::ostream &ostr, const Chamber::defineArgs &args)
Definition: Chamber.cxx:14
MuonGMR4::StripDesign::m_topRight
Amg::Vector2D m_topRight
Bottom right point of the trapezoid.
Definition: StripDesign.h:183
MuonGMR4::StripDesign::m_numStrips
int m_numStrips
Number of all strips.
Definition: StripDesign.h:154
MuonGMR4::StripDesign::operator<
bool operator<(const StripDesign &other) const
Odering operator.
Definition: StripDesign.cxx:26
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32
MuonGMR4::StripDesign::CheckVector2D
std::optional< Amg::Vector2D > CheckVector2D
Definition: StripDesign.h:82
MuonGMR4::StripDesign::firstStripPos
const Amg::Vector2D & firstStripPos() const
Vector indicating the first strip position.