ATLAS Offline Software
Loading...
Searching...
No Matches
TGCCableSLBToSSW.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6
10
11namespace MuonTGC_Cabling {
12
13TGCCableSLBToSSW::TGCCableSLBToSSW(const std::string& filename)
15 m_database{{{nullptr}}}
16{
17 m_database[TGCId::Endcap][TGCId::WT] = std::make_unique<TGCDatabaseSLBToROD>(filename, "SLB EWT");
18 m_database[TGCId::Endcap][TGCId::WD] = std::make_unique<TGCDatabaseSLBToROD>(filename, "SLB EWD");
19 m_database[TGCId::Endcap][TGCId::ST] = std::make_unique<TGCDatabaseSLBToROD>(filename, "SLB EST");
20 m_database[TGCId::Endcap][TGCId::SD] = std::make_unique<TGCDatabaseSLBToROD>(filename, "SLB ESD");
21 m_database[TGCId::Endcap][TGCId::WI] = std::make_unique<TGCDatabaseSLBToROD>(filename, "SLB EWI");
22 m_database[TGCId::Endcap][TGCId::SI] = std::make_unique<TGCDatabaseSLBToROD>(filename, "SLB ESI");
23 m_database[TGCId::Endcap][SL] = std::make_unique<TGCDatabaseSLBToROD>(filename, "SLB ESL");
24
25 m_database[TGCId::Forward][TGCId::WT] = std::make_unique<TGCDatabaseSLBToROD>(filename, "SLB FWT");
26 m_database[TGCId::Forward][TGCId::WD] = std::make_unique<TGCDatabaseSLBToROD>(filename, "SLB FWD");
27 m_database[TGCId::Forward][TGCId::ST] = std::make_unique<TGCDatabaseSLBToROD>(filename, "SLB FST");
28 m_database[TGCId::Forward][TGCId::SD] = std::make_unique<TGCDatabaseSLBToROD>(filename, "SLB FSD");
29 m_database[TGCId::Forward][TGCId::WI] = std::make_unique<TGCDatabaseSLBToROD>(filename, "SLB FWI");
30 m_database[TGCId::Forward][TGCId::SI] = std::make_unique<TGCDatabaseSLBToROD>(filename, "SLB FSI");
31 m_database[TGCId::Forward][SL] = std::make_unique<TGCDatabaseSLBToROD>(filename, "SLB FSL");
32}
33
35 if(moduleId){
36 if(moduleId->getModuleIdType()==TGCModuleId::SLB)
37 return getModuleOut(moduleId);
38 if(moduleId->getModuleIdType()==TGCModuleId::SSW)
39 return getModuleIn(moduleId);
40 }
41 return nullptr;
42}
43
45 if(ssw->isValid()==false) return nullptr;
46
47 const int sswId = ssw->getId();
48
52 for(int i=0; i<TGCId::MaxRegionType; i++){
53 for(int j=0; j< MaxModuleType; j++){
54 databaseP[i*MaxModuleType + j] = m_database[i][j].get();
55 region[i*MaxModuleType + j] = static_cast<TGCId::RegionType>(i);
56 module[i*MaxModuleType + j] = static_cast<TGCId::ModuleType>(j);
57 }
58 }
59
60 TGCModuleMap* mapId = nullptr;
62 const int MaxEntry = databaseP[type]->getMaxEntry();
63 for(int i=0; i<MaxEntry; i++){
64
65 if(databaseP[type]->getEntry(i,4) == sswId) {
66 int sector = databaseP[type]->getEntry(i,0);
67
68 // Inner
69 if(module[type]==TGCId::WI) {
70 // EI/FI
71 // wire(TGCId::WI) and strip(TGCId::SI) of a chamber
72 // use the same SLB chip
73
74 int sswSector = ssw->getReadoutSector();
75 // one ROD (rodId = 2,5,8,11) covers 6 Inner sectors
76 if(sswSector %3 != 1) continue;
77 sswSector -= 1;
78
79 sector += sswSector*2;
80 int id = databaseP[type]->getEntry(i,1);
81 int block = databaseP[type]->getEntry(i,5);
82 int sbLoc = databaseP[type]->getEntry(i,2);
83 int slbAddr = databaseP[type]->getEntry(i,3);
84 for(int ip= 0; ip<3 ; ip++){
85 int psector = sector + ip*2;
86 int pblock = block + ip*4;
87 int psbLoc = sbLoc + ip*4;
88 int pslbAddr = slbAddr + ip*2;
89 TGCModuleSLB* slb = new TGCModuleSLB(ssw->getSideType(),
90 module[type],
91 region[type],
92 psector,
93 id,
94 psbLoc,
95 pslbAddr);
96
97 if(mapId==nullptr) mapId = new TGCModuleMap();
98 mapId->insert(pblock,slb);
99 }
100
101 } else if(module[type]==TGCId::SI) {
102 // EI/FI
103 // wire(TGCId::WI) and strip(TGCId::SI) of a chamber
104 // use the same SLB chip
105
106 // do nothing
107
108 } else {
109 if(region[type]==TGCId::Endcap) {
111 } else {
113 }
114 int id = databaseP[type]->getEntry(i,1);
115 int sbLoc = databaseP[type]->getEntry(i,2);
116 int slbAddr = databaseP[type]->getEntry(i,3);
117 int block = databaseP[type]->getEntry(i,5);
118 TGCModuleSLB* slb = new TGCModuleSLB(ssw->getSideType(),
119 module[type],
120 region[type],
121 sector,
122 id,
123 sbLoc,
124 slbAddr);
125
126 if(mapId==nullptr) mapId = new TGCModuleMap();
127 mapId->insert(block,slb);
128 }
129
130 }
131 }
132 }
133
134 return mapId;
135}
136
137
139 if(slb->isValid()==false) return nullptr;
140
141 const int slbId = slb->getId();
142 const int sector = slb->getSectorInReadout();
143 int readoutSector = slb->getReadoutSector();
144
145 TGCModuleMap* mapId = nullptr;
146
147 TGCDatabase* databaseP =m_database[slb->getRegionType()][slb->getModuleType()].get();
148 const int MaxEntry = databaseP->getMaxEntry();
149 if(slb->getModuleType() == TGCId::WI ||
150 slb->getModuleType() == TGCId::SI) {
151 // inner
152 for(int i=0; i<MaxEntry; i++){
153 if(databaseP->getEntry(i,0)==sector &&
154 databaseP->getEntry(i,1)==slbId) {
155
156 int sswSectorRO = readoutSector - (readoutSector%3) + 1;
157 int id = databaseP->getEntry(i,4);
158 int block = databaseP->getEntry(i,5) + 4*(readoutSector%3);
159
160 TGCModuleSSW* ssw = new TGCModuleSSW(slb->getSideType(),
161 sswSectorRO,
162 id);
163 mapId = new TGCModuleMap();
164 mapId->insert(block,ssw);
165 break;
166 }
167 }
168
169 } else {
170 for(int i=0; i<MaxEntry; i++){
171 if(databaseP->getEntry(i,0)==sector&&
172 databaseP->getEntry(i,1)==slbId) {
173
174 int id = databaseP->getEntry(i,4);
175 int block = databaseP->getEntry(i,5);
176 TGCModuleSSW* ssw = new TGCModuleSSW(slb->getSideType(),
177 readoutSector,
178 id);
179 mapId = new TGCModuleMap();
180 mapId->insert(block,ssw);
181 break;
182 }
183 }
184
185 }
186 return mapId;
187}
188
189} //end of namespace
virtual TGCModuleMap * getModule(const TGCModuleId *moduleId) const
virtual TGCModuleMap * getModuleIn(const TGCModuleId *ssw) const
std::array< std::array< std::unique_ptr< TGCDatabase >, MaxModuleType >, TGCId::MaxRegionType > m_database
virtual TGCModuleMap * getModuleOut(const TGCModuleId *slb) const
TGCCable(CableType type=NoCableType)
Definition TGCCable.h:24
virtual int getMaxEntry(void) const
virtual int getEntry(int entry, int column) const
ModuleType getModuleType(void) const
Definition TGCId.h:122
static constexpr int NUM_ENDCAP_SECTOR
Definition TGCId.h:40
RegionType getRegionType(void) const
Definition TGCId.h:125
static constexpr int N_RODS
Definition TGCId.h:43
int getSectorInReadout(void) const
Definition TGCId.cxx:26
SideType getSideType(void) const
Definition TGCId.h:121
int getId() const
Definition TGCId.h:131
static constexpr int NUM_FORWARD_SECTOR
Definition TGCId.h:41
virtual bool isValid(void) const
Definition TGCModuleId.h:34
ModuleIdType getModuleIdType(void) const
Definition TGCModuleId.h:30
void insert(int connector, TGCModuleId *moduleId)