ATLAS Offline Software
Loading...
Searching...
No Matches
TgcReadoutParams.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
5#include "GeoModelKernel/throwExcept.h"
6
7#include <utility>
8
9
10namespace MuonGM {
13 TgcReadoutParams::TgcReadoutParams(const std::string& name,
14 int iCh,
15 double WireSp,
16 const int NCHRNG,
17 GasGapIntArray && numWireGangs,
18 WiregangArray&& IWGS1,
19 WiregangArray&& IWGS2,
20 WiregangArray&& IWGS3,
21 double PDIST,
22 std::vector<StripArray>&& SLARGE,
23 std::vector<StripArray>&& SSHORT,
24 GasGapIntArray&& numStrips):
25
26 AthMessaging{"TgcReadoutParams - "+name},
27 m_chamberName{name},
28 m_chamberType{iCh},
29 m_wirePitch{WireSp},
30 m_nPhiChambers{NCHRNG},
31 m_nStrips{std::move(numStrips)} {
32
33 for (int iGap =0 ; iGap < MaxNGaps; ++iGap){
34 m_nWires[iGap].resize(numWireGangs[iGap]);
35 m_nAccWires[iGap].resize(numWireGangs[iGap]);
36 }
37 for (int iGang = 0; iGang < MaxNGangs; ++iGang) {
38 if (iGang < numWireGangs[0]) {
39 m_nWires[0][iGang] = IWGS1[iGang];
40 m_totalWires[0] += IWGS1[iGang];
41 }
42 if (iGang < numWireGangs[1]) {
43 m_nWires[1][iGang] = IWGS2[iGang];
44 m_totalWires[1] += IWGS2[iGang];
45 }
46 if (iGang < numWireGangs[2]) {
47 m_nWires[2][iGang] = IWGS3[iGang];
48 m_totalWires[2] += IWGS3[iGang];
49 }
50 }
51
52 for (size_t iGap = 0; iGap < m_nWires.size(); ++iGap) {
53 // Grap the total wires in the gasGap
54 const int totWires = totalWires(iGap + 1);
55 int accumWires = totWires;
56 for (int iGang = m_nWires[iGap].size() - 1; iGang >= 0; --iGang) {
57 accumWires -= m_nWires[iGap][iGang];
58 m_nAccWires[iGap][iGang] = accumWires;
59 }
60 }
61
63 m_stripPositionOnLargeBase = std::move(SLARGE);
64 m_stripPositionOnShortBase = std::move(SSHORT);
66 for (size_t l = 0; l < m_stripPositionOnLargeBase.size(); ++l) {
67 for (size_t s = 0 ; s < m_stripPositionOnLargeBase[l].size() - 1; ++s) {
72 }
73 }
74 }
75
77
78 // Access to general parameters
79
82 int TgcReadoutParams::nGaps() const { return 2 + (nStrips(3) > 1); }
83 // Access to wire gang parameters
84 double TgcReadoutParams::wirePitch() const { return m_wirePitch; }
85
86 int TgcReadoutParams::nWireGangs(int gasGap) const {
87 if (invalidGasGap(gasGap)) {
88 THROW_EXCEPTION("gasGap "<<gasGap<<" is out of allowed range: 1-" << MaxNGaps );
89 }
90 return m_nWires[gasGap - 1].size();
91 }
92
93 int TgcReadoutParams::totalWires(int gasGap) const {
94 if (invalidGasGap(gasGap)) {
95 THROW_EXCEPTION("gasGap "<<gasGap<<" is out of allowed range: 1-" << MaxNGaps );
96 }
97 return m_totalWires[gasGap - 1];
98 }
99
100 int TgcReadoutParams::nWires(int gasGap, int gang) const {
101 if (invalidGasGap(gasGap) or invalidGang(gang)) {
102 THROW_EXCEPTION( " gasGap " << gasGap << " or gang " << gang << " out of allowed range" );
103 }
104 return m_nWires[gasGap - 1][gang - 1];
105 }
106 int TgcReadoutParams::nSummedWires(int gasGap, int gang) const {
107 if (invalidGasGap(gasGap) or invalidGang(gang)) {
108 THROW_EXCEPTION( " gasGap " << gasGap << " or gang " << gang << " out of allowed range" );
109 }
110 return m_nAccWires[gasGap -1 ][gang - 1];
111 }
112 double TgcReadoutParams::nPitchesToGang(int gasGap, int gang) const {
113 if (invalidGasGap(gasGap) or invalidGang(gang)) {
114 THROW_EXCEPTION( " gasGap " << gasGap << " or gang " << gang << " out of allowed range" );
115 }
116 const double nPit = 1.*m_nAccWires[gasGap -1][gang - 1] +
117 0.5*(m_nWires[gasGap-1][gang-1] -1) -
118 0.5*m_totalWires[gasGap -1];
119 return nPit;
120 }
121 // Access to strip parameters
122 int TgcReadoutParams::nStrips(int gasGap) const {
123 if (invalidGasGap(gasGap)) {
124 THROW_EXCEPTION("gasGap "<<gasGap<<" is out of allowed range: 1-" << MaxNGaps );
125 }
126 return m_nStrips[gasGap - 1];
127 }
129
130 double TgcReadoutParams::stripPositionOnLargeBase(int istrip, int gasGap) const {
131 // all gas gaps have the same n. of strips (=> check the first one)
132 if (istrip > m_nStrips[0] + 1 || istrip < 1){
133 THROW_EXCEPTION("Input strip n. " << istrip
134 << " out of range in TgcReadoutParams::stripPositionOnLargeBase for TgcReadoutParams of name/type " << m_chamberName << "/"
135 << m_chamberType << " - Nstrips = " << m_nStrips[0] << " MaxNStrips = " << MaxNStrips );
136 }
137 if (nStripLayers() > 1){
138 if( gasGap > nStripLayers() || gasGap == 0) {
139 THROW_EXCEPTION("Input gasGap n. "<<gasGap<<" is out of the allowed range [1-"<<nStripLayers()<<"]");
140 }
141 } else {
142 gasGap = 1;
143 }
144 return m_stripPositionOnLargeBase[gasGap -1][istrip - 1];
145 }
146 double TgcReadoutParams::stripPositionOnShortBase(int istrip, int gasGap) const {
147 // all gas gaps have the same n. of strips (=> check the first one)
148 if (istrip > m_nStrips[0] + 1 || istrip < 1) {
149 THROW_EXCEPTION(__func__<<"() "<<__LINE__<<" - Input strip n. " << istrip
150 << " out of range in TgcReadoutParams::stripPositionOnShortBase for TgcReadoutParams of name/type " << m_chamberName << "/"
151 << m_chamberType << " - Nstrips = " << m_nStrips[0] << " MaxNStrips = " << MaxNStrips );
152 }
153 if (nStripLayers() > 1 || gasGap == 0){
154 if( gasGap > nStripLayers()) {
155 THROW_EXCEPTION("Input gasGap n. "<<gasGap<<" is out of the allowed range [1-"<<nStripLayers()<<"]");
156 }
157 } else {
158 gasGap = 1;
159 }
160 return m_stripPositionOnShortBase[gasGap-1][istrip - 1];
161 }
162
163 double TgcReadoutParams::stripCenter(int istrip, int gasGap) const {
164 if (istrip > m_nStrips[0] + 1) {
165 THROW_EXCEPTION("Input strip n. " << istrip
166 << " out of range in TgcReadoutParams::stripPositionOnLargeBase for TgcReadoutParams of name/type " << m_chamberName << "/"
167 << m_chamberType << " - Nstrips = " << m_nStrips[0] << " MaxNStrips = " << MaxNStrips );
168 }
169 if (nStripLayers() > 1){
170 if(gasGap > nStripLayers() || gasGap == 0) {
171 THROW_EXCEPTION("Input gasGap n. "<<gasGap<<" is out of the allowed range [1-"<<nStripLayers()<<"]");
172 }
173 } else {
174 gasGap = 1;
175 }
176 return m_stripPositionCenter[gasGap-1][istrip -1];
177 }
178} // namespace MuonGM
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
int nWires(int gasGap, int gang) const
Returns the number of wires in a given gang.
double stripPositionOnLargeBase(int strip, int gasGap) const
Returns the signed distance of the i-th's strip's left edge w.r.t the center of the bottom chamber ed...
int totalWires(int gasGap) const
Returns the total number of wires in a given gang.
double stripPositionOnShortBase(int strip, int gasGap) const
Returns the signed distance of the i-th's strip's left edge w.r.t.
std::array< int, MaxNGangs > WiregangArray
std::array< std::vector< int >, MaxNGaps > m_nAccWires
Map describing the number of all wires up to gang i in gasgap j.
int nStripLayers() const
Returns the number of defined strip layers.
double wirePitch() const
Returns the wire pitch.
int nWireGangs(int gasGap) const
Returns the number of wire gangs.
TgcReadoutParams()
Default constructor used by the MuonTPCnv tests.
std::vector< StripArray > m_stripPositionCenter
The position of the strip center is defined as the intersector of the large and short edge strip posi...
std::array< std::vector< int >, MaxNGaps > m_nWires
Map of number of wires in a given wire gang & gas gap.
double physicalDistanceFromBase() const
std::vector< StripArray > m_stripPositionOnLargeBase
These 2 arrays represent the left edges of the i-th strip in a Tgc chamber The numbers are given as t...
double stripCenter(int strip, int gasGap) const
Returns the signed distance along the chamber edge of the strip expressed at the chamber center.
int nSummedWires(int gasGap, int gang) const
Returns the sum of all wires from gang [1 - i)
bool invalidGasGap(int gasGap) const
std::array< int, MaxNGaps > GasGapIntArray
double nPitchesToGang(int gasGap, int gang) const
Returns the number of wire pitches that have to be travelled to reach gang i.
int nStrips(int gasGap) const
bool invalidGang(int gang) const
std::vector< StripArray > m_stripPositionOnShortBase
Ensure that the Athena extensions are properly loaded.
Definition GeoMuonHits.h:27
STL namespace.
#define THROW_EXCEPTION(MESSAGE)
Definition throwExcept.h:10