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_lengthWI[] = {40, 32, 32, 32, 32};
80const int TGCChannelSLBIn::s_lengthSI[] = {40, 32, 32, 32, 32};
81const int TGCChannelSLBIn::s_adjacentCell[] = {0, 2, 2, 6, 6};
82const int TGCChannelSLBIn::s_adjacentWD[] = {0, 2, 2, 6, 6};
83const int TGCChannelSLBIn::s_adjacentSD[] = {0, 0, 0, 0, 0};
84const int TGCChannelSLBIn::s_adjacentWT[] = {0, 2, 2, 2, 2};
85const int TGCChannelSLBIn::s_adjacentST[] = {0, 0, 0, 0, 0};
86
88 checkCellType(cellType, __func__);
89 return s_lengthCell[cellType];
90}
91
93 checkCellType(cellType, __func__);
94 return s_offsetCell[cellType];
95}
96
98 CellType cellType) {
99 checkCellType(cellType, __func__);
100 switch (moduleType) {
102 return s_lengthWD[cellType];
104 return s_lengthSD[cellType];
106 return s_lengthWT[cellType];
108 return s_lengthST[cellType];
110 return s_lengthWI[cellType];
112 return s_lengthSI[cellType];
113 default:
114 break;
115 }
116 return -1;
117}
118
120 checkCellType(cellType, __func__);
121 return s_adjacentCell[cellType];
122}
123
125 CellType cellType) {
126 checkCellType(cellType, __func__);
127 switch (moduleType) {
129 return s_adjacentWD[cellType];
131 return s_adjacentSD[cellType];
133 return s_adjacentWT[cellType];
135 return s_adjacentST[cellType];
137 return s_adjacentST[cellType];
139 return s_adjacentST[cellType];
140 default:
141 break;
142 }
143 return -1;
144}
145
147 if (channel >= getOffsetOfCell(CellTrig) &&
149 return channel - getOffsetOfCell(CellTrig);
150 }
151 if (channel >= getOffsetOfCell(CellA) &&
153 return channel - getOffsetOfCell(CellA);
154 }
155 if (channel >= getOffsetOfCell(CellB) &&
157 return channel - getOffsetOfCell(CellB);
158 }
159 if (channel >= getOffsetOfCell(CellC) &&
161 return channel - getOffsetOfCell(CellC);
162 }
163 if (channel >= getOffsetOfCell(CellD) &&
165 return channel - getOffsetOfCell(CellD);
166 }
167 return -1;
168}
169
171 if (channel >= getOffsetOfCell(CellTrig) &&
173 return CellTrig;
174 }
175 if (channel >= getOffsetOfCell(CellA) &&
177 return CellA;
178 }
179 if (channel >= getOffsetOfCell(CellB) &&
181 return CellB;
182 }
183 if (channel >= getOffsetOfCell(CellC) &&
185 return CellC;
186 }
187 if (channel >= getOffsetOfCell(CellD) &&
189 return CellD;
190 }
191 return NoCellType;
192}
193
195 CellType cellType, int channel) {
196 const int adjacentSLB = getAdjacentOfSLB(moduleType, cellType);
197 if (adjacentSLB == -1) {
198 throw std::out_of_range(
199 "adjacentSLB is -1 in TGCChannelSLBIn::convertChannelInSLB");
200 }
201 int offset = getAdjacentOfCell(cellType) - adjacentSLB;
202 return channel - offset;
203}
204
206 CellType cellType, int channelInSLB) {
207 const int adjacentSLB = getAdjacentOfSLB(moduleType, cellType);
208 if (adjacentSLB == -1) {
209 throw std::out_of_range(
210 "adjacentSLB is -1 in TGCChannelSLBIn::convertChannel");
211 }
212 int offset = getAdjacentOfCell(cellType) - adjacentSLB;
213 return getOffsetOfCell(cellType) + offset + channelInSLB;
214}
215
219
223
231
232} // 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