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#include <ostream>
8
9namespace Muon {
10 namespace MuonStationIndex{
11
12 ChIndex chIndex( const std::string& index) {
13 if( index == "BIL" ) {
14 return ChIndex::BIL;
15 } else if( index == "BMS" ) {
16 return ChIndex::BMS;
17 } else if( index == "BIS" ) {
18 return ChIndex::BIS;
19 } else if( index == "BML" ) {
20 return ChIndex::BML;
21 } else if( index == "BOS" ) {
22 return ChIndex::BOS;
23 } else if( index == "BOL" ) {
24 return ChIndex::BOL;
25 } else if( index == "BEE" ) {
26 return ChIndex::BEE;
27 } else if( index == "EIS" ) {
28 return ChIndex::EIS;
29 } else if( index == "EIL" ) {
30 return ChIndex::EIL;
31 } else if( index == "EMS" ) {
32 return ChIndex::EMS;
33 } else if( index == "EML" ) {
34 return ChIndex::EML;
35 } else if( index == "EOS" ) {
36 return ChIndex::EOS;
37 } else if( index == "EOL" ) {
38 return ChIndex::EOL;
39 } else if( index == "EES" ) {
40 return ChIndex::EES;
41 } else if( index == "EEL" ) {
42 return ChIndex::EEL;
43 } else if( index == "CSS" ) {
44 return ChIndex::CSS;
45 } else if( index == "CSL" ) {
46 return ChIndex::CSL;
47 }
48 return ChIndex::ChUnknown;
49 }
51 constexpr unsigned nMax = sectorLayerHashMax();
52 static constexpr std::array<StIndex, nMax> regionLayerToStationIndex {
53 StIndex::EI, StIndex::EM, StIndex::EO,
54 StIndex::EE, StIndex::BE, StIndex::BI,
55 StIndex::BM, StIndex::BO, StIndex::StUnknown,
56 StIndex::StUnknown,
57 StIndex::EI, StIndex::EM, StIndex::EO,
58 StIndex::EE, StIndex::BE
59 };
60 return regionLayerToStationIndex[ sectorLayerHash( region, layer ) ];
61 }
62
65 constexpr unsigned nMax = sectorLayerHashMax();
66 static constexpr std::array<ChIndex, nMax> regionLayerToChamberIndexSmall {
73 };
74 static constexpr std::array<ChIndex, nMax> regionLayerToChamberIndexLarge {
81 };
82 if( isSmall ) {
83 return regionLayerToChamberIndexSmall[ sectorLayerHash(region, layer)];
84 }
85 return regionLayerToChamberIndexLarge[sectorLayerHash(region, layer )];
86 }
87
88 const std::string& phiName( PhiIndex index ) {
89 static const std::array<std::string, toInt(PhiIndex::PhiIndexMax)> phiIndexNames = {
90 "BI1", "BI2", "BM1", "BM2", "BO1", "BO2", "T1", "T2", "T3", "T4", "CSC", "STGC1",
91 "STGC2"
92 };
93
95 static const std::string dummy{"PhiUnknown"};
96 return dummy;
97 }
99 static const std::string dummy{"PhiOutOfRange"};
100 return dummy;
101 }
102 return phiIndexNames[toInt(index)];
103 }
104
105 const std::string& stName( StIndex index ) {
106 static const std::array<std::string, toInt(StIndex::StIndexMax)> stationIndexNames {
107 "BI", "BM", "BO", "BE", "EI", "EM", "EO", "EE"};
108
109 if( index == StIndex::StUnknown ) {
110 static const std::string dummy{"StUnknown"};
111 return dummy;
112 }
113 if( index >= StIndex::StIndexMax) {
114 static const std::string dummy{"StIndexMax"};
115 return dummy;
116 }
117 return stationIndexNames[ toInt(index) ];
118 }
119
120 const std::string& chName( ChIndex index ) {
121 static const std::array<std::string, toInt(ChIndex::ChIndexMax)> chamberIndexNames {
122 "BIS", "BIL", "BMS", "BML", "BOS", "BOL", "BEE",
123 "EIS", "EIL", "EMS", "EML", "EOS", "EOL", "EES",
124 "EEL", "CSS", "CSL"
125 };
126
127 if( index == ChIndex::ChUnknown ) {
128 static const std::string dummy{"ChUnknown"};
129 return dummy;
130 }
131 if( index >= ChIndex::ChIndexMax ) {
132 static const std::string dummy{"ChOutOfRange"};
133 return dummy;
134 }
135 return chamberIndexNames[toInt(index)];
136 }
137
138 const std::string&
140 static const std::array<std::string, toInt(DetectorRegionIndex::DetectorRegionIndexMax)> detectorRegionIndexNames {
141 "EndcapA", "Barrel", "EndcapC"};
142
144 static const std::string dummy( "DetectorRegionUnknown" );
145 return dummy;
146 }
148 static const std::string dummy( "DetectorRegionIndexMax" );
149 return dummy;
150 }
151 return detectorRegionIndexNames[ toInt(index) ];
152 }
153
154 const std::string& layerName( LayerIndex index ) {
155 static const std::array<std::string, toInt(LayerIndex::LayerIndexMax)> layerIndexNames {
156 "Inner", "Middle", "Outer", "Extended", "BarrelExtended"};
157
159 static const std::string dummy{"LayerUnknown"};
160 return dummy;
161 }
163 static const std::string dummy{"LayerOutOfRange"};
164 return dummy;
165 }
166 return layerIndexNames[toInt(index)];
167 }
168
169 const std::string&
171 using TechIdx = TechnologyIndex;
172 static const std::array<std::string, toInt(TechIdx::TechnologyIndexMax)> technologyIndexNames {
173 "MDT", "CSC", "RPC", "TGC", "STGC", "MM"};
174
175 if( index == TechIdx::TechnologyUnknown ) {
176 static const std::string dummy{"TechnologyUnknown"};
177 return dummy;
178 }
179 if( index >= TechIdx::TechnologyIndexMax ) {
180 static const std::string dummy{"TechnologyIndexMax"};
181 return dummy;
182 }
183 return technologyIndexNames[ toInt(index) ];
184 }
185
186 std::ostream& operator<<(std::ostream& ostr, const StIndex stIdx){
187 return (ostr<<stName(stIdx));
188 }
189 std::ostream& operator<<(std::ostream& ostr, const ChIndex chIdx){
190 return (ostr<<chName(chIdx));
191 }
192 std::ostream& operator<<(std::ostream& ostr, const PhiIndex phiIdx){
193 return (ostr<<phiName(phiIdx));
194 }
195 std::ostream& operator<<(std::ostream& ostr, const DetectorRegionIndex detIdx){
196 return (ostr<<regionName(detIdx));
197 }
198 std::ostream& operator<<(std::ostream& ostr, const LayerIndex layIdx){
199 return (ostr<<layerName(layIdx));
200 }
201 std::ostream& operator<<(std::ostream& ostr, const TechnologyIndex techIdx){
202 return (ostr<<technologyName(techIdx));
203 }
204 }
205} // 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
std::ostream & operator<<(std::ostream &ostr, const StIndex stIdx)
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
LayerIndex
enum to classify the different layers in the muon spectrometer
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
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