ATLAS Offline Software
Loading...
Searching...
No Matches
TGCCableSSWToROD.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
13TGCCableSSWToROD::TGCCableSSWToROD(const std::string& filename)
15 m_database(std::make_unique<TGCDatabaseSLBToROD>(filename, "SSW ALL")) {}
16
19 if (auto mypointer =
20 dynamic_cast<TGCDatabaseSLBToROD*>(right.m_database.get())) {
21 m_database = std::make_unique<TGCDatabaseSLBToROD>(*mypointer);
22 } else {
23 m_database.reset();
24 }
25}
26
28 if (this != &right) {
29 if (auto mypointer =
30 dynamic_cast<TGCDatabaseSLBToROD*>(right.m_database.get())) {
31 m_database = std::make_unique<TGCDatabaseSLBToROD>(*mypointer);
32 } else {
33 m_database.reset();
34 }
35 }
36 return *this;
37}
38
40
42
43 if (moduleId.getModuleIdType() == TGCModuleId::SSW) {
44 return getModuleOut(moduleId);
45 }
46 if (moduleId.getModuleIdType() == TGCModuleId::ROD) {
47 return getModuleIn(moduleId);
48 }
49
50 return TGCModuleMap{};
51}
52
54 if (!rod.isValid()) {
55 return TGCModuleMap{};
56 }
57
58 const TGCId::SideType rodSideType = rod.getSideType();
59 const int rodReadoutSector = rod.getReadoutSector();
60
61 TGCModuleMap mapId{};
62 const int MaxEntry = m_database->getMaxEntry();
63 for (int i = 0; i < MaxEntry; i++) {
64 int id = m_database->getEntry(i, 0);
65 int block = m_database->getEntry(i, 1);
66 auto ssw =
67 std::make_unique<TGCModuleSSW>(rodSideType, rodReadoutSector, id);
68 mapId.insert(block, std::move(ssw));
69 }
70 return mapId;
71}
72
74 if (!ssw.isValid()) {
75 return TGCModuleMap{};
76 }
77
78 const int sswId = ssw.getId();
79
80 TGCModuleMap mapId{};
81 const int MaxEntry = m_database->getMaxEntry();
82 for (int i = 0; i < MaxEntry; i++) {
83 if (m_database->getEntry(i, 0) == sswId) {
84 int block = m_database->getEntry(i, 1);
85 auto rod = std::make_unique<TGCModuleROD>(ssw.getSideType(),
86 ssw.getReadoutSector());
87
88 mapId.insert(block, std::move(rod));
89 break;
90 }
91 }
92 return mapId;
93}
94
95} // namespace MuonTGC_Cabling
TGCModuleMap getModuleOut(const TGCModuleId &ssw) const
TGCCableSSWToROD(const std::string &filename)
TGCModuleMap getModule(const TGCModuleId &moduleId) const
TGCCableSSWToROD & operator=(const TGCCableSSWToROD &)
TGCModuleMap getModuleIn(const TGCModuleId &rod) const
std::unique_ptr< TGCDatabase > m_database
TGCCable(CableType type=NoCableType)
Definition TGCCable.h:31
SideType getSideType() const
Definition TGCId.h:134
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)
STL namespace.