ATLAS Offline Software
MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/TgcReadoutElement.icc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 #ifndef MUONREADOUTGEOMETRY_TGCREADOUTELEMENT_ICC
5 #define MUONREADOUTGEOMETRY_TGCREADOUTELEMENT_ICC
6 
7 namespace MuonGM {
8  inline const std::string& TgcReadoutElement::readOutName() const { return m_readout_name; }
9 
10 
11  inline bool TgcReadoutElement::isEndcap() const { return getStationType()[2] == 'E'; }
12  inline bool TgcReadoutElement::isForward() const { return getStationType()[2] == 'F'; }
13  inline bool TgcReadoutElement::isDoublet() const { return nGasGaps() == 2; }
14  inline bool TgcReadoutElement::isTriplet() const { return nGasGaps() == 3; }
15 
16  inline double TgcReadoutElement::wirePitch() const { return m_readoutParams->wirePitch(); }
17  inline int TgcReadoutElement::nPhiChambers() const { return m_readoutParams->nPhiChambers(); }
18  inline int TgcReadoutElement::nPhiSectors() const { return m_stIdxT4E == getStationIndex() ? 36 : nPhiChambers(); }
19 
20  inline double TgcReadoutElement::chamberLocPhiMin() const { return m_locMinPhi; }
21  inline double TgcReadoutElement::chamberLocPhiMax() const { return m_locMaxPhi; }
22 
23 
24  inline int TgcReadoutElement::nGasGaps() const { return m_readoutParams->nGaps(); }
25  inline int TgcReadoutElement::nStrips(int gasGap) const { return m_readoutParams->nStrips(gasGap); }
26  inline int TgcReadoutElement::nWires(int gasGap) const { return m_readoutParams->totalWires(gasGap); }
27  inline int TgcReadoutElement::nWires(int gasGap, int gang) const { return m_readoutParams->nWires(gasGap, gang); }
28  inline int TgcReadoutElement::nWireGangs(int gasGap) const { return m_readoutParams->nWireGangs(gasGap); }
29  inline double TgcReadoutElement::nPitchesToGang(int gasGap, int gang) const { return m_readoutParams->nPitchesToGang(gasGap, gang); }
30  inline double TgcReadoutElement::gangThickness() const { return m_readoutParams->gangThickness(); }
31  inline int TgcReadoutElement::chamberType() const { return m_readoutParams->chamberType(); }
32 
33  inline double TgcReadoutElement::chamberWidth(double z) const {
34  return getSsize() + (0.5 *length() +z) * (getLongSsize() - getSsize()) / length();
35  }
36  inline double TgcReadoutElement::wireGangLocalX(const int gasGap, const int gang) const {
37  return wirePitch() * nPitchesToGang(gasGap, gang);
38  }
39 
40 
41  inline double TgcReadoutElement::stripLength() const { return m_Rsize; }
42  inline double TgcReadoutElement::physicalDistanceFromBase() const { return m_readoutParams->physicalDistanceFromBase(); }
43  inline double TgcReadoutElement::stripPosOnLargeBase(int strip, int gasGap) const {
44  return m_readoutParams->stripPositionOnLargeBase(strip, gasGap);
45  }
46  inline double TgcReadoutElement::stripPosOnShortBase(int strip, int gasGap) const {
47  return m_readoutParams->stripPositionOnShortBase(strip, gasGap);
48  }
49  inline double TgcReadoutElement::wireLength(int wire) const {
50  return m_Ssize + (wire - 1) * wirePitch() * (m_LongSsize - m_Ssize) / m_Rsize;
51  }
52 
53  inline const TgcReadoutParams* TgcReadoutElement::getReadoutParams() const { return m_readoutParams.get(); }
54 
55  inline std::pair<double, int> TgcReadoutElement::stripNumberToFetch(int gasGap, int inStrip) const {
56  const bool swapStrip{!((getStationEta() > 0 && gasGap == 1) || (getStationEta() < 0 && gasGap != 1) ||
57  m_readoutParams->nStripLayers() > 1)};
58  const bool flip = gasGap !=1 && m_readoutParams->nStripLayers() == 1;
59  const int pickStrip = swapStrip ? 33 - inStrip : inStrip;
60  return std::make_pair(-1. + 2.*flip, pickStrip);
61  }
62 
63  /// Override of functions declared as interfaces in the parent classes
64  inline int TgcReadoutElement::layerHash(const Identifier& id) const { return m_idHelper.gasGap(id) - 1; }
65 
66  inline int TgcReadoutElement::surfaceHash(const Identifier& id) const {
67  return surfaceHash(m_idHelper.gasGap(id) ,m_idHelper.isStrip(id));
68  }
69  inline int TgcReadoutElement::surfaceHash(int gasGap, bool isStrip) { return 2 * (gasGap -1) + isStrip; }
70  inline int TgcReadoutElement::boundaryHash(const Identifier& id) const { return (measuresPhi(id) ? 0 : 1); }
71  inline bool TgcReadoutElement::measuresPhi(const Identifier& id) const { return m_idHelper.isStrip(id); }
72  inline int TgcReadoutElement::numberOfLayers(bool) const { return nGasGaps(); }
73  inline int TgcReadoutElement::numberOfStrips(const Identifier& id) const { return numberOfStrips(m_idHelper.gasGap(id),
74  m_idHelper.isStrip(id));
75  }
76  inline int TgcReadoutElement::numberOfStrips(int layer, bool isStrip) const { return isStrip ? nStrips(layer) :
77  nWireGangs(layer);
78  }
79  inline double TgcReadoutElement::stripLocalX(const int gasGap,
80  const int stripNum,
81  const double locY,
82  const double refPoint) const {
83  return refPoint + (locY != 0. ? locY * m_stripSlope * (stripPosOnLargeBase(stripNum, gasGap) - stripPosOnShortBase(stripNum, gasGap)) : 0.);
84  }
85 
86  inline const Amg::Transform3D& TgcReadoutElement::localToGlobalTransf(const Identifier& id) const {
87  return transform(surfaceHash(id));
88  }
89  inline Amg::Transform3D TgcReadoutElement::globalToLocalTransf(const Identifier& id) const {
90  return transform(id).inverse();
91  }
92 
93  inline Amg::Vector3D TgcReadoutElement::wireGangPos(int gasGap, int gang) const {
94  return transform(surfaceHash(gasGap, false)) * localWireGangPos(gasGap, gang);
95  }
96 
97  inline Amg::Vector3D TgcReadoutElement::wireGangPos(const Identifier& id) const {
98  return wireGangPos(m_idHelper.gasGap(id),
99  m_idHelper.channel(id));
100  }
101 
102  inline Amg::Vector3D TgcReadoutElement::localWireGangPos(const Identifier& id) const {
103  return localWireGangPos(m_idHelper.gasGap(id),
104  m_idHelper.channel(id));
105  }
106  inline Amg::Vector3D TgcReadoutElement::localWireGangPos(int gasGap, int gang) const {
107  return wireGangLocalX(gasGap, gang) * Amg::Vector3D::UnitX();
108  }
109 
110  inline Amg::Vector3D TgcReadoutElement::stripPos(const Identifier& id) const {
111  return stripPos(m_idHelper.gasGap(id), m_idHelper.channel(id));
112  }
113  inline Amg::Vector3D TgcReadoutElement::stripPos(int gasGap, int strip) const {
114  return transform(surfaceHash(gasGap, true)) * localStripPos(gasGap, strip);
115  }
116 
117  inline Amg::Vector3D TgcReadoutElement::localStripPos(int gasGap, int strip) const {
118  return stripCenterLocX(gasGap, strip, 0.) * Amg::Vector3D::UnitX();
119  }
120  inline Amg::Vector3D TgcReadoutElement::localStripPos(const Identifier& id) const {
121  return localStripPos(m_idHelper.gasGap(id), m_idHelper.channel(id));
122  }
123  inline Amg::Vector3D TgcReadoutElement::localStripDir(int gasGap, int strip) const{
124  const double halfeight = 0.5 *getRsize();
125  return (Amg::Vector3D{stripCenterLocX(gasGap,strip, halfeight), halfeight,0} -
126  Amg::Vector3D{stripCenterLocX(gasGap,strip, -halfeight), -halfeight,0}).unit();
127 
128  }
129  inline Amg::Vector3D TgcReadoutElement::localStripDir(const Identifier& id) const{
130  return localStripDir(m_idHelper.gasGap(id), m_idHelper.channel(id));
131  }
132  inline Amg::Vector3D TgcReadoutElement::stripDir(int gasGap, int strip) const {
133  return transform(surfaceHash(gasGap, true)).linear() * localStripDir(gasGap, strip);
134  }
135  inline Amg::Vector3D TgcReadoutElement::stripDir(const Identifier& id) const {
136  return stripDir(m_idHelper.gasGap(id), m_idHelper.channel(id));
137  }
138 
139 
140  inline Amg::Vector3D TgcReadoutElement::channelPos(const Identifier& id) const {
141  return channelPos(m_idHelper.gasGap(id),
142  m_idHelper.isStrip(id),
143  m_idHelper.channel(id));
144  }
145  inline Amg::Vector3D TgcReadoutElement::channelPos(int gasGap, bool isStrip, int channel) const {
146  return transform(surfaceHash(gasGap, isStrip)) * localChannelPos(gasGap, isStrip, channel);
147  }
148  inline Amg::Vector3D TgcReadoutElement::localChannelPos(const Identifier& id) const {
149  return localChannelPos(m_idHelper.gasGap(id),
150  m_idHelper.isStrip(id),
151  m_idHelper.channel(id));
152  }
153  inline Amg::Vector3D TgcReadoutElement::localChannelPos(int gasGap, bool isStrip, int channel) const {
154  return isStrip ? localStripPos(gasGap, channel) : localWireGangPos(gasGap, channel);
155  }
156 
157 
158 
159 
160 } // namespace MuonGM
161 
162 #endif