From 1aec0aaf72f4fd4ecbf18073e7a9028c271b8bdc Mon Sep 17 00:00:00 2001 From: Anil Sonay <anil.sonay@cern.ch> Date: Fri, 6 Aug 2021 14:17:31 +0000 Subject: [PATCH] Setting Topo optical outputs to zero for jFEX and gFEX --- .../L1TopoCoreSim/Root/GlobalOutput.cxx | 100 ++++++++---------- .../L1TopoSimulation/src/L1TopoSimulation.cxx | 5 +- 2 files changed, 48 insertions(+), 57 deletions(-) diff --git a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/GlobalOutput.cxx b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/GlobalOutput.cxx index 90c3532c209..1d542d89dca 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/GlobalOutput.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/GlobalOutput.cxx @@ -45,58 +45,54 @@ GlobalOutput::setMultiplicityTriggerLines(const vector<TrigConf::TriggerLine> & uint64_t GlobalOutput::decision_field(const std::string & l1connName) const { - try { - return m_decision.find(l1connName)->second; - } - catch(std::exception &) { - TRG_MSG_ERROR("Connector name " << l1connName << " unknown"); - throw; - } - + if (m_decision.find(l1connName) != m_decision.end()) { + return m_decision.find(l1connName)->second; + }else{ + TRG_MSG_WARNING("Connector name " << l1connName << " unknown"); + return 0; + } } uint32_t GlobalOutput::decision_field(string l1connName, unsigned int clock) const { - try { - if(clock==0) { - // lower 32 bit - return static_cast<uint32_t>(m_decision.at(l1connName) & 0xffffffff); - } else { - // upper 32 bit - uint64_t clock1 = m_decision.at(l1connName) & 0xffffffff00000000; - return static_cast<uint32_t>(clock1 >> 32); - } - } - catch(std::exception &) { - TRG_MSG_ERROR("Connector name " << l1connName << " unknown"); - throw; - } -} -uint64_t -GlobalOutput::overflow_field(std::string l1connName) const { - try { - return m_overflow.find(l1connName)->second; - } - catch(std::exception &){ - TRG_MSG_ERROR("Connector name " << l1connName << " unknown"); - throw; - } + if (m_decision.find(l1connName) != m_decision.end()) { + if(clock==0) { + // lower 32 bit + return static_cast<uint32_t>(m_decision.at(l1connName) & 0xffffffff); + } else { + // upper 32 bit + uint64_t clock1 = m_decision.at(l1connName) & 0xffffffff00000000; + return static_cast<uint32_t>(clock1 >> 32); + } + }else{ + TRG_MSG_WARNING("Connector name " << l1connName << " unknown"); + return 0; + } } std::bitset<128> GlobalOutput::count_field(std::string l1connName) const { - try{ - return m_count.find(l1connName)->second; - } - catch(std::exception &){ - TRG_MSG_ERROR("Connector name " << l1connName << " unknown"); - throw; - } + if (m_count.find(l1connName) != m_count.end()) { + return m_count.find(l1connName)->second; + }else{ + TRG_MSG_WARNING("Connector name " << l1connName << " unknown"); + return 0; + } +} + +uint64_t +GlobalOutput::overflow_field(std::string l1connName) const { + if (m_overflow.find(l1connName) != m_overflow.end()) { + return m_overflow.find(l1connName)->second; + }else{ + TRG_MSG_WARNING("Connector name " << l1connName << " unknown"); + return 0; + } } uint32_t GlobalOutput::overflow_field(string l1connName, unsigned int clock) const { - try{ + if (m_overflow.find(l1connName) != m_overflow.end()) { if(clock==0) { // lower 32 bit return static_cast<uint32_t>(m_overflow.find(l1connName)->second & 0xffffffff); @@ -105,11 +101,10 @@ GlobalOutput::overflow_field(string l1connName, unsigned int clock) const { uint64_t clock1 = m_overflow.find(l1connName)->second & 0xffffffff00000000; return static_cast<uint32_t>(clock1 >> 32); } - } - catch(std::exception &){ - TRG_MSG_ERROR("Connector name " << l1connName << " unknown"); - throw; - } + }else{ + TRG_MSG_WARNING("Connector name " << l1connName << " unknown"); + return 0; + } } @@ -169,15 +164,12 @@ GlobalOutput::collectOutput(const set<DecisionConnector*> & outConn, const set<C TCS::StatusCode GlobalOutput::resetOutput() { - for(auto const& dec : m_decision) - m_decision[dec.first] = 0; - for(auto const& ovf : m_overflow) - m_overflow[ovf.first] = 0; - for(auto const& count : m_count) - m_count[count.first] = 0; - - m_valid = false; - return TCS::StatusCode::SUCCESS; + m_decision.clear(); + m_overflow.clear(); + m_count.clear(); + + m_valid = false; + return TCS::StatusCode::SUCCESS; } diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.cxx b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.cxx index 21b1f15f5bf..690caa83fa0 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.cxx @@ -247,11 +247,10 @@ L1TopoSimulation::execute() { } // set optical connectors - for( auto connOpt : l1menu->board("Topo1").connectorNames() ) { - topoOutput2CTP->setOptCableWord( connOpt, globalOutput.count_field(connOpt) ); + topoOutput2CTP->setOptCableWord( connOpt, globalOutput.count_field(connOpt) ); } - + CHECK(SG::makeHandle(m_topoCTPLocation) .record(std::move(topoOutput2CTP))); CHECK(SG::makeHandle(m_topoOverflowCTPLocation).record(std::move(topoOverflow2CTP))); } -- GitLab