From c1c10f27ecbea89f6d9ea27901da1a08becb5395 Mon Sep 17 00:00:00 2001 From: Tomasz Bold <tomasz.bold@gmail.com> Date: Mon, 8 May 2017 14:02:16 +0200 Subject: [PATCH] Debugged EM RoIs unpacking --- Trigger/TrigSteer/L1Decoder/share/decodeBS.py | 5 ++-- .../L1Decoder/src/CTPUnpackingTool.cxx | 26 +++++++++++-------- .../L1Decoder/src/CTPUnpackingTool.h | 2 +- .../L1Decoder/src/EMRoIsUnpackingTool.cxx | 22 +++++++++------- .../L1Decoder/src/EMRoIsUnpackingTool.h | 2 +- .../L1Decoder/src/IRoIsUnpackingTool.h | 6 +++++ .../L1Decoder/src/JRoIsUnpackingTool.h | 2 +- Trigger/TrigSteer/L1Decoder/src/L1Decoder.cxx | 6 ++--- .../L1Decoder/src/MURoIsUnpackingTool.cxx | 2 +- .../L1Decoder/src/MURoIsUnpackingTool.h | 6 ++--- .../L1Decoder/src/TAURoIsUnpackingTool.h | 2 +- 11 files changed, 48 insertions(+), 33 deletions(-) diff --git a/Trigger/TrigSteer/L1Decoder/share/decodeBS.py b/Trigger/TrigSteer/L1Decoder/share/decodeBS.py index 11091652257..5cd1ba44a77 100755 --- a/Trigger/TrigSteer/L1Decoder/share/decodeBS.py +++ b/Trigger/TrigSteer/L1Decoder/share/decodeBS.py @@ -85,8 +85,9 @@ if nThreads >= 1: from L1Decoder.L1DecoderConf import * l1Decoder = L1Decoder( OutputLevel=DEBUG ) -l1Decoder.ctpUnpacker = CTPUnpackingTool() -l1Decoder.ctpUnpacker.CTPToChainMapping = ["0:HLT_e3", "0:HLT_g5", "1:HLT_e7", "15:HLT_mu6", "33:HLT_2mu6", "15:HLT_mu6idperf", "42:HLT_e15mu4"] +l1Decoder.ctpUnpacker = CTPUnpackingTool( OutputLevel = DEBUG, ForceEnableAllChains=True ) + +l1Decoder.ctpUnpacker.CTPToChainMapping = ["0:HLT_e3", "0:HLT_g5", "1:HLT_e7", "15:HLT_mu6", "33:HLT_2mu6", "15:HLT_mu6idperf", "42:HLT_e15mu4"] # this are real IDs of L1_* items in pp_v5 menu emUnpacker = EMRoIsUnpackingTool( OutputLevel=DEBUG ) emUnpacker.ThresholdToChainMapping = ["EM3 : HLT_e3", "EM3 : HLT_g5", "EM7 : HLT_e7", "EM15 : HLT_e15mu4" ] diff --git a/Trigger/TrigSteer/L1Decoder/src/CTPUnpackingTool.cxx b/Trigger/TrigSteer/L1Decoder/src/CTPUnpackingTool.cxx index 3a350e07476..8cafc316730 100644 --- a/Trigger/TrigSteer/L1Decoder/src/CTPUnpackingTool.cxx +++ b/Trigger/TrigSteer/L1Decoder/src/CTPUnpackingTool.cxx @@ -13,6 +13,7 @@ CTPUnpackingTool::CTPUnpackingTool( const std::string& type, const IInterface* parent ) : AthAlgTool(type, name, parent) { declareProperty("CTPToChainMapping", m_ctpToChainProperty, "Mapping of the form: '34:HLT_x', '35:HLT_y', ..., both CTP ID and chain may appear many times"); + declareProperty("ForceEnableAllChains", m_forceEnable=false, "Enables all chains in each event, testing mode"); } @@ -21,7 +22,7 @@ CTPUnpackingTool::~CTPUnpackingTool() StatusCode CTPUnpackingTool::decodeCTPToChainMapping() { std::istringstream input; - for ( auto entry: m_ctpToChainProperty) { + for ( auto entry: m_ctpToChainProperty ) { input.clear(); input.str(entry); size_t ctpId; @@ -29,19 +30,19 @@ StatusCode CTPUnpackingTool::decodeCTPToChainMapping() { char delim; input >> delim; if ( delim != ':' ) { - ATH_MSG_ERROR("Error in conf. entry: " << entry << " missing ':'"); + ATH_MSG_ERROR( "Error in conf. entry: " << entry << " missing ':'" ); return StatusCode::FAILURE; } std::string chainName; input >> chainName; - ATH_MSG_DEBUG("Chain " << chainName << " seeded from CTP item of ID " << ctpId); - m_ctpToChain[ctpId].push_back(HLT::Identifier(chainName)); + ATH_MSG_DEBUG( "Chain " << chainName << " seeded from CTP item of ID " << ctpId ); + m_ctpToChain[ctpId].push_back( HLT::Identifier(chainName) ); } return StatusCode::SUCCESS; } -StatusCode CTPUnpackingTool::decode(const ROIB::RoIBResult& roib, HLT::IDVec& enabledChains) const { +StatusCode CTPUnpackingTool::decode( const ROIB::RoIBResult& roib, HLT::IDVec& enabledChains ) const { size_t numberPfActivatedBits= 0; auto tav = roib.cTPResult().TAV(); @@ -49,21 +50,24 @@ StatusCode CTPUnpackingTool::decode(const ROIB::RoIBResult& roib, HLT::IDVec& e for ( size_t wordCounter = 0; wordCounter < tavSize; ++wordCounter ) { for ( size_t bitCounter = 0; bitCounter < 32; ++bitCounter ) { - const size_t ctpIndex = 32*wordCounter+bitCounter; - const bool decision = (tav[wordCounter].roIWord() & (1 << bitCounter)) > 0; - if ( decision == true ) { + const size_t ctpIndex = 32*wordCounter + bitCounter; + const bool decision = ( tav[wordCounter].roIWord() & (1 << bitCounter) ) > 0; + + if ( decision == true or m_forceEnable ) { + if ( decision ) + ATH_MSG_DEBUG( "L1 item " << ctpIndex << " active, enabling chains"); numberPfActivatedBits++; auto itr = m_ctpToChain.find(ctpIndex); if ( itr != m_ctpToChain.end() ) - enabledChains.insert(enabledChains.end(), itr->second.begin(), itr->second.end()); + enabledChains.insert( enabledChains.end(), itr->second.begin(), itr->second.end() ); } } } for ( auto chain: enabledChains ) { - ATH_MSG_DEBUG("Enabling chain: " << chain); + ATH_MSG_DEBUG( "Enabling chain: " << chain ); } if ( numberPfActivatedBits == 0 ) { - ATH_MSG_ERROR("All CTP bits were disabled, this event shoudl not have shown here"); + ATH_MSG_ERROR( "All CTP bits were disabled, this event shoudl not have shown here" ); return StatusCode::FAILURE; } return StatusCode::SUCCESS; diff --git a/Trigger/TrigSteer/L1Decoder/src/CTPUnpackingTool.h b/Trigger/TrigSteer/L1Decoder/src/CTPUnpackingTool.h index 5b54a800980..0deeea131b4 100644 --- a/Trigger/TrigSteer/L1Decoder/src/CTPUnpackingTool.h +++ b/Trigger/TrigSteer/L1Decoder/src/CTPUnpackingTool.h @@ -48,7 +48,7 @@ private: typedef std::map<size_t, HLT::IDVec> IndexToIdentifiers; IndexToIdentifiers m_ctpToChain; std::vector<std::string> m_ctpToChainProperty; - + bool m_forceEnable; }; inline const InterfaceID& CTPUnpackingTool::interfaceID() diff --git a/Trigger/TrigSteer/L1Decoder/src/EMRoIsUnpackingTool.cxx b/Trigger/TrigSteer/L1Decoder/src/EMRoIsUnpackingTool.cxx index e058d090cc8..fe532ff4c7f 100644 --- a/Trigger/TrigSteer/L1Decoder/src/EMRoIsUnpackingTool.cxx +++ b/Trigger/TrigSteer/L1Decoder/src/EMRoIsUnpackingTool.cxx @@ -44,16 +44,18 @@ StatusCode EMRoIsUnpackingTool::initialize() { return StatusCode::SUCCESS; } -StatusCode EMRoIsUnpackingTool::beginRun() { +StatusCode EMRoIsUnpackingTool::updateConfiguration() { using namespace TrigConf; const ThresholdConfig* thresholdConfig = m_configSvc->thresholdConfig(); - for( auto caloType : std::vector<L1DataDef::TriggerType>{ L1DataDef::EM/*, L1DataDef::TAU*/} ) { - for (TriggerThreshold * th : thresholdConfig->getThresholdVector( caloType ) ) { - if ( th != nullptr ) { - ATH_MSG_DEBUG( "Found threshold in the configuration: " << th->name() << " of ID: " << HLT::Identifier(th->name()).numeric() ); - m_emThresholds.push_back(th); - } + auto filteredThresholds= thresholdConfig->getThresholdVector( L1DataDef::EM ); + ATH_MSG_DEBUG( "Number of filtered thresholds " << filteredThresholds.size() ); + for (auto th : filteredThresholds ) { + if ( th != nullptr ) { + ATH_MSG_DEBUG( "Found threshold in the configuration: " << th->name() << " of ID: " << HLT::Identifier(th->name()).numeric() ); + m_emThresholds.push_back(th); + } else { + ATH_MSG_DEBUG( "Nullptr to the threshood" ); } } return StatusCode::SUCCESS; @@ -93,10 +95,12 @@ StatusCode EMRoIsUnpackingTool::unpack( const EventContext& ctx, recRoI->phi(), recRoI->phi()-m_roIWidth, recRoI->phi()+m_roIWidth ); trigRoIs->push_back( trigRoI ); - ATH_MSG_DEBUG( "RoI word: 0x" << MSG::hex << std::setw(8) << roIWord << ", threshold pattern " << MSG::dec ); - + ATH_MSG_DEBUG( "RoI word: 0x" << MSG::hex << std::setw(8) << roIWord << MSG::dec ); + auto decision = TrigCompositeUtils::newDecisionIn( decisionOutput.get() ); + for ( auto th: m_emThresholds ) { + ATH_MSG_VERBOSE( "Checking if the threshold " << th->name() << " passed" ); if ( recRoI->passedThreshold( th->thresholdNumber() ) ) { ATH_MSG_DEBUG("Passed Threshold name " << th->name()); addChainsToDecision( HLT::Identifier( th->name() ), decision, activeChains ); diff --git a/Trigger/TrigSteer/L1Decoder/src/EMRoIsUnpackingTool.h b/Trigger/TrigSteer/L1Decoder/src/EMRoIsUnpackingTool.h index 341db2dd14e..cfd48eff417 100644 --- a/Trigger/TrigSteer/L1Decoder/src/EMRoIsUnpackingTool.h +++ b/Trigger/TrigSteer/L1Decoder/src/EMRoIsUnpackingTool.h @@ -37,7 +37,7 @@ class EMRoIsUnpackingTool : virtual public AthAlgTool, virtual public IRoIsUnpac // Athena algtool's Hooks StatusCode initialize() override; - StatusCode beginRun(); + StatusCode updateConfiguration() override; StatusCode finalize() override; private: diff --git a/Trigger/TrigSteer/L1Decoder/src/IRoIsUnpackingTool.h b/Trigger/TrigSteer/L1Decoder/src/IRoIsUnpackingTool.h index 2847eb5f097..d402cac5839 100644 --- a/Trigger/TrigSteer/L1Decoder/src/IRoIsUnpackingTool.h +++ b/Trigger/TrigSteer/L1Decoder/src/IRoIsUnpackingTool.h @@ -28,6 +28,12 @@ class IRoIsUnpackingTool typedef HLT::IDtoIDVecMap ThresholdToIdentifiers; static const InterfaceID& interfaceID(); + + /* + @brief Invoked when there is a potential change of the configuration. Typically beginRun. + */ + virtual StatusCode updateConfiguration() = 0; + /* @brief The methods reads the RoIB result object and unpacks fragment of it, depending of the implementation (i.e. EM, J..) diff --git a/Trigger/TrigSteer/L1Decoder/src/JRoIsUnpackingTool.h b/Trigger/TrigSteer/L1Decoder/src/JRoIsUnpackingTool.h index 308f4e11c67..6ec9b71e888 100644 --- a/Trigger/TrigSteer/L1Decoder/src/JRoIsUnpackingTool.h +++ b/Trigger/TrigSteer/L1Decoder/src/JRoIsUnpackingTool.h @@ -36,7 +36,7 @@ class JRoIsUnpackingTool /// Destructor: virtual ~JRoIsUnpackingTool(); - + StatusCode updateConfiguration() override { return StatusCode::SUCCESS; } // Athena algtool's Hooks virtual StatusCode initialize(); virtual StatusCode finalize(); diff --git a/Trigger/TrigSteer/L1Decoder/src/L1Decoder.cxx b/Trigger/TrigSteer/L1Decoder/src/L1Decoder.cxx index 1b933d51160..2c9bda3fede 100644 --- a/Trigger/TrigSteer/L1Decoder/src/L1Decoder.cxx +++ b/Trigger/TrigSteer/L1Decoder/src/L1Decoder.cxx @@ -29,8 +29,8 @@ StatusCode L1Decoder::initialize() { } StatusCode L1Decoder::beginRun() { - // for ( auto t: m_roiUnpackers ) - // CHECK( t->beginRun() ); + for ( auto t: m_roiUnpackers ) + CHECK( t->updateConfiguration() ); return StatusCode::SUCCESS; } @@ -42,7 +42,7 @@ StatusCode L1Decoder::readConfiguration() { StatusCode L1Decoder::execute_r (const EventContext& ctx) const { using namespace TrigCompositeUtils; SG::ReadHandle<ROIB::RoIBResult> roibH( m_RoIBResultKey, ctx ); - + ATH_MSG_DEBUG( "Obtained ROIB result" ); // this should realy be: const ROIB::RoIBResult* roib = SG::INPUT_PTR (m_RoIBResultKey, ctx); // or const ROIB::RoIBResult& roib = SG::INPUT_REF (m_RoIBResultKey, ctx); diff --git a/Trigger/TrigSteer/L1Decoder/src/MURoIsUnpackingTool.cxx b/Trigger/TrigSteer/L1Decoder/src/MURoIsUnpackingTool.cxx index 59313ec2231..5e784e2efb0 100644 --- a/Trigger/TrigSteer/L1Decoder/src/MURoIsUnpackingTool.cxx +++ b/Trigger/TrigSteer/L1Decoder/src/MURoIsUnpackingTool.cxx @@ -48,7 +48,7 @@ StatusCode MURoIsUnpackingTool::initialize() { return StatusCode::SUCCESS; } -StatusCode MURoIsUnpackingTool::beginRun() { +StatusCode MURoIsUnpackingTool::updateConfiguration() { using namespace TrigConf; const ThresholdConfig* thresholdConfig = m_configSvc->thresholdConfig(); for (TriggerThreshold * th : thresholdConfig->getThresholdVector( L1DataDef::MUON ) ) { diff --git a/Trigger/TrigSteer/L1Decoder/src/MURoIsUnpackingTool.h b/Trigger/TrigSteer/L1Decoder/src/MURoIsUnpackingTool.h index 773f77df906..7ee84dbdf37 100644 --- a/Trigger/TrigSteer/L1Decoder/src/MURoIsUnpackingTool.h +++ b/Trigger/TrigSteer/L1Decoder/src/MURoIsUnpackingTool.h @@ -44,9 +44,9 @@ class MURoIsUnpackingTool virtual ~MURoIsUnpackingTool(); // Athena algtool's Hooks - StatusCode initialize() override; - StatusCode beginRun(); - StatusCode finalize() override; + StatusCode initialize() override; + StatusCode updateConfiguration() override; + StatusCode finalize() override; StatusCode unpack(const EventContext& ctx, const ROIB::RoIBResult& roib, const HLT::IDSet& activeChains) const override; diff --git a/Trigger/TrigSteer/L1Decoder/src/TAURoIsUnpackingTool.h b/Trigger/TrigSteer/L1Decoder/src/TAURoIsUnpackingTool.h index ddb82cc2771..aeed27a4f01 100644 --- a/Trigger/TrigSteer/L1Decoder/src/TAURoIsUnpackingTool.h +++ b/Trigger/TrigSteer/L1Decoder/src/TAURoIsUnpackingTool.h @@ -38,7 +38,7 @@ class TAURoIsUnpackingTool /// Destructor: virtual ~TAURoIsUnpackingTool(); - + StatusCode updateConfiguration() override { return StatusCode::SUCCESS; } // Athena algtool's Hooks virtual StatusCode initialize(); virtual StatusCode finalize(); -- GitLab