Skip to content
Snippets Groups Projects

eflowRec: replace Decorator with WriteDecorHandle

Merged Bertrand Martin Dit Latour requested to merge martindl/athena:24.0_eflowRecDecor into 24.0
2 files
+ 15
6
Compare changes
  • Side-by-side
  • Inline
Files
2
/*
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;
}
Loading