26 declareProperty(
"AsideId",
m_AsideId=103);
27 declareProperty(
"CsideId",
m_CsideId=104);
28 declareProperty(
"rodId",
m_rodId);
29 declareProperty(
"databaseASDToPP",
m_databaseASDToPP=
"MuonTGC_Cabling_ASD2PP.db");
30 declareProperty(
"databaseInPP",
m_databaseInPP=
"MuonTGC_Cabling_PP.db");
31 declareProperty(
"databasePPToSL",
m_databasePPToSL=
"MuonTGC_Cabling_PP2SL.db");
38 if(MuonTGC_CablingSvc::interfaceID().versionMatch(riid)) {
41 return Service::queryInterface(riid, ppvIF);
45 return StatusCode::SUCCESS;
54 int& maxChannelId)
const
69 SmartIF<StoreGateSvc>
detStore{serviceLocator()->service(
"DetectorStore")};
76 std::ifstream inASDToPP;
78 inASDToPP.open(dbASDToPP.c_str());
81 return StatusCode::FAILURE;
85 return StatusCode::FAILURE;
94 inInPP.open(dbInPP.c_str());
97 return StatusCode::FAILURE;
101 return StatusCode::FAILURE;
108 std::ifstream inPPToSL;
110 inPPToSL.open(dbPPToSL.c_str());
113 return StatusCode::FAILURE;
117 return StatusCode::FAILURE;
125 std::ifstream inSLBToROD;
127 inSLBToROD.open(dbSLBToROD.c_str());
130 return StatusCode::FAILURE;
132 if(inSLBToROD.bad()) {
134 return StatusCode::FAILURE;
157 return StatusCode::SUCCESS;
160 return StatusCode::SUCCESS;
168 return StatusCode::SUCCESS;
175 double & endPhi)
const
177 int sectorInReadout = rodID - 1;
188 int & startEndcapSector,
189 int & coverageOfEndcapSector,
190 int & startForwardSector,
191 int & coverageOfForwardSector)
const
193 int sectorInReadout = rodID - 1;
196 coverageOfEndcapSector =
199 startEndcapSector = sectorInReadout * coverageOfEndcapSector;
200 coverageOfForwardSector =
203 startForwardSector = sectorInReadout *coverageOfForwardSector;
212 double & endPhi)
const
214 int sectorInReadout = srodID - 17;
225 int & startEndcapSector,
226 int & coverageOfEndcapSector,
227 int & startForwardSector,
228 int & coverageOfForwardSector)
const
230 int sectorInReadout = srodID - 17;
233 coverageOfEndcapSector =
236 startEndcapSector = sectorInReadout * coverageOfEndcapSector;
237 coverageOfForwardSector =
240 startForwardSector = sectorInReadout *coverageOfForwardSector;
252 const int channelID)
const
287 const int octantNumber,
288 const int moduleNumber,
289 const int layerNumber,
291 const int wireOrStrip,
292 const int channelNumber)
const
300 <<
" side=" << subsystemNumber <<
" octant=" << octantNumber
301 <<
" module=" << moduleNumber <<
" layer=" << layerNumber
302 <<
" chamber=" << rNumber <<
" w/s=" << wireOrStrip
303 <<
" channel=" << channelNumber);
324 const int subDetectorID,
329 bool orChannel)
const
353 if((!
status) && (!orChannel)) {
355 " getOfflineIDfromReadoutID :"
356 <<
" Cannot get OnineID for "
357 <<
" subdetectorID=" << subDetectorID
358 <<
" rodID=" << rodID
359 <<
" sswID=" << sswID
360 <<
" sbLoc=" << sbLoc
361 <<
" channel=" << channelID
362 <<
" [ Or =" << orChannel <<
"] ");
380 <<
" Cannot get OfflineID for "
381 <<
" side=" << subsystemNumber <<
" octant=" << octantNumber
382 <<
" module=" << moduleNumber <<
" layer=" << layerNumber
383 <<
" chamber=" << rNumber <<
" w/s=" << wireOrStrip
384 <<
" channel=" << channelNumber);
399 bool adChannel)
const
421 ATH_MSG_WARNING(
" Fail to getOnlineIDfromOfflineID " <<
" for OfflineID=" << offlineID);
426 <<
" offlineID=" << offlineID
428 <<
" side=" << subsystemNumber <<
" octant=" << octantNumber
429 <<
" module=" << moduleNumber <<
" layer=" << layerNumber
430 <<
" chamber=" << rNumber <<
" w/s=" << wireOrStrip
431 <<
" channel=" << channelNumber);
451 ATH_MSG_DEBUG(
" side=" << subsystemNumber <<
" octant=" << octantNumber
452 <<
" module=" << moduleNumber <<
" layer=" << layerNumber
453 <<
" chamber=" << rNumber <<
" w/s=" << wireOrStrip
454 <<
" channel=" << channelNumber);
457 <<
" Cannot get ReadoutID for "
458 <<
" side=" << subsystemNumber <<
" octant=" << octantNumber
459 <<
" module=" << moduleNumber <<
" layer=" << layerNumber
460 <<
" chamber=" << rNumber <<
" w/s=" << wireOrStrip
461 <<
" channel=" << channelNumber);
465 ATH_MSG_DEBUG(
" side=" << subsystemNumber <<
" octant=" << octantNumber
466 <<
" module=" << moduleNumber <<
" layer=" << layerNumber
467 <<
" chamber=" << rNumber <<
" w/s=" << wireOrStrip
468 <<
" channel=" << channelNumber
469 <<
"adjacent=" << adChannel);
471 <<
" rodID=" << rodID
472 <<
" sswID=" << sswID
473 <<
" channelID=" << channelID);
483 int & subSystemNumber,
489 int & channelNumber)
const
492 const int iStation =
m_idHelperSvc->tgcIdHelper().stationName(offlineId);
493 const int stationType = (iStation - 39)/2;
495 if((stationType <1) || (stationType >4))
return false;
506 const int sectorEI[] = {-1, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11,
507 12, 13, 14, 15, 16, 18, 19, 20, 22, 23,
516 sector = sectorEI[
iPhi ];
533 int max_module = (regionType==
FORWARD||stationType==4) ?
537 const int iOctant =
static_cast<int>(sector/max_module);
538 const int iModule = sector % max_module;
541 const int rIndex = std::abs(
iEta);
544 const int iGasGap =
m_idHelperSvc->tgcIdHelper().gasGap(offlineId);
548 subSystemNumber = (
iEta > 0) ? 1 : -1;
550 octantNumber = iOctant;
561 const int modmapE[7] = { -1, 0, 1, 3, 4, 6, 7 };
562 const int modmapF[4] = { -1, 2, 5, 8 };
563 const int modmapEI[4] = { -1, 9, 10, 11 };
564 const int modmapFI[4] = { -1, 12, 13, 14 };
566 if(stationType != 4) {
568 moduleNumber = modmapE[iModule+1];
571 moduleNumber = modmapF[iModule+1];
576 moduleNumber = modmapEI[iModule+1];
579 moduleNumber = modmapFI[iModule+1];
587 const int lyr_offset[5]= { 0, -1, 2, 4, 6 };
588 layerNumber = iGasGap + lyr_offset[stationType];
591 wireOrStrip =
m_idHelperSvc->tgcIdHelper().isStrip(offlineId);
601 const int OffsetForT11S = 8;
606 if((wireOrStrip ==0) && (stationType == 4)) {
650 if(!asdin.
isValid())
return false;
657 if(asdout==
nullptr)
return false;
673 const int subSystemNumber,
674 const int octantNumber,
675 const int moduleNumber,
676 const int layerNumber,
678 const int wireOrStrip,
679 const int channelNumber)
const
692 <<
" side=" << sideType <<
" octant=" << octantNumber
693 <<
" module=" << moduleNumber <<
" layer=" << layerNumber
694 <<
" chamber=" << rNumber <<
" w/s=" << signalType
695 <<
" channel=" << channelNumber);
707 <<
" side=" << sideType <<
" octant=" << octantNumber
708 <<
" module=" << moduleNumber <<
" layer=" << layerNumber
709 <<
" chamber=" << rNumber <<
" w/s=" << signalType
710 <<
" channel=" << channelNumber);
712 if(!asdout.
isValid())
return false;
719 if(!asdin || !asdin->
isValid()) {
721 <<
" Illegal AsdIn for "
722 <<
" side=" << sideType <<
" octant=" << octantNumber
723 <<
" module=" << moduleNumber <<
" layer=" << layerNumber
724 <<
" chamber=" << rNumber <<
" w/s=" << signalType
725 <<
" channel=" << channelNumber);
727 if(asdin==
nullptr)
return false;
734 std::string stationNameStr;
737 stationNameStr = (asdin->
isForward()) ?
"T1F" :
"T1E";
740 stationNameStr = (asdin->
isForward()) ?
"T2F" :
"T2E";
743 stationNameStr = (asdin->
isForward()) ?
"T3F" :
"T3E";
746 stationNameStr = (asdin->
isForward()) ?
"T4F" :
"T4E";
749 delete asdin; asdin =
nullptr;
761 const int phiIE[] = { -1, 1, 2, 3, 4, 5, 6, 7, 8, -1, 9, 10,
762 11, 12, 13, 14, 15, -1, 16, 17, 18, -1, 19, 20,
776 const int OffsetForT11S = 8;
805 offlineId =
m_idHelperSvc->tgcIdHelper().channelID(stationNameStr,
824 int & subsystemNumber,
831 bool orChannel)
const
846 if(asdout==
nullptr) {
849 <<
" Cannot get OnlineID of "
850 <<
" side=" << sideType
851 <<
" rodID=" << rodID
852 <<
" sswID=" << sswID
853 <<
" sbLoc=" << sbLoc
854 <<
" channel=" << channelID
855 <<
" [ Or =" << orChannel <<
"] ");
861 <<
" Illegal ASDout for "
862 <<
" side=" << sideType
863 <<
" rodID=" << rodID
864 <<
" sswID=" << sswID
865 <<
" sbLoc=" << sbLoc
866 <<
" channel=" << channelID
867 <<
" [ Or =" << orChannel <<
"] ");
874 subsystemNumber = (asdout->
isAside()) ? 1 : -1;
888 wireOrStrip = (asdout->
isStrip()) ? 1 : 0;
905 const int subsystemNumber,
906 const int octantNumber,
907 const int moduleNumber,
908 const int layerNumber,
910 const int wireOrStrip,
911 const int channelNumber,
912 bool adChannel)
const
934 <<
" Cannot get ASDout for "
935 <<
" side=" << sideType
936 <<
" signal=" << signalType
937 <<
" octant=" << octantNumber
938 <<
" module=" << moduleNumber
939 <<
" layer=" << layerNumber
940 <<
" chamber=" << rNumber
941 <<
" channel=" << channelNumber);
944 if(!asdout.
isValid())
return false;
960 <<
" Cannot get ReadoutID for "
961 <<
" side=" << sideType
962 <<
" signal=" << signalType
963 <<
" octant=" << octantNumber
964 <<
" module=" << moduleNumber
965 <<
" layer=" << layerNumber
966 <<
" chamber=" << rNumber
967 <<
" channel=" << channelNumber);
985 const int iStation =
m_idHelperSvc->tgcIdHelper().stationName(elementID);
986 const int stationType = (iStation - 39)/2;
999 const int max_phi = (regionType==
FORWARD||stationType==4) ?
1003 const int sector = ((
iPhi-1)+ max_phi/24 + max_phi)%max_phi;
1004 int readoutSector =
static_cast<int>(sector/max_module);
1006 if(stationType==4) {
1007 readoutSector = (readoutSector /3);
1008 readoutSector = 3*readoutSector + 1;
1012 rodID = readoutSector +1;
1021 const int subDetectorID,
1025 const int channelID,
1026 bool orChannel)
const
1031 int maxRodId, maxSRodId, maxSswId, maxSbloc, minChannelId ,maxChannelId;
1033 minChannelId, maxChannelId);
1036 if((sswID > maxSswId) ||
1037 (channelID < minChannelId) ||
1038 (channelID > maxChannelId)) {
1040 <<
" Illeagal channel ID"
1041 <<
" subdetectorID=" << subDetectorID
1042 <<
" rodID=" << rodID
1043 <<
" sswID=" << sswID
1044 <<
" sbLoc=" << sbLoc
1045 <<
" channel=" << channelID
1046 <<
" [ Or =" << orChannel <<
"] ");
1059 <<
" Cannot get OfflineID ");
1063 elementID =
m_idHelperSvc->tgcIdHelper().elementID(offlineID);
1074 const int subsectorID,
1077 const int sbLoc)
const
1086 <<
" Cannot get SLB of "
1088 <<
" rodID=" << rodID
1089 <<
" sswID=" << sswID
1090 <<
" sbLoc=" << sbLoc);
1107 offset = numOfSector - numOfSector/24;
1117 const int subsectorID,
1120 const int sbLoc)
const
1124 bool isAside = (subsectorID==
m_AsideId);
1131 <<
" Cannot get SLB of "
1133 <<
" rodID=" << rodID
1134 <<
" sswID=" << sswID
1135 <<
" sbLoc=" << sbLoc);
1142 <<
"dynamic_cast<const MuonTGC_Cabling::TGCModuleSLB*>(slb) failed.");
1153 const int subsectorID,
1156 const int sbLoc)
const
1160 bool isAside = (subsectorID==
m_AsideId);
1166 <<
" Cannot get rxId of "
1168 <<
" rodID=" << rodID
1169 <<
" sswID=" << sswID
1170 <<
" sbLoc=" << sbLoc);
1183 const int subsectorID,
1186 const int rxId)
const
1194 <<
" Cannot get SLB of "
1196 <<
" rodID=" << rodID
1197 <<
" sswID=" << sswID
1198 <<
" rxId=" << rxId);
1215 offset = numOfSector - numOfSector/24;
1218 delete slb; slb =
nullptr;
1226 const bool isEndcap,
1227 const int moduleType,
1240 }
else if(isEndcap) {
1252 <<
" side=" << ((isAside) ?
"A" :
"C")
1253 <<
" region=" << ((isEndcap) ?
"Endcap" :
"Forward")
1254 <<
" type=" << moduleType
1258 if(!slb.
isValid())
return false;
1269 <<
" side=" << ((isAside) ?
"A" :
"C")
1270 <<
" region=" << ((isEndcap) ?
"Endcap" :
"Forward")
1271 <<
" type=" << moduleType
1274 <<
" rodID=" << rodID
1275 <<
" sswID=" << sswID
1276 <<
" sbLoc=" << sbLoc);
1278 if(!
status)
return false;
1288 const int subsectorID,
1291 const int sbLoc)
const
1294 if(!isAside && (subsectorID!=
m_CsideId)) {
1296 <<
" ERROR illegal subsectorID [="
1297 << subsectorID <<
"] ");
1300 int sectorInReadout = (rodID -1);
1306 <<
" ERROR sswID for SL should be 9 [now ="
1311 int offset, numOfSector, sector;
1312 if(0<=sbLoc && sbLoc <= 3) {
1315 offset = numOfSector - numOfSector/24;
1317 phi = (sector + sbLoc +
offset)%numOfSector+1;
1318 }
else if(sbLoc==4 || sbLoc==5) {
1321 offset = numOfSector - numOfSector/24;
1323 phi = (sector + (sbLoc-4) +
offset)% numOfSector+1;
1326 <<
" ERROR illegal sbLoc for SL [="
1337 const int subsectorID,
1340 const bool forward)
const
1343 if(!isAside && (subsectorID!=
m_CsideId)) {
1345 <<
" ERROR illegal subsectorID [="
1346 << subsectorID <<
"] ");
1350 int sectorInReadout = (srodID - 17);
1352 (sectorInReadout < 0)){
1357 int offset, tmpsector, numOfSector;
1361 offset = numOfSector - numOfSector/24;
1363 phi = (sector + tmpsector +
offset)%numOfSector + 1;
1366 offset = numOfSector - numOfSector/24;
1368 phi = (sector + tmpsector +
offset)%numOfSector + 1;
1377 const bool isEndcap,
1393 int sectorInReadout;
1396 sectorInReadout = sector %
1398 sbLoc = sectorInReadout;
1399 rodID = (sector-sectorInReadout)/
1404 sectorInReadout = sector %
1406 sbLoc = sectorInReadout +4;
1407 rodID = (sector-sectorInReadout)/
1421 const bool isEndcap,
1437 int sectorInReadout;
1440 sectorInReadout = sector %
1442 sbLoc = sectorInReadout;
1443 srodID = (sector-sectorInReadout)/
1448 sectorInReadout = sector %
1450 sbLoc = sectorInReadout;
1451 srodID = (sector-sectorInReadout)/
1465 const bool isEndcap,
1487 bool orChannel)
const
1515 int RoiRow =
static_cast<int>(roi/4);
1516 int RoiColumn =
static_cast<int>(roi%4);
1521 case 0: chip=0; hitId=1; sub=0;
break;
1522 case 1: chip=0; hitId=1; sub=1;
break;
1523 case 2: chip=0; hitId=2; sub=0;
break;
1524 case 3: chip=0; hitId=2; sub=1;
break;
1525 case 4: chip=0; hitId=3; sub=0;
break;
1526 case 5: chip=0; hitId=3; sub=1;
break;
1527 case 6: chip=0; hitId=4; sub=0;
break;
1528 case 7: chip=0; hitId=4; sub=1;
break;
1529 case 8: chip=0; hitId=5; sub=0;
break;
1530 case 9: chip=0; hitId=5; sub=1;
break;
1531 case 10: chip=0; hitId=6; sub=0;
break;
1532 case 11: chip=0; hitId=6; sub=1;
break;
1533 case 12: chip=1; hitId=1; sub=0;
break;
1534 case 13: chip=1; hitId=1; sub=1;
break;
1535 case 14: chip=1; hitId=2; sub=0;
break;
1536 case 15: chip=1; hitId=2; sub=1;
break;
1537 default:
status=
false;
break;
1541 case 0: chip=0; hitId=1; sub=1;
break;
1542 case 1: chip=1; hitId=1; sub=0;
break;
1543 case 2: chip=1; hitId=1; sub=1;
break;
1544 case 3: chip=1; hitId=2; sub=0;
break;
1545 case 4: chip=1; hitId=2; sub=1;
break;
1546 case 5: chip=1; hitId=3; sub=0;
break;
1547 case 6: chip=1; hitId=3; sub=1;
break;
1548 case 7: chip=1; hitId=4; sub=0;
break;
1549 case 8: chip=1; hitId=4; sub=1;
break;
1550 case 9: chip=1; hitId=5; sub=0;
break;
1551 case 10: chip=1; hitId=5; sub=1;
break;
1552 case 11: chip=1; hitId=6; sub=0;
break;
1553 case 12: chip=1; hitId=6; sub=1;
break;
1554 case 13: chip=2; hitId=1; sub=0;
break;
1555 case 14: chip=2; hitId=1; sub=1;
break;
1556 case 15: chip=2; hitId=2; sub=0;
break;
1557 case 16: chip=2; hitId=2; sub=1;
break;
1558 case 17: chip=2; hitId=3; sub=0;
break;
1559 case 18: chip=2; hitId=3; sub=1;
break;
1560 case 19: chip=2; hitId=4; sub=0;
break;
1561 case 20: chip=2; hitId=4; sub=1;
break;
1562 case 21: chip=2; hitId=5; sub=0;
break;
1563 case 22: chip=2; hitId=5; sub=1;
break;
1564 case 23: chip=2; hitId=6; sub=0;
break;
1565 case 24: chip=2; hitId=6; sub=1;
break;
1566 case 25: chip=3; hitId=1; sub=0;
break;
1567 case 26: chip=3; hitId=1; sub=1;
break;
1568 case 27: chip=3; hitId=2; sub=0;
break;
1569 case 28: chip=3; hitId=2; sub=1;
break;
1570 case 29: chip=3; hitId=3; sub=0;
break;
1571 case 30: chip=3; hitId=3; sub=1;
break;
1572 case 31: chip=3; hitId=4; sub=0;
break;
1573 case 32: chip=3; hitId=4; sub=1;
break;
1574 case 33: chip=3; hitId=5; sub=0;
break;
1575 case 34: chip=3; hitId=5; sub=1;
break;
1576 case 35: chip=3; hitId=6; sub=0;
break;
1577 case 36: chip=3; hitId=6; sub=1;
break;
1578 default:
status=
false;
break;
1584 case 0: chip=0; hitId=1; sub=0;
break;
1585 case 1: chip=0; hitId=1; sub=1;
break;
1586 case 2: chip=0; hitId=2; sub=0;
break;
1587 case 3: chip=0; hitId=2; sub=1;
break;
1588 default:
status=
false;
break;
1593 if(RoiRow < 5) { chip=0; hitId=1; sub=0; }
1594 else if(RoiRow < 8) { chip=0; hitId=3; sub=0; }
1595 else if(RoiRow < 12) { chip=0; hitId=5; sub=0; }
1596 else if(RoiRow < 25) { chip=1; hitId=1; sub=0; }
1597 else if(RoiRow < 37) { chip=1; hitId=5; sub=0; }
1601 if(RoiRow < 5) { chip=0; hitId=1; sub=1; }
1602 else if(RoiRow < 8) { chip=0; hitId=3; sub=1; }
1603 else if(RoiRow < 12) { chip=0; hitId=5; sub=1; }
1604 else if(RoiRow < 25) { chip=1; hitId=1; sub=1; }
1605 else if(RoiRow < 37) { chip=1; hitId=5; sub=1; }
1609 if(RoiRow < 5) { chip=0; hitId=2; sub=0; }
1610 else if(RoiRow < 8) { chip=0; hitId=4; sub=0; }
1611 else if(RoiRow < 12) { chip=0; hitId=6; sub=0; }
1612 else if(RoiRow < 25) { chip=1; hitId=2; sub=0; }
1613 else if(RoiRow < 37) { chip=1; hitId=6; sub=0; }
1617 if(RoiRow < 5) { chip=0; hitId=2; sub=1; }
1618 else if(RoiRow < 8) { chip=0; hitId=4; sub=1; }
1619 else if(RoiRow < 12) { chip=0; hitId=6; sub=1; }
1620 else if(RoiRow < 25) { chip=1; hitId=2; sub=1; }
1621 else if(RoiRow < 37) { chip=1; hitId=6; sub=1; }
1624 default:
status=
false;
break;
1643 int sub_strip)
const
1652 RoiRow = 12*chip_wire + 2*(hitId_wire - 1) + sub_wire;
1653 RoiColumn = 2*((hitId_strip - 1)%2) + sub_strip;
1654 }
else if(!isForward) {
1655 RoiColumn = 2*((hitId_strip - 1)%2) + sub_strip;
1657 case 0: RoiRow=0;
break;
1660 case 3: RoiRow=12*(chip_wire-1) + 2*(hitId_wire - 1) + sub_wire + 1;
break;
1665 roi = 4*RoiRow + RoiColumn;
1689 if(
index==0 && chip==0) hitId=1;
1690 else if(
index==0 && chip==1) hitId++;
1691 else if(
index==1 && chip==0) {chip=2; hitId++;}
1692 else if(
index==1 && chip==1) {chip=3; hitId++;}
1718 case 0:
index=0; hitId=5;
break;
1719 case 1:
index=0; hitId--;
break;
1720 case 2:
index=1; chip=0; hitId--;
break;
1721 case 3:
index=1; chip=1; hitId--;
break;
1733 const int subDetectorID,
1735 const int sectorInReadout,
1737 const bool isForward,
1741 const int pos)
const
1781 if(!
status)
return false;
1796 int & subDetectorID,
1798 int & sectorInReadout,
1816 if(!
status)
return false;
1838 if(!
status)
return false;
1850 const int subDetectorID,
1873 if(!
status)
return false;
1886 int & subDetectorID,
1902 if(!
status)
return false;