ATLAS Offline Software
Loading...
Searching...
No Matches
TGCChannelSLBIn.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include <stdexcept>
8#include <string>
9
11
12namespace {
13void checkCellType(MuonTGC_Cabling::TGCChannelSLBIn::CellType cellType,
14 const std::string& funcName) {
17 const std::string msg = "cellType out of range in " + funcName;
18 throw std::out_of_range(msg);
19 }
20}
21
22} // namespace
23
24namespace MuonTGC_Cabling {
25
27 TGCId::ModuleType vmodule,
28 TGCId::RegionType vregion,
29 int vsector, int vid, int vchannel)
31 setSideType(vside);
32 setModuleType(vmodule);
33 setRegionType(vregion);
34 setSector(vsector);
35 setId(vid);
37}
38
40 TGCId::StationType vstation,
41 TGCId::ModuleType vmodule,
42 TGCId::RegionType vregion,
43 int vsector, int vid, int vchannel)
45 setSideType(vside);
46 setModuleType(vmodule);
47 setStation(vstation);
48 setRegionType(vregion);
49 setSector(vsector);
50 setId(vid);
52}
53
54std::unique_ptr<TGCModuleId> TGCChannelSLBIn::getModule() const {
55 return std::make_unique<TGCModuleSLB>(
57}
58
63 (getOctant() >= 0) && (getOctant() < 8) &&
64 (getId() >= 0) && (getChannel() >= 0) &&
66 (m_channelInSLB >= 0)) {
67 return true;
68 }
69 return false;
70}
71
72// Trig A B C D
73const int TGCChannelSLBIn::s_lengthCell[] = {40, 36, 36, 44, 44};
74const int TGCChannelSLBIn::s_offsetCell[] = {0, 40, 76, 112, 156};
75const int TGCChannelSLBIn::s_lengthWD[] = {40, 36, 36, 44, 44};
76const int TGCChannelSLBIn::s_lengthSD[] = {40, 32, 32, 32, 32};
77const int TGCChannelSLBIn::s_lengthWT[] = {40, 36, 36, 36, 36};
78const int TGCChannelSLBIn::s_lengthST[] = {40, 32, 32, 32, 32};
79const int TGCChannelSLBIn::s_adjacentCell[] = {0, 2, 2, 6, 6};
80const int TGCChannelSLBIn::s_adjacentWD[] = {0, 2, 2, 6, 6};
81const int TGCChannelSLBIn::s_adjacentSD[] = {0, 0, 0, 0, 0};
82const int TGCChannelSLBIn::s_adjacentWT[] = {0, 2, 2, 2, 2};
83const int TGCChannelSLBIn::s_adjacentST[] = {0, 0, 0, 0, 0};
84
86 checkCellType(cellType, __func__);
87 return s_lengthCell[cellType];
88}
89
91 checkCellType(cellType, __func__);
92 return s_offsetCell[cellType];
93}
94
96 CellType cellType) {
97 checkCellType(cellType, __func__);
98 switch (moduleType) {
100 return s_lengthWD[cellType];
102 return s_lengthSD[cellType];
104 return s_lengthWT[cellType];
106 return s_lengthST[cellType];
108 return s_lengthST[cellType];
110 return s_lengthST[cellType];
111 default:
112 break;
113 }
114 return -1;
115}
116
118 checkCellType(cellType, __func__);
119 return s_adjacentCell[cellType];
120}
121
123 CellType cellType) {
124 checkCellType(cellType, __func__);
125 switch (moduleType) {
127 return s_adjacentWD[cellType];
129 return s_adjacentSD[cellType];
131 return s_adjacentWT[cellType];
133 return s_adjacentST[cellType];
135 return s_adjacentST[cellType];
137 return s_adjacentST[cellType];
138 default:
139 break;
140 }
141 return -1;
142}
143
145 if (channel >= getOffsetOfCell(CellTrig) &&
147 return channel - getOffsetOfCell(CellTrig);
148 }
149 if (channel >= getOffsetOfCell(CellA) &&
151 return channel - getOffsetOfCell(CellA);
152 }
153 if (channel >= getOffsetOfCell(CellB) &&
155 return channel - getOffsetOfCell(CellB);
156 }
157 if (channel >= getOffsetOfCell(CellC) &&
159 return channel - getOffsetOfCell(CellC);
160 }
161 if (channel >= getOffsetOfCell(CellD) &&
163 return channel - getOffsetOfCell(CellD);
164 }
165 return -1;
166}
167
169 if (channel >= getOffsetOfCell(CellTrig) &&
171 return CellTrig;
172 }
173 if (channel >= getOffsetOfCell(CellA) &&
175 return CellA;
176 }
177 if (channel >= getOffsetOfCell(CellB) &&
179 return CellB;
180 }
181 if (channel >= getOffsetOfCell(CellC) &&
183 return CellC;
184 }
185 if (channel >= getOffsetOfCell(CellD) &&
187 return CellD;
188 }
189 return NoCellType;
190}
191
193 CellType cellType, int channel) {
194 const int adjacentSLB = getAdjacentOfSLB(moduleType, cellType);
195 if (adjacentSLB == -1) {
196 throw std::out_of_range(
197 "adjacentSLB is -1 in TGCChannelSLBIn::convertChannelInSLB");
198 }
199 int offset = getAdjacentOfCell(cellType) - adjacentSLB;
200 return channel - offset;
201}
202
204 CellType cellType, int channelInSLB) {
205 const int adjacentSLB = getAdjacentOfSLB(moduleType, cellType);
206 if (adjacentSLB == -1) {
207 throw std::out_of_range(
208 "adjacentSLB is -1 in TGCChannelSLBIn::convertChannel");
209 }
210 int offset = getAdjacentOfCell(cellType) - adjacentSLB;
211 return getOffsetOfCell(cellType) + offset + channelInSLB;
212}
213
217
221
229
230} // namespace MuonTGC_Cabling
virtual void setChannel(int channel)
TGCChannelId(ChannelIdType type=ChannelIdType::NoChannelIdType)
static int getLengthOfCell(CellType cellType)
static int convertChannelInSLB(TGCId::ModuleType moduleType, CellType cellType, int channel)
virtual CellType getCellType() const
static int convertChannelInCell(int channel)
static int getOffsetOfCell(CellType cellType)
virtual bool isValid() const override
static CellType convertCellType(int channel)
static int getAdjacentOfSLB(TGCId::ModuleType moduleType, CellType cellType)
virtual std::unique_ptr< TGCModuleId > getModule() const override
static int convertChannel(TGCId::ModuleType moduleType, CellType cellType, int channelInSLB)
static int getLengthOfSLB(TGCId::ModuleType moduleType, CellType cellType)
static int getAdjacentOfCell(CellType cellType)
virtual void setChannel(int channel) override
void setSideType(SideType side)
Definition TGCId.h:182
int getOctant() const
Definition TGCId.h:141
void setRegionType(RegionType region)
Definition TGCId.h:186
ModuleType getModuleType() const
Definition TGCId.h:131
void setId(int id)
Definition TGCId.h:194
RegionType getRegionType() const
Definition TGCId.h:137
virtual int getSector() const
Definition TGCId.h:144
void setStation(StationType vstation)
Definition TGCId.cxx:78
virtual void setSector(int vsector)
Definition TGCId.cxx:82
SideType getSideType() const
Definition TGCId.h:125
int getId() const
Definition TGCId.h:150
virtual void setModuleType(ModuleType module)
Definition TGCId.cxx:39
MsgStream & msg
Definition testRead.cxx:32