2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
6 #include <utility> //std::pair
8 namespace Muon::MuonStationIndex{
9 inline ChIndex toChamberIndex( StIndex stIndex, bool isSmall ) {
14 return static_cast<ChIndex>(2*toInt(stIndex) + !isSmall);
16 return isSmall ? ChIndex::BEE : ChIndex::ChUnknown;
17 /** There's no BES -> the station indices shift by 1 to the right */
22 return static_cast<ChIndex>(2*toInt(stIndex) -1 + !isSmall);
26 return ChIndex::ChUnknown;
28 inline bool isBarrel(const StIndex index) {
39 inline bool isBarrel(const ChIndex index) {
53 inline bool isSmall(const ChIndex index) {
69 inline StIndex toStationIndex( ChIndex index ) {
96 /// Don't do anything for
97 case ChIndex::ChIndexMax:
98 case ChIndex::ChUnknown:
101 return StIndex::StUnknown;
103 inline LayerIndex toLayerIndex( ChIndex index ) {
104 return toLayerIndex(toStationIndex(index));
106 inline LayerIndex toLayerIndex(StIndex index) {
110 return LayerIndex::Inner;
113 return LayerIndex::Middle;
116 return LayerIndex::Outer;
118 return LayerIndex::BarrelExtended;
120 return LayerIndex::Extended;
121 case StIndex::StUnknown:
122 case StIndex::StIndexMax:
125 return LayerIndex::LayerIndexMax;
127 inline unsigned int sectorLayerHash(DetectorRegionIndex regionIdx,
128 LayerIndex layerIndex ){
129 return toInt(regionIdx)*toInt(LayerIndex::LayerIndexMax) + toInt(layerIndex);
131 inline std::pair< DetectorRegionIndex, LayerIndex > decomposeSectorLayerHash( unsigned int hash ) {
132 assert(hash < sectorLayerHashMax());
133 return std::make_pair( static_cast< DetectorRegionIndex >( hash / toInt(LayerIndex::LayerIndexMax) ),
134 static_cast< LayerIndex >( hash % toInt(LayerIndex::LayerIndexMax) ) );