ATLAS Offline Software
Loading...
Searching...
No Matches
MuonTGC_Cabling::TGCCablePPToSLB Class Reference

#include <TGCCablePPToSLB.h>

Inheritance diagram for MuonTGC_Cabling::TGCCablePPToSLB:
Collaboration diagram for MuonTGC_Cabling::TGCCablePPToSLB:

Public Types

enum  CableType {
  NoCableType = -1 , InASD , ASDToPP , InPP ,
  PPToSLB , InSLB , SLBToHPB , HPBToSL ,
  SLBToSSW , SSWToROD , MaxCableType
}

Public Member Functions

 TGCCablePPToSLB (const std::string &filename)
virtual ~TGCCablePPToSLB ()
std::unique_ptr< TGCChannelIdgetChannel (const TGCChannelId &channelId, bool orChannel=false) const
TGCModuleMap getModule (const TGCModuleId &moduleId) const
CableType getCableType () const

Private Member Functions

 TGCCablePPToSLB ()=delete
std::unique_ptr< TGCChannelIdgetChannelIn (const TGCChannelId &slbin, bool orChannel=false) const
std::unique_ptr< TGCChannelIdgetChannelOut (const TGCChannelId &ppout, bool orChannel=false) const
TGCModuleMap getModuleIn (const TGCModuleId &slb) const
TGCModuleMap getModuleOut (const TGCModuleId &pp) const

Private Attributes

std::array< std::array< std::unique_ptr< TGCDatabase >,+TGCId::ModuleType::MaxModuleType >,+TGCId::RegionType::MaxRegionTypem_database
CableType m_type {CableType::NoCableType}

Detailed Description

Definition at line 18 of file TGCCablePPToSLB.h.

Member Enumeration Documentation

◆ CableType

Enumerator
NoCableType 
InASD 
ASDToPP 
InPP 
PPToSLB 
InSLB 
SLBToHPB 
HPBToSL 
SLBToSSW 
SSWToROD 
MaxCableType 

Definition at line 16 of file TGCCable.h.

Constructor & Destructor Documentation

◆ TGCCablePPToSLB() [1/2]

MuonTGC_Cabling::TGCCablePPToSLB::TGCCablePPToSLB ( const std::string & filename)

Definition at line 16 of file TGCCablePPToSLB.cxx.

17 : TGCCable(TGCCable::PPToSLB), m_database{{{nullptr}}} {
19 std::make_unique<TGCDatabasePPToSL>(filename, "PP EWT");
21 std::make_unique<TGCDatabasePPToSL>(filename, "PP EWD");
23 std::make_unique<TGCDatabasePPToSL>(filename, "PP EST");
25 std::make_unique<TGCDatabasePPToSL>(filename, "PP ESD");
27 std::make_unique<TGCDatabasePPToSL>(filename, "PP EWI");
29 std::make_unique<TGCDatabasePPToSL>(filename, "PP ESI");
31 std::make_unique<TGCDatabasePPToSL>(filename, "PP FWT");
33 std::make_unique<TGCDatabasePPToSL>(filename, "PP FWD");
35 std::make_unique<TGCDatabasePPToSL>(filename, "PP FST");
37 std::make_unique<TGCDatabasePPToSL>(filename, "PP FSD");
39 std::make_unique<TGCDatabasePPToSL>(filename, "PP FWI");
41 std::make_unique<TGCDatabasePPToSL>(filename, "PP FSI");
42}
std::array< std::array< std::unique_ptr< TGCDatabase >,+TGCId::ModuleType::MaxModuleType >,+TGCId::RegionType::MaxRegionType > m_database
TGCCable(CableType type=NoCableType)
Definition TGCCable.h:31

◆ ~TGCCablePPToSLB()

MuonTGC_Cabling::TGCCablePPToSLB::~TGCCablePPToSLB ( )
virtualdefault

◆ TGCCablePPToSLB() [2/2]

MuonTGC_Cabling::TGCCablePPToSLB::TGCCablePPToSLB ( )
privatedelete

Member Function Documentation

◆ getCableType()

CableType MuonTGC_Cabling::TGCCable::getCableType ( ) const
inlineinherited

Definition at line 34 of file TGCCable.h.

34{ return m_type; }

◆ getChannel()

std::unique_ptr< TGCChannelId > MuonTGC_Cabling::TGCCablePPToSLB::getChannel ( const TGCChannelId & channelId,
bool orChannel = false ) const

Definition at line 46 of file TGCCablePPToSLB.cxx.

47 {
48 if (channelId.getChannelIdType() == TGCChannelId::ChannelIdType::PPOut) {
49 return getChannelOut(channelId, orChannel);
50 }
51 if (channelId.getChannelIdType() == TGCChannelId::ChannelIdType::SLBIn) {
52 return getChannelIn(channelId, orChannel);
53 }
54
55 return nullptr;
56}
std::unique_ptr< TGCChannelId > getChannelOut(const TGCChannelId &ppout, bool orChannel=false) const
std::unique_ptr< TGCChannelId > getChannelIn(const TGCChannelId &slbin, bool orChannel=false) const

◆ getChannelIn()

std::unique_ptr< TGCChannelId > MuonTGC_Cabling::TGCCablePPToSLB::getChannelIn ( const TGCChannelId & slbin,
bool orChannel = false ) const
private

Definition at line 68 of file TGCCablePPToSLB.cxx.

69 {
70 if (orChannel || slbin.isValid() == false) {
71 return nullptr;
72 }
73
74 // SLB channel
75 const TGCChannelSLBIn* slbIn = nullptr;
76 if (slbin.getChannelIdType() == TGCChannelId::ChannelIdType::SLBIn) {
77 slbIn = dynamic_cast<const TGCChannelSLBIn*>(&slbin);
78 }
79 if (!slbIn) {
80 return nullptr;
81 }
82
83 // SLB module
84 std::unique_ptr<TGCModuleId> slb = slbIn->getModule();
85 if (!slb) {
86 return nullptr;
87 }
88
89 // SLB -> PP module connection
90 TGCModuleMap mapId = getModule(*slb);
91 if (!mapId.size()) {
92 return nullptr;
93 }
94
95 // PP module
96 int port = mapId.begin()->first;
97 auto pp = mapId.popModule(port);
98 if (!pp) {
99 return nullptr;
100 }
101
102 // SLB ->PP channel connection
103 int block = -1;
104 int channel = -1;
105 TGCChannelSLBIn::CellType cellType = slbIn->getCellType();
106 if (cellType == TGCChannelSLBIn::NoCellType) {
107 return nullptr;
108 }
109
110 if (cellType == TGCChannelSLBIn::CellA) {
111 block = 1 + 2 * port;
112 int lengthOfSLB = TGCChannelSLBIn::getLengthOfSLB(
113 slbIn->getModuleType(), TGCChannelSLBIn::CellB);
114 channel = lengthOfSLB + slbIn->getChannelInSLB();
115 }
116 if (cellType == TGCChannelSLBIn::CellB) {
117 block = 1 + 2 * port;
118 channel = slbIn->getChannelInSLB();
119 }
120 if (cellType == TGCChannelSLBIn::CellC) {
121 block = 0 + 2 * port;
122 int lengthOfSLB = TGCChannelSLBIn::getLengthOfSLB(
123 slbIn->getModuleType(), TGCChannelSLBIn::CellD);
124 channel = lengthOfSLB + slbIn->getChannelInSLB();
125 }
126 if (cellType == TGCChannelSLBIn::CellD) {
127 block = 0 + 2 * port;
128 channel = slbIn->getChannelInSLB();
129 }
130 return std::make_unique<TGCChannelPPOut>(
131 pp->getSideType(), pp->getStation(),
132 pp->getModuleType(), pp->getRegionType(),
133 pp->getSector(), pp->getId(), block, channel);
134}
TGCModuleMap getModule(const TGCModuleId &moduleId) const
static int getLengthOfSLB(TGCId::ModuleType moduleType, CellType cellType)

◆ getChannelOut()

std::unique_ptr< TGCChannelId > MuonTGC_Cabling::TGCCablePPToSLB::getChannelOut ( const TGCChannelId & ppout,
bool orChannel = false ) const
private

Definition at line 136 of file TGCCablePPToSLB.cxx.

137 {
138 if (orChannel || ppout.isValid() == false) {
139 return nullptr;
140 }
141
142 const int ppoutBlock = ppout.getBlock();
143
144 // PP module
145 std::unique_ptr<TGCModuleId> pp{ppout.getModule()};
146 if (!pp) {
147 return nullptr;
148 }
149
150 // PP -> SLB module connection
151 TGCModuleMap mapId = getModule(*pp);
152 if (!mapId.size()) {
153 return nullptr;
154 }
155
156 // SLB module
157 auto slb = mapId.popModule(ppoutBlock / 2);
158
159 if (!slb) {
160 return nullptr;
161 }
162
163 // PP ->SLB channel connection
165 int channelInSLB = -1;
166 if (ppoutBlock % 2 == 0) { // D,C
167 int lengthOfSLB = TGCChannelSLBIn::getLengthOfSLB(
168 slb->getModuleType(), TGCChannelSLBIn::CellD);
169 if (ppout.getChannel() < lengthOfSLB) {
170 cellType = TGCChannelSLBIn::CellD;
171 channelInSLB = ppout.getChannel();
172 } else {
173 cellType = TGCChannelSLBIn::CellC;
174 channelInSLB = ppout.getChannel() - lengthOfSLB;
175 }
176 } else { // B,A
177 int lengthOfSLB = TGCChannelSLBIn::getLengthOfSLB(
178 slb->getModuleType(), TGCChannelSLBIn::CellB);
179 if (ppout.getChannel() < lengthOfSLB) {
180 cellType = TGCChannelSLBIn::CellB;
181 channelInSLB = ppout.getChannel();
182 } else {
183 cellType = TGCChannelSLBIn::CellA;
184 channelInSLB = ppout.getChannel() - lengthOfSLB;
185 }
186 }
187
188 int channel = TGCChannelSLBIn::convertChannel(slb->getModuleType(),
189 cellType, channelInSLB);
190 return std::make_unique<TGCChannelSLBIn>(
191 slb->getSideType(), slb->getModuleType(), slb->getRegionType(),
192 slb->getSector(), slb->getId(), channel);
193}
static int convertChannel(TGCId::ModuleType moduleType, CellType cellType, int channelInSLB)

◆ getModule()

TGCModuleMap MuonTGC_Cabling::TGCCablePPToSLB::getModule ( const TGCModuleId & moduleId) const

Definition at line 58 of file TGCCablePPToSLB.cxx.

58 {
59 if (moduleId.getModuleIdType() == TGCModuleId::PP) {
60 return getModuleOut(moduleId);
61 }
62 if (moduleId.getModuleIdType() == TGCModuleId::SLB) {
63 return getModuleIn(moduleId);
64 }
65 return TGCModuleMap{};
66}
TGCModuleMap getModuleIn(const TGCModuleId &slb) const
TGCModuleMap getModuleOut(const TGCModuleId &pp) const

◆ getModuleIn()

TGCModuleMap MuonTGC_Cabling::TGCCablePPToSLB::getModuleIn ( const TGCModuleId & slb) const
private

Definition at line 195 of file TGCCablePPToSLB.cxx.

195 {
196 if (slb.isValid() == false) {
197 return TGCModuleMap{};
198 }
199
200 const int slbId = slb.getId();
201
202 TGCDatabase* databaseP =
203 m_database.at(+slb.getRegionType()).at(+slb.getModuleType()).get();
204 TGCModuleMap mapId{};
205 const int MaxEntry = databaseP->getMaxEntry();
206 for (int i = 0; i < MaxEntry; i++) {
207 if (databaseP->getEntry(i, 1) == slbId) {
208 int id = databaseP->getEntry(i, 0);
209 auto pp = std::make_unique<TGCModulePP>(
210 slb.getSideType(), slb.getStation(),
211 slb.getModuleType(), slb.getRegionType(),
212 slb.getSector(), id);
213
214 mapId.insert(0, std::move(pp));
215 break;
216 }
217 if (databaseP->getEntry(i, 2) == slbId) {
218 int id = databaseP->getEntry(i, 0);
219 auto pp = std::make_unique<TGCModulePP>(
220 slb.getSideType(), slb.getStation(),
221 slb.getModuleType(), slb.getRegionType(),
222 slb.getSector(), id);
223
224 mapId.insert(1, std::move(pp));
225 break;
226 }
227 }
228
229 return mapId;
230}

◆ getModuleOut()

TGCModuleMap MuonTGC_Cabling::TGCCablePPToSLB::getModuleOut ( const TGCModuleId & pp) const
private

Definition at line 232 of file TGCCablePPToSLB.cxx.

232 {
233 if (pp.isValid() == false) {
234 return TGCModuleMap{};
235 }
236
237 const int ppId = pp.getId();
238
239 TGCDatabase* databaseP =
240 m_database.at(+pp.getRegionType()).at(+pp.getModuleType()).get();
241 TGCModuleMap mapId{};
242 const int MaxEntry = databaseP->getMaxEntry();
243 for (int i = 0; i < MaxEntry; i++) {
244 if (databaseP->getEntry(i, 0) == ppId) {
245 int id = -1;
246
247 id = databaseP->getEntry(i, 1);
248 if (id != -1) {
249 auto slb = std::make_unique<TGCModuleSLB>(
250 pp.getSideType(), pp.getModuleType(), pp.getRegionType(),
251 pp.getSector(), id);
252
253 mapId.insert(0, std::move(slb));
254 }
255
256 id = databaseP->getEntry(i, 2);
257 if (id != -1) {
258 auto slb = std::make_unique<TGCModuleSLB>(
259 pp.getSideType(), pp.getModuleType(), pp.getRegionType(),
260 pp.getSector(), id);
261
262 mapId.insert(1, std::move(slb));
263 }
264 break;
265 }
266 }
267
268 return mapId;
269}

Member Data Documentation

◆ m_database

std::array<std::array<std::unique_ptr<TGCDatabase>, +TGCId::ModuleType::MaxModuleType>, +TGCId::RegionType::MaxRegionType> MuonTGC_Cabling::TGCCablePPToSLB::m_database
private

Definition at line 38 of file TGCCablePPToSLB.h.

◆ m_type

CableType MuonTGC_Cabling::TGCCable::m_type {CableType::NoCableType}
privateinherited

Definition at line 37 of file TGCCable.h.


The documentation for this class was generated from the following files: