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