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

◆ ~TGCCableSLBToHPB()

virtual MuonTGC_Cabling::TGCCableSLBToHPB::~TGCCableSLBToHPB ( )
virtualdefault

◆ TGCCableSLBToHPB() [2/2]

MuonTGC_Cabling::TGCCableSLBToHPB::TGCCableSLBToHPB ( void )
inlineprivate

Definition at line 33 of file TGCCableSLBToHPB.h.

33{}

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 27 of file TGCCableSLBToHPB.cxx.

28 {
29 if(channelId){
30 if(channelId->getChannelIdType()==TGCChannelId::ChannelIdType::SLBOut)
31 return getChannelOut(channelId,orChannel);
32 if(channelId->getChannelIdType()==TGCChannelId::ChannelIdType::HPBIn)
33 return getChannelIn(channelId,orChannel);
34 }
35 return nullptr;
36}
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 48 of file TGCCableSLBToHPB.cxx.

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

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

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

◆ getModule()

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

Definition at line 38 of file TGCCableSLBToHPB.cxx.

38 {
39 if(moduleId){
40 if(moduleId->getModuleIdType()==TGCModuleId::SLB)
41 return getModuleOut(moduleId);
42 if(moduleId->getModuleIdType()==TGCModuleId::HPB)
43 return getModuleIn(moduleId);
44 }
45 return nullptr;
46}
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 284 of file TGCCableSLBToHPB.cxx.

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

◆ getModuleInforHPB()

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

Definition at line 341 of file TGCCableSLBToHPB.cxx.

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

◆ getModuleOut()

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

Reimplemented from MuonTGC_Cabling::TGCCable.

Definition at line 383 of file TGCCableSLBToHPB.cxx.

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

Member Data Documentation

◆ m_database

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

Definition at line 41 of file TGCCableSLBToHPB.h.

41{{{nullptr}}};

◆ 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: