ATLAS Offline Software
Loading...
Searching...
No Matches
MuonSpectrometer
MuonCablings
MuonTGC_Cabling
src
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
5
#include "
MuonTGC_Cabling/TGCCableSLBToSSW.h
"
6
7
#include "
MuonTGC_Cabling/TGCDatabaseSLBToROD.h
"
8
#include "
MuonTGC_Cabling/TGCModuleSLB.h
"
9
#include "
MuonTGC_Cabling/TGCModuleSSW.h
"
10
11
namespace
MuonTGC_Cabling
{
12
13
TGCCableSLBToSSW::TGCCableSLBToSSW
(
const
std::string& filename)
14
:
TGCCable
(
TGCCable
::
SLBToSSW
)
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
33
TGCModuleMap
*
TGCCableSLBToSSW::getModule
(
const
TGCModuleId
* moduleId)
const
{
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
43
TGCModuleMap
*
TGCCableSLBToSSW::getModuleIn
(
const
TGCModuleId
* ssw)
const
{
44
if
(ssw->
isValid
()==
false
)
return
nullptr
;
45
46
const
int
sswId = ssw->
getId
();
47
48
TGCDatabase
* databaseP[
TGCId::MaxRegionType
*
MaxModuleType
];
49
TGCId::ModuleType
module[
TGCId::MaxRegionType
*
MaxModuleType
];
50
TGCId::RegionType
region[
TGCId::MaxRegionType
*
MaxModuleType
];
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
;
60
for
(
int
type
=0;
type
<
TGCId::MaxRegionType
*
MaxModuleType
;
type
++){
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
) {
109
sector += ssw->
getReadoutSector
() * (
TGCId::NUM_ENDCAP_SECTOR
/
TGCId::N_RODS
);
110
}
else
{
111
sector += ssw->
getReadoutSector
() * (
TGCId::NUM_FORWARD_SECTOR
/
TGCId::N_RODS
);
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
137
TGCModuleMap
*
TGCCableSLBToSSW::getModuleOut
(
const
TGCModuleId
* slb)
const
{
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
TGCCableSLBToSSW.h
TGCDatabaseSLBToROD.h
TGCModuleSLB.h
TGCModuleSSW.h
MuonTGC_Cabling::TGCCableSLBToSSW::getModule
virtual TGCModuleMap * getModule(const TGCModuleId *moduleId) const
Definition
TGCCableSLBToSSW.cxx:33
MuonTGC_Cabling::TGCCableSLBToSSW::getModuleIn
virtual TGCModuleMap * getModuleIn(const TGCModuleId *ssw) const
Definition
TGCCableSLBToSSW.cxx:43
MuonTGC_Cabling::TGCCableSLBToSSW::m_database
std::array< std::array< std::unique_ptr< TGCDatabase >, MaxModuleType >, TGCId::MaxRegionType > m_database
Definition
TGCCableSLBToSSW.h:34
MuonTGC_Cabling::TGCCableSLBToSSW::MaxModuleType
@ MaxModuleType
Definition
TGCCableSLBToSSW.h:22
MuonTGC_Cabling::TGCCableSLBToSSW::SL
@ SL
Definition
TGCCableSLBToSSW.h:21
MuonTGC_Cabling::TGCCableSLBToSSW::TGCCableSLBToSSW
TGCCableSLBToSSW()
Definition
TGCCableSLBToSSW.h:31
MuonTGC_Cabling::TGCCableSLBToSSW::getModuleOut
virtual TGCModuleMap * getModuleOut(const TGCModuleId *slb) const
Definition
TGCCableSLBToSSW.cxx:137
MuonTGC_Cabling::TGCCable::SLBToSSW
@ SLBToSSW
Definition
TGCCable.h:20
MuonTGC_Cabling::TGCCable::TGCCable
TGCCable(CableType type=NoCableType)
Definition
TGCCable.h:24
MuonTGC_Cabling::TGCDatabase
Definition
TGCDatabase.h:15
MuonTGC_Cabling::TGCDatabase::getMaxEntry
virtual int getMaxEntry(void) const
Definition
TGCDatabase.cxx:36
MuonTGC_Cabling::TGCDatabase::getEntry
virtual int getEntry(int entry, int column) const
Definition
TGCDatabase.cxx:28
MuonTGC_Cabling::TGCId::getModuleType
ModuleType getModuleType(void) const
Definition
TGCId.h:122
MuonTGC_Cabling::TGCId::NUM_ENDCAP_SECTOR
static constexpr int NUM_ENDCAP_SECTOR
Definition
TGCId.h:40
MuonTGC_Cabling::TGCId::getRegionType
RegionType getRegionType(void) const
Definition
TGCId.h:125
MuonTGC_Cabling::TGCId::N_RODS
static constexpr int N_RODS
Definition
TGCId.h:43
MuonTGC_Cabling::TGCId::getSectorInReadout
int getSectorInReadout(void) const
Definition
TGCId.cxx:26
MuonTGC_Cabling::TGCId::ModuleType
ModuleType
Definition
TGCId.h:47
MuonTGC_Cabling::TGCId::ST
@ ST
Definition
TGCId.h:47
MuonTGC_Cabling::TGCId::WD
@ WD
Definition
TGCId.h:47
MuonTGC_Cabling::TGCId::SD
@ SD
Definition
TGCId.h:47
MuonTGC_Cabling::TGCId::WT
@ WT
Definition
TGCId.h:47
MuonTGC_Cabling::TGCId::WI
@ WI
Definition
TGCId.h:47
MuonTGC_Cabling::TGCId::SI
@ SI
Definition
TGCId.h:47
MuonTGC_Cabling::TGCId::getSideType
SideType getSideType(void) const
Definition
TGCId.h:121
MuonTGC_Cabling::TGCId::RegionType
RegionType
Definition
TGCId.h:53
MuonTGC_Cabling::TGCId::Endcap
@ Endcap
Definition
TGCId.h:53
MuonTGC_Cabling::TGCId::MaxRegionType
@ MaxRegionType
Definition
TGCId.h:54
MuonTGC_Cabling::TGCId::Forward
@ Forward
Definition
TGCId.h:53
MuonTGC_Cabling::TGCId::getId
int getId() const
Definition
TGCId.h:131
MuonTGC_Cabling::TGCId::NUM_FORWARD_SECTOR
static constexpr int NUM_FORWARD_SECTOR
Definition
TGCId.h:41
MuonTGC_Cabling::TGCModuleId
Definition
TGCModuleId.h:13
MuonTGC_Cabling::TGCModuleId::SLB
@ SLB
Definition
TGCModuleId.h:16
MuonTGC_Cabling::TGCModuleId::SSW
@ SSW
Definition
TGCModuleId.h:16
MuonTGC_Cabling::TGCModuleId::isValid
virtual bool isValid(void) const
Definition
TGCModuleId.h:34
MuonTGC_Cabling::TGCModuleId::getReadoutSector
int getReadoutSector() const
Definition
TGCModuleId.h:36
MuonTGC_Cabling::TGCModuleId::getModuleIdType
ModuleIdType getModuleIdType(void) const
Definition
TGCModuleId.h:30
MuonTGC_Cabling::TGCModuleMap
Definition
TGCModuleMap.h:16
MuonTGC_Cabling::TGCModuleMap::insert
void insert(int connector, TGCModuleId *moduleId)
Definition
TGCModuleMap.cxx:34
MuonTGC_Cabling::TGCModuleSLB
Definition
TGCModuleSLB.h:14
MuonTGC_Cabling::TGCModuleSSW
Definition
TGCModuleSSW.h:14
MuonTGC_Cabling
Definition
TGCCable.h:13
type
Generated on
for ATLAS Offline Software by
1.14.0