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}
17
20 if (auto mypointer = 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 = dynamic_cast<TGCDatabaseSLBToROD*>(right.m_database.get())) {
30 m_database = std::make_unique<TGCDatabaseSLBToROD>(*mypointer);
31 } else {
32 m_database.reset();
33 }
34 }
35 return *this;
36}
37
39
41 if(moduleId){
42 if(moduleId->getModuleIdType()==TGCModuleId::SSW)
43 return getModuleOut(moduleId);
44 if(moduleId->getModuleIdType()==TGCModuleId::ROD)
45 return getModuleIn(moduleId);
46 }
47 return nullptr;
48}
49
51 if(!rod->isValid()) return nullptr;
52
53 const TGCId::SideType rodSideType = rod->getSideType();
54 const int rodReadoutSector = rod->getReadoutSector();
55
56 TGCModuleMap* mapId = nullptr;
57 const int MaxEntry = m_database->getMaxEntry();
58 for(int i=0; i<MaxEntry; i++){
59 int id = m_database->getEntry(i,0);
60 int block = m_database->getEntry(i,1);
61 TGCModuleSSW* ssw = new TGCModuleSSW(rodSideType,
62 rodReadoutSector,
63 id);
64 if(mapId==nullptr) mapId = new TGCModuleMap();
65 mapId->insert(block,ssw);
66 }
67 return mapId;
68}
69
71 if(!ssw->isValid()) return nullptr;
72
73 const int sswId = ssw->getId();
74
75 TGCModuleMap* mapId = nullptr;
76 const int MaxEntry = m_database->getMaxEntry();
77 for(int i=0; i<MaxEntry; i++){
78 if(m_database->getEntry(i,0)==sswId){
79 int block = m_database->getEntry(i,1);
80 TGCModuleROD* rod = new TGCModuleROD(ssw->getSideType(),
81 ssw->getReadoutSector());
82 mapId = new TGCModuleMap();
83 mapId->insert(block,rod);
84 break;
85 }
86 }
87 return mapId;
88}
89
90} //end of namespace
virtual TGCModuleMap * getModuleIn(const TGCModuleId *rod) const
TGCCableSSWToROD(const std::string &filename)
virtual TGCModuleMap * getModuleOut(const TGCModuleId *ssw) const
TGCCableSSWToROD & operator=(const TGCCableSSWToROD &)
virtual TGCModuleMap * getModule(const TGCModuleId *moduleId) const
std::unique_ptr< TGCDatabase > m_database
TGCCable(CableType type=NoCableType)
Definition TGCCable.h:24
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)
STL namespace.