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

Private Member Functions

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

◆ ~TGCCablePPToSLB()

virtual MuonTGC_Cabling::TGCCablePPToSLB::~TGCCablePPToSLB ( )
virtualdefault

◆ TGCCablePPToSLB() [2/2]

MuonTGC_Cabling::TGCCablePPToSLB::TGCCablePPToSLB ( void )
inlineprivate

Definition at line 29 of file TGCCablePPToSLB.h.

29{}

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 33 of file TGCCablePPToSLB.cxx.

34 {
35 if(channelId){
36 if(channelId->getChannelIdType()==TGCChannelId::ChannelIdType::PPOut)
37 return getChannelOut(channelId,orChannel);
38 if(channelId->getChannelIdType()==TGCChannelId::ChannelIdType::SLBIn)
39 return getChannelIn(channelId,orChannel);
40 }
41 return nullptr;
42}
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 54 of file TGCCablePPToSLB.cxx.

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

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

◆ getModule()

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

Definition at line 44 of file TGCCablePPToSLB.cxx.

44 {
45 if(moduleId){
46 if(moduleId->getModuleIdType()==TGCModuleId::PP)
47 return getModuleOut(moduleId);
48 if(moduleId->getModuleIdType()==TGCModuleId::SLB)
49 return getModuleIn(moduleId);
50 }
51 return nullptr;
52}
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 194 of file TGCCablePPToSLB.cxx.

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

◆ getModuleOut()

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

Reimplemented from MuonTGC_Cabling::TGCCable.

Definition at line 232 of file TGCCablePPToSLB.cxx.

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

Member Data Documentation

◆ m_database

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

Definition at line 37 of file TGCCablePPToSLB.h.

37{{{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: