ATLAS Offline Software
Loading...
Searching...
No Matches
TGCCableHPBToSL.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 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.at(+TGCId::RegionType::Endcap).at(+TGCId::SignalType::Wire) =
16 std::make_unique<TGCDatabasePPToSL>(filename, "HPB EW");
17 m_database.at(+TGCId::RegionType::Endcap).at(+TGCId::SignalType::Strip) =
18 std::make_unique<TGCDatabasePPToSL>(filename, "HPB ES");
19 m_database.at(+TGCId::RegionType::Forward).at(+TGCId::SignalType::Wire) =
20 std::make_unique<TGCDatabasePPToSL>(filename, "HPB FW");
21 m_database.at(+TGCId::RegionType::Forward).at(+TGCId::SignalType::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.at(+sl.getRegionType()).at(+TGCId::SignalType::Wire).get();
43 TGCDatabase* stripP = m_database.at(+sl.getRegionType()).at(+TGCId::SignalType::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(),
52 sl.getRegionType(),
53 sl.getSector(), id);
54 mapId.insert(block, std::move(hpb));
55 }
56
57 const int stripMaxEntry = stripP->getMaxEntry();
58 for (int i = 0; i < stripMaxEntry; i++) {
59 int id = stripP->getEntry(i, 0);
60 int block = stripP->getEntry(i, 1);
61 auto hpb = std::make_unique<TGCModuleHPB>(
63 id);
64 mapId.insert(block, std::move(hpb));
65 }
66
67 return mapId;
68}
69
71 if (hpb.isValid() == false) {
72 return TGCModuleMap{};
73 }
74
75 const int hpbId = hpb.getId();
76
77 TGCDatabase* databaseP =
78 m_database.at(+hpb.getRegionType()).at(+hpb.getSignalType()).get();
79
80 TGCModuleMap mapId{};
81 const int MaxEntry = databaseP->getMaxEntry();
82 for (int i = 0; i < MaxEntry; i++) {
83 if (databaseP->getEntry(i, 0) == hpbId) {
84 int block = databaseP->getEntry(i, 1);
85 auto sl = std::make_unique<TGCModuleSL>(
86 hpb.getSideType(), hpb.getRegionType(), hpb.getSector());
87
88 mapId.insert(block, std::move(sl));
89 break;
90 }
91 }
92
93 return mapId;
94}
95
96} // namespace MuonTGC_Cabling
TGCCableHPBToSL(const std::string &filename)
TGCModuleMap getModuleIn(const TGCModuleId &sl) const
TGCModuleMap getModule(const TGCModuleId &moduleId) const
TGCModuleMap getModuleOut(const TGCModuleId &hpt) const
std::array< std::array< std::unique_ptr< TGCDatabase >,+TGCId::SignalType::MaxSignalType >,+TGCId::RegionType::MaxRegionType > m_database
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:137
virtual int getSector() const
Definition TGCId.h:144
SideType getSideType() const
Definition TGCId.h:125
SignalType getSignalType() const
Definition TGCId.h:134
int getId() const
Definition TGCId.h:150
ModuleIdType getModuleIdType() const
Definition TGCModuleId.h:32
virtual bool isValid() const
Definition TGCModuleId.h:36
void insert(int connector, std::unique_ptr< TGCModuleId > moduleId)