diff --git a/L1Trigger/L1TGlobal/interface/GlobalBoard.h b/L1Trigger/L1TGlobal/interface/GlobalBoard.h index b91c001938234..ae9058113b20b 100644 --- a/L1Trigger/L1TGlobal/interface/GlobalBoard.h +++ b/L1Trigger/L1TGlobal/interface/GlobalBoard.h @@ -84,7 +84,9 @@ namespace l1t { void receiveMuonObjectData(const edm::Event&, const edm::EDGetTokenT>&, const bool receiveMu, - const int nrL1Mu); + const int nrL1Mu, + const std::vector* muonVec_bxm2, + const std::vector* muonVec_bxm1); void receiveMuonShowerObjectData(const edm::Event&, const edm::EDGetTokenT>&, diff --git a/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.cc b/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.cc index 430c6ffb4ea31..ca2839241fec5 100644 --- a/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.cc +++ b/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.cc @@ -266,6 +266,10 @@ L1TGlobalProducer::L1TGlobalProducer(const edm::ParameterSet& parSet) m_currentLumi = 0; + // + std::vector muonVec_bxm2; + std::vector muonVec_bxm1; + // Set default, initial, dummy prescale factor table std::vector> temp_prescaleTable; @@ -641,7 +645,7 @@ void L1TGlobalProducer::produce(edm::Event& iEvent, const edm::EventSetup& evSet receiveEtSumsZdc, receiveCICADA); - m_uGtBrd->receiveMuonObjectData(iEvent, m_muInputToken, receiveMu, m_nrL1Mu); + m_uGtBrd->receiveMuonObjectData(iEvent, m_muInputToken, receiveMu, m_nrL1Mu, &muonVec_bxm2, &muonVec_bxm1); if (m_useMuonShowers) m_uGtBrd->receiveMuonShowerObjectData(iEvent, m_muShowerInputToken, receiveMuShower, m_nrL1MuShower); @@ -700,6 +704,13 @@ void L1TGlobalProducer::produce(edm::Event& iEvent, const edm::EventSetup& evSet } //End Loop over Bx + muonVec_bxm2 = muonVec_bxm1; + muonVec_bxm1.clear(); + for (std::vector::const_iterator iMu = (*(m_uGtBrd->getCandL1Mu())).begin(0); + iMu != (*(m_uGtBrd->getCandL1Mu())).end(0); + ++iMu) { + muonVec_bxm1.push_back(**iMu); + } // Add explicit reset of Board m_uGtBrd->reset(); diff --git a/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.h b/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.h index 30ad29fe24061..53f857a136507 100644 --- a/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.h +++ b/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.h @@ -202,6 +202,10 @@ class L1TGlobalProducer : public edm::stream::EDProducer<> { //switch to save axo scores in global board bool m_produceAXOL1TLScore; + + //vectors to store muon data for previous relative bx crossings + std::vector muonVec_bxm2; + std::vector muonVec_bxm1; }; #endif // L1TGlobalProducer_h diff --git a/L1Trigger/L1TGlobal/src/GlobalBoard.cc b/L1Trigger/L1TGlobal/src/GlobalBoard.cc index b967fc83095f8..825571c064a1b 100644 --- a/L1Trigger/L1TGlobal/src/GlobalBoard.cc +++ b/L1Trigger/L1TGlobal/src/GlobalBoard.cc @@ -376,7 +376,9 @@ void l1t::GlobalBoard::receiveCaloObjectData(const edm::Event& iEvent, void l1t::GlobalBoard::receiveMuonObjectData(const edm::Event& iEvent, const edm::EDGetTokenT>& muInputToken, const bool receiveMu, - const int nrL1Mu) { + const int nrL1Mu, + const std::vector* muonVec_bxm2, + const std::vector* muonVec_bxm1) { if (m_verbosity) { LogDebug("L1TGlobal") << "\n**** GlobalBoard receiving muon data = "; //<< "\n from input tag " << muInputTag << "\n" @@ -403,16 +405,45 @@ void l1t::GlobalBoard::receiveMuonObjectData(const edm::Event& iEvent, //Loop over Muons in this bx int nObj = 0; - for (std::vector::const_iterator mu = muonData->begin(i); mu != muonData->end(i); ++mu) { - if (nObj < nrL1Mu) { - (*m_candL1Mu).push_back(i, &(*mu)); - } else { - edm::LogWarning("L1TGlobal") << " Too many Muons (" << nObj << ") for uGT Configuration maxMu =" << nrL1Mu; + if (i == -2) { + for (std::vector::const_iterator mu = muonVec_bxm2->begin(); mu != muonVec_bxm2->end(); ++mu) { + if (nObj < nrL1Mu) { + (*m_candL1Mu).push_back(i, &(*mu)); + } else { + edm::LogWarning("L1TGlobal") + << " Too many Muons (" << nObj << ") for uGT Configuration maxMu =" << nrL1Mu; + } + + LogDebug("L1TGlobal") << "Muon Pt " << mu->hwPt() << " EtaAtVtx " << mu->hwEtaAtVtx() << " PhiAtVtx " + << mu->hwPhiAtVtx() << " Qual " << mu->hwQual() << " Iso " << mu->hwIso(); + nObj++; } + } else if (i == -1) { + for (std::vector::const_iterator mu = muonVec_bxm1->begin(); mu != muonVec_bxm1->end(); ++mu) { + if (nObj < nrL1Mu) { + (*m_candL1Mu).push_back(i, &(*mu)); + } else { + edm::LogWarning("L1TGlobal") + << " Too many Muons (" << nObj << ") for uGT Configuration maxMu =" << nrL1Mu; + } - LogDebug("L1TGlobal") << "Muon Pt " << mu->hwPt() << " EtaAtVtx " << mu->hwEtaAtVtx() << " PhiAtVtx " - << mu->hwPhiAtVtx() << " Qual " << mu->hwQual() << " Iso " << mu->hwIso(); - nObj++; + LogDebug("L1TGlobal") << "Muon Pt " << mu->hwPt() << " EtaAtVtx " << mu->hwEtaAtVtx() << " PhiAtVtx " + << mu->hwPhiAtVtx() << " Qual " << mu->hwQual() << " Iso " << mu->hwIso(); + nObj++; + } + } else { + for (std::vector::const_iterator mu = muonData->begin(i); mu != muonData->end(i); ++mu) { + if (nObj < nrL1Mu) { + (*m_candL1Mu).push_back(i, &(*mu)); + } else { + edm::LogWarning("L1TGlobal") + << " Too many Muons (" << nObj << ") for uGT Configuration maxMu =" << nrL1Mu; + } + + LogDebug("L1TGlobal") << "Muon Pt " << mu->hwPt() << " EtaAtVtx " << mu->hwEtaAtVtx() << " PhiAtVtx " + << mu->hwPhiAtVtx() << " Qual " << mu->hwQual() << " Iso " << mu->hwIso(); + nObj++; + } } //end loop over muons in bx } //end loop over bx } //end if over valid muon data