ATLAS Offline Software
PadDesign.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
5 #include <GaudiKernel/SystemOfUnits.h>
6 namespace {
7  constexpr double tolerance = 0.001 * Gaudi::Units::mm;
8 }
10 #define ORDER_PROP(PROP) \
11  { \
12  if (std::abs(PROP - other.PROP) > tolerance) { \
13  return PROP < other.PROP; \
14  } \
15  }
16 
17 namespace MuonGMR4{
18  void PadDesign::print(std::ostream& ostr) const {
19  ostr<<"Dimension -- width x height [mm]: "<<halfWidth() * Gaudi::Units::mm<<" x ";
20  ostr<<shortHalfHeight()<<"/"<<longHalfHeight()<<" [mm], ";
21  if (hasStereoAngle()) ostr<<"stereo angle: "<<stereoAngle() / Gaudi::Units::deg<<", ";
22  ostr<<"position first pad "<<Amg::toString(stripPosition(firstStripNumber()),1);
23  ostr<<" *** Trapezoid edges "<<Amg::toString(cornerBotLeft(),1)<<" - "<<Amg::toString(cornerBotRight(), 1)<<" --- ";
24  ostr<<Amg::toString(cornerTopLeft(), 1)<<" - "<<Amg::toString(cornerTopRight(), 1);
25  ostr<<" -- numPadEta: "<<numPadEta()<<", numPadPhi: "<<numPadPhi()<<", pad height: "<<padHeight();
26  ostr<<" -- firstPadPhiDiv: "<<firstPadPhiDiv()<<", anglePadPhi: "<<anglePadPhi()<<", padPhiShift: "<<padPhiShift();
27  ostr<<" -- firstPadHeight: "<<firstPadHeight()<<", beamlineRadius: "<<beamlineRadius();
28  }
29 
30  bool PadDesign::operator<(const PadDesign& other) const {
35  return static_cast<const StripDesign&>(*this) < other;
36  }
37 
38  void PadDesign::definePadRow(const double firstPadPhiDiv,
39  const int numPadPhi,
40  const double anglePadPhi,
41  const int padPhiShift) {
42 
46  m_padPhiShift = static_cast<double>(padPhiShift);
47  };
48 
49  void PadDesign::definePadColumn(const double firstPadHeight,
50  const int numPadEta,
51  const double padHeight,
52  const int maxPadEta) {
53 
58  };
59 
61  m_radius = radius;
62  };
63 
64  localCornerArray PadDesign::padCorners(const std::pair<int, int>& padEtaPhi) const {
65  int padEta = padEtaPhi.first;
66  int padPhi = padEtaPhi.second;
67  localCornerArray padCorners = {make_array<Amg::Vector2D, 4>(Amg::Vector2D::Zero())};
69  double botEdge{0.};
70  double topEdge{0.};
72  double botLeftPoint{0.};
73  double botRightPoint{0.};
74  double topLeftPoint{0.};
75  double topRightPoint{0.};
77  double maxBottom = -halfWidth();
78  double maxTop = halfWidth();
79  if(padEta == 1) {
81  botEdge = maxBottom;
82  topEdge = botEdge + firstPadHeight();
83  }
84  else if(padEta > 1 && padEta <= numPadEta()) {
85  botEdge = maxBottom + firstPadHeight() + (padEta - 2) * padHeight();
86  topEdge = botEdge + padHeight();
87  if(padEta == numPadEta()) topEdge = maxTop;
88  }
89  else {
90  ATH_MSG_WARNING(__FILE__<<":"<<__LINE__<<" The given pad Eta " << padEta << " is out of range. Maximum range is " << numPadEta());
91  return padCorners;
92  }
93 
95  double phiRight = firstPadPhiDiv() + (padPhi - 2) * anglePadPhi();
96  double phiLeft = firstPadPhiDiv() + (padPhi - 1) * anglePadPhi();
98  double tanRight = std::tan(phiRight * Gaudi::Units::deg);
99  double tanLeft = std::tan(phiLeft * Gaudi::Units::deg);
101  double botBase = botEdge + beamlineRadius();
102  double topBase = topEdge + beamlineRadius();
104  botLeftPoint = -botBase * tanLeft;
105  botRightPoint = -botBase * tanRight;
106  topLeftPoint = -topBase * tanLeft;
107  topRightPoint = -topBase * tanRight;
109  double cosRight = botBase / std::hypot(botRightPoint, botBase);
110  double cosLeft = botBase / std::hypot(botLeftPoint, botBase);
112  botLeftPoint += padPhiShift() * cosLeft;
113  botRightPoint += padPhiShift() * cosRight;
114  topLeftPoint += padPhiShift() * cosLeft;
115  topRightPoint += padPhiShift() * cosRight;
117  double adjHeight = yCutout()? 2 * halfWidth() - yCutout() : 2 * halfWidth();
118  if(padPhi == 1) {
119  botRightPoint = shortHalfHeight() + ((longHalfHeight() - shortHalfHeight()) * (botEdge - maxBottom) / adjHeight);
120  topRightPoint = shortHalfHeight() + ((longHalfHeight() - shortHalfHeight()) * (topEdge - maxBottom) / adjHeight);
121  }
122  if(padPhi == numPadPhi()) {
123  botLeftPoint = -shortHalfHeight() - ((longHalfHeight() - shortHalfHeight()) * (botEdge - maxBottom) / adjHeight);
124  topLeftPoint = -shortHalfHeight() - ((longHalfHeight() - shortHalfHeight()) * (topEdge - maxBottom) / adjHeight);
125  }
132 
133  if (yCutout() && topEdge > (halfWidth() - yCutout())) {
134  if (padPhi == 1) {
135  topRightPoint = longHalfHeight();
136  if (botEdge > (halfWidth() - yCutout())) botRightPoint = longHalfHeight();
137  }
138  if (padPhi == numPadPhi()) {
139  topLeftPoint = -longHalfHeight();
140  if (botEdge > (halfWidth() - yCutout())) botLeftPoint = -longHalfHeight();
141  }
142  }
143 
146  if (botEdge > topEdge) {
147  ATH_MSG_VERBOSE("Swap top and bottom side "<<padEtaPhi.first<<"/"<<padEtaPhi.second);
148  std::swap(botEdge, topEdge);
149  }
150  if (botLeftPoint > botRightPoint) {
151  ATH_MSG_VERBOSE("Swap bottom left and right points "<<padEtaPhi.first<<"/"<<padEtaPhi.second);
152  std::swap(botLeftPoint, botRightPoint);
153  }
154  if (topLeftPoint > topRightPoint) {
155  ATH_MSG_VERBOSE("Swap top left and right points "<<padEtaPhi.first<<"/"<<padEtaPhi.second);
156  std::swap(topLeftPoint, topRightPoint);
157  }
158  padCorners[botLeft] = Amg::Vector2D(botLeftPoint, botEdge);
159  padCorners[botRight] = Amg::Vector2D(botRightPoint, botEdge);
160  padCorners[topLeft] = Amg::Vector2D(topLeftPoint, topEdge);
161  padCorners[topRight] = Amg::Vector2D(topRightPoint, topEdge);
162  return padCorners;
163  };
164 }
165 
MuonGMR4::StripDesign::cornerTopLeft
const Amg::Vector2D & cornerTopLeft() const
Returns the top left corner of the trapezoid.
MuonGMR4::PadDesign::padHeight
double padHeight() const
Returns the height of all the pads that are not adjacent to the bottom edge of the trapezoid active a...
MuonGMR4::PadDesign::maxPadEta
int maxPadEta() const
Returns the maximum number of pads that can be contained in a column of a pad. Used to match the pad ...
MuonGMR4::PadDesign::beamlineRadius
double beamlineRadius() const
Returns the distance between the gasGap center and the beamline.
MuonGMR4::StripDesign::stereoAngle
double stereoAngle() const
Returns the value of the stereo angle.
MuonGMR4::StripDesign
Definition: StripDesign.h:30
MuonGMR4::PadDesign::m_maxPadEta
int m_maxPadEta
The maximum number of pads that can be contained in a column of a pad. Used to match the pad numberin...
Definition: PadDesign.h:108
MuonGMR4::StripDesign::cornerBotLeft
const Amg::Vector2D & cornerBotLeft() const
Returns the bottom left corner of the trapezoid.
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
MuonGMR4::PadDesign::m_padHeight
double m_padHeight
Height of all the pads that are not adjacent to the bottom edge of the trapezoid active area.
Definition: PadDesign.h:106
MuonGMR4::PadDesign::padEta
int padEta(const int channel) const
Returns the Eta index of the pad for the given sequential channel number.
MuonGMR4::PadDesign::m_numPadPhi
int m_numPadPhi
Number of pads in the Phi direction in the given gasGap layer.
Definition: PadDesign.h:96
deg
#define deg
Definition: SbPolyhedron.cxx:17
MuonGMR4::PadDesign::definePadColumn
void definePadColumn(const double firstPadHeight, const int numPadEta, const double padHeight, const int maxPadEta=18)
Defines the Eta direction layout of the pad detector by specifing the height of the first pad in mill...
Definition: PadDesign.cxx:49
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
MuonGMR4::StripDesign::longHalfHeight
double longHalfHeight() const
Returns the longer half height of the panel.
MuonGMR4::PadDesign::firstPadHeight
double firstPadHeight() const
Returns the height of the pads that are adjacent to the bottom edge of the trapezoid active area.
MuonGMR4::StripDesign::shortHalfHeight
double shortHalfHeight() const
Returns the shorter half height of the panel.
ORDER_PROP
#define ORDER_PROP(PROP)
Helper macro to facilliate the ordering.
Definition: PadDesign.cxx:10
Amg::toString
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Definition: GeoPrimitivesToStringConverter.h:40
MuonGMR4
A muon chamber is a collection of readout elements belonging to the same station.
Definition: ChamberAssembleTool.h:16
MuonGMR4::PadDesign::padEtaPhi
std::pair< int, int > padEtaPhi(const int channel) const
Returns a pair of Eta and Phi index for the given sequential channel number.
MuonGMR4::PadDesign::numPadPhi
int numPadPhi() const
Returns the number of pads in the Phi direction in the given gasGap layer.
MuonGMR4::PadDesign::defineBeamlineRadius
void defineBeamlineRadius(const double radius)
Extracting the distance from gasGap center to beamline from the local to global transformation of the...
Definition: PadDesign.cxx:60
MuonGMR4::StripDesign::yCutout
double yCutout() const
Returns the cutout of the diamond.
MuonGMR4::PadDesign::anglePadPhi
double anglePadPhi() const
Returns the angular pitch of the pads in the phi direction.
MuonGMR4::PadDesign::m_padPhiShift
double m_padPhiShift
The staggering shift of inner pad edges in the phi direction.
Definition: PadDesign.h:100
MuonGMR4::PadDesign::botRight
@ botRight
Definition: PadDesign.h:78
MuonGMR4::PadDesign::padPhiShift
double padPhiShift() const
Returns the staggering shift of inner pad edges in the phi direction.
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
MuonGMR4::StripDesign::firstStripNumber
int firstStripNumber() const
Returns the number of the first strip.
WriteCalibToCool.swap
swap
Definition: WriteCalibToCool.py:94
MuonGMR4::PadDesign::botLeft
@ botLeft
Definition: PadDesign.h:78
MuonGMR4::PadDesign::definePadRow
void definePadRow(const double firstPadPhiDiv, const int numPadPhi, const double anglePadPhi, const int padPhiShift)
Defines the Phi direction layout of the pad detector by specifing the starting angle w....
Definition: PadDesign.cxx:38
MuonGMR4::StripDesign::cornerTopRight
const Amg::Vector2D & cornerTopRight() const
Returns the top right corner of the trapezoid.
MuonGMR4::PadDesign::padCorners
padCorners
Definition: PadDesign.h:78
tolerance
Definition: suep_shower.h:17
MuonGMR4::PadDesign::numPadEta
int numPadEta() const
Returns the number of pads in the eta direction in the given layer.
MuonGMR4::PadDesign::localCornerArray
std::array< Amg::Vector2D, 4 > localCornerArray
Defining an array of four vectors to store the pad corner position in the order of the enum defined b...
Definition: PadDesign.h:77
MuonGMR4::PadDesign::m_anglePadPhi
double m_anglePadPhi
Angular pitch of the pads in the phi direction.
Definition: PadDesign.h:98
ParticleGun_SamplingFraction.radius
radius
Definition: ParticleGun_SamplingFraction.py:96
MuonGMR4::PadDesign::topLeft
@ topLeft
Definition: PadDesign.h:78
MuonGMR4::PadDesign::print
void print(std::ostream &ostr) const override final
Dump properties to the ostr.
Definition: PadDesign.cxx:18
MuonGMR4::StripDesign::halfWidth
double halfWidth() const
Returns the half height of the strip panel.
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
MuonGMR4::StripDesign::cornerBotRight
const Amg::Vector2D & cornerBotRight() const
Returns the bottom right corner of the trapezoid.
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
MuonGMR4::PadDesign::topRight
@ topRight
Definition: PadDesign.h:78
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
MuonGMR4::PadDesign::m_radius
double m_radius
Stores the beamline radius extracted from the local to global transformation.
Definition: PadDesign.h:110
MuonGMR4::PadDesign::operator<
bool operator<(const PadDesign &other) const
set sorting operator
Definition: PadDesign.cxx:30
MuonGMR4::StripDesign::hasStereoAngle
bool hasStereoAngle() const
Returns whether a stereo angle is defined.
MuonGMR4::PadDesign::stripPosition
Amg::Vector2D stripPosition(int stripNum) const override final
Override from stripDesign. This function will give the center of the pad by taking the sequential cha...
MuonGMR4::PadDesign::m_firstPadHeight
double m_firstPadHeight
Height of the pads that are adjacent to the bottom edge of the trapezoid active area.
Definition: PadDesign.h:102
MuonGMR4::PadDesign
Definition: PadDesign.h:24
MuonGMR4::PadDesign::firstPadPhiDiv
double firstPadPhiDiv() const
Returns the angle of the first pad outer edge w.r.t. the gasGap center from the beamline.
MuonGMR4::PadDesign::m_firstPadPhiDiv
double m_firstPadPhiDiv
Angle of the first pad outer edge w.r.t. the gasGap center from the beamline.
Definition: PadDesign.h:94
MuonGMR4::PadDesign::padPhi
int padPhi(const int channel) const
Returns the Phi index of the pad for the given sequential channel number.
MuonGMR4::PadDesign::m_numPadEta
int m_numPadEta
Number of pads in the eta direction in the given layer.
Definition: PadDesign.h:104
PadDesign.h
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32