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) const { return m_readoutParams->stripPositionOnLargeBase(strip); }
44  inline double TgcReadoutElement::stripPosOnShortBase(int strip) const { return m_readoutParams->stripPositionOnShortBase(strip); }
45 
46  inline double TgcReadoutElement::wireLength(int wire) const {
47  return m_Ssize + (wire - 1) * wirePitch() * (m_LongSsize - m_Ssize) / m_Rsize;
48  }
49 
50  inline const TgcReadoutParams* TgcReadoutElement::getReadoutParams() const { return m_readoutParams.get(); }
51 
52  inline std::pair<double, int> TgcReadoutElement::stripNumberToFetch(int gasGap, int inStrip) const {
53  const bool swapStrip{!((getStationEta() > 0 && gasGap == 1) || (getStationEta() < 0 && gasGap != 1))};
54  const bool flip = gasGap !=1;/// {!((getStationEta() > 0 && gasGap == 1) || (getStationEta() < 0 && gasGap != 1))};
55  const int pickStrip = swapStrip ? 33 - inStrip : inStrip;
56  return std::make_pair(-1. + 2.*flip, pickStrip);
57  }
58 
59  /// Override of functions declared as interfaces in the parent classes
60  inline int TgcReadoutElement::layerHash(const Identifier& id) const { return m_idHelper.gasGap(id) - 1; }
61 
62  inline int TgcReadoutElement::surfaceHash(const Identifier& id) const {
63  return surfaceHash(m_idHelper.gasGap(id) ,m_idHelper.isStrip(id));
64  }
65  inline int TgcReadoutElement::surfaceHash(int gasGap, bool isStrip) { return 2 * (gasGap -1) + isStrip; }
66  inline int TgcReadoutElement::boundaryHash(const Identifier& id) const { return (measuresPhi(id) ? 0 : 1); }
67  inline bool TgcReadoutElement::measuresPhi(const Identifier& id) const { return m_idHelper.isStrip(id); }
68  inline int TgcReadoutElement::numberOfLayers(bool) const { return nGasGaps(); }
69  inline int TgcReadoutElement::numberOfStrips(const Identifier& id) const { return numberOfStrips(m_idHelper.gasGap(id),
70  m_idHelper.isStrip(id));
71  }
72  inline int TgcReadoutElement::numberOfStrips(int layer, bool isStrip) const { return isStrip ? nStrips(layer) :
73  nWireGangs(layer);
74  }
75  inline double TgcReadoutElement::stripLocalX(const int stripNum,
76  const double locY,
77  const double refPoint) const {
78  return refPoint + (locY != 0. ? locY * m_stripSlope * (stripPosOnLargeBase(stripNum) - stripPosOnShortBase(stripNum)) : 0.);
79  }
80 
81  inline const Amg::Transform3D& TgcReadoutElement::localToGlobalTransf(const Identifier& id) const {
82  return transform(surfaceHash(id));
83  }
84  inline Amg::Transform3D TgcReadoutElement::globalToLocalTransf(const Identifier& id) const {
85  return transform(id).inverse();
86  }
87 
88  inline Amg::Vector3D TgcReadoutElement::wireGangPos(int gasGap, int gang) const {
89  return transform(surfaceHash(gasGap, false)) * localWireGangPos(gasGap, gang);
90  }
91 
92  inline Amg::Vector3D TgcReadoutElement::wireGangPos(const Identifier& id) const {
93  return wireGangPos(m_idHelper.gasGap(id),
94  m_idHelper.channel(id));
95  }
96 
97  inline Amg::Vector3D TgcReadoutElement::localWireGangPos(const Identifier& id) const {
98  return localWireGangPos(m_idHelper.gasGap(id),
99  m_idHelper.channel(id));
100  }
101  inline Amg::Vector3D TgcReadoutElement::localWireGangPos(int gasGap, int gang) const {
102  return wireGangLocalX(gasGap, gang) * Amg::Vector3D::UnitX();
103  }
104 
105  inline Amg::Vector3D TgcReadoutElement::stripPos(const Identifier& id) const {
106  return stripPos(m_idHelper.gasGap(id), m_idHelper.channel(id));
107  }
108  inline Amg::Vector3D TgcReadoutElement::stripPos(int gasGap, int strip) const {
109  return transform(surfaceHash(gasGap, true)) * localStripPos(gasGap, strip);
110  }
111 
112  inline Amg::Vector3D TgcReadoutElement::localStripPos(int gasGap, int strip) const {
113  return stripCenterLocX(gasGap, strip, 0.) * Amg::Vector3D::UnitX();
114  }
115  inline Amg::Vector3D TgcReadoutElement::localStripPos(const Identifier& id) const {
116  return localStripPos(m_idHelper.gasGap(id), m_idHelper.channel(id));
117  }
118  inline Amg::Vector3D TgcReadoutElement::localStripDir(int gasGap, int strip) const{
119  const double halfeight = 0.5 *getRsize();
120  return (Amg::Vector3D{stripCenterLocX(gasGap,strip, halfeight), halfeight,0} -
121  Amg::Vector3D{stripCenterLocX(gasGap,strip, -halfeight), -halfeight,0}).unit();
122 
123  }
124  inline Amg::Vector3D TgcReadoutElement::localStripDir(const Identifier& id) const{
125  return localStripDir(m_idHelper.gasGap(id), m_idHelper.channel(id));
126  }
127  inline Amg::Vector3D TgcReadoutElement::stripDir(int gasGap, int strip) const {
128  return transform(surfaceHash(gasGap, true)).linear() * localStripDir(gasGap, strip);
129  }
130  inline Amg::Vector3D TgcReadoutElement::stripDir(const Identifier& id) const {
131  return stripDir(m_idHelper.gasGap(id), m_idHelper.channel(id));
132  }
133 
134 
135  inline Amg::Vector3D TgcReadoutElement::channelPos(const Identifier& id) const {
136  return channelPos(m_idHelper.gasGap(id),
137  m_idHelper.isStrip(id),
138  m_idHelper.channel(id));
139  }
140  inline Amg::Vector3D TgcReadoutElement::channelPos(int gasGap, bool isStrip, int channel) const {
141  return transform(surfaceHash(gasGap, isStrip)) * localChannelPos(gasGap, isStrip, channel);
142  }
143  inline Amg::Vector3D TgcReadoutElement::localChannelPos(const Identifier& id) const {
144  return localChannelPos(m_idHelper.gasGap(id),
145  m_idHelper.isStrip(id),
146  m_idHelper.channel(id));
147  }
148  inline Amg::Vector3D TgcReadoutElement::localChannelPos(int gasGap, bool isStrip, int channel) const {
149  return isStrip ? localStripPos(gasGap, channel) : localWireGangPos(gasGap, channel);
150  }
151 
152 
153 
154 
155 } // namespace MuonGM
156 
157 #endif