549 {
550
552
553 std::unordered_set<IdentifierHash>& ambiguousCollections{state.m_ambiguousCollections};
554 ATH_MSG_DEBUG(
"***************** Start of processPad eta/phiview "<< processingetaview <<
"/" << processingphiview);
555
556
559 ATH_MSG_DEBUG(
"***************** for Pad online Id "<< padId <<
" m_logic sector ID " << sectorId);
560
561
562 Identifier oldId{}, oldIdTrg{};
566 IdentifierHash rpcHashId{0};
567
569
570
571 int icm = 0;
573 ++icm;
575 bool highPtCm = false;
576
577 uint16_t cmaId = coinMat->onlineId();
578 ATH_MSG_DEBUG(
"A new CM here n. "<< icm <<
" CM online ID " << cmaId<<
" with n. of hits = " << coinMat->size()
579 <<", empty: "<<coinMat->empty());
581 if (cmaId < 2) {
583 } else if (cmaId >=4) {
584 highPtCm = true;
585 if (cmaId < 6) {
587 }
588 }
589 ATH_MSG_DEBUG(
" eta view = " << etaview<<
", processingetaview: "<<processingetaview
590 <<", processingphiview: "<<processingphiview);
591
592 if (processingetaview && !etaview){
593 continue;
594 } else if (processingphiview && etaview) {
595 continue;
596 }
597 if (coinMat->empty()) {
599 }
600
601 int idata = 0;
603 const RpcFiredChannel* rpcChan{*itD};
604 idata++;
605
607 unsigned short overlap = 99;
608
609
612
615 <<
" ijk "<< rpcChan->
ijk() <<
" ch " << ( rpcChan->
ijk() < 7 ? rpcChan->
channel() : -1));
616
617
618 bool triggerHit = false;
619 bool toSkip = false;
621 if (toSkip) {
622 continue;
623 }
624 if (triggerHit) {
625
626
627
628 solvePhiAmb_thisHit = false;
629 reduceCablOvl_thisHit = false;
630 ATH_MSG_DEBUG(
"RpcFiredChannel: it's a triggerHit or a lowPt coinc. in a high pt CM \n"
631 <<
" ijk = " << rpcChan->
ijk() <<
" isHighPtCM " << highPtCm
632 << " thr/ovl = " << threshold << "/" << overlap);
633 }
634
635
637 std::vector<Identifier> digitVec{
m_rpcRdoDecoderTool->getOfflineData(rpcChan, sectorId, padId,
638 cmaId, time, rpcCabling.
cptr())};
640
641 int nMatchingEtaHits{0}, nDuplicatePhiHits{0};
642 bool unsolvedAmbiguity{false}, notFinished{true};
643
644
645
646
647
648
649
650
651 while (notFinished) {
652
653 ATH_MSG_DEBUG(
"size of the corresponding list of ID = " << digitVec.size());
654 if (digitVec.empty()) {
656 notFinished = false;
657 continue;
658 }
659 for (const Identifier& channelId : digitVec) {
660
661
664
665
666
667
668 if (!idVect.empty() && std::find(idVect.begin(), idVect.end(), rpcHashId) == idVect.end()) {
669 continue;
670 }
673 bool hasAMatchingEtaHit = 0;
674
675 if (triggerHit) {
676 if ((oldIdTrg != parentId) || !collectionTrg) {
677
678
680 << " hash = " << rpcHashId);
681 collectionTrg = state.getCoinCollection(parentId);
684 }
685 } else if ((oldId != parentId) || !collection) {
686
687
689 collection = state.getPrepCollection(parentId);
692 }
693
694
695
696
697 bool duplicate = false;
698 if (reduceCablOvl_thisHit) {
699 ATH_MSG_VERBOSE(
"Check for duplicates in coll. with size "<< collection->size());
701 const Identifier existId{rpc->identify()};
702 if (channelId == existId &&
704 duplicate = true;
705 hasAMatchingEtaHit = false;
706
707
709 float previous_time = rpc->time();
710
711 if (time < previous_time) {
713 ATH_MSG_DEBUG(
"time of the prd previously stored is now updated with "
714 << "current hit time: "<< previous_time << " -> " << rpc->time());
715 }
716 break;
717
718
719 }
720
721
722 if (processingphiview && solvePhiAmb_thisHit && !unsolvedAmbiguity && !idHelper.
measuresPhi(existId) &&
725 hasAMatchingEtaHit = true;
727
728
729
730
731 }
732 }
733 if (hasAMatchingEtaHit)
734 nMatchingEtaHits++;
735
736
737 if (processingphiview && duplicate)
738 nDuplicatePhiHits++;
739
740
741 }
742
743 if (solvePhiAmb_thisHit && !etaview){
745 << " hasAMatchingEtaHit = "<< hasAMatchingEtaHit);
746 }
747 if (duplicate) {
748
750 continue;
751 }
752 ATH_MSG_VERBOSE(
" solvePhiAmb_thisHit: "<<solvePhiAmb_thisHit<<
", processingetaview:"<<processingetaview
753 <<", processingphiview: "<<processingphiview<<", hasAMatchingEtaHit: "<<hasAMatchingEtaHit
754 <<", unsolvedAmbiguity: "<< unsolvedAmbiguity);
755 if ( !solvePhiAmb_thisHit || processingetaview ||
756 (processingphiview && (hasAMatchingEtaHit || unsolvedAmbiguity))) {
757 if (unsolvedAmbiguity) {
758 if (idVect.empty()) {
760 } else {
761
762
763 ATH_MSG_DEBUG(
"unsolvedAmbiguity is true, adding collection with hash = "
764 << rpcHashId << " to ambiguous collections vector");
765 const auto&
decode{state.m_decodedOfflineHashIds};
767 ambiguousCollections.insert(rpcHashId);
768 ATH_MSG_DEBUG(
"collection not yet processed; added to ambiguous "
769 <<"collection vector; going to the next offline channel ID");
770 continue;
771 } else if (!doingSecondLoopAmbigColls) {
772 ambiguousCollections.insert(rpcHashId);
773 ATH_MSG_DEBUG(
"collection already processed and doingSecondLoopAmbigColls=false; added to ambiguous "
774 <<"collection vector; going to the next offline channel ID");
775 continue;
776 } else {
777 ATH_MSG_DEBUG(
"collection already processed and doingSecondLoopAmbigColls=true; trying to store data even if unsolvedAmbiguity");
778 }
779 }
780 }
782 const RpcReadoutElement* descriptor = muDetMgr->getRpcReadoutElement(channelId);
783
784
785
787 hasAMatchingEtaHit = false;
788 duplicate = false;
791 << "> inconsistent with the geometry of detector element <"
793 << "> =>>ignore this hit /// there are unmasked channels in BOG");
794 }else{
796 << "> inconsistent with the geometry of detector element <"
798 }
799 continue;
800 }
801
802
803
806
808 descriptor->
surface(channelId).
globalToLocal(tempGlobalPosition, tempGlobalPosition, pointLocPos);
809
810
811 std::vector<Identifier> identifierList{
channelId};
812
813
815
816
817 double errPos = stripWidth / std::sqrt(12.0);
820 mat *= errPos * errPos;
821
822
823 int ambiguityFlag = 0;
824 if (solvePhiAmb_thisHit) {
825 if (processingetaview){
826 ambiguityFlag = 1;
827 }
828 if (unsolvedAmbiguity){
829 ambiguityFlag = digitVec.size();
830 } else if (hasAMatchingEtaHit){
831 ambiguityFlag = nMatchingEtaHits;
832 }
833 }
834
835
837 SG::ReadCondHandle readHandle{
m_readKey, ctx};
838 std::optional<double> StripTimeFromCool = readHandle->getStripTime(channelId);
839 if (StripTimeFromCool) {
840 time -= (*StripTimeFromCool);
841 }
842 }
843
844 if (triggerHit) {
846
847 auto newCoinData = std::make_unique<RpcCoinData>(channelId, rpcHashId,
848 std::move(pointLocPos), std::move(identifierList),
849 std::move(mat), descriptor, time,
850 ambiguityFlag, rpcChan->
ijk(), threshold, overlap, cmaId, padId, sectorId,
851 !(highPtCm));
852
853
854 ATH_MSG_DEBUG(
" Adding RpcCoinData @ "<< newCoinData.get() <<
" to collection "
856
857 newCoinData->setHashAndIndex(collectionTrg->identifyHash(),
858 collectionTrg->size());
859 collectionTrg->push_back(std::move(newCoinData));
860 }
861 else {
863 << "ambiguityFlag = " << ambiguityFlag);
864
865 auto newPrepData = std::make_unique<RpcPrepData>(channelId, rpcHashId,std::move(pointLocPos),
866 std::move(identifierList),
867 std::move(mat), descriptor, time, ambiguityFlag);
868
869
870 ATH_MSG_DEBUG(
" Adding digit @ "<< newPrepData.get() <<
" to collection "
872
873 newPrepData->setHashAndIndex(collection->identifyHash(),
874 collection->size());
875 collection->push_back(std::move(newPrepData));
876
877
878
879 nPrepRawData++;
880 }
881 }
882 }
883
884 ATH_MSG_VERBOSE(
"processingphiview:"<<processingphiview<<
", nMatchingEtaHits:"<<nMatchingEtaHits
885 <<", nDuplicatePhiHits, unsolvedAmbiguity: "<<unsolvedAmbiguity<<", solvePhiAmb_thisHit : "
886 << solvePhiAmb_thisHit);
887 if ((processingphiview && (nMatchingEtaHits == 0)) && (nDuplicatePhiHits == 0) &&
888 (!unsolvedAmbiguity) && (solvePhiAmb_thisHit)) {
889 unsolvedAmbiguity = true;
890
891
892
893 ATH_MSG_DEBUG(
"No eta prepData matching any phi hit from this CM hit \n"
894 << "loop once again and store all phi digits potentially "
895 "generating this CM hit");
896 } else if (unsolvedAmbiguity)
897 notFinished = false;
898 else
899 notFinished = false;
900 }
901 }
902 }
903
904 ATH_MSG_DEBUG(
"***************** Stop of processPad eta/phiview "
905 << processingetaview << "/" << processingphiview
906 << "***************** for Pad online Id " << padId
907 << " m_logic sector ID " << sectorId);
908
909 return StatusCode::SUCCESS;
910}
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
int stationName(const Identifier &id) const
const std::string & stationNameString(const int &index) const
Identifier parentID(const Identifier &id) const
bool measuresPhi(const Identifier &id) const override
const_pointer_type cptr()