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::MaxModuleType >, TGCId::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::MaxModuleType >, TGCId::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->getModuleType(), pp->getRegionType(),
132 pp->getSector(), pp->getId(), block, channel);
133}
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 135 of file TGCCablePPToSLB.cxx.

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

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

◆ getModuleOut()

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

Definition at line 229 of file TGCCablePPToSLB.cxx.

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

Member Data Documentation

◆ m_database

std::array<std::array<std::unique_ptr<TGCDatabase>, TGCId::MaxModuleType>, TGCId::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: