ATLAS Offline Software
TGCCableSLBToSSW.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::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 {
57 
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<TGCIdBase::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<TGCIdBase::RegionType>(i);
90  module[i*MaxModuleType + j] = static_cast<TGCIdBase::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]==TGCIdBase::WI) {
104  // EI/FI
105  // wire(TGCIdBase::WI) and strip(TGCIdBase::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]==TGCIdBase::SI) {
136  // EI/FI
137  // wire(TGCIdBase::WI) and strip(TGCIdBase::SI) of a chamber
138  // use the same SLB chip
139 
140  // do nothing
141 
142  } else {
143  if(region[type]==TGCIdBase::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() == TGCIdBase::WI ||
184  slb->getModuleType() == TGCIdBase::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::~TGCCableSLBToSSW
virtual ~TGCCableSLBToSSW(void)
Definition: TGCCableSLBToSSW.cxx:48
MuonTGC_Cabling::TGCModuleId::getModuleIdType
ModuleIdType getModuleIdType(void) const
Definition: TGCModuleId.h:28
TGCIdBase::getRegionType
RegionType getRegionType(void) const
Definition: TGCIdBase.cxx:41
MuonTGC_Cabling::TGCId::NumberOfReadoutSector
@ NumberOfReadoutSector
Definition: TGCId.h:49
TGCIdBase::Endcap
@ Endcap
Definition: TGCIdBase.h:39
MuonTGC_Cabling::TGCCableSLBToSSW::getModuleOut
virtual TGCModuleMap * getModuleOut(const TGCModuleId *slb) const
Definition: TGCCableSLBToSSW.cxx:172
TGCIdBase::WT
@ WT
Definition: TGCIdBase.h:33
TGCIdBase::MaxRegionType
@ MaxRegionType
Definition: TGCIdBase.h:40
MuonTGC_Cabling::TGCModuleSLB
Definition: TGCModuleSLB.h:14
TGCModuleSSW.h
MuonTGC_Cabling::TGCModuleId::SLB
@ SLB
Definition: TGCModuleId.h:17
TGCIdBase::SD
@ SD
Definition: TGCIdBase.h:33
MuonTGC_Cabling::TGCModuleMap
Definition: TGCModuleMap.h:16
MuonTGC_Cabling::TGCModuleId::SSW
@ SSW
Definition: TGCModuleId.h:17
TGCIdBase::getModuleType
ModuleType getModuleType(void) const
Definition: TGCIdBase.cxx:38
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:134
MuonTGC_Cabling::TGCId::NumberOfEndcapSector
@ NumberOfEndcapSector
Definition: TGCId.h:53
TGCIdBase::WI
@ WI
Definition: TGCIdBase.h:33
MuonTGC_Cabling::TGCCableSLBToSSW::m_database
TGCDatabase * m_database[TGCIdBase::MaxRegionType][MaxModuleType]
Definition: TGCCableSLBToSSW.h:38
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:33
lumiFormat.i
int i
Definition: lumiFormat.py:92
TGCIdBase::ModuleType
ModuleType
Definition: TGCIdBase.h:33
MuonTGC_Cabling
Definition: TGCCable.h:13
MuonTGC_Cabling::TGCDatabase::getMaxEntry
virtual int getMaxEntry(void) const
Definition: TGCDatabase.cxx:36
MuonTGC_Cabling::TGCCableSLBToSSW::MaxModuleType
@ MaxModuleType
Definition: TGCCableSLBToSSW.h:24
TGCIdBase::getSideType
SideType getSideType(void) const
Definition: TGCIdBase.cxx:37
find_tgc_unfilled_channelids.ip
ip
Definition: find_tgc_unfilled_channelids.py:3
MuonTGC_Cabling::TGCCableSLBToSSW::SL
@ SL
Definition: TGCCableSLBToSSW.h:23
MuonTGC_Cabling::TGCCable
Definition: TGCCable.h:16
MuonTGC_Cabling::TGCId::NumberOfForwardSector
@ NumberOfForwardSector
Definition: TGCId.h:51
TGCIdBase::RegionType
RegionType
Definition: TGCIdBase.h:39
MuonTGC_Cabling::TGCModuleMap::insert
void insert(int connector, TGCModuleId *moduleId)
Definition: TGCModuleMap.cxx:34
TGCDatabaseSLBToROD.h
MuonTGC_Cabling::TGCDatabaseSLBToROD
Definition: TGCDatabaseSLBToROD.h:14
TGCIdBase::ST
@ ST
Definition: TGCIdBase.h:33
MuonTGC_Cabling::TGCModuleSSW
Definition: TGCModuleSSW.h:14
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TGCIdBase::Forward
@ Forward
Definition: TGCIdBase.h:39
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
MuonTGC_Cabling::TGCId::getReadoutSector
int getReadoutSector(void) const
Definition: TGCId.h:56
MuonTGC_Cabling::TGCCableSLBToSSW::TGCCableSLBToSSW
TGCCableSLBToSSW(void)
Definition: TGCCableSLBToSSW.h:35
MuonTGC_Cabling::TGCModuleId
Definition: TGCModuleId.h:14
TGCModuleSLB.h
TGCCableSLBToSSW.h
MuonTGC_Cabling::TGCCableSLBToSSW::getModuleIn
virtual TGCModuleMap * getModuleIn(const TGCModuleId *ssw) const
Definition: TGCCableSLBToSSW.cxx:78
TGCIdBase::getId
int getId(void) const
Definition: TGCIdBase.cxx:48
TGCIdBase::SI
@ SI
Definition: TGCIdBase.h:33
MuonTGC_Cabling::TGCModuleId::isValid
virtual bool isValid(void) const
Definition: TGCModuleId.h:32
TGCIdBase::WD
@ WD
Definition: TGCIdBase.h:33