ATLAS Offline Software
TGCCableHPBToSL.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 
14  : TGCCable(TGCCable::HPBToSL) {
15  m_database[TGCId::Endcap][TGCId::Wire] = std::make_unique<TGCDatabasePPToSL>(filename,"HPB EW");
16  m_database[TGCId::Endcap][TGCId::Strip] = std::make_unique<TGCDatabasePPToSL>(filename,"HPB ES");
17  m_database[TGCId::Forward][TGCId::Wire] = std::make_unique<TGCDatabasePPToSL>(filename,"HPB FW");
18  m_database[TGCId::Forward][TGCId::Strip] = std::make_unique<TGCDatabasePPToSL>(filename,"HPB FS");
19 }
20 
22  if(moduleId){
23  if(moduleId->getModuleIdType()==TGCModuleId::HPB)
24  return getModuleOut(moduleId);
25  if(moduleId->getModuleIdType()==TGCModuleId::SL)
26  return getModuleIn(moduleId);
27  }
28  return nullptr;
29 }
30 
32  if(sl->isValid()==false) return nullptr;
33 
34  TGCDatabase* wireP = m_database[sl->getRegionType()][TGCId::Wire].get();
35  TGCDatabase* stripP = m_database[sl->getRegionType()][TGCId::Strip].get();
36 
37  TGCModuleMap* mapId = nullptr;
38  const int wireMaxEntry = wireP->getMaxEntry();
39  for(int i=0; i<wireMaxEntry; i++){
40  int id = wireP->getEntry(i,0);
41  int block = wireP->getEntry(i,1);
42  TGCModuleHPB* hpb = new TGCModuleHPB(sl->getSideType(),
44  sl->getRegionType(),
45  sl->getSector(),
46  id);
47  if(mapId==nullptr) mapId = new TGCModuleMap();
48  mapId->insert(block,hpb);
49  }
50 
51  const int stripMaxEntry = stripP->getMaxEntry();
52  for(int i=0; i<stripMaxEntry; i++){
53  int id = stripP->getEntry(i,0);
54  int block = stripP->getEntry(i,1);
55  TGCModuleHPB* hpb = new TGCModuleHPB(sl->getSideType(),
57  sl->getRegionType(),
58  sl->getSector(),
59  id);
60  if(mapId==nullptr) mapId = new TGCModuleMap();
61  mapId->insert(block,hpb);
62  }
63 
64  return mapId;
65 }
66 
68  if(hpb->isValid()==false) return nullptr;
69 
70  const int hpbId = hpb->getId();
71 
72  TGCDatabase* databaseP = m_database[hpb->getRegionType()][hpb->getSignalType()].get();
73 
74  TGCModuleMap* mapId = nullptr;
75  const int MaxEntry = databaseP->getMaxEntry();
76  for(int i=0; i<MaxEntry; i++){
77  if(databaseP->getEntry(i,0)==hpbId)
78  {
79  int block = databaseP->getEntry(i,1);
80  TGCModuleSL* sl = new TGCModuleSL(hpb->getSideType(),
81  hpb->getRegionType(),
82  hpb->getSector());
83 
84  mapId = new TGCModuleMap();
85  mapId->insert(block,sl);
86  break;
87  }
88  }
89 
90  return mapId;
91 }
92 
93 } //end of namespace
TGCModuleSL.h
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::TGCId::getSignalType
SignalType getSignalType(void) const
Definition: TGCId.h:124
MuonTGC_Cabling::TGCId::getRegionType
RegionType getRegionType(void) const
Definition: TGCId.h:126
MuonTGC_Cabling::TGCModuleMap
Definition: TGCModuleMap.h:16
MuonTGC_Cabling::TGCModuleSL
Definition: TGCModuleSL.h:14
MuonTGC_Cabling::TGCCableHPBToSL::getModuleIn
virtual TGCModuleMap * getModuleIn(const TGCModuleId *sl) const
Definition: TGCCableHPBToSL.cxx:31
MuonTGC_Cabling::TGCCableHPBToSL::m_database
std::array< std::array< std::unique_ptr< TGCDatabase >, TGCId::MaxSignalType >, TGCId::MaxRegionType > m_database
Definition: TGCCableHPBToSL.h:31
MuonTGC_Cabling::TGCDatabase
Definition: TGCDatabase.h:15
MuonTGC_Cabling::TGCModuleHPB
Definition: TGCModuleHPB.h:14
MuonTGC_Cabling::TGCDatabase::getEntry
virtual int getEntry(int entry, int column) const
Definition: TGCDatabase.cxx:28
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::TGCId::Strip
@ Strip
Definition: TGCId.h:49
MuonTGC_Cabling::TGCCable
Definition: TGCCable.h:16
MuonTGC_Cabling::TGCCableHPBToSL::getModuleOut
virtual TGCModuleMap * getModuleOut(const TGCModuleId *hpt) const
Definition: TGCCableHPBToSL.cxx:67
MuonTGC_Cabling::TGCCableHPBToSL::TGCCableHPBToSL
TGCCableHPBToSL(void)
Definition: TGCCableHPBToSL.h:28
MuonTGC_Cabling::TGCModuleId::SL
@ SL
Definition: TGCModuleId.h:16
TGCDatabasePPToSL.h
MuonTGC_Cabling::TGCId::Endcap
@ Endcap
Definition: TGCId.h:53
MuonTGC_Cabling::TGCModuleId::HPB
@ HPB
Definition: TGCModuleId.h:16
MuonTGC_Cabling::TGCModuleMap::insert
void insert(int connector, TGCModuleId *moduleId)
Definition: TGCModuleMap.cxx:34
TGCCableHPBToSL.h
MuonTGC_Cabling::TGCId::getSector
virtual int getSector() const
Definition: TGCId.h:130
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
MuonTGC_Cabling::TGCId::Wire
@ Wire
Definition: TGCId.h:49
MuonTGC_Cabling::TGCCableHPBToSL::getModule
virtual TGCModuleMap * getModule(const TGCModuleId *moduleId) const
Definition: TGCCableHPBToSL.cxx:21
MuonTGC_Cabling::TGCModuleId
Definition: TGCModuleId.h:13
MuonTGC_Cabling::TGCId::Forward
@ Forward
Definition: TGCId.h:53
MuonTGC_Cabling::TGCModuleId::isValid
virtual bool isValid(void) const
Definition: TGCModuleId.h:34
TGCModuleHPB.h