ATLAS Offline Software
TGCCableSLBToSSW.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 
11 namespace MuonTGC_Cabling {
12 
13 // Constructor & Destructor
15  : TGCCable(TGCCable::SLBToSSW)
16 {
18  new TGCDatabaseSLBToROD(filename,"SLB EWT");
20  new TGCDatabaseSLBToROD(filename,"SLB EWD");
22  new TGCDatabaseSLBToROD(filename,"SLB EST");
24  new TGCDatabaseSLBToROD(filename,"SLB ESD");
26  new TGCDatabaseSLBToROD(filename,"SLB EWI");
28  new TGCDatabaseSLBToROD(filename,"SLB ESI");
30  new TGCDatabaseSLBToROD(filename,"SLB ESL");
31 
33  new TGCDatabaseSLBToROD(filename,"SLB FWT");
35  new TGCDatabaseSLBToROD(filename,"SLB FWD");
37  new TGCDatabaseSLBToROD(filename,"SLB FST");
39  new TGCDatabaseSLBToROD(filename,"SLB FSD");
41  new TGCDatabaseSLBToROD(filename,"SLB FWI");
43  new TGCDatabaseSLBToROD(filename,"SLB FSI");
45  new TGCDatabaseSLBToROD(filename,"SLB FSL");
46 }
47 
49 {
56  delete m_database[TGCId::Endcap][SL];
57 
64  delete m_database[TGCId::Forward][SL];
65 }
66 
67 
69  if(moduleId){
70  if(moduleId->getModuleIdType()==TGCModuleId::SLB)
71  return getModuleOut(moduleId);
72  if(moduleId->getModuleIdType()==TGCModuleId::SSW)
73  return getModuleIn(moduleId);
74  }
75  return nullptr;
76 }
77 
79  if(ssw->isValid()==false) return nullptr;
80 
81  const int sswId = ssw->getId();
82 
86  for(int i=0; i<TGCId::MaxRegionType; i++){
87  for(int j=0; j< MaxModuleType; j++){
88  databaseP[i*MaxModuleType + j] = m_database[i][j];
89  region[i*MaxModuleType + j] = static_cast<TGCId::RegionType>(i);
90  module[i*MaxModuleType + j] = static_cast<TGCId::ModuleType>(j);
91  }
92  }
93 
94  TGCModuleMap* mapId = nullptr;
96  const int MaxEntry = databaseP[type]->getMaxEntry();
97  for(int i=0; i<MaxEntry; i++){
98 
99  if(databaseP[type]->getEntry(i,4) == sswId) {
100  int sector = databaseP[type]->getEntry(i,0);
101 
102  // Inner
103  if(module[type]==TGCId::WI) {
104  // EI/FI
105  // wire(TGCId::WI) and strip(TGCId::SI) of a chamber
106  // use the same SLB chip
107 
108  int sswSector = ssw->getReadoutSector();
109  // one ROD (rodId = 2,5,8,11) covers 6 Inner sectors
110  if(sswSector %3 != 1) continue;
111  sswSector -= 1;
112 
113  sector += sswSector*2;
114  int id = databaseP[type]->getEntry(i,1);
115  int block = databaseP[type]->getEntry(i,5);
116  int sbLoc = databaseP[type]->getEntry(i,2);
117  int slbAddr = databaseP[type]->getEntry(i,3);
118  for(int ip= 0; ip<3 ; ip++){
119  int psector = sector + ip*2;
120  int pblock = block + ip*4;
121  int psbLoc = sbLoc + ip*4;
122  int pslbAddr = slbAddr + ip*2;
123  TGCModuleSLB* slb = new TGCModuleSLB(ssw->getSideType(),
124  module[type],
125  region[type],
126  psector,
127  id,
128  psbLoc,
129  pslbAddr);
130 
131  if(mapId==nullptr) mapId = new TGCModuleMap();
132  mapId->insert(pblock,slb);
133  }
134 
135  } else if(module[type]==TGCId::SI) {
136  // EI/FI
137  // wire(TGCId::WI) and strip(TGCId::SI) of a chamber
138  // use the same SLB chip
139 
140  // do nothing
141 
142  } else {
143  if(region[type]==TGCId::Endcap) {
145  } else {
147  }
148  int id = databaseP[type]->getEntry(i,1);
149  int sbLoc = databaseP[type]->getEntry(i,2);
150  int slbAddr = databaseP[type]->getEntry(i,3);
151  int block = databaseP[type]->getEntry(i,5);
152  TGCModuleSLB* slb = new TGCModuleSLB(ssw->getSideType(),
153  module[type],
154  region[type],
155  sector,
156  id,
157  sbLoc,
158  slbAddr);
159 
160  if(mapId==nullptr) mapId = new TGCModuleMap();
161  mapId->insert(block,slb);
162  }
163 
164  }
165  }
166  }
167 
168  return mapId;
169 }
170 
171 
173  if(slb->isValid()==false) return nullptr;
174 
175  const int slbId = slb->getId();
176  const int sector = slb->getSectorInReadout();
177  int readoutSector = slb->getReadoutSector();
178 
179  TGCModuleMap* mapId = nullptr;
180 
181  TGCDatabase* databaseP =m_database[slb->getRegionType()][slb->getModuleType()];
182  const int MaxEntry = databaseP->getMaxEntry();
183  if(slb->getModuleType() == TGCId::WI ||
184  slb->getModuleType() == TGCId::SI) {
185  // inner
186  for(int i=0; i<MaxEntry; i++){
187  if(databaseP->getEntry(i,0)==sector &&
188  databaseP->getEntry(i,1)==slbId) {
189 
190  int sswSectorRO = readoutSector - (readoutSector%3) + 1;
191  int id = databaseP->getEntry(i,4);
192  int block = databaseP->getEntry(i,5) + 4*(readoutSector%3);
193 
194  TGCModuleSSW* ssw = new TGCModuleSSW(slb->getSideType(),
195  sswSectorRO,
196  id);
197  mapId = new TGCModuleMap();
198  mapId->insert(block,ssw);
199  break;
200  }
201  }
202 
203  } else {
204  for(int i=0; i<MaxEntry; i++){
205  if(databaseP->getEntry(i,0)==sector&&
206  databaseP->getEntry(i,1)==slbId) {
207 
208  int id = databaseP->getEntry(i,4);
209  int block = databaseP->getEntry(i,5);
210  TGCModuleSSW* ssw = new TGCModuleSSW(slb->getSideType(),
211  readoutSector,
212  id);
213  mapId = new TGCModuleMap();
214  mapId->insert(block,ssw);
215  break;
216  }
217  }
218 
219  }
220  return mapId;
221 }
222 
223 } //end of namespace
MuonTGC_Cabling::TGCCableSLBToSSW::m_database
TGCDatabase * m_database[TGCId::MaxRegionType][MaxModuleType]
Definition: TGCCableSLBToSSW.h:38
MuonTGC_Cabling::TGCCableSLBToSSW::~TGCCableSLBToSSW
virtual ~TGCCableSLBToSSW(void)
Definition: TGCCableSLBToSSW.cxx:48
MuonTGC_Cabling::TGCModuleId::getModuleIdType
ModuleIdType getModuleIdType(void) const
Definition: TGCModuleId.h:30
MuonTGC_Cabling::TGCId::SI
@ SI
Definition: TGCId.h:47
MuonTGC_Cabling::TGCId::getSideType
SideType getSideType(void) const
Definition: TGCId.h:122
MuonTGC_Cabling::TGCCableSLBToSSW::getModuleOut
virtual TGCModuleMap * getModuleOut(const TGCModuleId *slb) const
Definition: TGCCableSLBToSSW.cxx:172
MuonTGC_Cabling::TGCId::getRegionType
RegionType getRegionType(void) const
Definition: TGCId.h:126
MuonTGC_Cabling::TGCId::N_RODS
static constexpr int N_RODS
Definition: TGCId.h:43
MuonTGC_Cabling::TGCModuleSLB
Definition: TGCModuleSLB.h:14
TGCModuleSSW.h
MuonTGC_Cabling::TGCId::ModuleType
ModuleType
Definition: TGCId.h:47
MuonTGC_Cabling::TGCModuleId::getReadoutSector
int getReadoutSector() const
Definition: TGCModuleId.h:36
MuonTGC_Cabling::TGCModuleId::SLB
@ SLB
Definition: TGCModuleId.h:16
MuonTGC_Cabling::TGCId::getModuleType
ModuleType getModuleType(void) const
Definition: TGCId.h:123
MuonTGC_Cabling::TGCCableSLBToSSW::SL
@ SL
Definition: TGCCableSLBToSSW.h:23
MuonTGC_Cabling::TGCModuleMap
Definition: TGCModuleMap.h:16
MuonTGC_Cabling::TGCId::SD
@ SD
Definition: TGCId.h:47
MuonTGC_Cabling::TGCModuleId::SSW
@ SSW
Definition: TGCModuleId.h:16
MuonTGC_Cabling::TGCId::NUM_FORWARD_SECTOR
static constexpr int NUM_FORWARD_SECTOR
Definition: TGCId.h:41
MuonTGC_Cabling::TGCCableSLBToSSW::getModule
virtual TGCModuleMap * getModule(const TGCModuleId *moduleId) const
Definition: TGCCableSLBToSSW.cxx:68
MuonTGC_Cabling::TGCDatabase
Definition: TGCDatabase.h:15
python.PyAthena.module
module
Definition: PyAthena.py:131
MuonTGC_Cabling::TGCDatabase::getEntry
virtual int getEntry(int entry, int column) const
Definition: TGCDatabase.cxx:28
MuonTGC_Cabling::TGCId::getSectorInReadout
int getSectorInReadout(void) const
Definition: TGCId.cxx:26
lumiFormat.i
int i
Definition: lumiFormat.py:85
MuonTGC_Cabling::TGCId::WT
@ WT
Definition: TGCId.h:47
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
find_tgc_unfilled_channelids.ip
ip
Definition: find_tgc_unfilled_channelids.py:3
MuonTGC_Cabling::TGCCable
Definition: TGCCable.h:16
MuonTGC_Cabling::TGCId::WD
@ WD
Definition: TGCId.h:47
MuonTGC_Cabling::TGCId::Endcap
@ Endcap
Definition: TGCId.h:53
MuonTGC_Cabling::TGCId::WI
@ WI
Definition: TGCId.h:47
MuonTGC_Cabling::TGCModuleMap::insert
void insert(int connector, TGCModuleId *moduleId)
Definition: TGCModuleMap.cxx:34
TGCDatabaseSLBToROD.h
MuonTGC_Cabling::TGCId::MaxRegionType
@ MaxRegionType
Definition: TGCId.h:54
MuonTGC_Cabling::TGCDatabaseSLBToROD
Definition: TGCDatabaseSLBToROD.h:14
MuonTGC_Cabling::TGCModuleSSW
Definition: TGCModuleSSW.h:14
MuonTGC_Cabling::TGCId::ST
@ ST
Definition: TGCId.h:47
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
MuonTGC_Cabling::TGCId::NUM_ENDCAP_SECTOR
static constexpr int NUM_ENDCAP_SECTOR
Definition: TGCId.h:40
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
MuonTGC_Cabling::TGCCableSLBToSSW::MaxModuleType
@ MaxModuleType
Definition: TGCCableSLBToSSW.h:24
MuonTGC_Cabling::TGCCableSLBToSSW::TGCCableSLBToSSW
TGCCableSLBToSSW(void)
Definition: TGCCableSLBToSSW.h:35
MuonTGC_Cabling::TGCId::RegionType
RegionType
Definition: TGCId.h:53
MuonTGC_Cabling::TGCModuleId
Definition: TGCModuleId.h:13
TGCModuleSLB.h
TGCCableSLBToSSW.h
MuonTGC_Cabling::TGCCableSLBToSSW::getModuleIn
virtual TGCModuleMap * getModuleIn(const TGCModuleId *ssw) const
Definition: TGCCableSLBToSSW.cxx:78
MuonTGC_Cabling::TGCId::Forward
@ Forward
Definition: TGCId.h:53
MuonTGC_Cabling::TGCModuleId::isValid
virtual bool isValid(void) const
Definition: TGCModuleId.h:34