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 if(moduleId){
40 if(moduleId->getModuleIdType()==TGCModuleId::SSW)
41 return getModuleOut(moduleId);
42 if(moduleId->getModuleIdType()==TGCModuleId::ROD)
43 return getModuleIn(moduleId);
44 }
45 return nullptr;
46}
47
49 if(!rod->isValid()) return nullptr;
50
51 const TGCId::SideType rodSideType = rod->getSideType();
52 const int rodReadoutSector = rod->getReadoutSector();
53
54 TGCModuleMap* mapId = nullptr;
55 const int MaxEntry = m_database->getMaxEntry();
56 for(int i=0; i<MaxEntry; i++){
57 int id = m_database->getEntry(i,0);
58 int block = m_database->getEntry(i,1);
59 TGCModuleSSW* ssw = new TGCModuleSSW(rodSideType,
60 rodReadoutSector,
61 id);
62 if(mapId==nullptr) mapId = new TGCModuleMap();
63 mapId->insert(block,ssw);
64 }
65 return mapId;
66}
67
69 if(!ssw->isValid()) return nullptr;
70
71 const int sswId = ssw->getId();
72
73 TGCModuleMap* mapId = nullptr;
74 const int MaxEntry = m_database->getMaxEntry();
75 for(int i=0; i<MaxEntry; i++){
76 if(m_database->getEntry(i,0)==sswId){
77 int block = m_database->getEntry(i,1);
78 TGCModuleROD* rod = new TGCModuleROD(ssw->getSideType(),
79 ssw->getReadoutSector());
80 mapId = new TGCModuleMap();
81 mapId->insert(block,rod);
82 break;
83 }
84 }
85 return mapId;
86}
87
88} //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.