22constexpr std::uint16_t translateBC(
const std::uint16_t bc) {
55 for (
int ibc = 0; ibc <
NBC_TRIG; ibc++) {
57 std::ostringstream location;
66 for (
int ibc = 0; ibc <
NBC_TRIG; ibc++) {
68 std::ostringstream location;
79 return StatusCode::SUCCESS;
93 return AthAlgTool::finalize();
98 const EventContext&,
const std::vector<uint32_t>& )
const {
100 return StatusCode::FAILURE;
102template <
class ContType,
class CollType>
104 ContType& container, std::vector<std::unique_ptr<CollType>>&& coll)
const {
105 for (std::unique_ptr<CollType>& toMove : coll) {
110 auto lock = container.getWriteHandle(hash);
111 if (!
lock.alreadyPresent()) {
115 return StatusCode::SUCCESS;
119 const EventContext& ctx)
const {
125 State& state)
const {
127 const unsigned hashMax =
m_idHelperSvc->tgcIdHelper().module_hash_max();
132 ATH_CHECK(prdHandle.
record(std::make_unique<TgcPrepDataContainer>(hashMax)));
133 ATH_MSG_DEBUG(
"TGC PrepData Container recorded in StoreGate with key "
138 ATH_CHECK(prdHandle.
record(std::make_unique<TgcPrepDataContainer>(update.ptr())));
145 for (
unsigned int ibc = 0; ibc <
NBC_TRIG; ibc++) {
149 const bool externalCacheCoin =
152 if (!externalCacheCoin) {
155 handle.record(std::make_unique<TgcCoinDataContainer>(hashMax)));
161 std::make_unique<TgcCoinDataContainer>(update.ptr())));
177 return StatusCode::SUCCESS;
180 const EventContext& ctx,
181 const std::vector<IdentifierHash>& requestedIdHashVect)
const {
187 int sizeVectorRequested = requestedIdHashVect.size();
189 <<
" offline collections called");
192 std::set<const TgcRdo*> decodedRdoCollVec{}, rdoCollVec{};
193 std::array<char, 24> decodedOnlineId{};
198 "Stored empty container. Decoding TGC RDO into TGC PrepRawData is "
200 return StatusCode::SUCCESS;
206 ATH_MSG_DEBUG(
"Retrieving TGC RDO container from the store");
211 if (rdoContainer->
empty()) {
213 ATH_MSG_DEBUG(
"Empty rdo container - no tgc rdo in this event");
214 return StatusCode::SUCCESS;
218 "Not empty rdo container in this event, the container size is "
219 << rdoContainer->
size());
222 if (sizeVectorRequested != 0) {
223 unsigned int nRdo = 0;
226 for (
const IdentifierHash& offlineCollHash : requestedIdHashVect) {
228 int subDetectorId = 0;
230 m_idHelperSvc->tgcIdHelper().get_id(offlineCollHash, elementId, &tgcContext);
235 if (decodedOnlineId.at(onlineId)) {
237 << onlineId <<
" which contains hash "
238 <<
static_cast<unsigned int>(offlineCollHash)
239 <<
" is already decoded and skipped");
243 decodedOnlineId.at(onlineId) =
true;
245 for (
const TgcRdo* rdoColl : *rdoContainer) {
246 if (rdoColl->identify() == onlineId) {
247 if (!decodedRdoCollVec.count(rdoColl)) {
248 rdoCollVec.insert(rdoColl);
259 if (sizeVectorRequested != 0) {
264 for (
const TgcRdo* rdo : rdoCollVec) {
271 offlineId, rd->subDetectorId(), rd->rodId(),
272 rd->sswId(), rd->slbId(), rd->bitpos())) {
277 if (std::find(requestedIdHashVect.begin(),
278 requestedIdHashVect.end(),
279 tgcHashId) == requestedIdHashVect.end()) {
284 decodedRdoCollVec.insert(rdo);
288 for (
const TgcRdo* rdoColl : *rdoContainer) {
289 if (rdoColl->empty() || decodedRdoCollVec.count(rdoColl) ||
290 rdoCollVec.count(rdoColl)) {
293 ATH_MSG_DEBUG(
" Number of RawData in this rdo " << rdoColl->size());
297 decodedRdoCollVec.insert(rdoColl);
302 for (std::unique_ptr<TgcPrepDataCollection>& allBcColl :
307 std::sort(allBcColl->begin(), allBcColl->end(),
309 return a->identify() < b->identify();
311 for (std::size_t i = 0; i < allBcColl->size(); ++i) {
312 allBcColl->at(i)->setHashAndIndex(allBcColl->identifyHash(), i);
324 return StatusCode::SUCCESS;
329 const TgcRdo* rdoColl)
const {
336 StatusCode status = StatusCode::SUCCESS;
350 (rd.
sector() & 4) != 0) ||
358 status =
decodeSL(state, rd, rdoColl);
360 if (!status.isSuccess()) {
371 return StatusCode::SUCCESS;
375 bool isConverted{
false}, isDuplicated{
false}, isInvalid{
false};
378 <<
" rod=" << rd.
rodId() <<
" ssw="
380 <<
" bitpos=" << rd.
bitpos());
385 for (
int iOr = 0; iOr < 2; iOr++) {
407 bool show_warning_level =
true;
427 if (msgLvl(show_warning_level ? MSG::WARNING : MSG::DEBUG)) {
428 msg(show_warning_level ? MSG::WARNING : MSG::DEBUG)
429 <<
"ElementID not found for "
431 <<
" rod=" << rd.
rodId() <<
" ssw=" << rd.
sswId()
432 <<
" slb=" << rd.
slbId() <<
" bitpos=" << rd.
bitpos()
433 <<
" orFlag=" << orFlag <<
endmsg;
447 "OfflineID not found for "
449 <<
" ssw=" << rd.
sswId() <<
" slb=" << rd.
slbId()
450 <<
" bitpos=" << rd.
bitpos() <<
" orFlag=" << orFlag);
454 const std::uint16_t
bcTag = translateBC(rd.
bcTag());
462 collection = std::make_unique<TgcPrepDataCollection>(tgcHashId);
463 collection->setIdentifier(elementId);
466 std::ranges::find_if(*collection,
468 return prd->
identify() == channelId;
470 if (duplicate_itr != collection->end()) {
471 const int newBCTag = (**duplicate_itr).getBcBitMap() |
bcTag;
473 isDuplicated |= (newBCTag == (**duplicate_itr).getBcBitMap());
474 (**duplicate_itr).setBcBitMap(newBCTag);
482 "decodeHits: MuonGM::TgcReadoutElement is invalid.");
486 "TGC RDO->PrepRawdata: " <<
m_idHelperSvc->toString(channelId));
488 std::vector<Identifier> identifierList{channelId};
493 position, position, hitPos);
497 "TgcRdoToPrepDataToolMT::decodeHits Amg::Vector2D* "
502 int gasGap = idHelper.
gasGap(channelId);
503 int channel = idHelper.
channel(channelId);
513 <<
" is smaller than s_cutDropPrdsWithZeroWidth= "
518 double errPos =
width / std::sqrt(12.);
522 mat *= errPos * errPos;
525 std::make_unique<TgcPrepData>(channelId,
531 translateBC(rd.
bcTag()));
532 newPrepData->setHashAndIndex(collection->identifyHash(),
534 collection->push_back(std::move(newPrepData));
540 }
else if (isDuplicated || isInvalid) {
544 return StatusCode::SUCCESS;
560 return StatusCode::SUCCESS;
565 int tmp_slbId{0}, tmp_subMatrix{0}, tmp_position{0};
568 return StatusCode::SUCCESS;
573 tmp_subMatrix, tmp_position,
true);
576 return StatusCode::SUCCESS;
588 if (!coincollection) {
589 coincollection = std::make_unique<TgcCoinDataCollection>(tgcHashId);
590 coincollection->setIdentifier(
m_idHelperSvc->chamberId(channelIdOut));
593 int subMatrix =
static_cast<int>(rd.
subMatrix());
594 int trackletId =
static_cast<int>(2 * rd.
slbId() + subMatrix);
595 int delta =
static_cast<int>(rd.
delta());
598 for (
const TgcCoinData* tgcCoinData : *coincollection) {
600 tgcCoinData->type() &&
602 tgcCoinData->identify() &&
604 channelIdIn == tgcCoinData->channelIdIn() &&
605 trackletId == tgcCoinData->trackletId() &&
606 delta == tgcCoinData->delta() &&
607 subMatrix == tgcCoinData->sub()) {
611 return StatusCode::SUCCESS;
622 return StatusCode::SUCCESS;
626 int gasGap_o = idHelper.
gasGap(channelIdOut);
627 int channel_o = idHelper.
channel(channelIdOut);
628 double width_o = !idHelper.
isStrip(channelIdOut)
630 : descriptor_o->
stripWidth(gasGap_o, channel_o);
635 return StatusCode::SUCCESS;
640 bool onSurface_o = descriptor_o->
surface(channelIdOut)
645 "TgcRdoToPrepDataToolMT::decodeTracklet Amg::Vector2D* "
646 "hitPos_o is null.");
647 return StatusCode::SUCCESS;
655 return StatusCode::SUCCESS;
658 int gasGap_i = idHelper.
gasGap(channelIdIn);
659 int channel_i = idHelper.
channel(channelIdIn);
660 double width_i = !idHelper.
isStrip(channelIdIn)
662 : descriptor_i->
stripWidth(gasGap_i, channel_i);
667 return StatusCode::SUCCESS;
672 bool onSurface_i = descriptor_i->
surface(channelIdIn)
677 "TgcRdoToPrepDataToolMT::decodeTracklet Amg::Vector2D* "
678 "hitPos_i is null.");
679 return StatusCode::SUCCESS;
695 idHelper.
isStrip(channelIdOut),
705 coincollection->size());
706 coincollection->push_back(newCoinData);
712 return StatusCode::SUCCESS;
726 bool isForward = (rd.
slbId() % 2 == 0);
738 int slot = ((rd.
slbId() / 2) + (rd.
rodId() - 2) * 2 + 23) % 24 + 1;
740 bool isBackward =
false;
744 isBackward = !isAside;
745 }
else if (slot == 16) {
746 isBackward = isAside;
751 isBackward = (slot % 3 == 2);
753 isBackward = (slot % 3 != 2);
757 isBackward = isAside;
767 int tmpsubMatrix =
static_cast<int>(rd.
subMatrix());
771 if (tmpsubMatrix == 3) {
772 if (slot == 1 || slot == 3 || slot == 4 || slot == 5 ||
773 slot == 6 || slot == 7 || slot == 8 || slot == 10 ||
774 slot == 11 || slot == 13 || slot == 18 || slot == 19 ||
779 }
else if (tmpsubMatrix == 2) {
780 if (slot == 2 || slot == 12 || slot == 14 || slot == 15 ||
781 slot == 16 || slot == 22 || slot == 23 || slot == 24) {
811 "TgcRdoToPrepDataToolMT::decodeTrackletEIFI OfflineID not "
816 <<
" bitpos=" << bitpos <<
" isStrip=" << isStrip
817 <<
" isAside=" << isAside <<
" isForward=" << isForward
818 <<
" slot=" << slot <<
" isBackward=" << isBackward);
819 return StatusCode::SUCCESS;
830 std::unique_ptr<TgcCoinDataCollection>& coincollection =
832 if (!coincollection) {
834 std::make_unique<TgcCoinDataCollection>(tgcHashId);
835 coincollection->setIdentifier(
m_idHelperSvc->chamberId(channelIdIn));
839 for (
const TgcCoinData* tgcCoinData : *coincollection) {
841 tgcCoinData->type() &&
842 channelIdIn == tgcCoinData->channelIdIn() &&
843 static_cast<int>(rd.
subMatrix()) == tgcCoinData->sub()) {
846 return StatusCode::SUCCESS;
854 "TgcRdoToPrepDataToolMT::decodeTrackletEIFI descriptor "
857 return StatusCode::SUCCESS;
863 bool onSurface = descriptor->
surface(channelIdIn)
868 "TgcRdoToPrepDataToolMT::decodeTrackletEIFI Amg::Vector2D* "
870 return StatusCode::SUCCESS;
874 int gasGap = idHelper.
gasGap(channelIdIn);
875 int channel = idHelper.
channel(channelIdIn);
878 double localZ = (descriptor->
transform(channelIdIn).inverse() *
885 width = std::abs(stripMaxX - stripMinX);
887 int positiveOffset = +4;
888 if (isForward && (slot % 3 == 2) && channel == 28) {
893 double gangMinZ = descriptor->
gangShortWidth(gasGap, channel - 3);
894 width = std::abs(gangMaxZ - gangMinZ);
910 coincollection->size());
911 coincollection->push_back(newCoinData);
915 return StatusCode::SUCCESS;
933 "TgcRdoToPrepDataToolMT::decodeHiPt::Unknown subDetectorId!!");
934 return StatusCode::SUCCESS;
938 if (rd.
hitId() == 0) {
940 "Invalid hitId_rdo_hipt, hitId == 0!! skip to convert this RDO to "
942 return StatusCode::SUCCESS;
944 int slbsubMatrix = 0;
951 std::array<Identifier, 2> channelIdOut{};
952 std::array<int, 2> bitpos_o{}, slbchannel_o{};
953 int sswId_o{0}, sbLoc_o{0}, slbId_o{0};
956 std::array<Identifier, 4> channelIdIn{};
957 std::array<int, 4> bitpos_i{}, slbchannel_i{};
958 int sswId_i{0}, sbLoc_i{0};
960 std::array<int, 4> slbId_in{}, sbLoc_in{};
962 std::array<int, 4> gasGap_i{}, channel_i{};
963 double width_i{0.}, hit_position_i{0};
966 std::array<int, 2> gasGap_o{}, channel_o{};
967 double width_o{0.}, hit_position_o{0.};
975 found =
getHiPtIds(state, rd, sswId_o, sbLoc_o, slbId_o);
977 return StatusCode::SUCCESS;
986 for (
int i = 0; i < 2; i++) {
991 ATH_MSG_DEBUG(
"Failed to get OfflineID from ReadoutID for Pivot "
992 << (rd.
isStrip() ?
"Strip" :
"Wire") <<
".");
993 return StatusCode::SUCCESS;
1004 slbId_in, sbLoc_in, sswId_i, bitpos_o, slbchannel_o,
1008 sbLoc_i, sswId_i, bitpos_o, slbchannel_o);
1010 for (
int i = 0; i < 4; i++) {
1013 rd.
isStrip() ? sbLoc_i : sbLoc_in[i], bitpos_i[i]);
1015 ATH_MSG_DEBUG(
"Failed to get OfflineID from ReadoutID for Pivot "
1016 << (rd.
isStrip() ?
"Strip" :
"Wire") <<
".");
1017 return StatusCode::SUCCESS;
1033 std::unique_ptr<TgcCoinDataCollection>& coincollection =
1035 if (!coincollection) {
1037 std::make_unique<TgcCoinDataCollection>(tgcHashId);
1038 coincollection->setIdentifier(
1044 std::array<const MuonGM::TgcReadoutElement*, 2> descriptor_o{
1047 for (
int i = 0; i < 2; i++) {
1050 return StatusCode::SUCCESS;
1055 for (
int i = 0; i < 2; i++) {
1056 gasGap_o[i] = idHelper.
gasGap(channelIdOut[i]);
1057 channel_o[i] = idHelper.
channel(channelIdOut[i]);
1062 channel_o, width_o, hit_position_o,
1063 tmp_hitPos_o, channelIdOut_tmp);
1066 channel_o, width_o, hit_position_o,
1067 tmp_hitPos_o, channelIdOut_tmp, isBackward,
1071 return StatusCode::SUCCESS;
1076 return StatusCode::SUCCESS;
1081 return StatusCode::SUCCESS;
1088 std::array<const MuonGM::TgcReadoutElement*, 4> descriptor_i{
1093 for (
int i = 0; i < 4; i++) {
1096 return StatusCode::SUCCESS;
1099 for (
int i = 0; i < 4; i++) {
1100 gasGap_i[i] = idHelper.
gasGap(channelIdIn[i]);
1101 channel_i[i] = idHelper.
channel(channelIdIn[i]);
1106 channel_i, width_i, hit_position_i,
1107 tmp_hitPos_i, channelIdIn_tmp);
1110 channel_i, width_i, hit_position_i,
1111 tmp_hitPos_i, channelIdIn_tmp, isBackward,
1115 return StatusCode::SUCCESS;
1120 return StatusCode::SUCCESS;
1125 return StatusCode::SUCCESS;
1130 int trackletId = 2 * sbLoc_o + slbsubMatrix;
1131 int delta =
static_cast<int>(rd.
delta());
1132 int hsub =
static_cast<int>(rd.
hsub());
1133 int inner =
static_cast<int>(rd.
inner());
1136 for (
const TgcCoinData* tgcCoinData : *coincollection) {
1138 tgcCoinData->type()) &&
1139 (channelIdOut_tmp ==
1140 tgcCoinData->identify()) &&
1142 (channelIdIn_tmp == tgcCoinData->channelIdIn()) &&
1143 (trackletId == tgcCoinData->trackletId()) &&
1144 (delta == tgcCoinData->delta()) &&
1145 (hsub == tgcCoinData->sub()) &&
1146 (inner == tgcCoinData->inner())) {
1147 if (38 <= trackletId && trackletId <= 41) {
1154 return StatusCode::SUCCESS;
1158 auto hitPos_o = std::make_unique<Amg::Vector2D>(tmp_hitPos_o);
1159 auto hitPos_i = std::make_unique<Amg::Vector2D>(tmp_hitPos_i);
1162 channelIdIn_tmp, channelIdOut_tmp,
1173 hitPos_i.release(), hitPos_o.release(), width_i, width_o,
1179 coincollection->size());
1180 coincollection->push_back(newCoinData);
1186 return StatusCode::SUCCESS;
1196 if (subDetectorId !=
ASIDE && subDetectorId !=
CSIDE) {
1198 "TgcRdoToPrepDataToolMT::decodeHiPt::Unknown subDetectorId!!");
1199 return StatusCode::SUCCESS;
1202 bool isInner = ((rd.
sector() & 4) != 0);
1207 int sbLoc_o = rd.
sector() & 3;
1208 int inner = rd.
inner();
1212 bool isAside =
false;
1213 bool isEndcap =
false;
1214 if (rd.
rodId() < 13) {
1216 subDetectorId, rd.
rodId(),
1276 auto hitPos_o = std::make_unique<Amg::Vector2D>(Amg::Vector2D::Zero());
1277 auto hitPos_i = std::make_unique<Amg::Vector2D>(Amg::Vector2D::Zero());
1282 std::string stationName =
"T3E";
1290 std::unique_ptr<TgcCoinDataCollection>& coincollection =
1292 if (!coincollection) {
1294 std::make_unique<TgcCoinDataCollection>(tgcHashId);
1295 coincollection->setIdentifier(elementId);
1299 <<
phi <<
" isAside: " << isAside <<
" isEndcap: " << isEndcap
1300 <<
" subDetectorId: " << subDetectorId
1301 <<
" isStrip: " << rd.
isStrip() <<
" rodId: " << rd.
rodId()
1302 <<
" slbId: " << sbLoc_o <<
" inner:" << rd.
inner());
1320 hitPos_i.release(), hitPos_o.release(),
1328 coincollection->size());
1329 coincollection->push_back(newCoinData);
1331 ATH_MSG_DEBUG(
"coincollection->push_back done (for Inner)");
1335 return StatusCode::SUCCESS;
1340 const TgcRdo* rdoColl)
const {
1354 "TgcRdoToPrepDataToolMT::decodeSL::Unknown subDetectorId!!");
1355 return StatusCode::SUCCESS;
1360 std::array<Identifier, 3> channelId_wire{};
1361 int index_w{0}, chip_w{0}, hitId_w{0}, sub_w{0}, sswId_w{0}, sbLoc_w{0},
1363 std::array<int, 3> bitpos_w{};
1366 found =
getSLIds(state,
false, rd, channelId_wire, index_w, chip_w, hitId_w, sub_w,
1367 sswId_w, sbLoc_w, subMatrix_w, bitpos_w);
1369 return StatusCode::SUCCESS;
1372 std::array<Identifier, 3> channelId_strip{};
1373 int index_s{0}, chip_s{0}, hitId_s{0}, sub_s{0}, sswId_s{0}, sbLoc_s{0},
1375 std::array<int, 3> bitpos_s{};
1378 found =
getSLIds(state,
true, rd, channelId_strip, index_s, chip_s, hitId_s, sub_s,
1379 sswId_s, sbLoc_s, subMatrix_s, bitpos_s,
1383 return StatusCode::SUCCESS;
1397 std::unique_ptr<TgcCoinDataCollection>& coincollection =
1399 if (!coincollection) {
1401 std::make_unique<TgcCoinDataCollection>(tgcHashId);
1402 coincollection->setIdentifier(
1406 int trackletId = 2 * sbLoc_w + subMatrix_w;
1407 int trackletIdStrip = 2 * sbLoc_s + subMatrix_s;
1408 int roi =
static_cast<int>(rd.
roi());
1410 if (rd0.
rodId() > 12) {
1411 pt += (
static_cast<int>(rd.
coinflag()) << 4);
1415 bool isPositiveDeltaR =
1419 for (
const TgcCoinData* tgcCoinData : *coincollection) {
1421 channelId_wire[2] == tgcCoinData->identify() &&
1422 trackletId == tgcCoinData->trackletId() &&
1423 trackletIdStrip == tgcCoinData->trackletIdStrip() &&
1424 roi == tgcCoinData->roi() &&
pt == tgcCoinData->pt() &&
1425 veto == tgcCoinData->veto() &&
1426 isPositiveDeltaR == tgcCoinData->isPositiveDeltaR()) {
1429 return StatusCode::SUCCESS;
1434 double width_w{0.}, tmp_r{0.}, tmp_wire_z{0.};
1437 return StatusCode::SUCCESS;
1442 return StatusCode::SUCCESS;
1445 double tmp_eta = 0.;
1446 bool isGoodEta =
getEtafromRZ(tmp_r, tmp_wire_z, tmp_eta);
1449 "Conversion from r and z to eta by "
1450 "TgcRdoToPrepDataToolMT::getEtafromRZ failed.");
1451 return StatusCode::SUCCESS;
1453 if (tmp_wire_z < 0.) {
1459 double width_s{0.}, tmp_phi{0.};
1463 return StatusCode::SUCCESS;
1468 return StatusCode::SUCCESS;
1474 return StatusCode::SUCCESS;
1477 Amg::Vector3D tmp_gp(tmp_r * std::cos(tmp_phi), tmp_r * std::sin(tmp_phi),
1480 bool onSurface = descriptor_w2->
surface(channelId_wire[2])
1491 mat(0, 0) = width_w;
1492 mat(1, 1) = width_s;
1514 coincollection->size());
1515 coincollection->push_back(newCoinData);
1519 return StatusCode::SUCCESS;
1530 if (channel % 3 == 0) {
1532 }
else if (channel % 3 == 1) {
1537 return bitpos + channel / 3;
1544 if (channel % 2 == 0) {
1549 return bitpos + channel / 2;
1555 if (channel % 2 == 0) {
1560 return bitpos + channel / 2;
1591 }
else if (input == 1) {
1596 channel = 3 * (bitpos - channel) + input;
1607 channel = 2 * (bitpos - channel) + input - 1;
1615 const double z,
double&
r) {
1626 double r_tmp = std::abs(
r);
1627 double z_tmp = std::abs(
z);
1629 if ((r_tmp < std::numeric_limits<double>::epsilon()) &&
1630 (z_tmp < std::numeric_limits<double>::epsilon())) {
1634 eta = std::abs(atan2(r_tmp, z_tmp));
1643 if (!descriptor || !descriptor->
containsId(channelId)) {
1654 int& tmp_position)
const {
1656 if (tmp_subMatrix != 0 && tmp_subMatrix != 1) {
1657 ATH_MSG_DEBUG(
"getTrackletInfo: subMatrix " << tmp_subMatrix
1662 int tmp_sswId = rd.
sswId();
1663 tmp_slbId = rd.
slbId();
1666 int tmp_position_delta = tmp_position + rd.
delta();
1667 int tmp_slbType = rd.
slbType();
1671 if (tmp_subMatrix == 1) {
1675 "Expected TGC2 Strip position ("
1676 << tmp_position_delta
1677 <<
") does not exist and is changed to the edge position "
1681 ((tmp_slbId == 3) || (tmp_slbId == 11))) {
1684 <<
" doesn't exist for FWD!! (upper "
1685 "edge SLB of FWD:sbLoc3,11)");
1688 (tmp_sswId != 7) && (tmp_slbId == 9)) {
1691 <<
" doesn't exist for EWD!! (upper "
1692 "edge SLB of EWD:sbLoc9)");
1702 }
else if (tmp_position_delta < 0) {
1704 if (tmp_subMatrix == 0) {
1708 "Expected TGC2 Strip position ("
1709 << tmp_position_delta
1710 <<
") does not exist and is changed to the edge position "
1714 ((tmp_slbId == 0) || (tmp_slbId == 8))) {
1716 if (tmp_position_delta == -1) {
1721 <<
" doesn't exist for FWD!! (bottom edge "
1722 "SLB of FWD:sbLoc0,8)");
1726 (tmp_sswId != 7) && (tmp_slbId == 0)) {
1728 if (tmp_position_delta == -1) {
1733 <<
" doesn't exist for EWD!! (bottom edge "
1734 "SLB of EWD:sbLoc0)");
1746 tmp_position = tmp_position_delta;
1753 int RoiRow =
static_cast<int>(rd.
roi() / 4);
1762 (RoiRow == 3 || RoiRow == 4 ||
1763 RoiRow == 7 || RoiRow == 8 ||
1764 RoiRow == 11 || RoiRow == 12 ||
1765 RoiRow == 23 || RoiRow == 24
1773 const TgcRawData& rd,
int& slbsubMatrix, std::array<int, 2>& bitpos_o) {
1775 if ((rd.
hitId() % 2) == 1) {
1777 if ((rd.
hsub()) == 0) {
1780 }
else if ((rd.
hsub()) == 1) {
1786 if ((rd.
hsub()) == 0) {
1789 }
else if ((rd.
hsub()) == 1) {
1804 if ((rd.
chip() == 0) && (rd.
hitId() == 1) && (rd.
hsub() == 1)) {
1809 }
else if ((rd.
chip() == 3) && (rd.
hitId() == 6) &&
1815 if ((rd.
chip() == 0) && (rd.
hitId() == 1) &&
1819 }
else if ((rd.
chip() == 1) && (rd.
hitId() == 2) &&
1829 const TgcRawData& rd,
const int deltaBeforeConvert,
1830 std::array<int, 4>& bitpos_i, std::array<int, 4>& slbchannel_i,
1831 std::array<int, 4>& slbId_in, std::array<int, 4>& sbLoc_in,
int& sswId_i,
1832 const std::array<int, 2>& bitpos_o, std::array<int, 2>& slbchannel_o,
1833 const int slbId_o)
const {
1835 const int NUM_SLBID_SBLOC_OFFSET_WT =
1841 int rdochIn_max = 0;
1842 int rdochIn_min = 0;
1854 int tmp_rdochannel_i = 0;
1855 int tmp_rdochannel_i2 = 0;
1856 for (
int i = 0; i < 2; i++) {
1859 tmp_rdochannel_i =
WD_MAP_SIZE * slbId_o + slbchannel_o[i] +
1860 deltaBeforeConvert + offset_dt;
1861 if (tmp_rdochannel_i > rdochIn_max) {
1862 tmp_rdochannel_i = rdochIn_max;
1863 }
else if (tmp_rdochannel_i < rdochIn_min) {
1864 tmp_rdochannel_i = rdochIn_min;
1880 tmp_rdochannel_i2 = (tmp_rdochannel_i / 3) * 3 + 2;
1882 tmp_rdochannel_i2 = ((tmp_rdochannel_i + 1) / 3) * 3 - 1;
1885 if (tmp_rdochannel_i2 > rdochIn_max) {
1886 tmp_rdochannel_i2 = rdochIn_max;
1887 }
else if (tmp_rdochannel_i2 < rdochIn_min) {
1888 tmp_rdochannel_i2 = rdochIn_min + 2;
1892 slbId_in[i + 2] = tmp_rdochannel_i2 /
WT_MAP_SIZE;
1894 sbLoc_in[i] = slbId_in[i];
1895 sbLoc_in[i + 2] = slbId_in[i + 2];
1896 if (rd.
sector() % 2 == 1) {
1901 sbLoc_in[i] += NUM_SLBID_SBLOC_OFFSET_WT;
1902 sbLoc_in[i + 2] += NUM_SLBID_SBLOC_OFFSET_WT;
1906 slbchannel_i[i + 2] = tmp_rdochannel_i2 %
WT_MAP_SIZE;
1915 sswId_i =
static_cast<int>(rd.
sector() / 2);
1922 const TgcRawData& rd,
int& slbsubMatrix, std::array<int, 2>& bitpos_o) {
1924 if ((rd.
hitId() % 2) == 1) {
1926 if ((rd.
hsub()) == 0) {
1931 }
else if ((rd.
hsub()) == 1) {
1939 if ((rd.
hsub()) == 0) {
1944 }
else if ((rd.
hsub()) == 1) {
1954 const TgcRawData& rd,
const int deltaBeforeConvert,
1955 std::array<int, 4>& bitpos_i, std::array<int, 4>& slbchannel_i,
1956 int& sbLoc_i,
int& sswId_i,
const std::array<int, 2>& bitpos_o,
1957 std::array<int, 2>& slbchannel_o)
const {
1962 int rdochIn_min = 0;
1964 if ((rd.
sector() % 2) == 0) {
1965 if (rd.
chip() == 0) {
1967 }
else if (rd.
chip() == 1) {
1971 if (rd.
chip() == 0) {
1973 }
else if (rd.
chip() == 1) {
1978 for (
int i = 0; i < 2; i++) {
1981 slbchannel_i[i] = slbchannel_o[i] + deltaBeforeConvert;
1982 if (slbchannel_i[i] > rdochIn_max) {
1983 slbchannel_i[i] = rdochIn_max;
1984 }
else if (slbchannel_i[i] < rdochIn_min) {
1985 slbchannel_i[i] = rdochIn_min;
1989 slbchannel_i[i + 2] = slbchannel_i[i] + 1;
1991 slbchannel_i[i + 2] = slbchannel_i[i] - 1;
1994 if (slbchannel_i[i + 2] > rdochIn_max) {
1995 slbchannel_i[i + 2] = rdochIn_max;
1996 }
else if (slbchannel_i[i + 2] < rdochIn_min) {
1997 slbchannel_i[i + 2] = rdochIn_min;
2007 sswId_i =
static_cast<int>(rd.
sector() / 2);
2014 const TgcRawData& rd,
const int hitId_w,
const int sub_w,
int& subMatrix_w,
2015 std::array<int, 3>& bitpos_w)
const {
2027 if (RoiRow == 0 && !isForward) {
2033 }
else if (RoiRow == 36 && !isForward) {
2039 }
else if (RoiRow == 0 && isForward) {
2045 }
else if (RoiRow == 15 && isForward) {
2052 if ((hitId_w % 2) == 0) {
2058 }
else if (sub_w == 1) {
2069 }
else if (sub_w == 1) {
2079 const int hitId_s,
const int sub_s,
int& subMatrix_s,
2080 std::array<int, 3>& bitpos_s) {
2086 if ((hitId_s % 2) == 0) {
2095 }
else if (sub_s == 1) {
2103 }
else if ((hitId_s % 2) == 1) {
2112 }
else if (sub_s == 1) {
2124 int deltaBeforeConvert = 0;
2127 switch (rd.
delta()) {
2129 deltaBeforeConvert = 6;
2132 deltaBeforeConvert = 8;
2135 deltaBeforeConvert = 10;
2138 deltaBeforeConvert = -5;
2141 deltaBeforeConvert = -7;
2144 deltaBeforeConvert = -9;
2147 deltaBeforeConvert = -12;
2150 deltaBeforeConvert = rd.
delta();
2154 switch (rd.
delta()) {
2156 deltaBeforeConvert = 12;
2159 deltaBeforeConvert = 14;
2162 deltaBeforeConvert = 16;
2165 deltaBeforeConvert = 18;
2168 deltaBeforeConvert = 20;
2171 deltaBeforeConvert = -13;
2174 deltaBeforeConvert = -15;
2177 deltaBeforeConvert = -17;
2180 deltaBeforeConvert = -19;
2183 deltaBeforeConvert = rd.
delta();
2188 return deltaBeforeConvert;
2192 bool isBackward =
false;
2215 const std::array<Identifier, 3>& channelId_wire,
double& width_wire,
2216 double& r_wire,
double& z_wire)
const {
2220 std::array<const MuonGM::TgcReadoutElement*, 3> descriptor_w{
2224 for (
int i = 0; i < 3; i++) {
2226 channelId_wire[i])) {
2231 Amg::Vector3D position_w = descriptor_w[2]->channelPos(channelId_wire[2]);
2233 bool onSurface_w = descriptor_w[2]
2234 ->surface(channelId_wire[2])
2235 .globalToLocal(position_w, position_w, loc_hitPos_w);
2238 "TgcRdoToPrepDataToolMT::getSLWireGeometry Amg::Vector2D* "
2239 "loc_hitPos_w is null.");
2244 std::array<int, 3> gasGap_w{}, channel_w{};
2245 for (
int i = 0; i < 3; i++) {
2246 gasGap_w[i] =
m_idHelperSvc->tgcIdHelper().gasGap(channelId_wire[i]);
2247 channel_w[i] =
m_idHelperSvc->tgcIdHelper().channel(channelId_wire[i]);
2250 std::array<double, 3> tmp_r_w{}, tmp_phi_w{}, tmp_eta_w{};
2252 std::array<Amg::Vector3D, 3> tmp_position_w{
2254 for (
int i = 0; i < 3; i += 2) {
2255 tmp_position_w[i] = descriptor_w[i]->channelPos(channelId_wire[i]);
2256 tmp_r_w[i] = tmp_position_w[i].perp();
2257 tmp_phi_w[i] = tmp_position_w[i].phi();
2258 tmp_eta_w[i] = tmp_position_w[i].eta();
2261 descriptor_w[i]->gangRadialLength(gasGap_w[i], channel_w[i]) / 2.;
2269 tmp_r_w[0] += half_width;
2270 }
else if (i == 2) {
2271 tmp_r_w[2] -= half_width;
2275 bool flag_geteta_w =
2276 getEtafromRZ(tmp_r_w[0], tmp_position_w[0].
z(), tmp_eta_w[0]);
2278 getRfromEtaZ(tmp_eta_w[0], tmp_position_w[2].
z(), tmp_r_w[0]);
2279 if (!flag_geteta_w || !flag_getr_w) {
2281 "TgcRdoToPrepDataToolMT::getSLWireGeometry::failed to getR on "
2285 width_wire = tmp_r_w[0] - tmp_r_w[2];
2286 double gang = descriptor_w[2]->gangShortWidth(gasGap_w[2], channel_w[2]) +
2293 ->surface(channelId_wire[2])
2294 .localToGlobal(tmp_hitPos_w, tmp_wire_gp, tmp_wire_gp);
2295 z_wire = tmp_wire_gp.z();
2296 r_wire = tmp_r_w[2] + width_wire / 2.;
2302 const std::array<Identifier, 3>& channelId_strip,
const bool isBackward,
2303 const bool isAside,
double& width_strip,
double& theta_strip)
const {
2307 std::array<const MuonGM::TgcReadoutElement*, 3> descriptor_s{
2311 for (
int i = 0; i < 3; i++) {
2313 channelId_strip[i])) {
2319 Amg::Vector3D(descriptor_s[1]->channelPos(channelId_strip[1]));
2321 bool onSurface_s = descriptor_s[1]
2322 ->surface(channelId_strip[1])
2323 .globalToLocal(position_s, position_s, loc_hitPos_s);
2326 "TgcRdoToPrepDataToolMT::getSLStripGeometry Amg::Vector2D* "
2327 "loc_hitPos_s is null.");
2332 std::array<int, 3> gasGap_s, channel_s{};
2333 for (
int i = 0; i < 3; i++) {
2334 gasGap_s[i] =
m_idHelperSvc->tgcIdHelper().gasGap(channelId_strip[i]);
2335 channel_s[i] =
m_idHelperSvc->tgcIdHelper().channel(channelId_strip[i]);
2338 std::array<Amg::Vector3D, 3> localPos{Amg::Vector3D::Zero()};
2339 for (
int i = 0; i < 3; i += 2) {
2340 localPos[i] = descriptor_s[i]->transform(channelId_strip[i]).inverse() *
2341 descriptor_s[i]->channelPos(channelId_strip[i]);
2344 bool flag_reverse =
false;
2345 std::array<int, 2> index_strip{};
2351 flag_reverse =
true;
2355 flag_reverse =
false;
2361 flag_reverse =
true;
2365 flag_reverse =
false;
2369 double stripMaxX = descriptor_s[index_strip[0]]->stripHighEdgeLocX(
2370 gasGap_s[index_strip[0]], channel_s[index_strip[0]],
2371 localPos[index_strip[0]].
z());
2372 double stripMinX = descriptor_s[index_strip[1]]->stripLowEdgeLocX(
2373 gasGap_s[index_strip[1]], channel_s[index_strip[1]],
2374 localPos[index_strip[1]].
z());
2375 width_strip = stripMaxX - stripMinX;
2376 double strip = stripMinX + width_strip / 2.;
2384 int index_strip_gp = 0;
2391 descriptor_s[index_strip_gp]
2392 ->surface(channelId_strip[index_strip_gp])
2393 .localToGlobal(tmp_hitPos_s, tmp_strip_gp, tmp_strip_gp);
2394 theta_strip = atan2(tmp_strip_gp.y(), tmp_strip_gp.x());
2400 const std::array<const MuonGM::TgcReadoutElement*, 2>& descriptor_o,
2401 const std::array<Identifier, 2>& channelIdOut,
2402 const std::array<int, 2>& gasGap_o,
const std::array<int, 2>& channel_o,
2403 double& width_o,
double& hit_position_o,
Amg::Vector2D& tmp_hitPos_o,
2406 std::array<Amg::Vector3D, 2> position_o{
2408 std::array<double, 2> tmp_phi_o{}, tmp_eta_o{}, tmp_r_o{};
2410 for (
int i = 0; i < 2; i++) {
2411 position_o[i] = descriptor_o[i]->channelPos(channelIdOut[i]);
2412 tmp_r_o[i] = position_o[i].perp();
2413 tmp_phi_o[i] = position_o[i].phi();
2414 tmp_eta_o[i] = position_o[i].phi();
2417 descriptor_o[i]->gangRadialLength(gasGap_o[i], channel_o[i]) / 2.;
2424 tmp_r_o[0] += half_width;
2426 tmp_r_o[1] -= half_width;
2430 bool flag_geteta_o =
2434 if (!flag_geteta_o || !flag_getr_o) {
2436 "TgcRdoToPrepDataToolMT::getPosAndIdWireOut::failed to getR on "
2441 width_o = tmp_r_o[0] - tmp_r_o[1];
2444 descriptor_o[1]->gangShortWidth(gasGap_o[1], channel_o[1]) +
2446 tmp_hitPos_o[
Trk::locX] = (hit_position_o);
2449 Amg::Vector3D(descriptor_o[1]->channelPos(channelIdOut[1]));
2454 ->surface(channelIdOut[1])
2455 .globalToLocal(position_out, position_out, loc_hitPos_o);
2458 "TgcRdoToPrepDataToolMT::getPosAndIdWireOut Amg::Vector2D* "
2459 "loc_hitPos_o is null.");
2464 channelIdOut_tmp = channelIdOut[1];
2470 const std::array<const MuonGM::TgcReadoutElement*, 2>& descriptor_o,
2471 const std::array<Identifier, 2>& channelIdOut,
2472 const std::array<int, 2>& gasGap_o,
const std::array<int, 2>& channel_o,
2473 double& width_o,
double& hit_position_o,
Amg::Vector2D& tmp_hitPos_o,
2474 Identifier& channelIdOut_tmp,
const bool isBackward,
2475 const bool isAside)
const {
2478 std::array<Amg::Vector3D, 2> localpos_o{
2480 for (
int i = 0; i < 2; i++) {
2481 localpos_o[i] = descriptor_o[i]->transform(channelIdOut[i]).inverse() *
2482 descriptor_o[i]->channelPos(channelIdOut[i]);
2485 std::array<int, 3>
index{};
2486 bool flag_reverse =
false;
2492 flag_reverse =
true;
2496 flag_reverse =
false;
2503 flag_reverse =
true;
2507 flag_reverse =
false;
2511 double stripMax = descriptor_o[
index[0]]->stripHighEdgeLocX(
2513 double stripMin = descriptor_o[
index[1]]->stripLowEdgeLocX(
2515 width_o = stripMax - stripMin;
2517 hit_position_o = stripMin + width_o / 2.;
2519 hit_position_o *= -1.;
2521 tmp_hitPos_o[
Trk::locX] = hit_position_o;
2524 Amg::Vector3D(descriptor_o[1]->channelPos(channelIdOut[1]));
2529 ->surface(channelIdOut[1])
2530 .globalToLocal(position_out, position_out, loc_hitPos_o);
2533 "TgcRdoToPrepDataToolMT::getPosAndIdStripOut Amg::Vector2D* "
2534 "loc_hitPos_o is null.");
2539 channelIdOut_tmp = channelIdOut[
index[2]];
2545 const std::array<const MuonGM::TgcReadoutElement*, 4>& descriptor_i,
2546 const std::array<Identifier, 4>& channelIdIn,
2547 const std::array<int, 4>& gasGap_i,
const std::array<int, 4>& channel_i,
2548 double& width_i,
double& hit_position_i,
Amg::Vector2D& tmp_hitPos_i,
2551 int flag_boundary_i = 0;
2552 if (descriptor_i[1]->chamberType() == descriptor_i[3]->chamberType()) {
2556 flag_boundary_i = 1;
2558 flag_boundary_i = 3;
2560 }
else if (descriptor_i[0]->chamberType() ==
2561 descriptor_i[2]->chamberType()) {
2565 flag_boundary_i = 0;
2567 flag_boundary_i = 2;
2571 "TgcRdoToPrepDataToolMT::getPosAndIdWireIn::ROI has 3 readout "
2576 channelIdIn_tmp = channelIdIn[flag_boundary_i];
2586 std::array<double, 3> tmp_r_i{}, tmp_phi_i{}, tmp_eta_i{};
2588 std::array<Amg::Vector3D, 3> position_i{
2589 descriptor_i[0]->channelPos(channelIdIn[0]),
2590 descriptor_i[1]->channelPos(channelIdIn[1]),
2593 for (
int i = 0; i < 3; i++) {
2594 tmp_r_i[i] = position_i[i].perp();
2595 tmp_phi_i[i] = position_i[i].phi();
2596 tmp_eta_i[i] = position_i[i].eta();
2601 descriptor_i[i]->gangRadialLength(gasGap_i[i], channel_i[i]) /
2609 tmp_r_i[0] += half_width;
2611 tmp_r_i[1] -= half_width;
2614 bool flag_geteta_i =
2619 if (!flag_geteta_i || !flag_getr_i) {
2621 "TgcRdoToPrepDataToolMT::getPosAndIdWireIn::failed to "
2623 << i <<
" on L3!!");
2629 width_i = tmp_r_i[0] - tmp_r_i[1];
2632 "TgcRdoToPrepDataToolMT::getPosAndIdWireIn::minus value width_i = "
2637 int gasGap_tmp =
m_idHelperSvc->tgcIdHelper().gasGap(channelIdIn_tmp);
2638 int channel_tmp =
m_idHelperSvc->tgcIdHelper().channel(channelIdIn_tmp);
2646 if ((flag_boundary_i % 2) ==
2648 tmp_r_i[2] -= half_width;
2651 (tmp_r_i[2] - tmp_r_i[1]) + width_i / 2.;
2653 tmp_r_i[2] += half_width;
2654 hit_position_i = descriptor_iw->
gangLongWidth(gasGap_tmp, channel_tmp) +
2655 (tmp_r_i[0] - tmp_r_i[2]) - width_i / 2.;
2659 tmp_hitPos_i[
Trk::locX] = hit_position_i;
2660 Amg::Vector3D position_in = descriptor_i[1]->channelPos(channelIdIn[1]);
2665 ->surface(channelIdIn[1])
2666 .globalToLocal(position_in, position_in, loc_hitPos_i);
2669 "TgcRdoToPrepDataToolMT::getPosAndIdWireIn Amg::Vector2D* "
2670 "loc_hitPos_i is null.");
2680 const std::array<const MuonGM::TgcReadoutElement*, 4>& descriptor_i,
2681 const std::array<Identifier, 4>& channelIdIn,
2682 const std::array<int, 4>& gasGap_i,
const std::array<int, 4>& channel_i,
2683 double& width_i,
double& hit_position_i,
Amg::Vector2D& tmp_hitPos_i,
2684 Identifier& channelIdIn_tmp,
const bool isBackward,
2685 const bool isAside)
const {
2689 for (
int i = 0; i < 4; i++) {
2690 if (gasGap_i[i] == 3) {
2695 if (flag_isL3 < 0 || flag_isL3 >= 4) {
2696 ATH_MSG_DEBUG(
"getPosAndIdStripIn: Any bitpos is not at Layer3!");
2700 channelIdIn_tmp = channelIdIn[flag_isL3];
2710 std::array<double, 3> tmp_r_i{}, tmp_phi_i{}, tmp_eta_i{};
2711 std::array<Amg::Vector3D, 3> position_is{
2713 for (
int i = 0; i < 3; i++) {
2715 position_is[i] = descriptor_i[i]->channelPos(channelIdIn[i]);
2717 position_is[i] = descriptor_is->
channelPos(channelIdIn_tmp);
2719 tmp_r_i[i] = position_is[i].perp();
2720 tmp_phi_i[i] = position_is[i].phi();
2721 tmp_eta_i[i] = position_is[i].eta();
2724 std::array<int, 2>
index{};
2725 bool flag_reverse =
false;
2730 flag_reverse =
true;
2734 flag_reverse =
false;
2740 flag_reverse =
true;
2744 flag_reverse =
false;
2748 std::array<Amg::Vector3D, 2> localpos_i{
2750 for (
int i = 0; i < 2; i++) {
2751 localpos_i[i] = descriptor_i[i]->transform(channelIdIn[i]).inverse() *
2752 descriptor_i[i]->channelPos(channelIdIn[i]);
2754 double stripMaxX = descriptor_i[
index[0]]->stripHighEdgeLocX(
2756 double stripMinX = descriptor_i[
index[1]]->stripLowEdgeLocX(
2758 width_i = stripMaxX - stripMinX;
2760 hit_position_i = stripMinX + width_i / 2.;
2762 hit_position_i *= -1.;
2764 tmp_hitPos_i[
Trk::locX] = hit_position_i;
2772 ->surface(channelIdIn[1])
2773 .globalToLocal(position_in, position_in, loc_hitPos_i);
2776 "TgcRdoToPrepDataToolMT::getPosAndIdStripIn Amg::Vector2D* "
2777 "loc_hitPos_i is null.");
2787 int& sswId_o,
int& sbLoc_o,
2788 int& slbId_o)
const {
2790 int chip =
static_cast<int>(rd.
chip());
2791 int hitId =
static_cast<int>(rd.
hitId());
2797 ATH_MSG_DEBUG(
"Failed to get SimHighPtID from RDOHighPtID for Pivot "
2798 << (rd.
isStrip() ?
"Strip" :
"Wire"));
2807 if (rd.
rodId() > 12) {
2818 ATH_MSG_DEBUG(
"Failed to get offlineID from HighPtID for Pivot "
2819 << (rd.
isStrip() ?
"Strip" :
"Wire"));
2823 std::array<int, 3> dummy_i{};
2825 dummyId, dummy_i[0], dummy_i[1], sswId_o, sbLoc_o, dummy_i[2]);
2827 ATH_MSG_DEBUG(
"Failed to get ReadoutID from OfflineID for Pivot "
2828 << (rd.
isStrip() ?
"Strip" :
"Wire"));
2832 std::array<int, 2> i_o{};
2833 std::array<bool, 2> b_o{
false,
false};
2834 if (rd.
rodId() > 12) {
2836 i_o[0], b_o[0], b_o[1], i_o[1], slbId_o, rd.
subDetectorId(),
2837 tmprodId, sswId_o, sbLoc_o);
2840 i_o[0], b_o[0], b_o[1], i_o[1], slbId_o, rd.
subDetectorId(),
2841 rd.
rodId(), sswId_o, sbLoc_o);
2844 ATH_MSG_DEBUG(
"Failed to get SLBID from ReadoutID for Pivot "
2845 << (rd.
isStrip() ?
"Strip" :
"Wire"));
2853 std::array<Identifier, 3>& channelId,
int&
index,
int& chip,
int& hitId,
2854 int& sub,
int& sswId,
int& sbLoc,
int& subMatrix,
2855 std::array<int, 3>& bitpos,
const bool isBoundary,
const TgcRdo* rdoColl,
2856 const int index_w,
const int chip_w,
const int hitId_w,
2857 const int sub_w)
const
2863 index, chip, hitId, sub);
2866 << (!isStrip ?
"Wire" :
"Strip"));
2873 ATH_MSG_DEBUG(
"Failed to get SimHighPtID from RDOHighPtID for "
2874 << (!isStrip ?
"Wire" :
"Strip"));
2884 << (!isStrip ?
"Wire" :
"Strip"));
2888 if (!isStrip || !isBoundary) {
2890 channelId[1] = offlineId;
2891 std::array<int, 3> dummy_i{};
2893 channelId[1], dummy_i[0], dummy_i[1], sswId, sbLoc, dummy_i[2]);
2896 << (!isStrip ?
"Wire" :
"Strip"));
2905 rd, sbLoc, rdoColl, index_w, chip_w, hitId_w, sub_w);
2906 if (!exist_hipt_s) {
2910 rd, sbLoc, rdoColl, index_w, chip_w, hitId_w, sub_w);
2911 if (!exist_tracklet_s) {
2913 "Failed to find correspond Tracklet_strip for SL!!");
2925 for (
int i = 0; i < 3; i++) {
2926 if (i == 1 && (!isStrip || !isBoundary)) {
2935 << (!isStrip ?
"Wire" :
"Strip"));
2936 if (!isStrip || i == 1) {
2939 <<
", rodId = " << rd.
rodId()
2940 <<
", sswId = " << sswId <<
", slbId = " << sbLoc
2941 <<
", bitpos_" << (!isStrip ?
"w" :
"s") <<
"["
2942 << i <<
"] = " << bitpos[i]);
2952 const TgcRawData& rd,
int& sbLoc,
const TgcRdo* rdoColl,
const int index_w,
2953 const int chip_w,
const int hitId_w,
const int sub_w)
const {
2955 bool exist_hipt_s =
false;
2958 int trackletIdStripFirst{-1}, trackletIdStripSecond{-1},
2959 trackletIdStripThird{-1};
2961 static_cast<int>(rd.
roi()), trackletIdStripFirst, trackletIdStripSecond,
2962 trackletIdStripThird);
2970 const TgcRawData rdH(rdH0->bcTag(), rdH0->subDetectorId(), tmprodId,
2971 rdH0->l1Id(), rdH0->bcId(), rdH0->isStrip(),
2972 rdH0->isForward(), tmpsector, rdH0->chip(),
2973 rdH0->index(), rdH0->isHipt(), rdH0->hitId(),
2974 rdH0->hsub(), rdH0->delta(), rdH0->inner());
2987 int sswId_o{0}, sbLoc_o{0}, slbId_o{0};
2988 bool found =
getHiPtIds(state, rdH, sswId_o, sbLoc_o, slbId_o);
2994 int slbsubMatrix = 0;
2995 std::array<int, 2> bitpos_o{};
2999 int trackletIdStrip = 2 * sbLoc_o + slbsubMatrix;
3002 if (trackletIdStrip != trackletIdStripFirst &&
3003 trackletIdStrip != trackletIdStripSecond &&
3004 trackletIdStrip != trackletIdStripThird) {
3010 if (exist_hipt_s && trackletIdStrip == trackletIdStripThird) {
3015 int index_w_tmp = index_w;
3016 int chip_w_tmp = chip_w;
3017 int hitId_w_tmp = hitId_w;
3022 index_w_tmp, chip_w_tmp, hitId_w_tmp);
3025 "Failed to get RDOHighPtID from SimHighPtID for Wire");
3030 int chip_s =
static_cast<int>(rdH.
chip());
3031 int hitId_s =
static_cast<int>(rdH.
hitId());
3032 int hsub_s =
static_cast<int>(rdH.
hsub());
3047 "Failed to get ROINumber from HighPtID for Strip");
3051 if (roi == rd.
roi()) {
3053 exist_hipt_s =
true;
3054 if (trackletIdStrip == trackletIdStripFirst) {
3062 return exist_hipt_s;
3066 const TgcRawData& rd,
int& sbLoc,
const TgcRdo* rdoColl,
const int index_w,
3067 const int chip_w,
const int hitId_w,
const int sub_w)
const {
3069 bool exist_tracklet_s =
false;
3072 int trackletIdStripFirst{-1}, trackletIdStripSecond{-1},
3073 trackletIdStripThird{-1};
3075 static_cast<int>(rd.
roi()), trackletIdStripFirst, trackletIdStripSecond,
3076 trackletIdStripThird);
3082 uint16_t tmprodId{0}, tmpsector{0};
3084 const TgcRawData rdS(rdS0->bcTag(), rdS0->subDetectorId(), tmprodId,
3085 rdS0->sswId(), rdS0->slbId(), rdS0->l1Id(),
3086 rdS0->bcId(), rdS0->slbType(), rdS0->delta(),
3087 rdS0->segment(), rdS0->subMatrix(),
3090 bool isForward_s = (rdS.
sswId() == 7);
3106 int trackletIdStrip =
static_cast<int>(
3109 if (trackletIdStrip != trackletIdStripFirst &&
3110 trackletIdStrip != trackletIdStripSecond &&
3111 trackletIdStrip != trackletIdStripThird) {
3117 if (exist_tracklet_s && trackletIdStrip == trackletIdStripThird) {
3128 "Failed to get OfflineID from LowPtCoincidenceID for "
3133 std::array<int, 7> i{};
3134 std::array<bool, 2> b{};
3136 offlineId, i[0], i[1], i[2], b[0], b[1], i[3], i[4], i[5],
3144 "Failed to get HighPtID from OfflineID for Strip");
3149 int index_w_tmp = index_w;
3150 int chip_w_tmp = chip_w;
3151 int hitId_w_tmp = hitId_w;
3160 "Failed to get RDOHighPtID from SimHighPtID for Wire");
3172 "Failed to get RDOHighPtID from SimHighPtID for Strip");
3189 "Failed to get ROINumber from HighPtID for Strip");
3193 if (roi == rd.
roi()) {
3194 sbLoc = rdS.
slbId();
3195 exist_tracklet_s =
true;
3196 if (trackletIdStrip == trackletIdStripFirst) {
3204 return exist_tracklet_s;
3208 const int roi,
int& trackletIdStripFirst,
int& trackletIdStripSecond,
3209 int& trackletIdStripThird) {
3210 constexpr int T9SscMax = 2;
3211 constexpr int T8SscMax = 4;
3212 constexpr int T7SscMax = 6;
3213 constexpr int T6SscMax = 12;
3214 constexpr int T5SscMax = 18;
3216 constexpr int T9Offset = 32 + 0;
3217 constexpr int T8Offset = 32 + 2;
3218 constexpr int T7Offset = 32 + 4;
3219 constexpr int T6Offset = 32 + 6;
3220 constexpr int T5Offset = 32 + 8;
3225 int ssc = (roi + 4) / 8;
3226 int halfSsc = (roi % 4) / 2;
3228 if (ssc < T9SscMax) {
3229 trackletIdStripFirst = T9Offset + halfSsc;
3230 trackletIdStripSecond = -1;
3231 trackletIdStripThird = -1;
3232 }
else if (ssc == T9SscMax) {
3233 trackletIdStripFirst = T8Offset + halfSsc;
3234 trackletIdStripSecond = T9Offset + halfSsc;
3235 trackletIdStripThird = -1;
3236 }
else if (ssc < T8SscMax) {
3237 trackletIdStripFirst = T8Offset + halfSsc;
3238 trackletIdStripSecond = -1;
3239 trackletIdStripThird = -1;
3240 }
else if (ssc == T8SscMax) {
3241 trackletIdStripFirst = T7Offset + halfSsc;
3242 trackletIdStripSecond = T8Offset + halfSsc;
3243 trackletIdStripThird = -1;
3244 }
else if (ssc < T7SscMax) {
3245 trackletIdStripFirst = T7Offset + halfSsc;
3246 trackletIdStripSecond = -1;
3247 trackletIdStripThird = -1;
3248 }
else if (ssc == T7SscMax) {
3249 trackletIdStripFirst = T6Offset + halfSsc;
3250 trackletIdStripSecond = T7Offset + halfSsc;
3251 trackletIdStripThird =
3253 }
else if (ssc < T6SscMax) {
3254 trackletIdStripFirst = T6Offset + halfSsc;
3255 trackletIdStripSecond =
3257 trackletIdStripThird = -1;
3258 }
else if (ssc == T6SscMax) {
3259 trackletIdStripFirst = T6Offset + halfSsc;
3260 trackletIdStripSecond = T5Offset + halfSsc;
3261 trackletIdStripThird = -1;
3262 }
else if (ssc <= T5SscMax) {
3263 trackletIdStripFirst = T5Offset + halfSsc;
3264 trackletIdStripSecond =
3266 trackletIdStripThird = -1;
3268 trackletIdStripFirst = -1;
3269 trackletIdStripSecond = -1;
3270 trackletIdStripThird = -1;
3278 const double eta,
const double phi) {
3280 return Amg::Vector2D::Zero();
3284 constexpr double length = 100.;
3285 constexpr unsigned int nRep = 10;
3286 constexpr double dRAccuracy = 1.0E-20;
3287 constexpr double maxLocR = 10000.;
3291 for (
unsigned int iRep = 0; iRep < nRep; iRep++) {
3295 loc_hitPos_c, tmp_glob_hitPos_c, tmp_glob_hitPos_c);
3298 double glob_eta_c = glob_hitPos_c.eta();
3299 double glob_phi_c = glob_hitPos_c.phi();
3304 if (dR < dRAccuracy) {
3316 loc_hitPos_w, tmp_glob_hitPos_w, tmp_glob_hitPos_w);
3320 loc_hitPos_s, tmp_glob_hitPos_s, tmp_glob_hitPos_s);
3324 matrix(0, 0) = glob_hitPos_w.eta() - glob_eta_c;
3325 matrix(1, 0) =
deltaPhi(glob_hitPos_w.phi(), glob_phi_c);
3326 matrix(0, 1) = glob_hitPos_s.eta() - glob_eta_c;
3327 matrix(1, 1) =
deltaPhi(glob_hitPos_s.phi(), glob_phi_c);
3329 bool invertible = matrix.determinant();
3333 locX +=
length * solution(0, 0);
3334 locY +=
length * solution(1, 0);
3336 double locR = sqrt(locX * locX + locY * locY);
3337 if (locR > maxLocR) {
3338 locX *= maxLocR / locR;
3339 locY *= maxLocR / locR;
Scalar eta() const
pseudorapidity method
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
Scalar phi() const
phi method
constexpr std::array< T, N > make_array(const T &def_val)
Helper function to initialize in-place arrays with non-zero values.
#define ATH_CHECK
Evaluate an expression and check for errors.
bool isValid() const
Test to see if the link can be dereferenced.
#define ATH_MSG_WARNING(x)
#define AmgSymMatrix(dim)
virtual void lock()=0
Interface to allow an object to lock itself when made const in SG.
unsigned bcTag(unsigned bcBitMap)
DataModel_detail::iterator< DataVector > iterator
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
bool empty() const
return true if container is empty
size_t size() const
Duplicate of fullSize for backwards compatability.
This is a "hash" representation of an Identifier.
virtual const Trk::PlaneSurface & surface() const override
access to chamber surface (phi orientation), uses the first gas gap
virtual const Amg::Transform3D & transform() const override
Return local to global transform.
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
const TgcReadoutElement * getTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
A TgcReadoutElement corresponds to a single TGC chamber; therefore typically a TGC station contains s...
Amg::Vector3D channelPos(const Identifier &id) const
Returns the position of the active channel (wireGang or strip).
double stripHighEdgeLocX(int gasGap, int strip, double radialPos) const
Returns the local X of the right edge of the strip at a given local radial position.
double gangShortWidth(int gasGap, int gang) const
Returns the length of the most bottom wire in the gang.
double stripWidth(int gasGap, int strip) const
Returns the width of a given strip in the gasGap i.
double stripLowEdgeLocX(int gasGap, int strip, double radialPos) const
Returns the local X of the left edge of the strip at a given local radial position.
double gangLongWidth(int gasGap, int gang) const
Returns the length of the most top wire in the gang.
double gangRadialLength(int gasGap, int gang) const
Returns the length of the wire gang along the radial direction [pitch x N_{wire}^{gang}...
virtual bool containsId(const Identifier &id) const override
int stationPhi(const Identifier &id) const
bool getOfflineIDfromHighPtID(Identifier &offlineID, const int subDetectorID, const int rodID, const int sectorInReadout, const bool isStrip, const bool isForward, const int hpb, const int chip, const int hitID, const int pos) const
bool getSLBIDfromReadoutID(int &phi, bool &isAside, bool &isEndcap, int &moduleType, int &id, const int subsectorID, const int rodID, const int sswID, const int sbLoc) const
bool getHighPtIDfromOfflineID(const Identifier &offlineID, int &subDetectorID, int &rodID, int §orInReadout, bool &isStrip, bool &isForward, int &hpb, int &chip, int &hitID, int &pos) const
bool getElementIDfromReadoutID(Identifier &elementID, const int subDetectorID, const int rodID, const int sswID, const int sbLoc, const int channelID, bool orChannel=false) const
bool getRDOHighPtIDfromSimHighPtID(const bool isForward, const bool isStrip, int &index, int &chip, int &hitId) const
bool getOfflineIDfromReadoutID(Identifier &offlineID, const int subDetectorID, const int rodID, const int sswID, const int sbLoc, const int channelID, bool orChannel=false) const
To be ported.
bool getSLIDfromReadoutID(int &phi, bool &isAside, bool &isEndcap, const int subsectorID, const int rodID, const int sswID, const int sbLoc) const
bool getReadoutIDfromOfflineID(const Identifier &offlineID, int &subDetectorID, int &rodID, int &sswID, int &sbLoc, int &channelID, bool adChannel=false) const
bool getHighPtIDfromROINumber(int roi, bool isForward, bool isStrip, int &hpb, int &chip, int &hitID, int &sub) const
bool getSimHighPtIDfromRDOHighPtID(const bool isForward, const bool isStrip, int &index, int &chip, int &hitId) const
bool getOfflineIDfromLowPtCoincidenceID(Identifier &offlineID, const int subDetectorID, const int rodID, const int sswID, const int sbLoc, const int block, const int pos, bool middle=false) const
bool getROINumberfromHighPtID(int &roi, bool isForward, int hpb_wire, int chip_wire, int hitId_wire, int sub_wire, int chip_strip, int hitId_strip, int sub_strip) const
bool getSLIDfromSReadoutID(int &phi, bool &isAside, const int subsectorID, const int srodID, const int sector, const bool forward) const
bool isOredChannel(const int subDetectorID, const int rodID, const int sswID, const int sbLoc, const int channelID) const
To be ported.
bool getReadoutIDfromElementID(const Identifier &elementID, int &subdetectorID, int &rodID) const
static constexpr uint32_t INNER_NSW_ID_BITSHIFT
static constexpr uint32_t INNER_TILE_MODULE_BITSHIFT
Bit info in int inner for the Tile inner-coincidence.
static constexpr uint32_t INNER_NSW_PHIRES_BITSHIFT
static constexpr uint32_t INNER_EIFI_CID_BITSHIFT
static constexpr uint32_t INNER_RPC_BCID_BITSHIFT
static constexpr uint32_t INNER_RPC_ETA_BITSHIFT
Bit info in int inner for the RPC inner-coincidence.
static constexpr uint32_t INNER_EIFI_EI_BITSHIFT
Bit info in int inner for the EI/FI inner-coincidence.
static constexpr uint32_t INNER_RPC_PHI_BITSHIFT
static constexpr uint32_t INNER_RPC_DPHI_BITSHIFT
void setHashAndIndex(unsigned short collHash, unsigned short objIndex)
static constexpr uint32_t INNER_NSW_PHI_BITSHIFT
static constexpr uint32_t INNER_EIFI_FI_BITSHIFT
static constexpr uint32_t INNER_RPC_FLAG_BITSHIFT
static constexpr uint32_t INNER_NSW_BCID_BITSHIFT
static constexpr uint32_t INNER_RPC_DETA_BITSHIFT
static constexpr uint32_t INNER_NSW_R_BITSHIFT
Bit info in int inner for the NSW inner-coincidence.
static constexpr uint32_t INNER_TILE_BCID_BITSHIFT
static constexpr uint32_t INNER_NSW_LOWRES_BITSHIFT
static constexpr uint32_t INNER_NSW_INPUT_BITSHIFT
static constexpr uint32_t INNER_NSW_DTHETA_BITSHIFT
Class to represent TGC measurements.
const_pointer_type cptr()
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
pointer_type ptr()
Dereference the pointer.
int channel(const Identifier &id) const override
int gasGap(const Identifier &id) const override
get the hashes
int isStrip(const Identifier &id) const
isStrip corresponds to measuresPhi
An unit object of TGC ROD output.
uint16_t nswlowres() const
uint16_t position() const
uint16_t subMatrix() const
uint16_t innerflag() const
uint16_t coinflag() const
static constexpr uint32_t RPC_FLAG_BIT
static constexpr uint32_t RPC_BCID_BITSHIFT
bool isCoincidence() const
uint16_t tmdbbcid() const
static constexpr uint32_t NSW_INPUT_BIT
static constexpr uint32_t RPC_BCID_BIT
uint16_t nswphires() const
static constexpr uint32_t NSW_INPUT_BITSHIFT
uint16_t subDetectorId() const
static constexpr uint32_t RPC_FLAG_BITSHIFT
uint16_t nswdtheta() const
static constexpr uint32_t NSW_BCID_BIT
static constexpr uint32_t NSW_BCID_BITSHIFT
uint16_t threshold() const
static uint16_t calculateOnlineId(uint16_t subDetectorId, uint16_t rodId)
virtual void localToGlobal(const Amg::Vector2D &locp, const Amg::Vector3D &mom, Amg::Vector3D &glob) const override final
Specified for PlaneSurface: LocalToGlobal method without dynamic memory allocation.
virtual bool globalToLocal(const Amg::Vector3D &glob, const Amg::Vector3D &mom, Amg::Vector2D &loc) const override final
Specified for PlaneSurface: GlobalToLocal method without dynamic memory allocation - boolean checks i...
Identifier identify() const
return the identifier
std::vector< std::string > veto
these patterns are anded
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
@ loc2
generic first and second local coordinate
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
setRcore setEtHad setFside pt
const Identifier & identify(const UncalibratedMeasurement *meas)
Returns the associated identifier from the muon measurement.