ATLAS Offline Software
TgcReadoutParams.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // ******************************************************************************
6 // Atlas Muon Detector Description
7 // -----------------------------------------
8 // ******************************************************************************
9 
11 
12 #include <GaudiKernel/IMessageSvc.h>
13 
14 #include <utility>
15 
17 #include "GaudiKernel/MsgStream.h"
18 
19 namespace MuonGM {
21  AthMessaging{"TgcReadoutParams"}{}
23  int iCh,
24  int Version,
25  double WireSp,
26  const int NCHRNG,
27  GasGapIntArray && numWireGangs,
28  WiregangArray && IWGS1,
29  WiregangArray && IWGS2,
30  WiregangArray && IWGS3,
31  GasGapIntArray && numStrips):
32  AthMessaging{"TgcRadoutParams - "+name},
33  m_chamberName(name),
34  m_chamberType(iCh),
35  m_readoutVersion(Version),
36  m_wirePitch(WireSp),
37  m_nPhiChambers(NCHRNG),
38  m_nStrips{std::move(numStrips)} {
39 
40  for (int iGap =0 ; iGap < MaxNGaps; ++iGap){
41  m_nWires[iGap].resize(numWireGangs[iGap]);
42  m_nAccWires[iGap].resize(numWireGangs[iGap]);
43  }
44  for (int iGang = 0; iGang < MaxNGangs; ++iGang) {
45  if (iGang < numWireGangs[0]) {
46  m_nWires[0][iGang] = IWGS1[iGang];
47  m_totalWires[0] += IWGS1[iGang];
48  }
49  if (iGang < numWireGangs[1]) {
50  m_nWires[1][iGang] = IWGS2[iGang];
51  m_totalWires[1] += IWGS2[iGang];
52  }
53  if (iGang < numWireGangs[2]) {
54  m_nWires[2][iGang] = IWGS3[iGang];
55  m_totalWires[2] += IWGS3[iGang];
56  }
57  }
58  for (size_t iGap = 0; iGap < m_nWires.size(); ++iGap) {
59  // Grap the total wires in the gasGap
60  const int totWires = totalWires(iGap + 1);
61  int accumWires = totWires;
62  for (int iGang = m_nWires[iGap].size() - 1; iGang >= 0; --iGang) {
63  accumWires -= m_nWires[iGap][iGang];
64  m_nAccWires[iGap][iGang] = accumWires;
65  }
66  }
67  }
69  int iCh,
70  int Version,
71  double WireSp,
72  const int NCHRNG,
73  GasGapIntArray && numWireGangs,
74  WiregangArray&& IWGS1,
75  WiregangArray&& IWGS2,
76  WiregangArray&& IWGS3,
77  double PDIST,
78  StripArray&& SLARGE,
79  StripArray&& SSHORT,
80  GasGapIntArray&& numStrips):
81  TgcReadoutParams(name, iCh, Version, WireSp, NCHRNG, std::move(numWireGangs),
82  std::move(IWGS1), std::move(IWGS2), std::move(IWGS3),
83  std::move(numStrips)){
84 
86  m_stripPositionOnLargeBase = std::move(SLARGE);
87  m_stripPositionOnShortBase = std::move(SSHORT);
88  for (size_t s = 0 ; s < m_stripPositionOnLargeBase.size() - 1; ++s) {
93  }
94 
95  }
96 
98 
99  // Access to general parameters
100 
104  int TgcReadoutParams::nGaps() const { return 2 + (nStrips(3) > 1); }
105  // Access to wire gang parameters
106  double TgcReadoutParams::wirePitch() const { return m_wirePitch; }
107 
109  if (invalidGasGap(gasGap)) {
110  ATH_MSG_FATAL(__func__<<":"<<__LINE__<<"nWireGangs(" << gasGap << ") gasGap out of allowed range: 1-" << MaxNGaps );
111  throw std::out_of_range("input gas gap index is incorrect");
112  }
113  return m_nWires[gasGap - 1].size();
114  }
115 
117  if (invalidGasGap(gasGap)) {
118  ATH_MSG_FATAL(__func__<<":"<<__LINE__<<"(" << gasGap << ") gasGap out of allowed range: 1-" << MaxNGaps );
119  throw std::out_of_range("input gas gap index is incorrect");
120  }
121  return m_totalWires[gasGap - 1];
122  }
123 
124  int TgcReadoutParams::nWires(int gasGap, int gang) const {
125  if (invalidGasGap(gasGap) or invalidGang(gang)) {
126  ATH_MSG_FATAL( __func__<<":"<<__LINE__<<" gasGap " << gasGap << " or gang " << gang << " out of allowed range" );
127  throw std::out_of_range("input gas gap or wire gang index are incorrect");
128  }
129  return m_nWires[gasGap - 1][gang - 1];
130  }
131  int TgcReadoutParams::nSummedWires(int gasGap, int gang) const {
132  if (invalidGasGap(gasGap) or invalidGang(gang)) {
133  ATH_MSG_FATAL( __func__<<":"<<__LINE__<<" gasGap " << gasGap << " or gang " << gang << " out of allowed range" );
134  throw std::out_of_range("input gas gap or wire gang index are incorrect");
135  }
136  return m_nAccWires[gasGap -1 ][gang - 1];
137  }
138  double TgcReadoutParams::nPitchesToGang(int gasGap, int gang) const {
139  if (invalidGasGap(gasGap) or invalidGang(gang)) {
140  ATH_MSG_FATAL( __func__<<":"<<__LINE__<<" gasGap " << gasGap << " or gang " << gang << " out of allowed range" );
141  throw std::out_of_range("input gas gap or wire gang index are incorrect");
142  }
143  const double nPit = 1.*m_nAccWires[gasGap -1][gang - 1] +
144  0.5*(m_nWires[gasGap-1][gang-1] -1) -
145  0.5*m_totalWires[gasGap -1];
146  return nPit;
147  }
148  // Access to strip parameters
150  if (invalidGasGap(gasGap)) {
151  ATH_MSG_FATAL( __func__<<":"<<__LINE__<<"(" << gasGap << ") gasGap out of allowed range: 1-" << MaxNGaps );
152  throw std::out_of_range("input gas gap index is incorrect");
153  }
154  return m_nStrips[gasGap - 1];
155  }
157 
159  // all gas gaps have the same n. of strips (=> check the first one)
160  if (istrip > m_nStrips[0] + 1){
161  ATH_MSG_FATAL( "Input strip n. " << istrip
162  << " out of range in TgcReadoutParams::stripPositionOnLargeBase 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_stripPositionOnLargeBase[istrip - 1];;
167  }
169  // all gas gaps have the same n. of strips (=> check the first one)
170  if (istrip > m_nStrips[0] + 1){
171  ATH_MSG_FATAL( "Input strip n. " << istrip
172  << " out of range in TgcReadoutParams::stripPositionOnShortBase 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_stripPositionOnShortBase[istrip - 1];;
177  }
178 
179  double TgcReadoutParams::stripCenter(int istrip) const {
180  if (istrip > m_nStrips[0] + 1) {
181  ATH_MSG_FATAL( "Input strip n. " << istrip
182  << " out of range in TgcReadoutParams::stripPositionOnLargeBase for TgcReadoutParams of name/type " << m_chamberName << "/"
183  << m_chamberType << " - Nstrips = " << m_nStrips[0] << " MaxNStrips = " << MaxNStrips );
184  throw std::out_of_range("invalid strip index");
185  }
186  return m_stripPositionCenter[istrip -1];;
187  }
188 } // 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
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
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
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
MuonGM::TgcReadoutParams::chamberType
int chamberType() const
Definition: TgcReadoutParams.cxx:101
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:156
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:116
MuonGM::TgcReadoutParams::nGaps
int nGaps() const
Definition: TgcReadoutParams.cxx:104
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:124
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:149
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:106
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:168
MuonGM::TgcReadoutParams::nSummedWires
int nSummedWires(int gasGap, int gang) const
Returns the sum of all wires from gang [1 - i)
Definition: TgcReadoutParams.cxx:131
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:108
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
MuonGM::TgcReadoutParams::m_chamberType
int m_chamberType
Definition: TgcReadoutParams.h:118
MuonGM::TgcReadoutParams::TgcReadoutParams
TgcReadoutParams()
Constructor not setting any parameters.
Definition: TgcReadoutParams.cxx:20
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
MuonGM::TgcReadoutParams::WiregangArray
std::array< int, MaxNGangs > WiregangArray
Definition: TgcReadoutParams.h:45
MuonGM::TgcReadoutParams::readoutVersion
int readoutVersion() const
Definition: TgcReadoutParams.cxx:102
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:179
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:138
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:158
MuonGM::TgcReadoutParams::nPhiChambers
int nPhiChambers() const
Definition: TgcReadoutParams.cxx:103