From 84d9b2d64f672f3813d57c2c99f6ce6660ccddd1 Mon Sep 17 00:00:00 2001 From: Tim Martin <Tim.Martin@cern.ch> Date: Wed, 1 Apr 2020 10:52:08 +0200 Subject: [PATCH] Make ROI collection output optional --- .../DecisionHandling/src/InputMakerForRoI.cxx | 18 +++++++++++------- .../DecisionHandling/src/InputMakerForRoI.h | 3 ++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Trigger/TrigSteer/DecisionHandling/src/InputMakerForRoI.cxx b/Trigger/TrigSteer/DecisionHandling/src/InputMakerForRoI.cxx index eb4be8cb27c1..340a2d6adc5f 100644 --- a/Trigger/TrigSteer/DecisionHandling/src/InputMakerForRoI.cxx +++ b/Trigger/TrigSteer/DecisionHandling/src/InputMakerForRoI.cxx @@ -22,7 +22,7 @@ InputMakerForRoI:: InputMakerForRoI( const std::string& name, StatusCode InputMakerForRoI::initialize() { ATH_MSG_DEBUG("Will produce output RoI collections: " << m_RoIs); - CHECK( m_RoIs.initialize() ); + CHECK( m_RoIs.initialize( SG::AllowEmpty ) ); return StatusCode::SUCCESS; } @@ -35,7 +35,7 @@ StatusCode InputMakerForRoI::execute( const EventContext& context ) const { ATH_CHECK(outputHandle.isValid()); // Prepare Outputs - std::unique_ptr< TrigRoiDescriptorCollection > oneRoIColl( new TrigRoiDescriptorCollection() ); + std::unique_ptr<TrigRoiDescriptorCollection> oneRoIColl = std::make_unique<TrigRoiDescriptorCollection>(); // use also this: ElementLinkVector<xAOD::MuonRoIContainer> getMuonRoILinks = obj->objectCollectionLinks<xAOD::MuonRoIContainer>("ManyMuonRoIs"); std::vector <ElementLink<TrigRoiDescriptorCollection> > RoIsFromDecision; // used to check for duplicate features linked to different inputHandles @@ -70,11 +70,15 @@ StatusCode InputMakerForRoI::execute( const EventContext& context ) const { } // loop over decisions - // Finally, record output - ATH_MSG_DEBUG("Produced "<<oneRoIColl->size() <<" output RoIs"); - auto roi_outputHandle = SG::makeHandle(m_RoIs, context); - ATH_CHECK( roi_outputHandle.record(std::move(oneRoIColl)) ); - + // Finally, record output + if (m_RoIs.empty()) { + ATH_MSG_DEBUG("No concrete output ROI collection required from this InputMaker."); + } else { + ATH_MSG_DEBUG("Produced "<<oneRoIColl->size() <<" output RoIs"); + auto roi_outputHandle = SG::makeHandle(m_RoIs, context); + ATH_CHECK( roi_outputHandle.record(std::move(oneRoIColl)) ); + } + // call base class helper method to print some debug messages summarising the content of the outputHandles. if (msgLvl(MSG::DEBUG)) { debugPrintOut(context, outputHandle); diff --git a/Trigger/TrigSteer/DecisionHandling/src/InputMakerForRoI.h b/Trigger/TrigSteer/DecisionHandling/src/InputMakerForRoI.h index fda2d2b0cc6a..9f5119fd46c7 100644 --- a/Trigger/TrigSteer/DecisionHandling/src/InputMakerForRoI.h +++ b/Trigger/TrigSteer/DecisionHandling/src/InputMakerForRoI.h @@ -26,7 +26,8 @@ virtual StatusCode execute(const EventContext&) const override; private: - SG::WriteHandleKey<TrigRoiDescriptorCollection> m_RoIs {this,"RoIs", "Unspecified", "Name of the RoIs extracted from the decisions"}; + SG::WriteHandleKey<TrigRoiDescriptorCollection> m_RoIs {this,"RoIs", "", + "Name of the collection of ROI extrated from the input Decision Objects. Used as cocnrete starting handle for step's reconstruction."}; }; -- GitLab