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 ()
virtual TGCChannelIdgetChannel (const TGCChannelId *channelId, bool orChannel=false) const
virtual TGCModuleMapgetModule (const TGCModuleId *moduleId) const
CableType getCableType (void) const

Private Member Functions

 TGCCablePPToSLB ()=delete
virtual TGCChannelIdgetChannelIn (const TGCChannelId *slbin, bool orChannel=false) const
virtual TGCChannelIdgetChannelOut (const TGCChannelId *ppout, bool orChannel=false) const
virtual TGCModuleMapgetModuleIn (const TGCModuleId *slb) const
virtual TGCModuleMapgetModuleOut (const TGCModuleId *pp) 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 TGCCablePPToSLB.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

◆ TGCCablePPToSLB() [1/2]

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

Definition at line 16 of file TGCCablePPToSLB.cxx.

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

◆ ~TGCCablePPToSLB()

MuonTGC_Cabling::TGCCablePPToSLB::~TGCCablePPToSLB ( )
virtualdefault

◆ TGCCablePPToSLB() [2/2]

MuonTGC_Cabling::TGCCablePPToSLB::TGCCablePPToSLB ( )
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::TGCCablePPToSLB::getChannel ( const TGCChannelId * channelId,
bool orChannel = false ) const
virtual

Definition at line 36 of file TGCCablePPToSLB.cxx.

37 {
38 if(channelId){
39 if(channelId->getChannelIdType()==TGCChannelId::ChannelIdType::PPOut)
40 return getChannelOut(channelId,orChannel);
41 if(channelId->getChannelIdType()==TGCChannelId::ChannelIdType::SLBIn)
42 return getChannelIn(channelId,orChannel);
43 }
44 return nullptr;
45}
virtual TGCChannelId * getChannelIn(const TGCChannelId *slbin, bool orChannel=false) const
virtual TGCChannelId * getChannelOut(const TGCChannelId *ppout, bool orChannel=false) const

◆ getChannelIn()

TGCChannelId * MuonTGC_Cabling::TGCCablePPToSLB::getChannelIn ( const TGCChannelId * slbin,
bool orChannel = false ) const
privatevirtual

Reimplemented from MuonTGC_Cabling::TGCCable.

Definition at line 57 of file TGCCablePPToSLB.cxx.

58 {
59 if(orChannel) return nullptr;
60 if(slbin->isValid()==false) return nullptr;
61 TGCChannelPPOut* ppout = nullptr;
62
63 // SLB channel
64 const TGCChannelSLBIn* slbIn = nullptr;
65 if(slbin->getChannelIdType()==TGCChannelId::ChannelIdType::SLBIn){
66 slbIn = dynamic_cast<const TGCChannelSLBIn*>(slbin);
67 }
68 if(!slbIn) {
69 return nullptr;
70 }
71
72 // SLB module
73 TGCModuleId* slb = slbIn->getModule();
74 if(!slb) return nullptr;
75
76 // SLB -> PP module connection
77 TGCModuleMap* mapId = getModule(slb);
78 delete slb;
79 if(!mapId) return nullptr;
80
81 // PP module
82 int port = mapId->connector(0);
83 TGCModuleId* pp = mapId->popModuleId(0);
84 delete mapId;
85 if(!pp) return nullptr;
86
87 // SLB ->PP channel connection
88 int block = -1;
89 int channel = -1;
90 TGCChannelSLBIn::CellType cellType = slbIn->getCellType();
91 if(cellType==TGCChannelSLBIn::NoCellType){
92 delete pp;
93 return nullptr;
94 }
95
96 if(cellType==TGCChannelSLBIn::CellA) {
97 block = 1+2*port;
98 int lengthOfSLB = TGCChannelSLBIn::getLengthOfSLB(slbIn->getModuleType(),
100 channel = lengthOfSLB+slbIn->getChannelInSLB();
101 }
102 if(cellType==TGCChannelSLBIn::CellB) {
103 block = 1+2*port;
104 channel = slbIn->getChannelInSLB();
105 }
106 if(cellType==TGCChannelSLBIn::CellC) {
107 block = 0+2*port;
108 int lengthOfSLB = TGCChannelSLBIn::getLengthOfSLB(slbIn->getModuleType(),
110 channel = lengthOfSLB+slbIn->getChannelInSLB();
111 }
112 if(cellType==TGCChannelSLBIn::CellD) {
113 block = 0+2*port;
114 channel = slbIn->getChannelInSLB();
115 }
116 ppout = new TGCChannelPPOut(pp->getSideType(),
117 pp->getModuleType(),
118 pp->getRegionType(),
119 pp->getSector(),
120 pp->getId(),
121 block,
122 channel);
123
124 delete pp;
125 return ppout;
126}
virtual TGCModuleMap * getModule(const TGCModuleId *moduleId) const
static int getLengthOfSLB(TGCId::ModuleType moduleType, CellType cellType)

◆ getChannelOut()

TGCChannelId * MuonTGC_Cabling::TGCCablePPToSLB::getChannelOut ( const TGCChannelId * ppout,
bool orChannel = false ) const
privatevirtual

Reimplemented from MuonTGC_Cabling::TGCCable.

Definition at line 129 of file TGCCablePPToSLB.cxx.

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

◆ getModule()

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

Definition at line 47 of file TGCCablePPToSLB.cxx.

47 {
48 if(moduleId){
49 if(moduleId->getModuleIdType()==TGCModuleId::PP)
50 return getModuleOut(moduleId);
51 if(moduleId->getModuleIdType()==TGCModuleId::SLB)
52 return getModuleIn(moduleId);
53 }
54 return nullptr;
55}
virtual TGCModuleMap * getModuleOut(const TGCModuleId *pp) const
virtual TGCModuleMap * getModuleIn(const TGCModuleId *slb) const

◆ getModuleIn()

TGCModuleMap * MuonTGC_Cabling::TGCCablePPToSLB::getModuleIn ( const TGCModuleId * slb) const
privatevirtual

Reimplemented from MuonTGC_Cabling::TGCCable.

Definition at line 197 of file TGCCablePPToSLB.cxx.

197 {
198 if(slb->isValid()==false) return nullptr;
199
200 const int slbId = slb->getId();
201
202 TGCDatabase* databaseP = m_database[slb->getRegionType()][slb->getModuleType()].get();
203 TGCModuleMap* mapId = nullptr;
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 TGCModulePP* pp = new TGCModulePP(slb->getSideType(),
209 slb->getModuleType(),
210 slb->getRegionType(),
211 slb->getSector(),
212 id);
213
214 mapId = new TGCModuleMap();
215 mapId->insert(0,pp);
216 break;
217 }
218 if(databaseP->getEntry(i,2)==slbId) {
219 int id = databaseP->getEntry(i,0);
220 TGCModulePP* pp = new TGCModulePP(slb->getSideType(),
221 slb->getModuleType(),
222 slb->getRegionType(),
223 slb->getSector(),
224 id);
225
226 mapId = new TGCModuleMap();
227 mapId->insert(1,pp);
228 break;
229 }
230 }
231
232 return mapId;
233}

◆ getModuleOut()

TGCModuleMap * MuonTGC_Cabling::TGCCablePPToSLB::getModuleOut ( const TGCModuleId * pp) const
privatevirtual

Reimplemented from MuonTGC_Cabling::TGCCable.

Definition at line 235 of file TGCCablePPToSLB.cxx.

235 {
236 if(pp->isValid()==false) return nullptr;
237
238 const int ppId = pp->getId();
239
240 TGCDatabase* databaseP = m_database[pp->getRegionType()][pp->getModuleType()].get();
241 TGCModuleMap* mapId = nullptr;
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 TGCModuleSLB* slb=nullptr;
247 mapId = new TGCModuleMap();
248
249 id = databaseP->getEntry(i,1);
250 if(id!=-1){
251 slb = new TGCModuleSLB(pp->getSideType(),
252 pp->getModuleType(),
253 pp->getRegionType(),
254 pp->getSector(),
255 id);
256
257 mapId->insert(0,slb);
258 }
259
260 id = databaseP->getEntry(i,2);
261 if(id!=-1){
262 slb = new TGCModuleSLB(pp->getSideType(),
263 pp->getModuleType(),
264 pp->getRegionType(),
265 pp->getSector(),
266 id);
267
268 mapId->insert(1,slb);
269 }
270 break;
271 }
272 }
273
274 return mapId;
275}

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 37 of file TGCCablePPToSLB.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: