45 return Service::queryInterface(riid, ppvIF);
49 return StatusCode::SUCCESS;
58 int& maxChannelId)
const
80 std::ifstream inASDToPP;
82 inASDToPP.open(dbASDToPP.c_str());
85 return StatusCode::FAILURE;
89 return StatusCode::FAILURE;
98 inInPP.open(dbInPP.c_str());
101 return StatusCode::FAILURE;
105 return StatusCode::FAILURE;
112 std::ifstream inPPToSL;
114 inPPToSL.open(dbPPToSL.c_str());
117 return StatusCode::FAILURE;
121 return StatusCode::FAILURE;
129 std::ifstream inSLBToROD;
131 inSLBToROD.open(dbSLBToROD.c_str());
134 return StatusCode::FAILURE;
136 if(inSLBToROD.bad()) {
138 return StatusCode::FAILURE;
155 return StatusCode::FAILURE;
160 return StatusCode::SUCCESS;
163 return StatusCode::SUCCESS;
171 return StatusCode::SUCCESS;
178 double & endPhi)
const
180 int sectorInReadout = rodID - 1;
191 int & startEndcapSector,
192 int & coverageOfEndcapSector,
193 int & startForwardSector,
194 int & coverageOfForwardSector)
const
196 int sectorInReadout = rodID - 1;
199 coverageOfEndcapSector =
202 startEndcapSector = sectorInReadout * coverageOfEndcapSector;
203 coverageOfForwardSector =
206 startForwardSector = sectorInReadout *coverageOfForwardSector;
215 double & endPhi)
const
217 int sectorInReadout = srodID - 17;
228 int & startEndcapSector,
229 int & coverageOfEndcapSector,
230 int & startForwardSector,
231 int & coverageOfForwardSector)
const
233 int sectorInReadout = srodID - 17;
236 coverageOfEndcapSector =
239 startEndcapSector = sectorInReadout * coverageOfEndcapSector;
240 coverageOfForwardSector =
243 startForwardSector = sectorInReadout *coverageOfForwardSector;
255 const int channelID)
const
290 const int octantNumber,
291 const int moduleNumber,
292 const int layerNumber,
294 const int wireOrStrip,
295 const int channelNumber)
const
303 <<
" side=" << subsystemNumber <<
" octant=" << octantNumber
304 <<
" module=" << moduleNumber <<
" layer=" << layerNumber
305 <<
" chamber=" << rNumber <<
" w/s=" << wireOrStrip
306 <<
" channel=" << channelNumber);
327 const int subDetectorID,
332 bool orChannel)
const
356 if((!
status) && (!orChannel)) {
358 " getOfflineIDfromReadoutID :"
359 <<
" Cannot get OnineID for "
360 <<
" subdetectorID=" << subDetectorID
361 <<
" rodID=" << rodID
362 <<
" sswID=" << sswID
363 <<
" sbLoc=" << sbLoc
364 <<
" channel=" << channelID
365 <<
" [ Or =" << orChannel <<
"] ");
383 <<
" Cannot get OfflineID for "
384 <<
" side=" << subsystemNumber <<
" octant=" << octantNumber
385 <<
" module=" << moduleNumber <<
" layer=" << layerNumber
386 <<
" chamber=" << rNumber <<
" w/s=" << wireOrStrip
387 <<
" channel=" << channelNumber);
402 bool adChannel)
const
424 ATH_MSG_WARNING(
" Fail to getOnlineIDfromOfflineID " <<
" for OfflineID=" << offlineID);
429 <<
" offlineID=" << offlineID
431 <<
" side=" << subsystemNumber <<
" octant=" << octantNumber
432 <<
" module=" << moduleNumber <<
" layer=" << layerNumber
433 <<
" chamber=" << rNumber <<
" w/s=" << wireOrStrip
434 <<
" channel=" << channelNumber);
454 ATH_MSG_DEBUG(
" side=" << subsystemNumber <<
" octant=" << octantNumber
455 <<
" module=" << moduleNumber <<
" layer=" << layerNumber
456 <<
" chamber=" << rNumber <<
" w/s=" << wireOrStrip
457 <<
" channel=" << channelNumber);
460 <<
" Cannot get ReadoutID for "
461 <<
" side=" << subsystemNumber <<
" octant=" << octantNumber
462 <<
" module=" << moduleNumber <<
" layer=" << layerNumber
463 <<
" chamber=" << rNumber <<
" w/s=" << wireOrStrip
464 <<
" channel=" << channelNumber);
468 ATH_MSG_DEBUG(
" side=" << subsystemNumber <<
" octant=" << octantNumber
469 <<
" module=" << moduleNumber <<
" layer=" << layerNumber
470 <<
" chamber=" << rNumber <<
" w/s=" << wireOrStrip
471 <<
" channel=" << channelNumber
472 <<
"adjacent=" << adChannel);
474 <<
" rodID=" << rodID
475 <<
" sswID=" << sswID
476 <<
" channelID=" << channelID);
486 int & subSystemNumber,
492 int & channelNumber)
const
495 const int iStation =
m_idHelperSvc->tgcIdHelper().stationName(offlineId);
496 const int stationType = (iStation - 39)/2;
498 if((stationType <1) || (stationType >4))
return false;
509 const int sectorEI[] = {-1, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11,
510 12, 13, 14, 15, 16, 18, 19, 20, 22, 23,
519 sector = sectorEI[
iPhi ];
536 int max_module = (regionType==
FORWARD||stationType==4) ?
540 const int iOctant =
static_cast<int>(sector/max_module);
541 const int iModule = sector % max_module;
544 const int rIndex = std::abs(
iEta);
547 const int iGasGap =
m_idHelperSvc->tgcIdHelper().gasGap(offlineId);
551 subSystemNumber = (
iEta > 0) ? 1 : -1;
553 octantNumber = iOctant;
564 const int modmapE[7] = { -1, 0, 1, 3, 4, 6, 7 };
565 const int modmapF[4] = { -1, 2, 5, 8 };
566 const int modmapEI[4] = { -1, 9, 10, 11 };
567 const int modmapFI[4] = { -1, 12, 13, 14 };
569 if(stationType != 4) {
571 moduleNumber = modmapE[iModule+1];
574 moduleNumber = modmapF[iModule+1];
579 moduleNumber = modmapEI[iModule+1];
582 moduleNumber = modmapFI[iModule+1];
590 const int lyr_offset[5]= { 0, -1, 2, 4, 6 };
591 layerNumber = iGasGap + lyr_offset[stationType];
594 wireOrStrip =
m_idHelperSvc->tgcIdHelper().isStrip(offlineId);
604 const int OffsetForT11S = 8;
609 if((wireOrStrip ==0) && (stationType == 4)) {
653 if(!asdin.
isValid())
return false;
660 if(asdout==
nullptr)
return false;
676 const int subSystemNumber,
677 const int octantNumber,
678 const int moduleNumber,
679 const int layerNumber,
681 const int wireOrStrip,
682 const int channelNumber)
const
695 <<
" side=" << sideType <<
" octant=" << octantNumber
696 <<
" module=" << moduleNumber <<
" layer=" << layerNumber
697 <<
" chamber=" << rNumber <<
" w/s=" << signalType
698 <<
" channel=" << channelNumber);
710 <<
" side=" << sideType <<
" octant=" << octantNumber
711 <<
" module=" << moduleNumber <<
" layer=" << layerNumber
712 <<
" chamber=" << rNumber <<
" w/s=" << signalType
713 <<
" channel=" << channelNumber);
715 if(!asdout.
isValid())
return false;
722 if(!asdin || !asdin->
isValid()) {
724 <<
" Illegal AsdIn for "
725 <<
" side=" << sideType <<
" octant=" << octantNumber
726 <<
" module=" << moduleNumber <<
" layer=" << layerNumber
727 <<
" chamber=" << rNumber <<
" w/s=" << signalType
728 <<
" channel=" << channelNumber);
730 if(asdin==
nullptr)
return false;
737 std::string stationNameStr;
740 stationNameStr = (asdin->
isForward()) ?
"T1F" :
"T1E";
743 stationNameStr = (asdin->
isForward()) ?
"T2F" :
"T2E";
746 stationNameStr = (asdin->
isForward()) ?
"T3F" :
"T3E";
749 stationNameStr = (asdin->
isForward()) ?
"T4F" :
"T4E";
752 delete asdin; asdin =
nullptr;
764 const int phiIE[] = { -1, 1, 2, 3, 4, 5, 6, 7, 8, -1, 9, 10,
765 11, 12, 13, 14, 15, -1, 16, 17, 18, -1, 19, 20,
779 const int OffsetForT11S = 8;
808 offlineId =
m_idHelperSvc->tgcIdHelper().channelID(stationNameStr,
827 int & subsystemNumber,
834 bool orChannel)
const
849 if(asdout==
nullptr) {
852 <<
" Cannot get OnlineID of "
853 <<
" side=" << sideType
854 <<
" rodID=" << rodID
855 <<
" sswID=" << sswID
856 <<
" sbLoc=" << sbLoc
857 <<
" channel=" << channelID
858 <<
" [ Or =" << orChannel <<
"] ");
864 <<
" Illegal ASDout for "
865 <<
" side=" << sideType
866 <<
" rodID=" << rodID
867 <<
" sswID=" << sswID
868 <<
" sbLoc=" << sbLoc
869 <<
" channel=" << channelID
870 <<
" [ Or =" << orChannel <<
"] ");
877 subsystemNumber = (asdout->
isAside()) ? 1 : -1;
891 wireOrStrip = (asdout->
isStrip()) ? 1 : 0;
908 const int subsystemNumber,
909 const int octantNumber,
910 const int moduleNumber,
911 const int layerNumber,
913 const int wireOrStrip,
914 const int channelNumber,
915 bool adChannel)
const
937 <<
" Cannot get ASDout for "
938 <<
" side=" << sideType
939 <<
" signal=" << signalType
940 <<
" octant=" << octantNumber
941 <<
" module=" << moduleNumber
942 <<
" layer=" << layerNumber
943 <<
" chamber=" << rNumber
944 <<
" channel=" << channelNumber);
947 if(!asdout.
isValid())
return false;
963 <<
" Cannot get ReadoutID for "
964 <<
" side=" << sideType
965 <<
" signal=" << signalType
966 <<
" octant=" << octantNumber
967 <<
" module=" << moduleNumber
968 <<
" layer=" << layerNumber
969 <<
" chamber=" << rNumber
970 <<
" channel=" << channelNumber);
988 const int iStation =
m_idHelperSvc->tgcIdHelper().stationName(elementID);
989 const int stationType = (iStation - 39)/2;
1002 const int max_phi = (regionType==
FORWARD||stationType==4) ?
1006 const int sector = ((
iPhi-1)+ max_phi/24 + max_phi)%max_phi;
1007 int readoutSector =
static_cast<int>(sector/max_module);
1009 if(stationType==4) {
1010 readoutSector = (readoutSector /3);
1011 readoutSector = 3*readoutSector + 1;
1015 rodID = readoutSector +1;
1024 const int subDetectorID,
1028 const int channelID,
1029 bool orChannel)
const
1034 int maxRodId, maxSRodId, maxSswId, maxSbloc, minChannelId ,maxChannelId;
1036 minChannelId, maxChannelId);
1039 if((sswID > maxSswId) ||
1040 (channelID < minChannelId) ||
1041 (channelID > maxChannelId)) {
1043 <<
" Illeagal channel ID"
1044 <<
" subdetectorID=" << subDetectorID
1045 <<
" rodID=" << rodID
1046 <<
" sswID=" << sswID
1047 <<
" sbLoc=" << sbLoc
1048 <<
" channel=" << channelID
1049 <<
" [ Or =" << orChannel <<
"] ");
1062 <<
" Cannot get OfflineID ");
1066 elementID =
m_idHelperSvc->tgcIdHelper().elementID(offlineID);
1077 const int subsectorID,
1080 const int sbLoc)
const
1089 <<
" Cannot get SLB of "
1091 <<
" rodID=" << rodID
1092 <<
" sswID=" << sswID
1093 <<
" sbLoc=" << sbLoc);
1110 offset = numOfSector - numOfSector/24;
1120 const int subsectorID,
1123 const int sbLoc)
const
1127 bool isAside = (subsectorID==
m_AsideId);
1134 <<
" Cannot get SLB of "
1136 <<
" rodID=" << rodID
1137 <<
" sswID=" << sswID
1138 <<
" sbLoc=" << sbLoc);
1145 <<
"dynamic_cast<const MuonTGC_Cabling::TGCModuleSLB*>(slb) failed.");
1156 const int subsectorID,
1159 const int sbLoc)
const
1163 bool isAside = (subsectorID==
m_AsideId);
1169 <<
" Cannot get rxId of "
1171 <<
" rodID=" << rodID
1172 <<
" sswID=" << sswID
1173 <<
" sbLoc=" << sbLoc);
1186 const int subsectorID,
1189 const int rxId)
const
1197 <<
" Cannot get SLB of "
1199 <<
" rodID=" << rodID
1200 <<
" sswID=" << sswID
1201 <<
" rxId=" << rxId);
1218 offset = numOfSector - numOfSector/24;
1221 delete slb; slb =
nullptr;
1229 const bool isEndcap,
1230 const int moduleType,
1243 }
else if(isEndcap) {
1255 <<
" side=" << ((isAside) ?
"A" :
"C")
1256 <<
" region=" << ((isEndcap) ?
"Endcap" :
"Forward")
1257 <<
" type=" << moduleType
1261 if(!slb.
isValid())
return false;
1272 <<
" side=" << ((isAside) ?
"A" :
"C")
1273 <<
" region=" << ((isEndcap) ?
"Endcap" :
"Forward")
1274 <<
" type=" << moduleType
1277 <<
" rodID=" << rodID
1278 <<
" sswID=" << sswID
1279 <<
" sbLoc=" << sbLoc);
1281 if(!
status)
return false;
1291 const int subsectorID,
1294 const int sbLoc)
const
1297 if(!isAside && (subsectorID!=
m_CsideId)) {
1299 <<
" ERROR illegal subsectorID [="
1300 << subsectorID <<
"] ");
1303 int sectorInReadout = (rodID -1);
1309 <<
" ERROR sswID for SL should be 9 [now ="
1314 int offset, numOfSector, sector;
1315 if(0<=sbLoc && sbLoc <= 3) {
1318 offset = numOfSector - numOfSector/24;
1320 phi = (sector + sbLoc +
offset)%numOfSector+1;
1321 }
else if(sbLoc==4 || sbLoc==5) {
1324 offset = numOfSector - numOfSector/24;
1326 phi = (sector + (sbLoc-4) +
offset)% numOfSector+1;
1329 <<
" ERROR illegal sbLoc for SL [="
1340 const int subsectorID,
1343 const bool forward)
const
1346 if(!isAside && (subsectorID!=
m_CsideId)) {
1348 <<
" ERROR illegal subsectorID [="
1349 << subsectorID <<
"] ");
1353 int sectorInReadout = (srodID - 17);
1355 (sectorInReadout < 0)){
1360 int offset, tmpsector, numOfSector;
1364 offset = numOfSector - numOfSector/24;
1366 phi = (sector + tmpsector +
offset)%numOfSector + 1;
1369 offset = numOfSector - numOfSector/24;
1371 phi = (sector + tmpsector +
offset)%numOfSector + 1;
1380 const bool isEndcap,
1396 int sectorInReadout;
1399 sectorInReadout = sector %
1401 sbLoc = sectorInReadout;
1402 rodID = (sector-sectorInReadout)/
1407 sectorInReadout = sector %
1409 sbLoc = sectorInReadout +4;
1410 rodID = (sector-sectorInReadout)/
1424 const bool isEndcap,
1440 int sectorInReadout;
1443 sectorInReadout = sector %
1445 sbLoc = sectorInReadout;
1446 srodID = (sector-sectorInReadout)/
1451 sectorInReadout = sector %
1453 sbLoc = sectorInReadout;
1454 srodID = (sector-sectorInReadout)/
1468 const bool isEndcap,
1490 bool orChannel)
const
1518 int RoiRow =
static_cast<int>(roi/4);
1519 int RoiColumn =
static_cast<int>(roi%4);
1524 case 0: chip=0; hitId=1; sub=0;
break;
1525 case 1: chip=0; hitId=1; sub=1;
break;
1526 case 2: chip=0; hitId=2; sub=0;
break;
1527 case 3: chip=0; hitId=2; sub=1;
break;
1528 case 4: chip=0; hitId=3; sub=0;
break;
1529 case 5: chip=0; hitId=3; sub=1;
break;
1530 case 6: chip=0; hitId=4; sub=0;
break;
1531 case 7: chip=0; hitId=4; sub=1;
break;
1532 case 8: chip=0; hitId=5; sub=0;
break;
1533 case 9: chip=0; hitId=5; sub=1;
break;
1534 case 10: chip=0; hitId=6; sub=0;
break;
1535 case 11: chip=0; hitId=6; sub=1;
break;
1536 case 12: chip=1; hitId=1; sub=0;
break;
1537 case 13: chip=1; hitId=1; sub=1;
break;
1538 case 14: chip=1; hitId=2; sub=0;
break;
1539 case 15: chip=1; hitId=2; sub=1;
break;
1540 default:
status=
false;
break;
1544 case 0: chip=0; hitId=1; sub=1;
break;
1545 case 1: chip=1; hitId=1; sub=0;
break;
1546 case 2: chip=1; hitId=1; sub=1;
break;
1547 case 3: chip=1; hitId=2; sub=0;
break;
1548 case 4: chip=1; hitId=2; sub=1;
break;
1549 case 5: chip=1; hitId=3; sub=0;
break;
1550 case 6: chip=1; hitId=3; sub=1;
break;
1551 case 7: chip=1; hitId=4; sub=0;
break;
1552 case 8: chip=1; hitId=4; sub=1;
break;
1553 case 9: chip=1; hitId=5; sub=0;
break;
1554 case 10: chip=1; hitId=5; sub=1;
break;
1555 case 11: chip=1; hitId=6; sub=0;
break;
1556 case 12: chip=1; hitId=6; sub=1;
break;
1557 case 13: chip=2; hitId=1; sub=0;
break;
1558 case 14: chip=2; hitId=1; sub=1;
break;
1559 case 15: chip=2; hitId=2; sub=0;
break;
1560 case 16: chip=2; hitId=2; sub=1;
break;
1561 case 17: chip=2; hitId=3; sub=0;
break;
1562 case 18: chip=2; hitId=3; sub=1;
break;
1563 case 19: chip=2; hitId=4; sub=0;
break;
1564 case 20: chip=2; hitId=4; sub=1;
break;
1565 case 21: chip=2; hitId=5; sub=0;
break;
1566 case 22: chip=2; hitId=5; sub=1;
break;
1567 case 23: chip=2; hitId=6; sub=0;
break;
1568 case 24: chip=2; hitId=6; sub=1;
break;
1569 case 25: chip=3; hitId=1; sub=0;
break;
1570 case 26: chip=3; hitId=1; sub=1;
break;
1571 case 27: chip=3; hitId=2; sub=0;
break;
1572 case 28: chip=3; hitId=2; sub=1;
break;
1573 case 29: chip=3; hitId=3; sub=0;
break;
1574 case 30: chip=3; hitId=3; sub=1;
break;
1575 case 31: chip=3; hitId=4; sub=0;
break;
1576 case 32: chip=3; hitId=4; sub=1;
break;
1577 case 33: chip=3; hitId=5; sub=0;
break;
1578 case 34: chip=3; hitId=5; sub=1;
break;
1579 case 35: chip=3; hitId=6; sub=0;
break;
1580 case 36: chip=3; hitId=6; sub=1;
break;
1581 default:
status=
false;
break;
1587 case 0: chip=0; hitId=1; sub=0;
break;
1588 case 1: chip=0; hitId=1; sub=1;
break;
1589 case 2: chip=0; hitId=2; sub=0;
break;
1590 case 3: chip=0; hitId=2; sub=1;
break;
1591 default:
status=
false;
break;
1596 if(RoiRow < 5) { chip=0; hitId=1; sub=0; }
1597 else if(RoiRow < 8) { chip=0; hitId=3; sub=0; }
1598 else if(RoiRow < 12) { chip=0; hitId=5; sub=0; }
1599 else if(RoiRow < 25) { chip=1; hitId=1; sub=0; }
1600 else if(RoiRow < 37) { chip=1; hitId=5; sub=0; }
1604 if(RoiRow < 5) { chip=0; hitId=1; sub=1; }
1605 else if(RoiRow < 8) { chip=0; hitId=3; sub=1; }
1606 else if(RoiRow < 12) { chip=0; hitId=5; sub=1; }
1607 else if(RoiRow < 25) { chip=1; hitId=1; sub=1; }
1608 else if(RoiRow < 37) { chip=1; hitId=5; sub=1; }
1612 if(RoiRow < 5) { chip=0; hitId=2; sub=0; }
1613 else if(RoiRow < 8) { chip=0; hitId=4; sub=0; }
1614 else if(RoiRow < 12) { chip=0; hitId=6; sub=0; }
1615 else if(RoiRow < 25) { chip=1; hitId=2; sub=0; }
1616 else if(RoiRow < 37) { chip=1; hitId=6; sub=0; }
1620 if(RoiRow < 5) { chip=0; hitId=2; sub=1; }
1621 else if(RoiRow < 8) { chip=0; hitId=4; sub=1; }
1622 else if(RoiRow < 12) { chip=0; hitId=6; sub=1; }
1623 else if(RoiRow < 25) { chip=1; hitId=2; sub=1; }
1624 else if(RoiRow < 37) { chip=1; hitId=6; sub=1; }
1627 default:
status=
false;
break;
1646 int sub_strip)
const
1655 RoiRow = 12*chip_wire + 2*(hitId_wire - 1) + sub_wire;
1656 RoiColumn = 2*((hitId_strip - 1)%2) + sub_strip;
1657 }
else if(!isForward) {
1658 RoiColumn = 2*((hitId_strip - 1)%2) + sub_strip;
1660 case 0: RoiRow=0;
break;
1663 case 3: RoiRow=12*(chip_wire-1) + 2*(hitId_wire - 1) + sub_wire + 1;
break;
1668 roi = 4*RoiRow + RoiColumn;
1692 if(
index==0 && chip==0) hitId=1;
1693 else if(
index==0 && chip==1) hitId++;
1694 else if(
index==1 && chip==0) {chip=2; hitId++;}
1695 else if(
index==1 && chip==1) {chip=3; hitId++;}
1721 case 0:
index=0; hitId=5;
break;
1722 case 1:
index=0; hitId--;
break;
1723 case 2:
index=1; chip=0; hitId--;
break;
1724 case 3:
index=1; chip=1; hitId--;
break;
1736 const int subDetectorID,
1738 const int sectorInReadout,
1740 const bool isForward,
1744 const int pos)
const
1784 if(!
status)
return false;
1799 int & subDetectorID,
1801 int & sectorInReadout,
1819 if(!
status)
return false;
1841 if(!
status)
return false;
1853 const int subDetectorID,
1876 if(!
status)
return false;
1889 int & subDetectorID,
1905 if(!
status)
return false;