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

#include <TGCCableSLBToHPB.h>

Inheritance diagram for MuonTGC_Cabling::TGCCableSLBToHPB:
Collaboration diagram for MuonTGC_Cabling::TGCCableSLBToHPB:

Public Types

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

Public Member Functions

 TGCCableSLBToHPB (const std::string &filename)
virtual ~TGCCableSLBToHPB ()
virtual TGCChannelIdgetChannel (const TGCChannelId *channelId, bool orChannel=false) const
virtual TGCModuleMapgetModule (const TGCModuleId *moduleId) const
TGCChannelIdgetChannelInforHPB (const TGCChannelId *hpbin, TGCId::ModuleType moduleType, bool orChannel=false) const
CableType getCableType (void) const

Private Member Functions

 TGCCableSLBToHPB (void)=delete
virtual TGCChannelIdgetChannelIn (const TGCChannelId *hpbin, bool orChannel=false) const
virtual TGCChannelIdgetChannelOut (const TGCChannelId *slbout, bool orChannel=false) const
virtual TGCModuleMapgetModuleIn (const TGCModuleId *hpb) const
virtual TGCModuleMapgetModuleInforHPB (const TGCModuleId *hpb, TGCId::ModuleType moduleType) const
virtual TGCModuleMapgetModuleOut (const TGCModuleId *slb) const

Private Attributes

std::array< std::array< std::unique_ptr< TGCDatabase >, TGCId::MaxModuleType >, TGCId::MaxRegionTypem_database
CableType m_type

Detailed Description

Definition at line 18 of file TGCCableSLBToHPB.h.

Member Enumeration Documentation

◆ CableType

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

Definition at line 18 of file TGCCable.h.

Constructor & Destructor Documentation

◆ TGCCableSLBToHPB() [1/2]

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

Definition at line 15 of file TGCCableSLBToHPB.cxx.

17 m_database{{{nullptr}}}
18{
19 m_database[TGCId::Endcap][TGCId::WT] = std::make_unique<TGCDatabasePPToSL>(filename,"SB EWT");
20 m_database[TGCId::Endcap][TGCId::WD] = std::make_unique<TGCDatabasePPToSL>(filename,"SB EWD");
21 m_database[TGCId::Endcap][TGCId::ST] = std::make_unique<TGCDatabasePPToSL>(filename,"SB EST");
22 m_database[TGCId::Endcap][TGCId::SD] = std::make_unique<TGCDatabasePPToSL>(filename,"SB ESD");
23 m_database[TGCId::Forward][TGCId::WT] = std::make_unique<TGCDatabasePPToSL>(filename,"SB FWT");
24 m_database[TGCId::Forward][TGCId::WD] = std::make_unique<TGCDatabasePPToSL>(filename,"SB FWD");
25 m_database[TGCId::Forward][TGCId::ST] = std::make_unique<TGCDatabasePPToSL>(filename,"SB FST");
26 m_database[TGCId::Forward][TGCId::SD] = std::make_unique<TGCDatabasePPToSL>(filename,"SB FSD");
27}
std::array< std::array< std::unique_ptr< TGCDatabase >, TGCId::MaxModuleType >, TGCId::MaxRegionType > m_database
TGCCable(CableType type=NoCableType)
Definition TGCCable.h:24

◆ ~TGCCableSLBToHPB()

MuonTGC_Cabling::TGCCableSLBToHPB::~TGCCableSLBToHPB ( )
virtualdefault

◆ TGCCableSLBToHPB() [2/2]

MuonTGC_Cabling::TGCCableSLBToHPB::TGCCableSLBToHPB ( void )
privatedelete

Member Function Documentation

◆ getCableType()

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

Definition at line 30 of file TGCCable.h.

30{ return m_type; }

◆ getChannel()

TGCChannelId * MuonTGC_Cabling::TGCCableSLBToHPB::getChannel ( const TGCChannelId * channelId,
bool orChannel = false ) const
virtual

Definition at line 31 of file TGCCableSLBToHPB.cxx.

32 {
33 if(channelId){
34 if(channelId->getChannelIdType()==TGCChannelId::ChannelIdType::SLBOut)
35 return getChannelOut(channelId,orChannel);
36 if(channelId->getChannelIdType()==TGCChannelId::ChannelIdType::HPBIn)
37 return getChannelIn(channelId,orChannel);
38 }
39 return nullptr;
40}
virtual TGCChannelId * getChannelOut(const TGCChannelId *slbout, bool orChannel=false) const
virtual TGCChannelId * getChannelIn(const TGCChannelId *hpbin, bool orChannel=false) const

◆ getChannelIn()

TGCChannelId * MuonTGC_Cabling::TGCCableSLBToHPB::getChannelIn ( const TGCChannelId * hpbin,
bool orChannel = false ) const
privatevirtual

Reimplemented from MuonTGC_Cabling::TGCCable.

Definition at line 52 of file TGCCableSLBToHPB.cxx.

53 {
54 if(orChannel) return nullptr;
55 if(hpbin->isValid()==false) return nullptr;
56 TGCChannelSLBOut* slbout = nullptr;
57
58 // HPB module
59 TGCModuleId* hpb = hpbin->getModule();
60 if(!hpb) return nullptr;
61
62 // HPB -> SLB module connection
63 TGCModuleMap* mapId = getModule(hpb);
64 delete hpb;
65 if(!mapId) return nullptr;
66
68 if(numOfBlock==0) {
69 delete mapId;
70 mapId = nullptr;
71 return nullptr;
72 }
73
75 int slbInBlock = TGCChannelHPBIn::getSlbInBlock();
76
77 // SLB module
78 TGCModuleId* slb = nullptr;
79 int blockInHPB = hpbin->getBlock();
80 int nSlb = hpbin->getChannel()/(numOfBlock*2); // half block
81 int port = blockInHPB*slbInBlock+nSlb;
82 const int size = mapId->size();
83 for(int i=0;i<size;i++){
84 if(mapId->connector(i)==port){
85 slb = mapId->popModuleId(i);
86 break;
87 }
88 }
89
90 delete mapId;
91 if(!slb) return nullptr;
92
93 // HPB ->SLB channel connection
94 int nInSlb = hpbin->getChannel()/(numOfBlock*2); // half block
95 int blockInSlb = nInSlb/2;
96 int nInBlock = nInSlb%2;
97 int channel = (chInBlock/2)*nInBlock;
98
99 slbout = new TGCChannelSLBOut(slb->getSideType(),
100 slb->getModuleType(),
101 slb->getRegionType(),
102 slb->getSector(),
103 slb->getId(),
104 blockInSlb,
105 channel);
106
107 delete slb;
108 return slbout;
109}
virtual TGCModuleMap * getModule(const TGCModuleId *moduleId) const
static int getNumberOfBlock(TGCId::ModuleType moduleType)
static int getChannelInBlock(TGCId::ModuleType moduleType)

◆ getChannelInforHPB()

TGCChannelId * MuonTGC_Cabling::TGCCableSLBToHPB::getChannelInforHPB ( const TGCChannelId * hpbin,
TGCId::ModuleType moduleType,
bool orChannel = false ) const

Definition at line 111 of file TGCCableSLBToHPB.cxx.

114{
115 if(orChannel) return nullptr;
116 if(hpbin->isValid()==false) return nullptr;
117
118 TGCChannelSLBOut* slbout = nullptr;
119
120 // HPB module
121 TGCModuleId* hpb = hpbin->getModule();//This function is defined in TGCChannelHPBIn
122 //set current SideType,SignalType...
123 //ChannelID(HPBIn) is set in HPBIn constructor
124 if(!hpb) return nullptr;
125
126 // HPB -> SLB module connection
127 TGCModuleMap* mapId = getModuleInforHPB(hpb,moduleType);
128 delete hpb;
129 if(!mapId) return nullptr;
130
131 // need to check
132 int numOfBlock = TGCChannelSLBOut::getNumberOfBlock(moduleType);
133 if(numOfBlock==0) {
134 delete mapId;
135 mapId = nullptr;
136 return nullptr;
137 }
138
139 int chInBlock = TGCChannelSLBOut::getChannelInBlock(moduleType);
140 int slbInBlock = 0;
141
142 // SLB module
143 TGCModuleId* slb = nullptr;
144 int blockInHPB = 0;
145 int nSlb = 0; // half block
146 int port = 0; // input position for HPT
147
148 // HPB ->SLB channel connection
149 int blockInSlb = 0;
150 int posInHpb = 0;
151 int channel = 0;
152 int size = 0;
153 switch(moduleType){
154
155 case TGCId::WD:
156 case TGCId::SD:
157 slbInBlock = 3;
158 blockInHPB = hpbin->getBlock();
159 nSlb = hpbin->getChannel()/(numOfBlock*2);
160 port = blockInHPB*slbInBlock+nSlb;
161 size = mapId->size();
162 for(int i=0;i<size;i++){
163 if(mapId->connector(i)==port){
164 slb = mapId->popModuleId(i);
165 break;
166 }
167 }
168 blockInSlb = (hpbin->getChannel() - nSlb*(numOfBlock*2))/2;
169 posInHpb = (hpbin->getChannel() - (numOfBlock*2)*nSlb)%2;
170 channel = (chInBlock/2)*posInHpb;
171 break;
172
173 case TGCId::WT:
174 slbInBlock = 2;
175 blockInHPB = hpbin->getBlock();
176 nSlb = hpbin->getChannel()/(numOfBlock*2);
177 port = blockInHPB*slbInBlock+nSlb;
178 size = mapId->size();
179 for(int i=0;i<size;i++){
180 if(mapId->connector(i)== -1*port){//triplet: - sign
181 slb = mapId->popModuleId(i);
182 break;
183 }
184 }
185 blockInSlb = (hpbin->getChannel() - nSlb*(numOfBlock*2))/2;
186 posInHpb = (hpbin->getChannel() - (numOfBlock*2)*nSlb)%2;
187 channel = (chInBlock/2)*posInHpb;
188 break;
189
190 case TGCId::ST:
191 blockInHPB = hpbin->getBlock();
192 if(blockInHPB==0 && hpbin->getChannel()<numOfBlock) port=1;
193 else port=2;
194 size = mapId->size();
195 for(int i=0;i<size;i++){
196 if(mapId->connector(i)== -1*port){//triplet: - sign
197 slb = mapId->popModuleId(i);
198 break;
199 }
200 }
201 blockInSlb = (hpbin->getChannel())%numOfBlock;
202 if(blockInHPB == 1 && hpbin->getChannel() >= numOfBlock) blockInSlb = blockInSlb + numOfBlock/2;
203 channel = 0;
204 break;
205
206 default:
207 break;
208
209 }
210
211 delete mapId; mapId = nullptr;
212 if(!slb) return nullptr;
213
214 const int offset =6; // offset to get center of block
215 channel += offset;
216
217 int SLBID = slb->getId();
218 if((chInBlock*blockInSlb+channel)>chInBlock*numOfBlock){
219 SLBID++;
220 channel = channel%chInBlock;
221 blockInSlb = 0;
222 } else if( channel > chInBlock){
223 channel = channel%chInBlock;
224 blockInSlb++;
225 }
226
227 slbout = new TGCChannelSLBOut(slb->getSideType(),
228 moduleType,
229 slb->getRegionType(),
230 slb->getSector(),
231 SLBID,
232 blockInSlb,
233 channel );
234
235 delete slb;
236 return slbout;
237}
virtual TGCModuleMap * getModuleInforHPB(const TGCModuleId *hpb, TGCId::ModuleType moduleType) const

◆ getChannelOut()

TGCChannelId * MuonTGC_Cabling::TGCCableSLBToHPB::getChannelOut ( const TGCChannelId * slbout,
bool orChannel = false ) const
privatevirtual

Reimplemented from MuonTGC_Cabling::TGCCable.

Definition at line 240 of file TGCCableSLBToHPB.cxx.

241 {
242 if(orChannel) return nullptr;
243 if(slbout->isValid()==false) return nullptr;
244 if(slbout->getMultipletType()==TGCId::Triplet) return nullptr;
245 TGCChannelHPBIn* hpbin = nullptr;
246
247 // SLB module
248 TGCModuleId* slb = slbout->getModule();
249 if(!slb) return nullptr;
250
251 // SLB -> HPB module connection
252 TGCModuleMap* mapId = getModule(slb);
253 delete slb;
254 if(!mapId) return nullptr;
255
256 // HPB module
257 int port = mapId->connector(0);
258 TGCModuleId* hpb = mapId->popModuleId(0);
259 delete mapId;
260 if(!hpb) return nullptr;
261
262 int chInBlock = TGCChannelSLBOut::getChannelInBlock(slbout->getModuleType());
263 if(chInBlock<=1) {
264 delete hpb;
265 hpb = nullptr;
266 return nullptr;
267 }
268 int slbInBlock = TGCChannelHPBIn::getSlbInBlock();
269
270 // SLB ->HPB channel connection
271 int block = port/slbInBlock;
272 int hitId = (port%slbInBlock)*2+slbout->getBlock();
273 int pos = slbout->getChannel()/(chInBlock/2);
274 int channel = hitId*2 + pos;
275
276 hpbin = new TGCChannelHPBIn(hpb->getSideType(),
277 hpb->getSignalType(),
278 hpb->getRegionType(),
279 hpb->getSector(),
280 hpb->getId(),
281 block,
282 channel);
283 delete hpb;
284
285 return hpbin;
286}

◆ getModule()

TGCModuleMap * MuonTGC_Cabling::TGCCableSLBToHPB::getModule ( const TGCModuleId * moduleId) const
virtual

Definition at line 42 of file TGCCableSLBToHPB.cxx.

42 {
43 if(moduleId){
44 if(moduleId->getModuleIdType()==TGCModuleId::SLB)
45 return getModuleOut(moduleId);
46 if(moduleId->getModuleIdType()==TGCModuleId::HPB)
47 return getModuleIn(moduleId);
48 }
49 return nullptr;
50}
virtual TGCModuleMap * getModuleOut(const TGCModuleId *slb) const
virtual TGCModuleMap * getModuleIn(const TGCModuleId *hpb) const

◆ getModuleIn()

TGCModuleMap * MuonTGC_Cabling::TGCCableSLBToHPB::getModuleIn ( const TGCModuleId * hpb) const
privatevirtual

Reimplemented from MuonTGC_Cabling::TGCCable.

Definition at line 288 of file TGCCableSLBToHPB.cxx.

288 {
289 if(hpb->isValid()==false) return nullptr;
290 const int hpbId = hpb->getId();
291
294 if(hpb->getSignalType()==TGCId::Wire){
295 doublet = TGCId::WD;
296 triplet = TGCId::WT;
297 }
298 if(hpb->getSignalType()==TGCId::Strip){
299 doublet = TGCId::SD;
300 triplet = TGCId::ST;
301 }
302
303 if(doublet==TGCId::NoModuleType || triplet==TGCId::NoModuleType) {
304 return nullptr;
305 }
306
307 TGCDatabase* doubletP = m_database[hpb->getRegionType()][doublet].get();
308 TGCDatabase* tripletP = m_database[hpb->getRegionType()][triplet].get();
309
310 TGCModuleMap* mapId = nullptr;
311 const int doubletMaxEntry = doubletP->getMaxEntry();
312 for(int i=0; i<doubletMaxEntry; i++){
313 if(doubletP->getEntry(i,1)==hpbId)
314 {
315 int id = doubletP->getEntry(i,0);
316 int block = doubletP->getEntry(i,2);
317 TGCModuleSLB* slb = new TGCModuleSLB(hpb->getSideType(),
318 doublet,
319 hpb->getRegionType(),
320 hpb->getSector(),
321 id);
322 if(mapId==nullptr) mapId = new TGCModuleMap();
323 mapId->insert(block,slb);
324 }
325 }
326 const int tripletMaxEntry = tripletP->getMaxEntry();
327 for(int i=0; i<tripletMaxEntry; i++){
328 if(tripletP->getEntry(i,1)==hpbId)
329 {
330 int id = tripletP->getEntry(i,0);
331 int block = -tripletP->getEntry(i,2);
332 TGCModuleSLB* slb = new TGCModuleSLB(hpb->getSideType(),
333 triplet,
334 hpb->getRegionType(),
335 hpb->getSector(),
336 id);
337 if(mapId==nullptr) mapId = new TGCModuleMap();
338 mapId->insert(block,slb);
339 }
340 }
341
342 return mapId;
343}

◆ getModuleInforHPB()

TGCModuleMap * MuonTGC_Cabling::TGCCableSLBToHPB::getModuleInforHPB ( const TGCModuleId * hpb,
TGCId::ModuleType moduleType ) const
privatevirtual

Definition at line 345 of file TGCCableSLBToHPB.cxx.

346 {
347 if(hpb->isValid()==false) return nullptr;
348
349 const int hpbId = hpb->getId();
350
351 TGCDatabase* databaseP = m_database[hpb->getRegionType()][moduleType].get();
352
353 TGCModuleMap* mapId = nullptr;
354 const int MaxEntry = databaseP->getMaxEntry();
355 for(int i=0; i<MaxEntry; i++){
356 if(databaseP->getEntry(i,1)==hpbId)
357 {
358 int id = databaseP->getEntry(i,0);
359 int block = -100;
360 switch(moduleType){
361 case TGCId::WD:
362 case TGCId::SD:
363 block = databaseP->getEntry(i,2);
364 break;
365
366 case TGCId::WT:
367 case TGCId::ST:
368 block = -1*databaseP->getEntry(i,2);// check - sign
369 break;
370
371 default:
372 break;
373 }
374 TGCModuleSLB* slb = new TGCModuleSLB(hpb->getSideType(),
375 moduleType,
376 hpb->getRegionType(),
377 hpb->getSector(),
378 id);
379 if(mapId==nullptr) mapId = new TGCModuleMap();
380 mapId->insert(block,slb);
381 }
382 }
383
384 return mapId;
385}

◆ getModuleOut()

TGCModuleMap * MuonTGC_Cabling::TGCCableSLBToHPB::getModuleOut ( const TGCModuleId * slb) const
privatevirtual

Reimplemented from MuonTGC_Cabling::TGCCable.

Definition at line 387 of file TGCCableSLBToHPB.cxx.

387 {
388 if(slb->isValid()==false) return nullptr;
389
390 const int slbId = slb->getId();
391
392 TGCDatabase* databaseP =m_database[slb->getRegionType()][slb->getModuleType()].get();
393
394 TGCModuleMap* mapId = nullptr;
395 const int MaxEntry = databaseP->getMaxEntry();
396 for(int i=0; i<MaxEntry; i++){
397 if(databaseP->getEntry(i,0)==slbId) {
398 int id = databaseP->getEntry(i,1);
399 int block = databaseP->getEntry(i,2);
400 if(slb->getMultipletType()==TGCId::Triplet)
401 block *=-1;
402
403 TGCModuleHPB* hpb = new TGCModuleHPB(slb->getSideType(),
404 slb->getSignalType(),
405 slb->getRegionType(),
406 slb->getSector(),
407 id);
408
409 mapId = new TGCModuleMap();
410 mapId->insert(block,hpb);
411 break;
412 }
413 }
414
415 return mapId;
416}

Member Data Documentation

◆ m_database

std::array<std::array<std::unique_ptr<TGCDatabase>, TGCId::MaxModuleType>, TGCId::MaxRegionType> MuonTGC_Cabling::TGCCableSLBToHPB::m_database
private

Definition at line 41 of file TGCCableSLBToHPB.h.

◆ m_type

CableType MuonTGC_Cabling::TGCCable::m_type
privateinherited

Definition at line 43 of file TGCCable.h.


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