17 m_database[TGCId::Endcap][TGCId::WT] =
18 std::make_unique<TGCDatabasePPToSL>(filename,
"SB EWT");
19 m_database[TGCId::Endcap][TGCId::WD] =
20 std::make_unique<TGCDatabasePPToSL>(filename,
"SB EWD");
21 m_database[TGCId::Endcap][TGCId::ST] =
22 std::make_unique<TGCDatabasePPToSL>(filename,
"SB EST");
23 m_database[TGCId::Endcap][TGCId::SD] =
24 std::make_unique<TGCDatabasePPToSL>(filename,
"SB ESD");
25 m_database[TGCId::Forward][TGCId::WT] =
26 std::make_unique<TGCDatabasePPToSL>(filename,
"SB FWT");
27 m_database[TGCId::Forward][TGCId::WD] =
28 std::make_unique<TGCDatabasePPToSL>(filename,
"SB FWD");
29 m_database[TGCId::Forward][TGCId::ST] =
30 std::make_unique<TGCDatabasePPToSL>(filename,
"SB FST");
31 m_database[TGCId::Forward][TGCId::SD] =
32 std::make_unique<TGCDatabasePPToSL>(filename,
"SB FSD");
35TGCCableSLBToHPB::~TGCCableSLBToHPB() =
default;
64 if (orChannel || hpbin.
isValid() ==
false) {
69 std::unique_ptr<TGCModuleId> hpb{hpbin.
getModule()};
82 if (numOfBlock == 0) {
92 int nSlb = hpbin.
getChannel() / (numOfBlock * 2);
93 int port = blockInHPB * slbInBlock + nSlb;
101 int nInSlb = hpbin.
getChannel() / (numOfBlock * 2);
102 int blockInSlb = nInSlb / 2;
103 int nInBlock = nInSlb % 2;
104 int channel = (chInBlock / 2) * nInBlock;
106 return std::make_unique<TGCChannelSLBOut>(
107 slb->getSideType(), slb->getModuleType(), slb->getRegionType(),
108 slb->getSector(), slb->getId(), blockInSlb, channel);
113 bool orChannel)
const {
114 if (orChannel || hpbin.
isValid() ==
false) {
118 std::unique_ptr<TGCModuleId> hpb{
134 if (numOfBlock == 0) {
142 std::unique_ptr<TGCModuleId> slb{};
151 switch (moduleType) {
157 port = blockInHPB * slbInBlock + nSlb;
159 blockInSlb = (hpbin.
getChannel() - nSlb * (numOfBlock * 2)) / 2;
160 posInHpb = (hpbin.
getChannel() - (numOfBlock * 2) * nSlb) % 2;
161 channel = (chInBlock / 2) * posInHpb;
168 port = blockInHPB * slbInBlock + nSlb;
171 blockInSlb = (hpbin.
getChannel() - nSlb * (numOfBlock * 2)) / 2;
172 posInHpb = (hpbin.
getChannel() - (numOfBlock * 2) * nSlb) % 2;
173 channel = (chInBlock / 2) * posInHpb;
178 if (blockInHPB == 0 && hpbin.
getChannel() < numOfBlock) {
185 blockInSlb = (hpbin.
getChannel()) % numOfBlock;
186 if (blockInHPB == 1 && hpbin.
getChannel() >= numOfBlock) {
187 blockInSlb = blockInSlb + numOfBlock / 2;
200 const int offset = 6;
203 int SLBID = slb->getId();
204 if ((chInBlock * blockInSlb + channel) > chInBlock * numOfBlock) {
206 channel = channel % chInBlock;
208 }
else if (channel > chInBlock) {
209 channel = channel % chInBlock;
213 return std::make_unique<TGCChannelSLBOut>(
214 slb->getSideType(), moduleType, slb->getRegionType(), slb->getSector(),
215 SLBID, blockInSlb, channel);
220 if (orChannel || slbout.
isValid() ==
false ||
226 std::unique_ptr<TGCModuleId> slb{slbout.
getModule()};
239 int port = mapId.
begin()->first;
240 std::unique_ptr<TGCModuleId> hpb = mapId.
popModule(port);
246 if (chInBlock <= 1) {
252 int block = port / slbInBlock;
253 int hitId = (port % slbInBlock) * 2 + slbout.
getBlock();
254 int pos = slbout.
getChannel() / (chInBlock / 2);
255 int channel = hitId * 2 + pos;
257 return std::make_unique<TGCChannelHPBIn>(
258 hpb->getSideType(), hpb->getSignalType(), hpb->getRegionType(),
259 hpb->getSector(), hpb->getId(), block, channel);
263 if (hpbin.
isValid() ==
false) {
266 const int hpbId = hpbin.
getId();
287 const int doubletMaxEntry = doubletP->
getMaxEntry();
288 for (
int i = 0; i < doubletMaxEntry; i++) {
289 if (doubletP->
getEntry(i, 1) == hpbId) {
291 int block = doubletP->
getEntry(i, 2);
292 auto slb = std::make_unique<TGCModuleSLB>(
296 mapId.
insert(block, std::move(slb));
299 const int tripletMaxEntry = tripletP->
getMaxEntry();
300 for (
int i = 0; i < tripletMaxEntry; i++) {
301 if (tripletP->
getEntry(i, 1) == hpbId) {
303 int block = -tripletP->
getEntry(i, 2);
304 auto slb = std::make_unique<TGCModuleSLB>(
308 mapId.
insert(block, std::move(slb));
317 if (hpbin.
isValid() ==
false) {
321 const int hpbId = hpbin.
getId();
328 for (
int i = 0; i < MaxEntry; i++) {
329 if (databaseP->
getEntry(i, 1) == hpbId) {
332 switch (moduleType) {
340 block = -1 * databaseP->
getEntry(i, 2);
346 auto slb = std::make_unique<TGCModuleSLB>(
350 mapId.
insert(block, std::move(slb));
362 const int slbId = slb.
getId();
369 for (
int i = 0; i < MaxEntry; i++) {
370 if (databaseP->
getEntry(i, 0) == slbId) {
372 int block = databaseP->
getEntry(i, 2);
377 auto hpb = std::make_unique<TGCModuleHPB>(
381 mapId.
insert(block, std::move(hpb));
bool getModule(std::istream &s, RegSelModule &m)
std::unique_ptr< TGCChannelId > getChannel(const TGCChannelId &channelId, bool orChannel=false) const
TGCModuleMap getModuleIn(const TGCModuleId &hpb) const
std::unique_ptr< TGCChannelId > getChannelOut(const TGCChannelId &slbout, bool orChannel=false) const
std::unique_ptr< TGCChannelId > getChannelIn(const TGCChannelId &hpbin, bool orChannel=false) const
std::unique_ptr< TGCChannelId > getChannelInforHPB(const TGCChannelId &hpbin, TGCId::ModuleType moduleType, bool orChannel=false) const
std::array< std::array< std::unique_ptr< TGCDatabase >, TGCId::MaxModuleType >, TGCId::MaxRegionType > m_database
TGCModuleMap getModule(const TGCModuleId &moduleId) const
TGCCableSLBToHPB()=delete
TGCModuleMap getModuleInforHPB(const TGCModuleId &hpb, TGCId::ModuleType moduleType) const
TGCModuleMap getModuleOut(const TGCModuleId &slb) const
TGCCable(CableType type=NoCableType)
static int getSlbInBlock()
virtual std::unique_ptr< TGCModuleId > getModule() const
virtual bool isValid() const
static int getNumberOfBlock(TGCId::ModuleType moduleType)
static int getChannelInBlock(TGCId::ModuleType moduleType)
virtual int getMaxEntry() const
virtual int getEntry(int entry, int column) const
ModuleType getModuleType() const
RegionType getRegionType() const
virtual int getSector() const
MultipletType getMultipletType() const
SideType getSideType() const
SignalType getSignalType() const
ModuleIdType getModuleIdType() const
virtual bool isValid() const
Store_t::const_iterator begin() const
Returns the begin iterator of the underlying map.
void insert(int connector, std::unique_ptr< TGCModuleId > moduleId)
std::unique_ptr< TGCModuleId > popModule(const int connector)
Return a certain module and remove it from the map.