ATLAS Offline Software
TGCCableSSWToROD.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
10 
11 namespace MuonTGC_Cabling {
12 
13 // Constructor & Destructor
15  : TGCCable(TGCCable::SSWToROD)
16 {
17  m_database = new TGCDatabaseSLBToROD(filename,"SSW ALL");
18 }
19 
21  : TGCCable(TGCCable::SSWToROD),
22  m_database(nullptr)
23 {
24 }
25 
27  : TGCCable(TGCCable::SSWToROD),
28  m_database(nullptr)
29 {
30  TGCDatabaseSLBToROD* mypointer = dynamic_cast<TGCDatabaseSLBToROD*>(right.m_database);
31  if(mypointer) m_database = new TGCDatabaseSLBToROD(*mypointer);
32  else m_database = nullptr;
33 }
34 
36 {
37  if (this != &right) {
38  delete m_database;
39  TGCDatabaseSLBToROD* mypointer = dynamic_cast<TGCDatabaseSLBToROD*>(right.m_database);
40  if(mypointer) m_database = new TGCDatabaseSLBToROD(*mypointer);
41  else m_database = nullptr;
42  }
43  return *this;
44 }
45 
47 {
48  delete m_database;
49 }
50 
51 
53  if(moduleId){
54  if(moduleId->getModuleIdType()==TGCModuleId::SSW)
55  return getModuleOut(moduleId);
56  if(moduleId->getModuleIdType()==TGCModuleId::ROD)
57  return getModuleIn(moduleId);
58  }
59  return nullptr;
60 }
61 
63  if(!rod->isValid()) return nullptr;
64 
65  const TGCId::SideType rodSideType = rod->getSideType();
66  const int rodReadoutSector = rod->getReadoutSector();
67 
68  TGCModuleMap* mapId = nullptr;
69  const int MaxEntry = m_database->getMaxEntry();
70  for(int i=0; i<MaxEntry; i++){
71  int id = m_database->getEntry(i,0);
72  int block = m_database->getEntry(i,1);
73  TGCModuleSSW* ssw = new TGCModuleSSW(rodSideType,
74  rodReadoutSector,
75  id);
76  if(mapId==nullptr) mapId = new TGCModuleMap();
77  mapId->insert(block,ssw);
78  }
79  return mapId;
80 }
81 
83  if(!ssw->isValid()) return nullptr;
84 
85  const int sswId = ssw->getId();
86 
87  TGCModuleMap* mapId = nullptr;
88  const int MaxEntry = m_database->getMaxEntry();
89  for(int i=0; i<MaxEntry; i++){
90  if(m_database->getEntry(i,0)==sswId){
91  int block = m_database->getEntry(i,1);
93  ssw->getReadoutSector());
94  mapId = new TGCModuleMap();
95  mapId->insert(block,rod);
96  break;
97  }
98  }
99  return mapId;
100 }
101 
102 } //end of namespace
TGCCableSSWToROD.h
MuonTGC_Cabling::TGCCableSSWToROD::getModuleOut
virtual TGCModuleMap * getModuleOut(const TGCModuleId *ssw) const
Definition: TGCCableSSWToROD.cxx:82
MuonTGC_Cabling::TGCModuleId::getModuleIdType
ModuleIdType getModuleIdType(void) const
Definition: TGCModuleId.h:30
MuonTGC_Cabling::TGCId::getSideType
SideType getSideType(void) const
Definition: TGCId.h:122
MuonTGC_Cabling::TGCModuleId::ROD
@ ROD
Definition: TGCModuleId.h:16
TGCModuleSSW.h
MuonTGC_Cabling::TGCModuleId::getReadoutSector
int getReadoutSector() const
Definition: TGCModuleId.h:36
MuonTGC_Cabling::TGCCableSSWToROD::operator=
TGCCableSSWToROD & operator=(const TGCCableSSWToROD &)
Definition: TGCCableSSWToROD.cxx:35
TGCModuleROD.h
MuonTGC_Cabling::TGCModuleMap
Definition: TGCModuleMap.h:16
MuonTGC_Cabling::TGCCableSSWToROD
Definition: TGCCableSSWToROD.h:18
MuonTGC_Cabling::TGCModuleId::SSW
@ SSW
Definition: TGCModuleId.h:16
MuonTGC_Cabling::TGCDatabase::getEntry
virtual int getEntry(int entry, int column) const
Definition: TGCDatabase.cxx:28
MuonTGC_Cabling::TGCCableSSWToROD::getModule
virtual TGCModuleMap * getModule(const TGCModuleId *moduleId) const
Definition: TGCCableSSWToROD.cxx:52
lumiFormat.i
int i
Definition: lumiFormat.py:85
MuonTGC_Cabling
Definition: TGCCable.h:13
MuonTGC_Cabling::TGCDatabase::getMaxEntry
virtual int getMaxEntry(void) const
Definition: TGCDatabase.cxx:36
MuonTGC_Cabling::TGCId::getId
int getId() const
Definition: TGCId.h:132
MuonTGC_Cabling::TGCCableSSWToROD::TGCCableSSWToROD
TGCCableSSWToROD(void)
Definition: TGCCableSSWToROD.cxx:20
MuonTGC_Cabling::TGCCable
Definition: TGCCable.h:16
RunTileMonitoring.rod
rod
Definition: RunTileMonitoring.py:134
MuonTGC_Cabling::TGCModuleROD
Definition: TGCModuleROD.h:14
MuonTGC_Cabling::TGCCableSSWToROD::m_database
TGCDatabase * m_database
Definition: TGCCableSSWToROD.h:33
MuonTGC_Cabling::TGCModuleMap::insert
void insert(int connector, TGCModuleId *moduleId)
Definition: TGCModuleMap.cxx:34
TGCDatabaseSLBToROD.h
MuonTGC_Cabling::TGCDatabaseSLBToROD
Definition: TGCDatabaseSLBToROD.h:14
MuonTGC_Cabling::TGCModuleSSW
Definition: TGCModuleSSW.h:14
MuonTGC_Cabling::TGCCableSSWToROD::~TGCCableSSWToROD
virtual ~TGCCableSSWToROD(void)
Definition: TGCCableSSWToROD.cxx:46
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
MuonTGC_Cabling::TGCModuleId
Definition: TGCModuleId.h:13
MuonTGC_Cabling::TGCId::SideType
SideType
Definition: TGCId.h:45
MuonTGC_Cabling::TGCModuleId::isValid
virtual bool isValid(void) const
Definition: TGCModuleId.h:34
MuonTGC_Cabling::TGCCableSSWToROD::getModuleIn
virtual TGCModuleMap * getModuleIn(const TGCModuleId *rod) const
Definition: TGCCableSSWToROD.cxx:62