ATLAS Offline Software
Loading...
Searching...
No Matches
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
8namespace 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 {
52 StIndex::EI, StIndex::EM, StIndex::EO,
53 StIndex::EE, StIndex::BE, StIndex::BI,
54 StIndex::BM, StIndex::BO, StIndex::StUnknown,
55 StIndex::StUnknown,
56 StIndex::EI, StIndex::EM, StIndex::EO,
57 StIndex::EE, StIndex::BE
58 };
59 return regionLayerToStationIndex[ sectorLayerHash( region, layer ) ];
60 }
61
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
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
StIndex
enum to classify the different station layers in the muon spectrometer
const std::string & layerName(LayerIndex index)
convert LayerIndex into a string
ChIndex chIndex(const std::string &index)
convert ChIndex name string to enum
TechnologyIndex
enum to classify the different layers in the muon spectrometer
DetectorRegionIndex
enum to classify the different layers in the muon spectrometer
PhiIndex
enum to classify the different phi layers in the muon spectrometer
StIndex toStationIndex(ChIndex index)
convert ChIndex into StIndex
bool isSmall(const ChIndex index)
Returns true if the chamber index is in a small sector.
constexpr int toInt(const EnumType enumVal)
constexpr unsigned int sectorLayerHashMax()
maximum create a hash out of region and layer
ChIndex toChamberIndex(DetectorRegionIndex region, LayerIndex layer, bool isSmall)
convert DetectorRegionIndex + LayerIndex + isSmall into ChIndex
unsigned int sectorLayerHash(DetectorRegionIndex detectorRegionIndex, LayerIndex layerIndex)
create a hash out of region and layer
const std::string & stName(StIndex index)
convert StIndex into a string
const std::string & technologyName(TechnologyIndex index)
convert LayerIndex into a string
const std::string & chName(ChIndex index)
convert ChIndex into a string
const std::string & regionName(DetectorRegionIndex index)
convert DetectorRegionIndex into a string
const std::string & phiName(PhiIndex index)
convert PhiIndex into a string
LayerIndex
enum to classify the different layers in the muon spectrometer
ChIndex
enum to classify the different chamber layers in the muon spectrometer
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition index.py:1