ATLAS Offline Software
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 
6 #include <utility>
7 
8 
9 namespace MuonGM {
11  AthMessaging{"TgcReadoutParams"}{}
13  int iCh,
14  int Version,
15  double WireSp,
16  const int NCHRNG,
17  GasGapIntArray && numWireGangs,
18  WiregangArray && IWGS1,
19  WiregangArray && IWGS2,
20  WiregangArray && IWGS3,
21  GasGapIntArray && numStrips):
22  AthMessaging{"TgcRadoutParams - "+name},
23  m_chamberName(name),
24  m_chamberType(iCh),
25  m_readoutVersion(Version),
26  m_wirePitch(WireSp),
27  m_nPhiChambers(NCHRNG),
28  m_nStrips{std::move(numStrips)} {
29 
30  for (int iGap =0 ; iGap < MaxNGaps; ++iGap){
31  m_nWires[iGap].resize(numWireGangs[iGap]);
32  m_nAccWires[iGap].resize(numWireGangs[iGap]);
33  }
34  for (int iGang = 0; iGang < MaxNGangs; ++iGang) {
35  if (iGang < numWireGangs[0]) {
36  m_nWires[0][iGang] = IWGS1[iGang];
37  m_totalWires[0] += IWGS1[iGang];
38  }
39  if (iGang < numWireGangs[1]) {
40  m_nWires[1][iGang] = IWGS2[iGang];
41  m_totalWires[1] += IWGS2[iGang];
42  }
43  if (iGang < numWireGangs[2]) {
44  m_nWires[2][iGang] = IWGS3[iGang];
45  m_totalWires[2] += IWGS3[iGang];
46  }
47  }
48  for (size_t iGap = 0; iGap < m_nWires.size(); ++iGap) {
49  // Grap the total wires in the gasGap
50  const int totWires = totalWires(iGap + 1);
51  int accumWires = totWires;
52  for (int iGang = m_nWires[iGap].size() - 1; iGang >= 0; --iGang) {
53  accumWires -= m_nWires[iGap][iGang];
54  m_nAccWires[iGap][iGang] = accumWires;
55  }
56  }
57  }
59  int iCh,
60  int Version,
61  double WireSp,
62  const int NCHRNG,
63  GasGapIntArray && numWireGangs,
64  WiregangArray&& IWGS1,
65  WiregangArray&& IWGS2,
66  WiregangArray&& IWGS3,
67  double PDIST,
68  StripArray&& SLARGE,
69  StripArray&& SSHORT,
70  GasGapIntArray&& numStrips):
71  TgcReadoutParams(name, iCh, Version, WireSp, NCHRNG, std::move(numWireGangs),
72  std::move(IWGS1), std::move(IWGS2), std::move(IWGS3),
73  std::move(numStrips)){
74 
76  m_stripPositionOnLargeBase = std::move(SLARGE);
77  m_stripPositionOnShortBase = std::move(SSHORT);
78  for (size_t s = 0 ; s < m_stripPositionOnLargeBase.size() - 1; ++s) {
83  }
84 
85  }
86 
88 
89  // Access to general parameters
90 
94  int TgcReadoutParams::nGaps() const { return 2 + (nStrips(3) > 1); }
95  // Access to wire gang parameters
96  double TgcReadoutParams::wirePitch() const { return m_wirePitch; }
97 
99  if (invalidGasGap(gasGap)) {
100  ATH_MSG_FATAL(__func__<<":"<<__LINE__<<"nWireGangs(" << gasGap << ") gasGap out of allowed range: 1-" << MaxNGaps );
101  throw std::out_of_range("input gas gap index is incorrect");
102  }
103  return m_nWires[gasGap - 1].size();
104  }
105 
107  if (invalidGasGap(gasGap)) {
108  ATH_MSG_FATAL(__func__<<":"<<__LINE__<<"(" << gasGap << ") gasGap out of allowed range: 1-" << MaxNGaps );
109  throw std::out_of_range("input gas gap index is incorrect");
110  }
111  return m_totalWires[gasGap - 1];
112  }
113 
114  int TgcReadoutParams::nWires(int gasGap, int gang) const {
115  if (invalidGasGap(gasGap) or invalidGang(gang)) {
116  ATH_MSG_FATAL( __func__<<":"<<__LINE__<<" gasGap " << gasGap << " or gang " << gang << " out of allowed range" );
117  throw std::out_of_range("input gas gap or wire gang index are incorrect");
118  }
119  return m_nWires[gasGap - 1][gang - 1];
120  }
121  int TgcReadoutParams::nSummedWires(int gasGap, int gang) const {
122  if (invalidGasGap(gasGap) or invalidGang(gang)) {
123  ATH_MSG_FATAL( __func__<<":"<<__LINE__<<" gasGap " << gasGap << " or gang " << gang << " out of allowed range" );
124  throw std::out_of_range("input gas gap or wire gang index are incorrect");
125  }
126  return m_nAccWires[gasGap -1 ][gang - 1];
127  }
128  double TgcReadoutParams::nPitchesToGang(int gasGap, int gang) const {
129  if (invalidGasGap(gasGap) or invalidGang(gang)) {
130  ATH_MSG_FATAL( __func__<<":"<<__LINE__<<" gasGap " << gasGap << " or gang " << gang << " out of allowed range" );
131  throw std::out_of_range("input gas gap or wire gang index are incorrect");
132  }
133  const double nPit = 1.*m_nAccWires[gasGap -1][gang - 1] +
134  0.5*(m_nWires[gasGap-1][gang-1] -1) -
135  0.5*m_totalWires[gasGap -1];
136  return nPit;
137  }
138  // Access to strip parameters
140  if (invalidGasGap(gasGap)) {
141  ATH_MSG_FATAL( __func__<<":"<<__LINE__<<"(" << gasGap << ") gasGap out of allowed range: 1-" << MaxNGaps );
142  throw std::out_of_range("input gas gap index is incorrect");
143  }
144  return m_nStrips[gasGap - 1];
145  }
147 
149  // all gas gaps have the same n. of strips (=> check the first one)
150  if (istrip > m_nStrips[0] + 1 || istrip < 1){
151  ATH_MSG_FATAL(__func__<<"() "<<__LINE__<<" - Input strip n. " << istrip
152  << " out of range in TgcReadoutParams::stripPositionOnLargeBase for TgcReadoutParams of name/type " << m_chamberName << "/"
153  << m_chamberType << " - Nstrips = " << m_nStrips[0] << " MaxNStrips = " << MaxNStrips );
154  throw std::out_of_range("invalid strip index");
155  }
156  return m_stripPositionOnLargeBase[istrip - 1];
157  }
159  // all gas gaps have the same n. of strips (=> check the first one)
160  if (istrip > m_nStrips[0] + 1 || istrip < 1) {
161  ATH_MSG_FATAL(__func__<<"() "<<__LINE__<<" - Input strip n. " << istrip
162  << " out of range in TgcReadoutParams::stripPositionOnShortBase for TgcReadoutParams of name/type " << m_chamberName << "/"
163  << m_chamberType << " - Nstrips = " << m_nStrips[0] << " MaxNStrips = " << MaxNStrips );
164  throw std::out_of_range("invalid strip index");
165  }
166  return m_stripPositionOnShortBase[istrip - 1];
167  }
168 
169  double TgcReadoutParams::stripCenter(int istrip) const {
170  if (istrip > m_nStrips[0] + 1) {
171  ATH_MSG_FATAL( "Input strip n. " << istrip
172  << " out of range in TgcReadoutParams::stripPositionOnLargeBase for TgcReadoutParams of name/type " << m_chamberName << "/"
173  << m_chamberType << " - Nstrips = " << m_nStrips[0] << " MaxNStrips = " << MaxNStrips );
174  throw std::out_of_range("invalid strip index");
175  }
176  return m_stripPositionCenter[istrip -1];
177  }
178 } // namespace MuonGM
dumpTgcDigiDeadChambers.gasGap
list gasGap
Definition: dumpTgcDigiDeadChambers.py:33
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
MuonGM
Ensure that the Athena extensions are properly loaded.
Definition: GeoMuonHits.h:27
MuonGM::TgcReadoutParams::m_nAccWires
std::array< std::vector< int >, MaxNGaps > m_nAccWires
Map describing the number of all wires up to gang i in gasgap j.
Definition: TgcReadoutParams.h:126
MuonGM::TgcReadoutParams::chamberType
int chamberType() const
Definition: TgcReadoutParams.cxx:91
MuonGM::TgcReadoutParams::MaxNStrips
@ MaxNStrips
Definition: TgcReadoutParams.h:42
MuonGM::TgcReadoutParams::m_stripPositionOnShortBase
StripArray m_stripPositionOnShortBase
Definition: TgcReadoutParams.h:138
MuonGM::TgcReadoutParams::m_physicalDistanceFromBase
double m_physicalDistanceFromBase
Definition: TgcReadoutParams.h:133
MuonGM::TgcReadoutParams::physicalDistanceFromBase
double physicalDistanceFromBase() const
Definition: TgcReadoutParams.cxx:146
MuonGM::TgcReadoutParams::m_nStrips
GasGapIntArray m_nStrips
Definition: TgcReadoutParams.h:128
MuonGM::TgcReadoutParams::StripArray
std::array< double, MaxNStrips > StripArray
Definition: TgcReadoutParams.h:46
MuonGM::TgcReadoutParams::m_nPhiChambers
int m_nPhiChambers
Definition: TgcReadoutParams.h:121
TgcReadoutParams.h
MuonGM::TgcReadoutParams::totalWires
int totalWires(int gasGap) const
Returns the total number of wires in a given gang.
Definition: TgcReadoutParams.cxx:106
MuonGM::TgcReadoutParams::nGaps
int nGaps() const
Definition: TgcReadoutParams.cxx:94
MuonGM::TgcReadoutParams::m_chamberName
std::string m_chamberName
Definition: TgcReadoutParams.h:117
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
MuonGM::TgcReadoutParams::nWires
int nWires(int gasGap, int gang) const
Returns the number of wires in a given gang.
Definition: TgcReadoutParams.cxx:114
MuonGM::TgcReadoutParams::m_nWires
std::array< std::vector< int >, MaxNGaps > m_nWires
Map of number of wires in a given wire gang & gas gap.
Definition: TgcReadoutParams.h:124
MuonGM::TgcReadoutParams::nStrips
int nStrips(int gasGap) const
Definition: TgcReadoutParams.cxx:139
MuonGM::TgcReadoutParams::invalidGasGap
bool invalidGasGap(int gasGap) const
Definition: TgcReadoutParams.h:143
MuonGM::TgcReadoutParams::GasGapIntArray
std::array< int, MaxNGaps > GasGapIntArray
Definition: TgcReadoutParams.h:43
MuonGM::TgcReadoutParams::wirePitch
double wirePitch() const
Returns the wire pitch.
Definition: TgcReadoutParams.cxx:96
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
MuonGM::TgcReadoutParams::stripPositionOnShortBase
double stripPositionOnShortBase(int strip) const
Returns the signed distance of the i-th's strip's left edge w.r.t.
Definition: TgcReadoutParams.cxx:158
MuonGM::TgcReadoutParams::nSummedWires
int nSummedWires(int gasGap, int gang) const
Returns the sum of all wires from gang [1 - i)
Definition: TgcReadoutParams.cxx:121
MuonGM::TgcReadoutParams::invalidGang
bool invalidGang(int gang) const
Definition: TgcReadoutParams.h:144
MuonGM::TgcReadoutParams::m_stripPositionOnLargeBase
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...
Definition: TgcReadoutParams.h:137
MuonGM::TgcReadoutParams::nWireGangs
int nWireGangs(int gasGap) const
Returns the number of wire gangs.
Definition: TgcReadoutParams.cxx:98
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
MuonGM::TgcReadoutParams::m_chamberType
int m_chamberType
Definition: TgcReadoutParams.h:118
MuonGM::TgcReadoutParams::TgcReadoutParams
TgcReadoutParams()
Constructor not setting any parameters.
Definition: TgcReadoutParams.cxx:10
MuonGM::TgcReadoutParams::m_wirePitch
double m_wirePitch
Definition: TgcReadoutParams.h:120
MuonGM::TgcReadoutParams::m_stripPositionCenter
StripArray m_stripPositionCenter
The position of the strip center is defined as the intersector of the large and short edge strip posi...
Definition: TgcReadoutParams.h:141
MuonGM::TgcReadoutParams::m_readoutVersion
int m_readoutVersion
Definition: TgcReadoutParams.h:119
MuonGM::TgcReadoutParams
Definition: TgcReadoutParams.h:38
python.SystemOfUnits.s
float s
Definition: SystemOfUnits.py:147
MuonGM::TgcReadoutParams::WiregangArray
std::array< int, MaxNGangs > WiregangArray
Definition: TgcReadoutParams.h:45
MuonGM::TgcReadoutParams::readoutVersion
int readoutVersion() const
Definition: TgcReadoutParams.cxx:92
MuonGM::TgcReadoutParams::stripCenter
double stripCenter(int strip) const
Returns the signed distance along the chamber edge of the strip expressed at the chamber center.
Definition: TgcReadoutParams.cxx:169
MuonGM::TgcReadoutParams::MaxNGaps
@ MaxNGaps
Definition: TgcReadoutParams.h:42
MuonGM::TgcReadoutParams::nPitchesToGang
double nPitchesToGang(int gasGap, int gang) const
Returns the number of wire pitches that have to be travelled to reach gang i.
Definition: TgcReadoutParams.cxx:128
MuonGM::TgcReadoutParams::m_totalWires
GasGapIntArray m_totalWires
Definition: TgcReadoutParams.h:129
MuonGM::TgcReadoutParams::~TgcReadoutParams
~TgcReadoutParams()
MuonGM::TgcReadoutParams::stripPositionOnLargeBase
double stripPositionOnLargeBase(int strip) const
Returns the signed distance of the i-th's strip's left edge w.r.t the center of the bottom chamber ed...
Definition: TgcReadoutParams.cxx:148
MuonGM::TgcReadoutParams::nPhiChambers
int nPhiChambers() const
Definition: TgcReadoutParams.cxx:93