ATLAS Offline Software
Loading...
Searching...
No Matches
MuonPadDesign.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5/***************************************************************************
6 properties of a plane based detector allowing for a stereo angle
7 ----------------------------------------------------------------------
8***************************************************************************/
9
10#ifndef MUONREADOUTGEOMETRY_MUONPADDESIGN_H
11#define MUONREADOUTGEOMETRY_MUONPADDESIGN_H
12
13#include <cmath>
14#include <utility>
15#include <vector>
16
18#include "CLHEP/Units/SystemOfUnits.h"
22namespace MuonGM {
23
25
37 struct MuonPadDesign: public AthMessaging {
38 public:
40 int padEtaMin{0};
41 int padEtaMax{0};
42
43 double inputRowPitch{0.};
44 double inputPhiPitch{0.};
45 double signY{0.};
46 double firstRowPos{0.};
47 double firstPhiPos{0.};
48
49 double Length{0.};
50 double sWidth{0.};
51 double lWidth{0.};
52 double Size{0.};
53 double thickness{0.};
54 double radialDistance{0.};
55
56 double sPadWidth{0.};
57 double lPadWidth{0.};
58 double xFrame{0.};
59 double ysFrame{0.};
60 double ylFrame{0.};
61 double yCutout{0.};
62 int nPadH{0};
64 double PadPhiShift{0.};
65 int etasign{0};
69 static constexpr double largeSectorOpeningAngle{28.0};
70 static constexpr double smallSectorOpeningAngle{17.0};
71
72 std::pair<int, int> etaPhiId(const int channel) const;
73 int channelId(const std::pair<int, int>& padId) const;
74
75
77 double distanceToChannel(const Amg::Vector2D& pos, bool measPhi, int channel = 0) const;
78
79 Amg::Vector2D distanceToPad(const Amg::Vector2D& pos, int channel) const;
80
82 bool withinSensitiveArea(const Amg::Vector2D& pos) const;
84 double minSensitiveY() const;
86 double maxSensitiveY() const;
88 double maxAbsSensitiveX(const double& y) const;
89
91 std::pair<int, int> channelNumber(const Amg::Vector2D& pos) const;
92
94 bool channelPosition(const std::pair<int, int>& pad, Amg::Vector2D& pos) const;
95 bool channelPosition(const int channel, Amg::Vector2D& pos) const;
96
98 using CornerArray = std::array<Amg::Vector2D, 4>;
100 bool channelCorners(const std::pair<int, int>& pad, CornerArray& corners) const;
101 bool channelCorners(const int channel, CornerArray& corners) const;
103 double channelWidth(const Amg::Vector2D& pos, bool measPhi, bool preciseMeas = false) const;
104
106 double gasGapThickness() const;
107
109 void setR(double R) { this->radialDistance = R; }
110 };
111
112 inline std::pair<int, int> MuonPadDesign::etaPhiId(const int channel) const {
113 return std::make_pair( ((channel -1) % 18) + 1, ( (channel -1) / 18) + 1);
114 }
115 inline int MuonPadDesign::channelId(const std::pair<int, int>& padId) const {
116 return 1 + (padId.first - 1) + (padId.second - 1 ) * 18;
117 }
118
119 inline double MuonPadDesign::distanceToChannel(const Amg::Vector2D& pos, bool measPhi, int channel) const {
120 // if channel number not provided, get the nearest channel ( mostly for validation purposes )
121
122 std::pair<int, int> pad{};
123 if (channel < 1) { // retrieve nearest pad indices
124 pad = channelNumber(pos);
125 } else { // hardcode - or add a member saving idHelper max
126 pad = etaPhiId(channel);
127 }
128
129 Amg::Vector2D chPos{Amg::Vector2D::Zero()};
130 if (!channelPosition(pad, chPos)) return -10000.;
131
132 if (!measPhi) return (pos.y() - chPos.y());
133
134 // the "phi" distance to be compared with channel width (taking into account the stereo angle)
135
136 return (pos.x() - chPos.x());
137 }
138
139 inline double MuonPadDesign::channelWidth(const Amg::Vector2D& pos, bool measPhi, bool preciseMeas) const {
140 // get Eta and Phi indices, and corner positions of given pad
141 const std::pair<int, int>& pad = channelNumber(pos);
142 std::array<Amg::Vector2D,4> corners{make_array<Amg::Vector2D, 4>(Amg::Vector2D::Zero())};
143 channelCorners(pad, corners);
144
145 // For eta pad measurement, return height of given pad
146 if (!measPhi) return corners.at(2)[1] - corners.at(0)[1];
147
148 // Return the width at the top of the pads
149 /* This is used by default and allows for track/segment association to pads to work correctly
150 In these cases, the given position of the pad is always its centre so we can not know the
151 precise position where we want to compute the width so its best to give a larger value
152 */
153 if (!preciseMeas) return corners.at(3)[0] - corners.at(2)[0];
154
155 // Return precise Phi width for a given precise position on the pad
156 /* This is only used when the precise position of a hit, track or segment is known on the pad
157 Only to be used in specific cases, like in the digitization when we need to know the exact
158 width along a certain point in the pad, e.g. for charge sharing.
159 */
160
161 double WidthTop = corners.at(3)[0] - corners.at(2)[0];
162 double WidthBot = corners.at(1)[0] - corners.at(0)[0];
163 return WidthBot + (WidthTop - WidthBot) * (pos.y() - corners.at(0)[1]) / (corners.at(2)[1]-corners.at(0)[1]);
164 }
165
166 inline double MuonPadDesign::gasGapThickness() const { return thickness; }
167
168} // namespace MuonGM
169#endif // MUONREADOUTGEOMETRY_MUONPADDESIGN_H
constexpr std::array< T, N > make_array(const T &def_val)
Helper function to initialize in-place arrays with non-zero values.
Definition ArrayHelper.h:10
#define y
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
Eigen::Matrix< double, 2, 1 > Vector2D
Ensure that the Athena extensions are properly loaded.
Definition GeoMuonHits.h:27
double radialDistance
DT-2015-11-29 distance from the beamline to the center of the module.
bool channelPosition(const std::pair< int, int > &pad, Amg::Vector2D &pos) const
calculate local channel position for a given channel number
std::pair< int, int > etaPhiId(const int channel) const
bool withinSensitiveArea(const Amg::Vector2D &pos) const
whether pos is within the sensitive area of the module
double distanceToChannel(const Amg::Vector2D &pos, bool measPhi, int channel=0) const
distance to channel - residual
double maxAbsSensitiveX(const double &y) const
largest (abs, local) x of the sensitive volume
double gasGapThickness() const
thickness of gas gap
static constexpr double smallSectorOpeningAngle
static constexpr double largeSectorOpeningAngle
bool channelCorners(const std::pair< int, int > &pad, CornerArray &corners) const
int channelId(const std::pair< int, int > &padId) const
std::pair< int, int > channelNumber(const Amg::Vector2D &pos) const
calculate local channel number, range 1=nstrips like identifiers.
void setR(double R)
access to cache
double channelWidth(const Amg::Vector2D &pos, bool measPhi, bool preciseMeas=false) const
calculate local channel width
Amg::Vector2D distanceToPad(const Amg::Vector2D &pos, int channel) const
std::array< Amg::Vector2D, 4 > CornerArray
calculate local channel corners for a given channel number
double maxSensitiveY() const
highest y (local) of the sensitive volume
double minSensitiveY() const
lowest y (local) of the sensitive volume