@@ -659,9 +659,18 @@ void HLTExoticaSubAnalysis::analyze(const edm::Event &iEvent, const edm::EventSe
659659 }
660660 }
661661
662+ int jel = 0 ;
663+ int jmu = 0 ;
664+ int jmutrk = 0 ;
665+
666+ // jel, jmu and jmutrk are being used as a dedicated counters to avoid getting
667+ // non-existent elements inside trkObjs[11], trkObjs[13] and trkObjs[130], respectively
668+ // more information in the issue https://github.com/cms-sw/cmssw/issues/32550
669+
662670 for (size_t j = 0 ; (j != matchesReco.size ()) && isPassedLeadingCut; ++j) {
663671 const unsigned int objType = matchesReco[j].pdgId ();
664- // std::cout << "(4) Gonna call with " << objType << std::endl;
672+ // std::cout << "(4) Gonna call with " << objType << std::endl;
673+
665674 const std::string objTypeStr = EVTColContainer::getTypeString (objType);
666675
667676 float pt = matchesReco[j].pt ();
@@ -703,10 +712,25 @@ void HLTExoticaSubAnalysis::analyze(const edm::Event &iEvent, const edm::EventSe
703712 this ->fillHist (" rec" , objTypeStr, " SumEt" , theSumEt[objType]);
704713 }
705714
706- if (trkObjs[objType].size () >= j + 1 ) {
707- float dxyRec = trkObjs[objType].at (j)->dxy (cols->bs ->position ());
715+ if (objType == 11 ){
716+ float dxyRec = trkObjs[objType].at (jel)->dxy (cols->bs ->position ());
717+ this ->fillHist (" rec" , objTypeStr, " Dxy" , dxyRec);
718+ dxys.push_back (dxyRec);
719+ ++jel;
720+ }
721+
722+ if (objType == 13 ){
723+ float dxyRec = trkObjs[objType].at (jmu)->dxy (cols->bs ->position ());
724+ this ->fillHist (" rec" , objTypeStr, " Dxy" , dxyRec);
725+ dxys.push_back (dxyRec);
726+ ++jmu;
727+ }
728+
729+ if (objType == 130 ){
730+ float dxyRec = trkObjs[objType].at (jmutrk)->dxy (cols->bs ->position ());
708731 this ->fillHist (" rec" , objTypeStr, " Dxy" , dxyRec);
709732 dxys.push_back (dxyRec);
733+ ++jmutrk;
710734 }
711735
712736 } // Closes loop in reco
0 commit comments