Skip to content
Snippets Groups Projects
Commit 70c96301 authored by Tim Martin's avatar Tim Martin
Browse files

Merge branch 'trig_context1' into '24.0'

RoiWriter+EndOfEventROIConfirmerAlg: construct handle from key

See merge request !78069
parents db2b7aac 1fe9a00f
No related branches found
No related tags found
No related merge requests found
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
*/
......@@ -20,8 +20,12 @@ StatusCode EndOfEventROIConfirmerAlg::initialize() {
StatusCode EndOfEventROIConfirmerAlg::execute(const EventContext& context) const {
ATH_MSG_DEBUG( "EndOfEventROIConfirmerAlg::execute()" );
SG::ReadHandleKey<TrigRoiDescriptorCollection> rhk("temp");
ATH_CHECK( rhk.initialize() );
for (const auto& whk : m_writeHandleKeyArray_ROIs) {
SG::ReadHandle<TrigRoiDescriptorCollection> readHandle( whk.key() );
rhk = whk.key(); // update the key
auto readHandle = SG::makeHandle(rhk, context);
if ( readHandle.isValid() ) {
ATH_MSG_DEBUG( "The " << whk.key() << " already present - this chain must have run as part of the trigger in this event" );
} else {
......
/*
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
*/
//
// @file RoiWriter.cxx
......@@ -30,7 +30,7 @@ RoiWriter::RoiWriter( const std::string& name, ISvcLocator* pSvcLocator )
: AthReentrantAlgorithm( name, pSvcLocator ) {
}
StatusCode RoiWriter::execute(const EventContext& /*ctx*/) const {
StatusCode RoiWriter::execute(const EventContext& ctx) const {
ATH_MSG_DEBUG( "In execute()..." );
......@@ -43,16 +43,23 @@ StatusCode RoiWriter::execute(const EventContext& /*ctx*/) const {
bool just_dandy = true;
// Create handle keys for use in the loop:
SG::ReadHandleKey< TrigRoiDescriptorCollection > rhk("temp");
SG::WriteHandleKey< xAOD::RoiDescriptorStore > whk("temp");
ATH_CHECK( rhk.initialize() && whk.initialize() );
// Loop over these container(s):
for( const std::string& key : keys ) {
// Update key to read from:
rhk = key;
// Construct the key of the new container:
const std::string newKey = ( ( key.find( prefix ) == 0 ) ?
( newPrefix + key.substr( prefix.size() ) ) :
key );
whk = ( ( key.find( prefix ) == 0 ) ?
( newPrefix + key.substr( prefix.size() ) ) :
key );
SG::ReadHandle< TrigRoiDescriptorCollection > rh(key);
SG::WriteHandle< xAOD::RoiDescriptorStore > wh(newKey);
auto rh = SG::makeHandle(rhk, ctx);
auto wh = SG::makeHandle(whk, ctx);
/// check object actually points to something - make sure that we do all
/// collections that we can, and not barf on the first one that might fail
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment