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) {
29 if (moduleId->getModuleIdType() == TGCModuleId::HPB) {
30 return getModuleOut(moduleId);
31 }
32 if (moduleId->getModuleIdType() == TGCModuleId::SL) {
33 return getModuleIn(moduleId);
34 }
35 }
36 return nullptr;
37}
38
40 if (sl->isValid() == false) {
41 return nullptr;
42 }
43
44 TGCDatabase* wireP = m_database[sl->getRegionType()][TGCId::Wire].get();
45 TGCDatabase* stripP = m_database[sl->getRegionType()][TGCId::Strip].get();
46
47 TGCModuleMap* mapId = nullptr;
48 const int wireMaxEntry = wireP->getMaxEntry();
49 for (int i = 0; i < wireMaxEntry; i++) {
50 int id = wireP->getEntry(i, 0);
51 int block = wireP->getEntry(i, 1);
52 TGCModuleHPB* hpb =
54 sl->getRegionType(), sl->getSector(), id);
55 if (mapId == nullptr) {
56 mapId = new TGCModuleMap();
57 }
58 mapId->insert(block, hpb);
59 }
60
61 const int stripMaxEntry = stripP->getMaxEntry();
62 for (int i = 0; i < stripMaxEntry; i++) {
63 int id = stripP->getEntry(i, 0);
64 int block = stripP->getEntry(i, 1);
65 TGCModuleHPB* hpb =
67 sl->getRegionType(), sl->getSector(), id);
68 if (mapId == nullptr) {
69 mapId = new TGCModuleMap();
70 }
71 mapId->insert(block, hpb);
72 }
73
74 return mapId;
75}
76
78 if (hpb->isValid() == false) {
79 return nullptr;
80 }
81
82 const int hpbId = hpb->getId();
83
84 TGCDatabase* databaseP =
85 m_database[hpb->getRegionType()][hpb->getSignalType()].get();
86
87 TGCModuleMap* mapId = nullptr;
88 const int MaxEntry = databaseP->getMaxEntry();
89 for (int i = 0; i < MaxEntry; i++) {
90 if (databaseP->getEntry(i, 0) == hpbId) {
91 int block = databaseP->getEntry(i, 1);
92 TGCModuleSL* sl = new TGCModuleSL(
93 hpb->getSideType(), hpb->getRegionType(), hpb->getSector());
94
95 mapId = new TGCModuleMap();
96 mapId->insert(block, sl);
97 break;
98 }
99 }
100
101 return mapId;
102}
103
104} // namespace MuonTGC_Cabling
virtual TGCModuleMap * getModule(const TGCModuleId *moduleId) const
virtual TGCModuleMap * getModuleOut(const TGCModuleId *hpt) const
virtual TGCModuleMap * getModuleIn(const TGCModuleId *sl) const
std::array< std::array< std::unique_ptr< TGCDatabase >, TGCId::MaxSignalType >, TGCId::MaxRegionType > m_database
TGCCable(CableType type=NoCableType)
Definition TGCCable.h:31
virtual int getMaxEntry(void) const
virtual int getEntry(int entry, int column) const
RegionType getRegionType(void) const
Definition TGCId.h:146
SignalType getSignalType(void) const
Definition TGCId.h:140
virtual int getSector() const
Definition TGCId.h:156
SideType getSideType(void) const
Definition TGCId.h:134
int getId() const
Definition TGCId.h:162
virtual bool isValid(void) const
Definition TGCModuleId.h:38
ModuleIdType getModuleIdType(void) const
Definition TGCModuleId.h:34
void insert(int connector, TGCModuleId *moduleId)