From 2f1bfb1b0a5dbf6cef78503bed48c135f851f258 Mon Sep 17 00:00:00 2001 From: Bertrand Martin dit Latour <martindl@cern.ch> Date: Thu, 20 Mar 2025 20:14:08 +0100 Subject: [PATCH] eflowRec: replace Decorator with WriteDecorHandle Hello, This MR is replacing a Decorator with a WriteDecorHandle(+Key). The main motivation is to suppress these warnings which appear once per event in the HLT: ``` 02:41:36 copyAuxStoreThinned 8 0 WARNING AthContainers/src/copyAuxStoreThinned.cxx:134: unlocked decoration passPFTrackPresel (269) in object of type xAOD::TrackParticleAuxContainer_v5 ``` Cheers, Bertrand --- Reconstruction/eflowRec/src/PFTrackPreselAlg.cxx | 16 +++++++++++----- Reconstruction/eflowRec/src/PFTrackPreselAlg.h | 5 ++++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Reconstruction/eflowRec/src/PFTrackPreselAlg.cxx b/Reconstruction/eflowRec/src/PFTrackPreselAlg.cxx index 88cb34440169..d9af3ca4fdf9 100644 --- a/Reconstruction/eflowRec/src/PFTrackPreselAlg.cxx +++ b/Reconstruction/eflowRec/src/PFTrackPreselAlg.cxx @@ -1,17 +1,14 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration */ #include "PFTrackPreselAlg.h" #include "StoreGate/ReadHandle.h" #include "StoreGate/WriteHandle.h" +#include "StoreGate/WriteDecorHandle.h" #include "AthContainers/ConstDataVector.h" #include <memory> -namespace { - const SG::AuxElement::Decorator<char> decPass("passPFTrackPresel"); -} - PFTrackPreselAlg::PFTrackPreselAlg(const std::string& name, ISvcLocator* pSvcLocator) : AthReentrantAlgorithm(name, pSvcLocator) { @@ -23,7 +20,12 @@ StatusCode PFTrackPreselAlg::initialize() { ATH_CHECK( m_inputTracksKey.initialize() ); ATH_CHECK( m_outputTracksKey.initialize() ); + + m_outputDecorKey = m_inputTracksKey.key()+"."+m_outputDecorKey.key(); + ATH_CHECK( m_outputDecorKey.initialize() ); + ATH_CHECK( m_trackSelTool.retrieve() ); + return StatusCode::SUCCESS; } @@ -35,6 +37,9 @@ StatusCode PFTrackPreselAlg::execute(const EventContext &ctx) const ATH_MSG_ERROR("Failed to retrieve " << m_inputTracksKey); return StatusCode::FAILURE; } + + SG::WriteDecorHandle<xAOD::TrackParticleContainer, char> decPass(m_outputDecorKey, ctx); + auto output = std::make_unique<ConstDataVector<xAOD::TrackParticleContainer>>(SG::VIEW_ELEMENTS); for (const xAOD::TrackParticle* itrk : *input) { @@ -48,5 +53,6 @@ StatusCode PFTrackPreselAlg::execute(const EventContext &ctx) const } auto outputHandle = SG::makeHandle(m_outputTracksKey, ctx); ATH_CHECK(outputHandle.put(std::move(output)) != nullptr); + return StatusCode::SUCCESS; } diff --git a/Reconstruction/eflowRec/src/PFTrackPreselAlg.h b/Reconstruction/eflowRec/src/PFTrackPreselAlg.h index 3d3d923dceae..217a1c907d58 100644 --- a/Reconstruction/eflowRec/src/PFTrackPreselAlg.h +++ b/Reconstruction/eflowRec/src/PFTrackPreselAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration */ #ifndef EFLOWREC_PFTRACKPRESELALG_H #define EFLOWREC_PFTRACKPRESELALG_H @@ -7,6 +7,7 @@ #include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "StoreGate/ReadHandleKey.h" #include "StoreGate/WriteHandleKey.h" +#include "StoreGate/WriteDecorHandleKey.h" #include "xAODTracking/TrackParticleContainer.h" #include "GaudiKernel/ToolHandle.h" #include "InDetTrackSelectionTool/IInDetTrackSelectionTool.h" @@ -31,6 +32,8 @@ class PFTrackPreselAlg : public AthReentrantAlgorithm { this, "InputTracks", "", "The input track selection"}; SG::WriteHandleKey<xAOD::TrackParticleContainer> m_outputTracksKey{ this, "OutputTracks", "", "The output preselected track collection"}; + SG::WriteDecorHandleKey<xAOD::TrackParticleContainer> m_outputDecorKey{ + this, "OutputDecor" , "passPFTrackPresel", "Output decoration"}; ToolHandle<InDet::IInDetTrackSelectionTool> m_trackSelTool{ this, "TrackSelTool", "", "The track selection tool"}; Gaudi::Property<float> m_upperPtCut{ -- GitLab