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 #include "GeoModelKernel/throwExcept.h"
6 
7 #include <utility>
8 
9 
10 namespace MuonGM {
12  AthMessaging{"TgcReadoutParams"}{}
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 
62  m_physicalDistanceFromBase = PDIST;
63  m_stripPositionOnLargeBase = std::move(SLARGE);
64  m_stripPositionOnShortBase = std::move(SSHORT);
65  m_stripPositionCenter.resize(m_stripPositionOnShortBase.size());
66  for (size_t l = 0; l < m_stripPositionOnLargeBase.size(); ++l) {
67  for (size_t s = 0 ; s < m_stripPositionOnLargeBase[l].size() - 1; ++s) {
70  m_stripPositionCenter[l][s] = 0.25 *( m_stripPositionOnLargeBase[l][s] + m_stripPositionOnShortBase[l][s] +
71  m_stripPositionOnLargeBase[l][s+1] + m_stripPositionOnShortBase[l][s+1]);
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 
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 
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
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
MuonGM::TgcReadoutParams::nStripLayers
int nStripLayers() const
Returns the number of defined strip layers.
Definition: TgcReadoutParams.h:112
dumpTgcDigiDeadChambers.gasGap
list gasGap
Definition: dumpTgcDigiDeadChambers.py:33
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:123
MuonGM::TgcReadoutParams::chamberType
int chamberType() const
Definition: TgcReadoutParams.cxx:80
MuonGM::TgcReadoutParams::MaxNStrips
@ MaxNStrips
Definition: TgcReadoutParams.h:42
MuonGM::TgcReadoutParams::stripPositionOnLargeBase
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...
Definition: TgcReadoutParams.cxx:130
MuonGM::TgcReadoutParams::m_physicalDistanceFromBase
double m_physicalDistanceFromBase
Definition: TgcReadoutParams.h:130
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:157
MuonGM::TgcReadoutParams::physicalDistanceFromBase
double physicalDistanceFromBase() const
Definition: TgcReadoutParams.cxx:128
MuonGM::TgcReadoutParams::m_stripPositionOnLargeBase
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...
Definition: TgcReadoutParams.h:134
MuonGM::TgcReadoutParams::m_nStrips
GasGapIntArray m_nStrips
Definition: TgcReadoutParams.h:125
MuonGM::TgcReadoutParams::m_nPhiChambers
int m_nPhiChambers
Definition: TgcReadoutParams.h:118
TgcReadoutParams.h
MuonGM::TgcReadoutParams::totalWires
int totalWires(int gasGap) const
Returns the total number of wires in a given gang.
Definition: TgcReadoutParams.cxx:93
MuonGM::TgcReadoutParams::nGaps
int nGaps() const
Definition: TgcReadoutParams.cxx:82
MuonGM::TgcReadoutParams::m_chamberName
std::string m_chamberName
Definition: TgcReadoutParams.h:115
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:100
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:121
MuonGM::TgcReadoutParams::nStrips
int nStrips(int gasGap) const
Definition: TgcReadoutParams.cxx:122
MuonGM::TgcReadoutParams::invalidGasGap
bool invalidGasGap(int gasGap) const
Definition: TgcReadoutParams.h:140
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:84
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
MuonGM::TgcReadoutParams::nSummedWires
int nSummedWires(int gasGap, int gang) const
Returns the sum of all wires from gang [1 - i)
Definition: TgcReadoutParams.cxx:106
MuonGM::TgcReadoutParams::m_stripPositionOnShortBase
std::vector< StripArray > m_stripPositionOnShortBase
Definition: TgcReadoutParams.h:135
MuonGM::TgcReadoutParams::invalidGang
bool invalidGang(int gang) const
Definition: TgcReadoutParams.h:141
MuonGM::TgcReadoutParams::nWireGangs
int nWireGangs(int gasGap) const
Returns the number of wire gangs.
Definition: TgcReadoutParams.cxx:86
MuonGM::TgcReadoutParams::m_stripPositionCenter
std::vector< 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:138
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
MuonGM::TgcReadoutParams::m_chamberType
int m_chamberType
Definition: TgcReadoutParams.h:116
MuonGM::TgcReadoutParams::TgcReadoutParams
TgcReadoutParams()
Default constructor used by the MuonTPCnv tests.
Definition: TgcReadoutParams.cxx:11
THROW_EXCEPTION
#define THROW_EXCEPTION(MESSAGE)
Definition: throwExcept.h:10
MuonGM::TgcReadoutParams::stripPositionOnShortBase
double stripPositionOnShortBase(int strip, int gasGap) const
Returns the signed distance of the i-th's strip's left edge w.r.t.
Definition: TgcReadoutParams.cxx:146
MuonGM::TgcReadoutParams::m_wirePitch
double m_wirePitch
Definition: TgcReadoutParams.h:117
MuonGM::TgcReadoutParams::stripCenter
double stripCenter(int strip, int gasGap) const
Returns the signed distance along the chamber edge of the strip expressed at the chamber center.
Definition: TgcReadoutParams.cxx:163
python.SystemOfUnits.s
float s
Definition: SystemOfUnits.py:147
MuonGM::TgcReadoutParams::WiregangArray
std::array< int, MaxNGangs > WiregangArray
Definition: TgcReadoutParams.h:45
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:112
MuonGM::TgcReadoutParams::m_totalWires
GasGapIntArray m_totalWires
Definition: TgcReadoutParams.h:126
MuonGM::TgcReadoutParams::~TgcReadoutParams
~TgcReadoutParams()
MuonGM::TgcReadoutParams::nPhiChambers
int nPhiChambers() const
Definition: TgcReadoutParams.cxx:81