513 {
514
516
517 std::unordered_set<IdentifierHash>& ambiguousCollections{state.m_ambiguousCollections};
518 ATH_MSG_DEBUG(
"***************** Start of processPad eta/phiview "<< processingetaview <<
"/" << processingphiview);
519
520
523 ATH_MSG_DEBUG(
"***************** for Pad online Id "<< padId <<
" m_logic sector ID " << sectorId);
524
525
526 Identifier oldId{}, oldIdTrg{};
530 IdentifierHash rpcHashId{0};
531
533
534
535 int icm = 0;
537 ++icm;
539 bool highPtCm = false;
540
541 uint16_t cmaId = coinMat->onlineId();
542 ATH_MSG_DEBUG(
"A new CM here n. "<< icm <<
" CM online ID " << cmaId<<
" with n. of hits = " << coinMat->size()
543 <<", empty: "<<coinMat->empty());
545 if (cmaId < 2) {
547 } else if (cmaId >=4) {
548 highPtCm = true;
549 if (cmaId < 6) {
551 }
552 }
553 ATH_MSG_DEBUG(
" eta view = " << etaview<<
", processingetaview: "<<processingetaview
554 <<", processingphiview: "<<processingphiview);
555
556 if (processingetaview && !etaview){
557 continue;
558 } else if (processingphiview && etaview) {
559 continue;
560 }
561 if (coinMat->empty()) {
563 }
564
565 int idata = 0;
567 const RpcFiredChannel* rpcChan{*itD};
568 idata++;
569
571 unsigned short overlap = 99;
572
573
576
579 <<
" ijk "<< rpcChan->
ijk() <<
" ch " << ( rpcChan->
ijk() < 7 ? rpcChan->
channel() : -1));
580
581
582 bool triggerHit = false;
583 bool toSkip = false;
585 if (toSkip) {
586 continue;
587 }
588 if (triggerHit) {
589
590
591
592 solvePhiAmb_thisHit = false;
593 reduceCablOvl_thisHit = false;
594 ATH_MSG_DEBUG(
"RpcFiredChannel: it's a triggerHit or a lowPt coinc. in a high pt CM \n"
595 <<
" ijk = " << rpcChan->
ijk() <<
" isHighPtCM " << highPtCm
596 << " thr/ovl = " << threshold << "/" << overlap);
597 }
598
599
601 std::vector<Identifier> digitVec{
m_rpcRdoDecoderTool->getOfflineData(rpcChan, sectorId, padId,
602 cmaId, time, rpcCabling.
cptr())};
604
605 int nMatchingEtaHits{0}, nDuplicatePhiHits{0};
606 bool unsolvedAmbiguity{false}, notFinished{true};
607
608
609
610
611
612
613
614
615 while (notFinished) {
616
617 ATH_MSG_DEBUG(
"size of the corresponding list of ID = " << digitVec.size());
618 if (digitVec.empty()) {
620 notFinished = false;
621 continue;
622 }
623 for (const Identifier& channelId : digitVec) {
624
625
628
629
630
631
632 if (!idVect.empty() && std::find(idVect.begin(), idVect.end(), rpcHashId) == idVect.end()) {
633 continue;
634 }
637 bool hasAMatchingEtaHit = 0;
638
639 if (triggerHit) {
640 if ((oldIdTrg != parentId) || !collectionTrg) {
641
642
644 << " hash = " << rpcHashId);
645 collectionTrg = state.getCoinCollection(parentId);
648 }
649 } else if ((oldId != parentId) || !collection) {
650
651
653 collection = state.getPrepCollection(parentId);
656 }
657
658
659
660
661 bool duplicate = false;
662 if (reduceCablOvl_thisHit) {
663 ATH_MSG_VERBOSE(
"Check for duplicates in coll. with size "<< collection->size());
665 const Identifier existId{rpc->identify()};
666 if (channelId == existId &&
668 duplicate = true;
669 hasAMatchingEtaHit = false;
670
671
673 float previous_time = rpc->time();
674
675 if (time < previous_time) {
677 ATH_MSG_DEBUG(
"time of the prd previously stored is now updated with "
678 << "current hit time: "<< previous_time << " -> " << rpc->time());
679 }
680 break;
681
682
683 }
684
685
686 if (processingphiview && solvePhiAmb_thisHit && !unsolvedAmbiguity && !idHelper.
measuresPhi(existId) &&
689 hasAMatchingEtaHit = true;
691
692
693
694
695 }
696 }
697 if (hasAMatchingEtaHit)
698 nMatchingEtaHits++;
699
700
701 if (processingphiview && duplicate)
702 nDuplicatePhiHits++;
703
704
705 }
706
707 if (solvePhiAmb_thisHit && !etaview){
709 << " hasAMatchingEtaHit = "<< hasAMatchingEtaHit);
710 }
711 if (duplicate) {
712
714 continue;
715 }
716 ATH_MSG_VERBOSE(
" solvePhiAmb_thisHit: "<<solvePhiAmb_thisHit<<
", processingetaview:"<<processingetaview
717 <<", processingphiview: "<<processingphiview<<", hasAMatchingEtaHit: "<<hasAMatchingEtaHit
718 <<", unsolvedAmbiguity: "<< unsolvedAmbiguity);
719 if ( !solvePhiAmb_thisHit || processingetaview ||
720 (processingphiview && (hasAMatchingEtaHit || unsolvedAmbiguity))) {
721 if (unsolvedAmbiguity) {
722 if (idVect.empty()) {
724 } else {
725
726
727 ATH_MSG_DEBUG(
"unsolvedAmbiguity is true, adding collection with hash = "
728 << rpcHashId << " to ambiguous collections vector");
729 const auto&
decode{state.m_decodedOfflineHashIds};
731 ambiguousCollections.insert(rpcHashId);
732 ATH_MSG_DEBUG(
"collection not yet processed; added to ambiguous "
733 <<"collection vector; going to the next offline channel ID");
734 continue;
735 } else if (!doingSecondLoopAmbigColls) {
736 ambiguousCollections.insert(rpcHashId);
737 ATH_MSG_DEBUG(
"collection already processed and doingSecondLoopAmbigColls=false; added to ambiguous "
738 <<"collection vector; going to the next offline channel ID");
739 continue;
740 } else {
741 ATH_MSG_DEBUG(
"collection already processed and doingSecondLoopAmbigColls=true; trying to store data even if unsolvedAmbiguity");
742 }
743 }
744 }
746 const RpcReadoutElement* descriptor = muDetMgr->getRpcReadoutElement(channelId);
747
748
749
751 hasAMatchingEtaHit = false;
752 duplicate = false;
755 << "> inconsistent with the geometry of detector element <"
757 << "> =>>ignore this hit /// there are unmasked channels in BOG");
758 }else{
760 << "> inconsistent with the geometry of detector element <"
762 }
763 continue;
764 }
765
766
767
770
772 descriptor->
surface(channelId).
globalToLocal(tempGlobalPosition, tempGlobalPosition, pointLocPos);
773
774
775 std::vector<Identifier> identifierList{
channelId};
776
777
779
780
781 double errPos = stripWidth / std::sqrt(12.0);
784 mat *= errPos * errPos;
785
786
787 int ambiguityFlag = 0;
788 if (solvePhiAmb_thisHit) {
789 if (processingetaview){
790 ambiguityFlag = 1;
791 }
792 if (unsolvedAmbiguity){
793 ambiguityFlag = digitVec.size();
794 } else if (hasAMatchingEtaHit){
795 ambiguityFlag = nMatchingEtaHits;
796 }
797 }
798
799
801 SG::ReadCondHandle readHandle{
m_readKey, ctx};
802 std::optional<double> StripTimeFromCool = readHandle->getStripTime(channelId);
803 if (StripTimeFromCool) {
804 time -= (*StripTimeFromCool);
805 }
806 }
807
808 if (triggerHit) {
810
811 auto newCoinData = std::make_unique<RpcCoinData>(channelId, rpcHashId,
812 std::move(pointLocPos), std::move(identifierList),
813 std::move(mat), descriptor, time,
814 ambiguityFlag, rpcChan->
ijk(), threshold, overlap, cmaId, padId, sectorId,
815 !(highPtCm));
816
817
818 ATH_MSG_DEBUG(
" Adding RpcCoinData @ "<< newCoinData.get() <<
" to collection "
820
821 newCoinData->setHashAndIndex(collectionTrg->identifyHash(),
822 collectionTrg->size());
823 collectionTrg->push_back(std::move(newCoinData));
824 }
825 else {
827 << "ambiguityFlag = " << ambiguityFlag);
828
829 auto newPrepData = std::make_unique<RpcPrepData>(channelId, rpcHashId,std::move(pointLocPos),
830 std::move(identifierList),
831 std::move(mat), descriptor, time, ambiguityFlag);
832
833
834 ATH_MSG_DEBUG(
" Adding digit @ "<< newPrepData.get() <<
" to collection "
836
837 newPrepData->setHashAndIndex(collection->identifyHash(),
838 collection->size());
839 collection->push_back(std::move(newPrepData));
840
841
842
843 nPrepRawData++;
844 }
845 }
846 }
847
848 ATH_MSG_VERBOSE(
"processingphiview:"<<processingphiview<<
", nMatchingEtaHits:"<<nMatchingEtaHits
849 <<", nDuplicatePhiHits, unsolvedAmbiguity: "<<unsolvedAmbiguity<<", solvePhiAmb_thisHit : "
850 << solvePhiAmb_thisHit);
851 if ((processingphiview && (nMatchingEtaHits == 0)) && (nDuplicatePhiHits == 0) &&
852 (!unsolvedAmbiguity) && (solvePhiAmb_thisHit)) {
853 unsolvedAmbiguity = true;
854
855
856
857 ATH_MSG_DEBUG(
"No eta prepData matching any phi hit from this CM hit \n"
858 << "loop once again and store all phi digits potentially "
859 "generating this CM hit");
860 } else if (unsolvedAmbiguity)
861 notFinished = false;
862 else
863 notFinished = false;
864 }
865 }
866 }
867
868 ATH_MSG_DEBUG(
"***************** Stop of processPad eta/phiview "
869 << processingetaview << "/" << processingphiview
870 << "***************** for Pad online Id " << padId
871 << " m_logic sector ID " << sectorId);
872
873 return StatusCode::SUCCESS;
874}
Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Current RpcCoinMatrix
DataModel_detail::const_iterator< DataVector > const_iterator
Identifier identify() const override final
Returns the ATLAS Identifier of the MuonReadOutElement.
virtual bool containsId(const Identifier &id) const override
function to be used to check whether a given Identifier is contained in the readout element
const std::string & stationNameString(const Identifier &id) const
int stationName(const Identifier &id) const
Identifier parentID(const Identifier &id) const
bool measuresPhi(const Identifier &id) const override
const_pointer_type cptr()