ATLAS Offline Software
Loading...
Searching...
No Matches
TGCId.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef MUONTGC_CABLING_TGCID_H
6#define MUONTGC_CABLING_TGCID_H
7
8#include <type_traits>
9#include <ostream>
10
11namespace MuonTGC_Cabling {
12
13class TGCId {
14 public:
15 enum class IdType { NoIdType, Channel, Module };
16
17 public:
19 virtual ~TGCId() = default;
20
21 virtual bool isValid() const { return true; }
22
23 public:
24 // <internal numbering scheme>
25 // 1. IdType
26 // 2. IdIndex
27 // int station [0..3]
28 // int sectorRO [0..11]
29 // int srod [0..2]
30 // int octant [0..7]
31 // int sector [0..47],[0..23]
32 // int chamber [0..n]
33 // int id [0..n]
34 //
36 // int layer [0..8]
37 // int block [0..n]
38 // int channel [0..n]
39
40 static constexpr int NUM_LAYERS =
41 9; // [0..2]:M1, [3..4]:M2, [5..6]:M3, [7..8]:M4(Inner)
42 static constexpr int NUM_OCTANT = 8;
43 static constexpr int NUM_ENDCAP_SECTOR = 48;
44 static constexpr int NUM_FORWARD_SECTOR = 24;
45 static constexpr int NUM_INNER_SECTOR = 24;
46 static constexpr int N_RODS = 12;
47
48 enum class SideType : int { Aside = 0, Cside = 1, MaxSideType = 2, Undefined = 99 };
49 enum class StationType : int { M1 = 0, M2 = 1, M3 = 2, M4 = 3, // M3 is also used for M2/M3 SLB
51 enum class ModuleType : int { WD = 0, SD = 1,
52 WT = 2, ST = 3,
53 WI = 4, SI = 5,
55 SL_SLB = 6, // SL SLB module, not used in TGCId but in TGCModuleSLB
57 };
58 enum class SignalType : int { Wire = 0, Strip = 1, MaxSignalType = 2, Undefined = 99 };
59 enum class RegionType : int { Endcap = 0, Forward = 1, MaxRegionType = 2, Undefined = 99 };
60
61 IdType getIdType() const;
62 SideType getSideType() const;
63 StationType getStation() const;
67
68 int getSectorInReadout() const;
69
70 virtual int getSectorInOctant() const;
71 virtual int getSectorModule() const;
72
73 int getOctant() const;
74 virtual int getSector() const;
75 int getChamber() const;
76 int getId() const;
77 int getBlock() const;
78
79 bool isAside() const;
80 bool isCside() const;
81 bool isStrip() const;
82 bool isWire() const;
83 bool isTriplet() const;
84 bool isDoublet() const;
85 bool isInner() const;
86 bool isForward() const;
87 bool isEndcap() const;
88
89 public:
90 void setSideType(SideType side);
91 void setStation(StationType vstation);
92 virtual void setModuleType(ModuleType module);
93 void setSignalType(SignalType signal);
94 void setRegionType(RegionType region);
95
96 virtual void setOctant(int voctant);
97 virtual void setSector(int vsector);
98 virtual void setChamber(int chamber);
99 void setId(int id);
100
101 protected:
102 void setIdType(IdType idtype);
103 void setReadoutSector(int sector);
104 void setSectorModule(int sectorModule);
105
106 protected:
112
113 int m_octant{-1};
114 int m_sector{-1};
115 int m_chamber{-1};
116 int m_id{-1};
117
118 private:
120};
121
123 return m_idType;
124}
126 return m_side;
127}
129 return m_station;
130}
132 return m_module;
133}
135 return m_signal;
136}
138 return m_region;
139}
140
141inline int TGCId::getOctant() const {
142 return m_octant;
143}
144inline int TGCId::getSector() const {
145 return m_sector;
146}
147inline int TGCId::getChamber() const {
148 return m_chamber;
149}
150inline int TGCId::getId() const {
151 return m_id;
152}
153
154inline bool TGCId::isAside() const {
155 return (m_side == SideType::Aside);
156}
157inline bool TGCId::isCside() const {
158 return (m_side == SideType::Cside);
159}
160inline bool TGCId::isStrip() const {
161 return (m_signal == SignalType::Strip);
162}
163inline bool TGCId::isWire() const {
164 return (m_signal == SignalType::Wire);
165}
166inline bool TGCId::isTriplet() const {
167 return (m_station == StationType::M1);
168}
169inline bool TGCId::isDoublet() const {
171}
172inline bool TGCId::isInner() const {
173 return (m_station == StationType::M4);
174}
175inline bool TGCId::isForward() const {
176 return (m_region == RegionType::Forward);
177}
178inline bool TGCId::isEndcap() const {
179 return (m_region == RegionType::Endcap);
180}
181
182inline void TGCId::setSideType(SideType side) {
183 m_side = side;
184}
185
186inline void TGCId::setRegionType(RegionType region) {
187 m_region = region;
188}
189
190inline void TGCId::setChamber(int chamber) {
191 m_chamber = chamber;
192}
193
194inline void TGCId::setId(int id) {
195 m_id = id;
196}
197
198inline void TGCId::setIdType(IdType idtype) {
199 m_idType = idtype;
200}
201
202constexpr auto operator + (TGCId::SideType e) noexcept {
203 return static_cast<std::underlying_type_t<TGCId::SideType>>(e);
204}
205constexpr auto operator + (TGCId::ModuleType e) noexcept {
206 return static_cast<std::underlying_type_t<TGCId::ModuleType>>(e);
207}
208constexpr auto operator + (TGCId::SignalType e) noexcept {
209 return static_cast<std::underlying_type_t<TGCId::SignalType>>(e);
210}
211constexpr auto operator + (TGCId::RegionType e) noexcept {
212 return static_cast<std::underlying_type_t<TGCId::RegionType>>(e);
213}
214
215inline std::ostream& operator<<(std::ostream& os, const TGCId::SideType& type) {
216 return os << (type == TGCId::SideType::Aside ? "Aside" : "Cside");
217}
218inline std::ostream& operator<<(std::ostream& os, const TGCId::StationType& type) {
219 return os << static_cast<int>(type);
220}
221inline std::ostream& operator<<(std::ostream& os, const TGCId::ModuleType& type) {
222 return os << static_cast<int>(type);
223}
224inline std::ostream& operator<<(std::ostream& os, const TGCId::SignalType& type) {
225 return os << (type == TGCId::SignalType::Wire ? "Wire" : "Strip");
226}
227inline std::ostream& operator<<(std::ostream& os, const TGCId::RegionType& type) {
228 return os << (type == TGCId::RegionType::Endcap ? "Endcap" : "Forward");
229}
230
231} // namespace MuonTGC_Cabling
232
233#endif
@ Undefined
void setSideType(SideType side)
Definition TGCId.h:182
StationType getStation() const
Definition TGCId.h:128
bool isEndcap() const
Definition TGCId.h:178
int getOctant() const
Definition TGCId.h:141
virtual bool isValid() const
Definition TGCId.h:21
bool isTriplet() const
Definition TGCId.h:166
bool isDoublet() const
Definition TGCId.h:169
ModuleType m_module
Definition TGCId.h:109
SignalType m_signal
Definition TGCId.h:110
bool isAside() const
Definition TGCId.h:154
bool isForward() const
Definition TGCId.h:175
RegionType m_region
Definition TGCId.h:111
virtual int getSectorModule() const
Definition TGCId.cxx:99
static constexpr int NUM_INNER_SECTOR
Definition TGCId.h:45
void setRegionType(RegionType region)
Definition TGCId.h:186
void setSectorModule(int sectorModule)
Definition TGCId.cxx:125
int getSectorInReadout() const
Definition TGCId.cxx:26
ModuleType getModuleType() const
Definition TGCId.h:131
virtual void setOctant(int voctant)
Definition TGCId.cxx:95
static constexpr int NUM_ENDCAP_SECTOR
Definition TGCId.h:43
int getChamber() const
Definition TGCId.h:147
void setIdType(IdType idtype)
Definition TGCId.h:198
void setId(int id)
Definition TGCId.h:194
bool isCside() const
Definition TGCId.h:157
bool isStrip() const
Definition TGCId.h:160
void setReadoutSector(int sector)
RegionType getRegionType() const
Definition TGCId.h:137
static constexpr int N_RODS
Definition TGCId.h:46
bool isWire() const
Definition TGCId.h:163
virtual int getSector() const
Definition TGCId.h:144
IdType getIdType() const
Definition TGCId.h:122
void setSignalType(SignalType signal)
Definition TGCId.cxx:61
void setStation(StationType vstation)
Definition TGCId.cxx:78
virtual void setSector(int vsector)
Definition TGCId.cxx:82
StationType m_station
Definition TGCId.h:108
SideType getSideType() const
Definition TGCId.h:125
bool isInner() const
Definition TGCId.h:172
virtual int getSectorInOctant() const
Definition TGCId.cxx:13
static constexpr int NUM_OCTANT
Definition TGCId.h:42
SignalType getSignalType() const
Definition TGCId.h:134
int getId() const
Definition TGCId.h:150
virtual ~TGCId()=default
virtual void setModuleType(ModuleType module)
Definition TGCId.cxx:39
TGCId(IdType vtype=IdType::NoIdType)
Definition TGCId.cxx:9
virtual void setChamber(int chamber)
Definition TGCId.h:190
static constexpr int NUM_LAYERS
in ChannelId
Definition TGCId.h:40
static constexpr int NUM_FORWARD_SECTOR
Definition TGCId.h:44
std::ostream & operator<<(std::ostream &os, const TGCId::SideType &type)
Definition TGCId.h:215
constexpr auto operator+(TGCId::SideType e) noexcept
Definition TGCId.h:202