ATLAS Offline Software
Loading...
Searching...
No Matches
TGCCableHPBToSL.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
13TGCCableHPBToSL::TGCCableHPBToSL(const std::string& filename)
14 : TGCCable(TGCCable::HPBToSL), m_database{{{nullptr}}} {
15 m_database[TGCId::Endcap][TGCId::Wire] =
16 std::make_unique<TGCDatabasePPToSL>(filename, "HPB EW");
17 m_database[TGCId::Endcap][TGCId::Strip] =
18 std::make_unique<TGCDatabasePPToSL>(filename, "HPB ES");
19 m_database[TGCId::Forward][TGCId::Wire] =
20 std::make_unique<TGCDatabasePPToSL>(filename, "HPB FW");
21 m_database[TGCId::Forward][TGCId::Strip] =
22 std::make_unique<TGCDatabasePPToSL>(filename, "HPB FS");
23}
24
25TGCCableHPBToSL::~TGCCableHPBToSL() = default;
26
28 if (moduleId.getModuleIdType() == TGCModuleId::HPB) {
29 return getModuleOut(moduleId);
30 }
31 if (moduleId.getModuleIdType() == TGCModuleId::SL) {
32 return getModuleIn(moduleId);
33 }
34 return TGCModuleMap{};
35}
36
38 if (sl.isValid() == false) {
39 return TGCModuleMap{};
40 }
41
42 TGCDatabase* wireP = m_database[sl.getRegionType()][TGCId::Wire].get();
43 TGCDatabase* stripP = m_database[sl.getRegionType()][TGCId::Strip].get();
44
45 TGCModuleMap mapId{};
46 const int wireMaxEntry = wireP->getMaxEntry();
47 for (int i = 0; i < wireMaxEntry; i++) {
48 int id = wireP->getEntry(i, 0);
49 int block = wireP->getEntry(i, 1);
50 auto hpb = std::make_unique<TGCModuleHPB>(sl.getSideType(), TGCId::Wire,
51 sl.getRegionType(),
52 sl.getSector(), id);
53 mapId.insert(block, std::move(hpb));
54 }
55
56 const int stripMaxEntry = stripP->getMaxEntry();
57 for (int i = 0; i < stripMaxEntry; i++) {
58 int id = stripP->getEntry(i, 0);
59 int block = stripP->getEntry(i, 1);
60 auto hpb = std::make_unique<TGCModuleHPB>(
62 id);
63 mapId.insert(block, std::move(hpb));
64 }
65
66 return mapId;
67}
68
70 if (hpb.isValid() == false) {
71 return TGCModuleMap{};
72 }
73
74 const int hpbId = hpb.getId();
75
76 TGCDatabase* databaseP =
77 m_database[hpb.getRegionType()][hpb.getSignalType()].get();
78
79 TGCModuleMap mapId{};
80 const int MaxEntry = databaseP->getMaxEntry();
81 for (int i = 0; i < MaxEntry; i++) {
82 if (databaseP->getEntry(i, 0) == hpbId) {
83 int block = databaseP->getEntry(i, 1);
84 auto sl = std::make_unique<TGCModuleSL>(
85 hpb.getSideType(), hpb.getRegionType(), hpb.getSector());
86
87 mapId.insert(block, std::move(sl));
88 break;
89 }
90 }
91
92 return mapId;
93}
94
95} // namespace MuonTGC_Cabling
TGCCableHPBToSL(const std::string &filename)
TGCModuleMap getModuleIn(const TGCModuleId &sl) const
TGCModuleMap getModule(const TGCModuleId &moduleId) const
std::array< std::array< std::unique_ptr< TGCDatabase >, TGCId::MaxSignalType >, TGCId::MaxRegionType > m_database
TGCModuleMap getModuleOut(const TGCModuleId &hpt) const
TGCCable(CableType type=NoCableType)
Definition TGCCable.h:31
virtual int getMaxEntry() const
virtual int getEntry(int entry, int column) const
RegionType getRegionType() const
Definition TGCId.h:146
virtual int getSector() const
Definition TGCId.h:156
SideType getSideType() const
Definition TGCId.h:134
SignalType getSignalType() const
Definition TGCId.h:140
int getId() const
Definition TGCId.h:162
ModuleIdType getModuleIdType() const
Definition TGCModuleId.h:32
virtual bool isValid() const
Definition TGCModuleId.h:36
void insert(int connector, std::unique_ptr< TGCModuleId > moduleId)