diff --git a/L1Trigger/L1TGlobal/interface/GlobalBoard.h b/L1Trigger/L1TGlobal/interface/GlobalBoard.h index 1054b2e91c4f0..3fabb5a4f175d 100644 --- a/L1Trigger/L1TGlobal/interface/GlobalBoard.h +++ b/L1Trigger/L1TGlobal/interface/GlobalBoard.h @@ -174,7 +174,8 @@ namespace l1t { /// pointer to External data list inline const BXVector* getCandL1External() const { return m_candL1External; } - inline const float getCICADAScore() const { return m_cicadaScore; } + /// pointer to CICADA-score data list + inline const BXVector* getCandL1CICADAScore() const { return m_candL1CICADAScore; } /* Drop individual EtSums for Now /// pointer to ETM data list @@ -208,8 +209,6 @@ namespace l1t { void setResetPSCountersEachLumiSec(bool val) { m_resetPSCountersEachLumiSec = val; } void setSemiRandomInitialPSCounters(bool val) { m_semiRandomInitialPSCounters = val; } - void setCICADAScore(float val) { m_cicadaScore = val; } - public: inline void setVerbosity(const int verbosity) { m_verbosity = verbosity; } @@ -224,6 +223,7 @@ namespace l1t { BXVector* m_candL1EtSum; BXVector* m_candL1EtSumZdc; BXVector* m_candL1External; + BXVector* m_candL1CICADAScore; // BXVector* m_candETM; // BXVector* m_candETT; @@ -233,8 +233,6 @@ namespace l1t { int m_bxFirst_; int m_bxLast_; - float m_cicadaScore = 0.0; - std::bitset m_gtlAlgorithmOR; std::bitset m_gtlDecisionWord; diff --git a/L1Trigger/L1TGlobal/src/CICADACondition.cc b/L1Trigger/L1TGlobal/src/CICADACondition.cc index 2fec836454ad6..ea0b4bf6c5a25 100644 --- a/L1Trigger/L1TGlobal/src/CICADACondition.cc +++ b/L1Trigger/L1TGlobal/src/CICADACondition.cc @@ -40,22 +40,24 @@ l1t::CICADACondition& l1t::CICADACondition::operator=(const l1t::CICADACondition } const bool l1t::CICADACondition::evaluateCondition(const int bxEval) const { - bool condResult = false; - const float cicadaScore = m_uGtB->getCICADAScore(); + auto const* cicadaScoreBXVec = m_uGtB->getCandL1CICADAScore(); + + int const useBx = bxEval + m_gtCICADATemplate->condRelativeBx(); + + if (cicadaScoreBXVec->isEmpty(useBx)) { + return false; + } + + float const cicadaScore = cicadaScoreBXVec->at(useBx, 0); // This gets rid of a GT emulator convention "iCondition". // This usually indexes the next line, which is somewhat concerning // AXOL1TL operates this way, but it should be checked const CICADATemplate::ObjectParameter objPar = (*(m_gtCICADATemplate->objectParameter()))[0]; - bool condGEqVal = m_gtCICADATemplate->condGEq(); - bool passCondition = false; - - passCondition = checkCut(objPar.minCICADAThreshold, cicadaScore, condGEqVal); - - condResult |= passCondition; + bool const condGEqVal = m_gtCICADATemplate->condGEq(); - return condResult; + return checkCut(objPar.minCICADAThreshold, cicadaScore, condGEqVal); } void l1t::CICADACondition::print(std::ostream& myCout) const { diff --git a/L1Trigger/L1TGlobal/src/GlobalBoard.cc b/L1Trigger/L1TGlobal/src/GlobalBoard.cc index 51538b46463c5..5065d1cee5cd1 100644 --- a/L1Trigger/L1TGlobal/src/GlobalBoard.cc +++ b/L1Trigger/L1TGlobal/src/GlobalBoard.cc @@ -75,6 +75,7 @@ l1t::GlobalBoard::GlobalBoard() m_candL1EtSum(new BXVector), m_candL1EtSumZdc(new BXVector), m_candL1External(new BXVector), + m_candL1CICADAScore(new BXVector), m_currentLumi(0), m_isDebugEnabled(edm::isDebugEnabled()) { m_uGtAlgBlk.reset(); @@ -98,6 +99,7 @@ l1t::GlobalBoard::~GlobalBoard() { delete m_candL1EtSum; delete m_candL1EtSumZdc; delete m_candL1External; + delete m_candL1CICADAScore; } // Operations @@ -124,6 +126,7 @@ void l1t::GlobalBoard::init(const int numberPhysTriggers, m_candL1EtSum->setBXRange(m_bxFirst_, m_bxLast_); m_candL1EtSumZdc->setBXRange(m_bxFirst_, m_bxLast_); m_candL1External->setBXRange(m_bxFirst_, m_bxLast_); + m_candL1CICADAScore->setBXRange(m_bxFirst_, m_bxLast_); m_uGtAlgBlk.reset(); @@ -338,26 +341,26 @@ void l1t::GlobalBoard::receiveCaloObjectData(const edm::Event& iEvent, } } if (receiveCICADA) { - edm::Handle> cicadaScoreHandle; - iEvent.getByToken(CICADAInputToken, cicadaScoreHandle); - if (not cicadaScoreHandle.isValid()) { - if (m_verbosity) { - edm::LogWarning("L1Tglobal") << "\nWarning: Input tag for the CICADA score" - << "\nrequested in configuration, but not found in the event.\n" - << "\nSetting score to 0.0"; - } - setCICADAScore(0.0); - } else if (cicadaScoreHandle->isEmpty(0)) { + edm::Handle> cicadaScoreData; + iEvent.getByToken(CICADAInputToken, cicadaScoreData); + + if (!cicadaScoreData.isValid()) { if (m_verbosity) { - edm::LogWarning("L1Tglobal") - << "\nWarning: CICADA score had a valid input tag, but an empty BX collection" - << "\nThe CICADA score will be filled with 0.0 to prevent any failure of uGT emulation"; + edm::LogWarning("L1TGlobal") << "\nWarning: Input tag for the CICADA-score collection" + << "\nrequested in configuration, but not found in the event.\n"; } - setCICADAScore(0.0); } else { - setCICADAScore(cicadaScoreHandle->at( - 0, - 0)); //CICADA emulation will only provide a central BX, and one value. Unpacking may have more values, but that can't be guaranteed. + for (int i = cicadaScoreData->getFirstBX(); i <= cicadaScoreData->getLastBX(); ++i) { + // Prevent from pushing back bx that is outside of allowed range + if (i < m_bxFirst_ || i > m_bxLast_) + continue; + + for (std::vector::const_iterator cicadaScore = cicadaScoreData->begin(i); + cicadaScore != cicadaScoreData->end(i); + ++cicadaScore) { + m_candL1CICADAScore->push_back(i, *cicadaScore); + } + } //end loop over Bx } } } @@ -1183,13 +1186,14 @@ void l1t::GlobalBoard::resetCalo() { m_candL1Jet->clear(); m_candL1EtSum->clear(); m_candL1EtSumZdc->clear(); - m_cicadaScore = 0.0; + m_candL1CICADAScore->clear(); m_candL1EG->setBXRange(m_bxFirst_, m_bxLast_); m_candL1Tau->setBXRange(m_bxFirst_, m_bxLast_); m_candL1Jet->setBXRange(m_bxFirst_, m_bxLast_); m_candL1EtSum->setBXRange(m_bxFirst_, m_bxLast_); m_candL1EtSumZdc->setBXRange(m_bxFirst_, m_bxLast_); + m_candL1CICADAScore->setBXRange(m_bxFirst_, m_bxLast_); } void l1t::GlobalBoard::resetExternal() {