ATLAS Offline Software
Loading...
Searching...
No Matches
TGCCableHPBToSL.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
6
10
11namespace MuonTGC_Cabling {
12
13TGCCableHPBToSL::TGCCableHPBToSL(const std::string& filename)
15 m_database[TGCId::Endcap][TGCId::Wire] = std::make_unique<TGCDatabasePPToSL>(filename,"HPB EW");
16 m_database[TGCId::Endcap][TGCId::Strip] = std::make_unique<TGCDatabasePPToSL>(filename,"HPB ES");
17 m_database[TGCId::Forward][TGCId::Wire] = std::make_unique<TGCDatabasePPToSL>(filename,"HPB FW");
18 m_database[TGCId::Forward][TGCId::Strip] = std::make_unique<TGCDatabasePPToSL>(filename,"HPB FS");
19}
20
22 if(moduleId){
23 if(moduleId->getModuleIdType()==TGCModuleId::HPB)
24 return getModuleOut(moduleId);
25 if(moduleId->getModuleIdType()==TGCModuleId::SL)
26 return getModuleIn(moduleId);
27 }
28 return nullptr;
29}
30
32 if(sl->isValid()==false) return nullptr;
33
34 TGCDatabase* wireP = m_database[sl->getRegionType()][TGCId::Wire].get();
35 TGCDatabase* stripP = m_database[sl->getRegionType()][TGCId::Strip].get();
36
37 TGCModuleMap* mapId = nullptr;
38 const int wireMaxEntry = wireP->getMaxEntry();
39 for(int i=0; i<wireMaxEntry; i++){
40 int id = wireP->getEntry(i,0);
41 int block = wireP->getEntry(i,1);
42 TGCModuleHPB* hpb = new TGCModuleHPB(sl->getSideType(),
44 sl->getRegionType(),
45 sl->getSector(),
46 id);
47 if(mapId==nullptr) mapId = new TGCModuleMap();
48 mapId->insert(block,hpb);
49 }
50
51 const int stripMaxEntry = stripP->getMaxEntry();
52 for(int i=0; i<stripMaxEntry; i++){
53 int id = stripP->getEntry(i,0);
54 int block = stripP->getEntry(i,1);
55 TGCModuleHPB* hpb = new TGCModuleHPB(sl->getSideType(),
57 sl->getRegionType(),
58 sl->getSector(),
59 id);
60 if(mapId==nullptr) mapId = new TGCModuleMap();
61 mapId->insert(block,hpb);
62 }
63
64 return mapId;
65}
66
68 if(hpb->isValid()==false) return nullptr;
69
70 const int hpbId = hpb->getId();
71
72 TGCDatabase* databaseP = m_database[hpb->getRegionType()][hpb->getSignalType()].get();
73
74 TGCModuleMap* mapId = nullptr;
75 const int MaxEntry = databaseP->getMaxEntry();
76 for(int i=0; i<MaxEntry; i++){
77 if(databaseP->getEntry(i,0)==hpbId)
78 {
79 int block = databaseP->getEntry(i,1);
80 TGCModuleSL* sl = new TGCModuleSL(hpb->getSideType(),
81 hpb->getRegionType(),
82 hpb->getSector());
83
84 mapId = new TGCModuleMap();
85 mapId->insert(block,sl);
86 break;
87 }
88 }
89
90 return mapId;
91}
92
93} //end of namespace
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:24
virtual int getMaxEntry(void) const
virtual int getEntry(int entry, int column) const
RegionType getRegionType(void) const
Definition TGCId.h:125
SignalType getSignalType(void) const
Definition TGCId.h:123
virtual int getSector() const
Definition TGCId.h:129
SideType getSideType(void) const
Definition TGCId.h:121
int getId() const
Definition TGCId.h:131
virtual bool isValid(void) const
Definition TGCModuleId.h:34
ModuleIdType getModuleIdType(void) const
Definition TGCModuleId.h:30
void insert(int connector, TGCModuleId *moduleId)