2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
4 #ifndef MUONREADOUTGEOMETRY_TGCREADOUTELEMENT_ICC
5 #define MUONREADOUTGEOMETRY_TGCREADOUTELEMENT_ICC
8 inline const std::string& TgcReadoutElement::readOutName() const { return m_readout_name; }
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; }
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(); }
20 inline double TgcReadoutElement::chamberLocPhiMin() const { return m_locMinPhi; }
21 inline double TgcReadoutElement::chamberLocPhiMax() const { return m_locMaxPhi; }
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(); }
33 inline double TgcReadoutElement::chamberWidth(double z) const {
34 return getSsize() + (0.5 *length() +z) * (getLongSsize() - getSsize()) / length();
36 inline double TgcReadoutElement::wireGangLocalX(const int gasGap, const int gang) const {
37 return wirePitch() * nPitchesToGang(gasGap, gang);
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);
46 inline double TgcReadoutElement::stripPosOnShortBase(int strip, int gasGap) const {
47 return m_readoutParams->stripPositionOnShortBase(strip, gasGap);
49 inline double TgcReadoutElement::wireLength(int wire) const {
50 return m_Ssize + (wire - 1) * wirePitch() * (m_LongSsize - m_Ssize) / m_Rsize;
53 inline const TgcReadoutParams* TgcReadoutElement::getReadoutParams() const { return m_readoutParams.get(); }
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);
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; }
66 inline int TgcReadoutElement::surfaceHash(const Identifier& id) const {
67 return surfaceHash(m_idHelper.gasGap(id) ,m_idHelper.isStrip(id));
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));
76 inline int TgcReadoutElement::numberOfStrips(int layer, bool isStrip) const { return isStrip ? nStrips(layer) :
79 inline double TgcReadoutElement::stripLocalX(const int gasGap,
82 const double refPoint) const {
83 return refPoint + (locY != 0. ? locY * m_stripSlope * (stripPosOnLargeBase(stripNum, gasGap) - stripPosOnShortBase(stripNum, gasGap)) : 0.);
86 inline const Amg::Transform3D& TgcReadoutElement::localToGlobalTransf(const Identifier& id) const {
87 return transform(surfaceHash(id));
89 inline Amg::Transform3D TgcReadoutElement::globalToLocalTransf(const Identifier& id) const {
90 return transform(id).inverse();
93 inline Amg::Vector3D TgcReadoutElement::wireGangPos(int gasGap, int gang) const {
94 return transform(surfaceHash(gasGap, false)) * localWireGangPos(gasGap, gang);
97 inline Amg::Vector3D TgcReadoutElement::wireGangPos(const Identifier& id) const {
98 return wireGangPos(m_idHelper.gasGap(id),
99 m_idHelper.channel(id));
102 inline Amg::Vector3D TgcReadoutElement::localWireGangPos(const Identifier& id) const {
103 return localWireGangPos(m_idHelper.gasGap(id),
104 m_idHelper.channel(id));
106 inline Amg::Vector3D TgcReadoutElement::localWireGangPos(int gasGap, int gang) const {
107 return wireGangLocalX(gasGap, gang) * Amg::Vector3D::UnitX();
110 inline Amg::Vector3D TgcReadoutElement::stripPos(const Identifier& id) const {
111 return stripPos(m_idHelper.gasGap(id), m_idHelper.channel(id));
113 inline Amg::Vector3D TgcReadoutElement::stripPos(int gasGap, int strip) const {
114 return transform(surfaceHash(gasGap, true)) * localStripPos(gasGap, strip);
117 inline Amg::Vector3D TgcReadoutElement::localStripPos(int gasGap, int strip) const {
118 return stripCenterLocX(gasGap, strip, 0.) * Amg::Vector3D::UnitX();
120 inline Amg::Vector3D TgcReadoutElement::localStripPos(const Identifier& id) const {
121 return localStripPos(m_idHelper.gasGap(id), m_idHelper.channel(id));
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();
129 inline Amg::Vector3D TgcReadoutElement::localStripDir(const Identifier& id) const{
130 return localStripDir(m_idHelper.gasGap(id), m_idHelper.channel(id));
132 inline Amg::Vector3D TgcReadoutElement::stripDir(int gasGap, int strip) const {
133 return transform(surfaceHash(gasGap, true)).linear() * localStripDir(gasGap, strip);
135 inline Amg::Vector3D TgcReadoutElement::stripDir(const Identifier& id) const {
136 return stripDir(m_idHelper.gasGap(id), m_idHelper.channel(id));
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));
145 inline Amg::Vector3D TgcReadoutElement::channelPos(int gasGap, bool isStrip, int channel) const {
146 return transform(surfaceHash(gasGap, isStrip)) * localChannelPos(gasGap, isStrip, channel);
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));
153 inline Amg::Vector3D TgcReadoutElement::localChannelPos(int gasGap, bool isStrip, int channel) const {
154 return isStrip ? localStripPos(gasGap, channel) : localWireGangPos(gasGap, channel);
160 } // namespace MuonGM