ATLAS Offline Software
MuonStationIndex.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include <array>
7 
8 namespace Muon {
9 
10  static constexpr int N_CHAMBER_INDEX = 18;
11  static constexpr int N_STATION_INDEX = 9;
12  static constexpr int N_REGIONLAYER_INDEX = 15;
13 
15  if( stIndex == BE && isSmall ) return ChUnknown;
16  return static_cast<ChIndex>( 2*stIndex + !isSmall );
17  }
18 
20  MuonStationIndex::chIndex( const std::string& index ) {
21 
22  if( index == "BIS" ) return BIS;
23  if( index == "BIL" ) return BIL;
24  if( index == "BMS" ) return BMS;
25  if( index == "BML" ) return BML;
26  if( index == "BOS" ) return BOS;
27  if( index == "BOL" ) return BOL;
28  if( index == "BEE" ) return BEE;
29  if( index == "EIS" ) return EIS;
30  if( index == "EIL" ) return EIL;
31  if( index == "EMS" ) return EMS;
32  if( index == "EML" ) return EML;
33  if( index == "EOS" ) return EOS;
34  if( index == "EOL" ) return EOL;
35  if( index == "EES" ) return EES;
36  if( index == "EEL" ) return EEL;
37  if( index == "CSS" ) return CSS;
38  if( index == "CSL" ) return CSL;
39  return ChUnknown;
40  }
41 
44  static constexpr std::array<MuonStationIndex::StIndex, N_CHAMBER_INDEX> chamberToStationIndex {
51  };
52  return chamberToStationIndex[ index ];
53  }
54 
57  static constexpr std::array<MuonStationIndex::LayerIndex, N_CHAMBER_INDEX> chamberToLayerIndex {
67  };
68  return chamberToLayerIndex[ index ];
69  }
70 
73  static constexpr std::array<MuonStationIndex::LayerIndex, N_STATION_INDEX> stationToLayerIndex {
79  };
80  return stationToLayerIndex[ index ];
81  }
82 
85  LayerIndex layer ) {
86  static constexpr std::array<MuonStationIndex::StIndex, N_REGIONLAYER_INDEX> regionLayerToStationIndex {
93  };
94  return regionLayerToStationIndex[ sectorLayerHash( region, layer ) ];
95  }
96 
99  LayerIndex layer, bool isSmall ) {
100  static constexpr std::array<MuonStationIndex::ChIndex, N_REGIONLAYER_INDEX> regionLayerToChamberIndexSmall {
107  };
108  static constexpr std::array<MuonStationIndex::ChIndex, N_REGIONLAYER_INDEX> regionLayerToChamberIndexLarge {
115  };
116  if( isSmall ) {
117  return regionLayerToChamberIndexSmall[ sectorLayerHash( region,
118  layer ) ];
119  }
120  return regionLayerToChamberIndexLarge[ sectorLayerHash( region,
121  layer ) ];
122  }
123 
124  const std::string& MuonStationIndex::phiName( PhiIndex index ) {
125  static const std::array<std::string, 14> phiIndexNames = {
126  "BI1", "BI2", "BM1", "BM2", "BO1", "BO2", "T1", "T2", "T3", "T4", "CSC", "STGC1",
127  "STGC2", "PhiIndexMax"
128  };
129 
130  if( index == PhiUnknown ) {
131  static const std::string dummy( "PhiUnknown" );
132  return dummy;
133  }
134  if( index >= PhiIndexMax ) {
135  static const std::string dummy( "PhiOutOfRange" );
136  return dummy;
137  }
138  return phiIndexNames[ index ];
139  }
140 
141  const std::string& MuonStationIndex::stName( StIndex index ) {
142  static const std::array<std::string, N_STATION_INDEX> stationIndexNames {
143  "BI", "BM", "BO", "BE", "EI", "EM", "EO", "EE", "StIndexMax"
144  };
145 
146  if( index == StUnknown ) {
147  static const std::string dummy( "StUnknown" );
148  return dummy;
149  }
150  if( index >= StIndexMax ) {
151  static const std::string dummy( "StOutOfRange" );
152  return dummy;
153  }
154  return stationIndexNames[ index ];
155  }
156 
157  const std::string& MuonStationIndex::chName( ChIndex index ) {
158  static const std::array<std::string, N_CHAMBER_INDEX> chamberIndexNames {
159  "BIS", "BIL", "BMS", "BML", "BOS", "BOL", "BEE",
160  "EIS", "EIL", "EMS", "EML", "EOS", "EOL", "EES",
161  "EEL", "CSS", "CSL", "ChIndexMax"
162  };
163 
164  if( index == ChUnknown ) {
165  static const std::string dummy( "ChUnknown" );
166  return dummy;
167  }
168  if( index >= ChIndexMax ) {
169  static const std::string dummy( "ChOutOfRange" );
170  return dummy;
171  }
172  return chamberIndexNames[ index ];
173  }
174 
175  const std::string&
177  static const std::array<std::string, 4> detectorRegionIndexNames {
178  "EndcapA", "Barrel", "EndcapC", "DetectorRegionIndexMax"
179  };
180 
181  if( index == DetectorRegionUnknown ) {
182  static const std::string dummy( "DetectorRegionUnknown" );
183  return dummy;
184  }
185  if( index >= DetectorRegionIndexMax ) {
186  static const std::string dummy( "DetectorRegionOutOfRange" );
187  return dummy;
188  }
189  return detectorRegionIndexNames[ index ];
190  }
191 
193  static const std::array<std::string, 6> layerIndexNames {
194  "Inner", "Middle", "Outer", "Extended", "BarrelExtended", "LayerIndexMax"
195  };
196 
197  if( index == LayerUnknown ) {
198  static const std::string dummy( "LayerUnknown" );
199  return dummy;
200  }
201  if( index >= LayerIndexMax ) {
202  static const std::string dummy ( "LayerOutOfRange" );
203  return dummy;
204  }
205  return layerIndexNames[ index ];
206  }
207 
208  const std::string&
210  static const std::array<std::string, 7> technologyIndexNames {
211  "MDT", "CSC", "RPC", "TGC", "STGC", "MM", "TechnologyIndexMax"
212  };
213 
214  if( index == TechnologyUnknown ) {
215  static const std::string dummy( "TechnologyUnknown" );
216  return dummy;
217  }
218  if( index >= TechnologyIndexMax ) {
219  static const std::string dummy( "TechnologyOutOfRange" );
220  return dummy;
221  }
222  return technologyIndexNames[ index ];
223  }
224 
225  unsigned int
227  LayerIndex layerIndex ){
228  return detectorRegionIndex*LayerIndexMax + layerIndex;
229  }
230 
233  }
234 
238  return std::make_pair( static_cast< DetectorRegionIndex >( hash /
239  LayerIndexMax ),
240  static_cast< LayerIndex >( hash % LayerIndexMax ) );
241  }
242 
243 } // namespace Muon
Muon::MuonStationIndex::BIS
@ BIS
Definition: MuonStationIndex.h:17
Muon::MuonStationIndex::chName
static const std::string & chName(ChIndex index)
convert ChIndex into a string
Definition: MuonStationIndex.cxx:157
Muon::MuonStationIndex::StUnknown
@ StUnknown
Definition: MuonStationIndex.h:24
Muon::MuonStationIndex::BE
@ BE
Definition: MuonStationIndex.h:25
Muon::MuonStationIndex::toChamberIndex
static ChIndex toChamberIndex(DetectorRegionIndex region, LayerIndex layer, bool isSmall)
convert DetectorRegionIndex + LayerIndex + isSmall into ChIndex
Definition: MuonStationIndex.cxx:98
Muon::MuonStationIndex::CSS
@ CSS
Definition: MuonStationIndex.h:18
Muon::MuonStationIndex::toStationIndex
static StIndex toStationIndex(ChIndex index)
convert ChIndex into StIndex
Definition: MuonStationIndex.cxx:43
Muon::MuonStationIndex::LayerIndexMax
@ LayerIndexMax
BEE.
Definition: MuonStationIndex.h:43
Muon::MuonStationIndex::chIndex
static ChIndex chIndex(const std::string &index)
convert ChIndex name string to enum
Definition: MuonStationIndex.cxx:20
Muon::MuonStationIndex::BarrelExtended
@ BarrelExtended
EE.
Definition: MuonStationIndex.h:42
Muon::MuonStationIndex::Inner
@ Inner
Definition: MuonStationIndex.h:40
Muon::MuonStationIndex::Outer
@ Outer
Definition: MuonStationIndex.h:40
Muon::MuonStationIndex::EEL
@ EEL
Definition: MuonStationIndex.h:18
Muon::MuonStationIndex::EO
@ EO
Definition: MuonStationIndex.h:26
index
Definition: index.py:1
Muon::MuonStationIndex::TechnologyUnknown
@ TechnologyUnknown
Definition: MuonStationIndex.h:55
Muon::MuonStationIndex::BML
@ BML
Definition: MuonStationIndex.h:17
Muon::MuonStationIndex::sectorLayerHashMax
static unsigned int sectorLayerHashMax()
maximum create a hash out of region and layer
Definition: MuonStationIndex.cxx:231
Muon::MuonStationIndex::LayerIndex
LayerIndex
enum to classify the different layers in the muon spectrometer
Definition: MuonStationIndex.h:38
Muon::MuonStationIndex::sectorLayerHash
static unsigned int sectorLayerHash(DetectorRegionIndex detectorRegionIndex, LayerIndex layerIndex)
create a hash out of region and layer
Definition: MuonStationIndex.cxx:226
Muon::MuonStationIndex::BI
@ BI
Definition: MuonStationIndex.h:25
Muon::MuonStationIndex::BOS
@ BOS
Definition: MuonStationIndex.h:17
Muon::MuonStationIndex::BMS
@ BMS
Definition: MuonStationIndex.h:17
Muon::MuonStationIndex::PhiIndexMax
@ PhiIndexMax
Definition: MuonStationIndex.h:34
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:49
Muon::MuonStationIndex::PhiIndex
PhiIndex
enum to classify the different phi layers in the muon spectrometer
Definition: MuonStationIndex.h:31
Muon::MuonStationIndex::EIS
@ EIS
Definition: MuonStationIndex.h:18
Muon::MuonStationIndex::EOS
@ EOS
Definition: MuonStationIndex.h:18
Muon::MuonStationIndex::decomposeSectorLayerHash
static std::pair< DetectorRegionIndex, LayerIndex > decomposeSectorLayerHash(unsigned int hash)
decompose the hash into Region and Layer
Definition: MuonStationIndex.cxx:237
Muon::MuonStationIndex::PhiUnknown
@ PhiUnknown
Definition: MuonStationIndex.h:32
Muon::MuonStationIndex::regionName
static const std::string & regionName(DetectorRegionIndex index)
convert DetectorRegionIndex into a string
Definition: MuonStationIndex.cxx:176
Muon::MuonStationIndex::BM
@ BM
Definition: MuonStationIndex.h:25
Muon::MuonStationIndex::LayerUnknown
@ LayerUnknown
Definition: MuonStationIndex.h:39
Muon::MuonStationIndex::EI
@ EI
Definition: MuonStationIndex.h:26
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
Muon::MuonStationIndex::DetectorRegionUnknown
@ DetectorRegionUnknown
Definition: MuonStationIndex.h:48
Muon::MuonStationIndex::phiName
static const std::string & phiName(PhiIndex index)
convert PhiIndex into a string
Definition: MuonStationIndex.cxx:124
python.xAODType.dummy
dummy
Definition: xAODType.py:4
Muon::MuonStationIndex::layerName
static const std::string & layerName(LayerIndex index)
convert LayerIndex into a string
Definition: MuonStationIndex.cxx:192
Muon::MuonStationIndex::toLayerIndex
static LayerIndex toLayerIndex(ChIndex index)
convert ChIndex into LayerIndex
Definition: MuonStationIndex.cxx:56
Muon::MuonStationIndex::EES
@ EES
Definition: MuonStationIndex.h:18
Muon::MuonStationIndex::ChUnknown
@ ChUnknown
Definition: MuonStationIndex.h:16
Muon::MuonStationIndex::DetectorRegionIndex
DetectorRegionIndex
enum to classify the different layers in the muon spectrometer
Definition: MuonStationIndex.h:47
Muon::MuonStationIndex::StIndexMax
@ StIndexMax
Definition: MuonStationIndex.h:27
Muon::MuonStationIndex::DetectorRegionIndexMax
@ DetectorRegionIndexMax
Definition: MuonStationIndex.h:50
Muon::MuonStationIndex::ChIndexMax
@ ChIndexMax
Definition: MuonStationIndex.h:19
Muon::MuonStationIndex::EML
@ EML
Definition: MuonStationIndex.h:18
DeMoScan.index
string index
Definition: DeMoScan.py:362
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
Muon::MuonStationIndex::BO
@ BO
Definition: MuonStationIndex.h:25
Muon::MuonStationIndex::BIL
@ BIL
Definition: MuonStationIndex.h:17
Muon::MuonStationIndex::BEE
@ BEE
Definition: MuonStationIndex.h:17
Muon::MuonStationIndex::TechnologyIndexMax
@ TechnologyIndexMax
Definition: MuonStationIndex.h:57
Muon::MuonStationIndex::Middle
@ Middle
Definition: MuonStationIndex.h:40
Muon::MuonStationIndex::ChIndex
ChIndex
enum to classify the different chamber layers in the muon spectrometer
Definition: MuonStationIndex.h:15
Muon::MuonStationIndex::stName
static const std::string & stName(StIndex index)
convert StIndex into a string
Definition: MuonStationIndex.cxx:141
Muon::MuonStationIndex::StIndex
StIndex
enum to classify the different station layers in the muon spectrometer
Definition: MuonStationIndex.h:23
Muon::MuonStationIndex::Extended
@ Extended
Definition: MuonStationIndex.h:41
MuonStationIndex.h
Muon::MuonStationIndex::EMS
@ EMS
Definition: MuonStationIndex.h:18
Muon::MuonStationIndex::EOL
@ EOL
Definition: MuonStationIndex.h:18
Muon::MuonStationIndex::EE
@ EE
Definition: MuonStationIndex.h:26
Muon::MuonStationIndex::TechnologyIndex
TechnologyIndex
enum to classify the different layers in the muon spectrometer
Definition: MuonStationIndex.h:54
Muon::MuonStationIndex::BOL
@ BOL
Definition: MuonStationIndex.h:17
Muon::MuonStationIndex::EM
@ EM
Definition: MuonStationIndex.h:26
Muon::MuonStationIndex::CSL
@ CSL
Definition: MuonStationIndex.h:18
Muon::MuonStationIndex::EIL
@ EIL
Definition: MuonStationIndex.h:18
Muon::MuonStationIndex::technologyName
static const std::string & technologyName(TechnologyIndex index)
convert LayerIndex into a string
Definition: MuonStationIndex.cxx:209