ATLAS Offline Software
MuonStationIndex.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include <array>
7 
8 namespace Muon {
9  namespace MuonStationIndex{
10 
11  ChIndex chIndex( const std::string& index) {
12  if( index == "BIL" ) {
13  return ChIndex::BIL;
14  } else if( index == "BMS" ) {
15  return ChIndex::BMS;
16  } else if( index == "BIS" ) {
17  return ChIndex::BIS;
18  } else if( index == "BML" ) {
19  return ChIndex::BML;
20  } else if( index == "BOS" ) {
21  return ChIndex::BOS;
22  } else if( index == "BOL" ) {
23  return ChIndex::BOL;
24  } else if( index == "BEE" ) {
25  return ChIndex::BEE;
26  } else if( index == "EIS" ) {
27  return ChIndex::EIS;
28  } else if( index == "EIL" ) {
29  return ChIndex::EIL;
30  } else if( index == "EMS" ) {
31  return ChIndex::EMS;
32  } else if( index == "EML" ) {
33  return ChIndex::EML;
34  } else if( index == "EOS" ) {
35  return ChIndex::EOS;
36  } else if( index == "EOL" ) {
37  return ChIndex::EOL;
38  } else if( index == "EES" ) {
39  return ChIndex::EES;
40  } else if( index == "EEL" ) {
41  return ChIndex::EEL;
42  } else if( index == "CSS" ) {
43  return ChIndex::CSS;
44  } else if( index == "CSL" ) {
45  return ChIndex::CSL;
46  }
47  return ChIndex::ChUnknown;
48  }
50  constexpr unsigned nMax = sectorLayerHashMax();
51  static constexpr std::array<StIndex, nMax> regionLayerToStationIndex {
58  };
59  return regionLayerToStationIndex[ sectorLayerHash( region, layer ) ];
60  }
61 
62  ChIndex
64  constexpr unsigned nMax = sectorLayerHashMax();
65  static constexpr std::array<ChIndex, nMax> regionLayerToChamberIndexSmall {
72  };
73  static constexpr std::array<ChIndex, nMax> regionLayerToChamberIndexLarge {
80  };
81  if( isSmall ) {
82  return regionLayerToChamberIndexSmall[ sectorLayerHash(region, layer)];
83  }
84  return regionLayerToChamberIndexLarge[sectorLayerHash(region, layer )];
85  }
86 
87  const std::string& phiName( PhiIndex index ) {
88  static const std::array<std::string, toInt(PhiIndex::PhiIndexMax)> phiIndexNames = {
89  "BI1", "BI2", "BM1", "BM2", "BO1", "BO2", "T1", "T2", "T3", "T4", "CSC", "STGC1",
90  "STGC2"
91  };
92 
93  if(index == PhiIndex::PhiUnknown ) {
94  static const std::string dummy{"PhiUnknown"};
95  return dummy;
96  }
98  static const std::string dummy{"PhiOutOfRange"};
99  return dummy;
100  }
101  return phiIndexNames[toInt(index)];
102  }
103 
104  const std::string& stName( StIndex index ) {
105  static const std::array<std::string, toInt(StIndex::StIndexMax)> stationIndexNames {
106  "BI", "BM", "BO", "BE", "EI", "EM", "EO", "EE"};
107 
108  if( index == StIndex::StUnknown ) {
109  static const std::string dummy{"StUnknown"};
110  return dummy;
111  }
112  if( index >= StIndex::StIndexMax) {
113  static const std::string dummy{"StIndexMax"};
114  return dummy;
115  }
116  return stationIndexNames[ toInt(index) ];
117  }
118 
119  const std::string& chName( ChIndex index ) {
120  static const std::array<std::string, toInt(ChIndex::ChIndexMax)> chamberIndexNames {
121  "BIS", "BIL", "BMS", "BML", "BOS", "BOL", "BEE",
122  "EIS", "EIL", "EMS", "EML", "EOS", "EOL", "EES",
123  "EEL", "CSS", "CSL"
124  };
125 
126  if( index == ChIndex::ChUnknown ) {
127  static const std::string dummy{"ChUnknown"};
128  return dummy;
129  }
130  if( index >= ChIndex::ChIndexMax ) {
131  static const std::string dummy{"ChOutOfRange"};
132  return dummy;
133  }
134  return chamberIndexNames[toInt(index)];
135  }
136 
137  const std::string&
139  static const std::array<std::string, toInt(DetectorRegionIndex::DetectorRegionIndexMax)> detectorRegionIndexNames {
140  "EndcapA", "Barrel", "EndcapC"};
141 
143  static const std::string dummy( "DetectorRegionUnknown" );
144  return dummy;
145  }
147  static const std::string dummy( "DetectorRegionIndexMax" );
148  return dummy;
149  }
150  return detectorRegionIndexNames[ toInt(index) ];
151  }
152 
153  const std::string& layerName( LayerIndex index ) {
154  static const std::array<std::string, toInt(LayerIndex::LayerIndexMax)> layerIndexNames {
155  "Inner", "Middle", "Outer", "Extended", "BarrelExtended"};
156 
158  static const std::string dummy{"LayerUnknown"};
159  return dummy;
160  }
162  static const std::string dummy{"LayerOutOfRange"};
163  return dummy;
164  }
165  return layerIndexNames[toInt(index)];
166  }
167 
168  const std::string&
170  using TechIdx = TechnologyIndex;
171  static const std::array<std::string, toInt(TechIdx::TechnologyIndexMax)> technologyIndexNames {
172  "MDT", "CSC", "RPC", "TGC", "STGC", "MM"};
173 
174  if( index == TechIdx::TechnologyUnknown ) {
175  static const std::string dummy{"TechnologyUnknown"};
176  return dummy;
177  }
178  if( index >= TechIdx::TechnologyIndexMax ) {
179  static const std::string dummy{"TechnologyIndexMax"};
180  return dummy;
181  }
182  return technologyIndexNames[ toInt(index) ];
183  }
184 
185 
186  }
187 } // namespace Muon
Muon::MuonStationIndex::LayerIndex
LayerIndex
enum to classify the different layers in the muon spectrometer
Definition: MuonStationIndex.h:38
Muon::MuonStationIndex::toChamberIndex
ChIndex toChamberIndex(DetectorRegionIndex region, LayerIndex layer, bool isSmall)
convert DetectorRegionIndex + LayerIndex + isSmall into ChIndex
Definition: MuonStationIndex.cxx:63
Muon::MuonStationIndex::ChIndex::EEL
@ EEL
Muon::MuonStationIndex::sectorLayerHashMax
constexpr unsigned int sectorLayerHashMax()
maximum create a hash out of region and layer
Definition: MuonStationIndex.h:110
Muon::MuonStationIndex::ChIndex::EML
@ EML
Muon::MuonStationIndex::ChIndex::EOS
@ EOS
index
Definition: index.py:1
Muon::MuonStationIndex::StIndex::EM
@ EM
Muon::MuonStationIndex::sectorLayerHash
unsigned int sectorLayerHash(DetectorRegionIndex detectorRegionIndex, LayerIndex layerIndex)
create a hash out of region and layer
Muon::MuonStationIndex::ChIndex::BIL
@ BIL
Muon::MuonStationIndex::stName
const std::string & stName(StIndex index)
convert StIndex into a string
Definition: MuonStationIndex.cxx:104
Muon::MuonStationIndex::TechnologyIndex
TechnologyIndex
enum to classify the different layers in the muon spectrometer
Definition: MuonStationIndex.h:54
Muon::MuonStationIndex::ChIndex::EIS
@ EIS
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition: TrackSystemController.h:45
Muon::MuonStationIndex::DetectorRegionIndex::DetectorRegionIndexMax
@ DetectorRegionIndexMax
Muon::MuonStationIndex::ChIndex::ChIndexMax
@ ChIndexMax
Muon::MuonStationIndex::ChIndex::CSL
@ CSL
Muon::MuonStationIndex::PhiIndex::PhiUnknown
@ PhiUnknown
Muon::MuonStationIndex::StIndex::StUnknown
@ StUnknown
Muon::MuonStationIndex::LayerIndex::LayerUnknown
@ LayerUnknown
Muon::MuonStationIndex::ChIndex::EIL
@ EIL
Muon::MuonStationIndex::toStationIndex
StIndex toStationIndex(ChIndex index)
convert ChIndex into StIndex
Muon::MuonStationIndex::ChIndex::BIS
@ BIS
Muon::MuonStationIndex::chIndex
ChIndex chIndex(const std::string &index)
convert ChIndex name string to enum
Definition: MuonStationIndex.cxx:11
Muon::MuonStationIndex::chName
const std::string & chName(ChIndex index)
convert ChIndex into a string
Definition: MuonStationIndex.cxx:119
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
CalibDbCompareRT.dummy
dummy
Definition: CalibDbCompareRT.py:59
Muon::MuonStationIndex::ChIndex::BML
@ BML
Muon::MuonStationIndex::ChIndex::CSS
@ CSS
Muon::MuonStationIndex::ChIndex::BOS
@ BOS
Muon::MuonStationIndex::technologyName
const std::string & technologyName(TechnologyIndex index)
convert LayerIndex into a string
Definition: MuonStationIndex.cxx:169
Muon::MuonStationIndex::StIndex::EE
@ EE
Muon::MuonStationIndex::ChIndex::EES
@ EES
Muon::MuonStationIndex::StIndex::BO
@ BO
Muon::MuonStationIndex::ChIndex::BEE
@ BEE
Muon::MuonStationIndex::StIndex
StIndex
enum to classify the different station layers in the muon spectrometer
Definition: MuonStationIndex.h:23
lumiFormat.array
array
Definition: lumiFormat.py:91
Muon::MuonStationIndex::ChIndex::BMS
@ BMS
Muon::MuonStationIndex::StIndex::BE
@ BE
Muon::MuonStationIndex::layerName
const std::string & layerName(LayerIndex index)
convert LayerIndex into a string
Definition: MuonStationIndex.cxx:153
Muon::MuonStationIndex::PhiIndex
PhiIndex
enum to classify the different phi layers in the muon spectrometer
Definition: MuonStationIndex.h:31
Muon::MuonStationIndex::regionName
const std::string & regionName(DetectorRegionIndex index)
convert DetectorRegionIndex into a string
Definition: MuonStationIndex.cxx:138
Muon::MuonStationIndex::StIndex::StIndexMax
@ StIndexMax
Muon::MuonStationIndex::DetectorRegionIndex::DetectorRegionUnknown
@ DetectorRegionUnknown
Muon::MuonStationIndex::LayerIndex::LayerIndexMax
@ LayerIndexMax
BEE.
Muon::MuonStationIndex::DetectorRegionIndex
DetectorRegionIndex
enum to classify the different layers in the muon spectrometer
Definition: MuonStationIndex.h:47
Muon::MuonStationIndex::ChIndex::EOL
@ EOL
Muon::MuonStationIndex::StIndex::EO
@ EO
Muon::MuonStationIndex::PhiIndex::PhiIndexMax
@ PhiIndexMax
Muon::MuonStationIndex::ChIndex
ChIndex
enum to classify the different chamber layers in the muon spectrometer
Definition: MuonStationIndex.h:15
MuonStationIndex.h
Muon::MuonStationIndex::ChIndex::ChUnknown
@ ChUnknown
Muon::MuonStationIndex::ChIndex::EMS
@ EMS
Muon::MuonStationIndex::StIndex::BI
@ BI
Muon::MuonStationIndex::StIndex::BM
@ BM
Muon::MuonStationIndex::phiName
const std::string & phiName(PhiIndex index)
convert PhiIndex into a string
Definition: MuonStationIndex.cxx:87
Muon::MuonStationIndex::StIndex::EI
@ EI
Muon::MuonStationIndex::isSmall
bool isSmall(const ChIndex index)
Returns true if the chamber index is in a small sector.
Muon::MuonStationIndex::toInt
constexpr int toInt(const EnumType enumVal)
Definition: MuonStationIndex.h:61
Muon::MuonStationIndex::ChIndex::BOL
@ BOL