ATLAS Offline Software
Loading...
Searching...
No Matches
CalibratedJetCopyAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
11
12
14 ATH_CHECK(m_calibTool.retrieve());
15 ATH_CHECK(m_jetKey.initialize());
16 ATH_CHECK(m_copyKey.initialize());
17 ATH_CHECK(m_linkKey.initialize());
18 return StatusCode::SUCCESS;
19}
20
21StatusCode CalibratedJetCopyAlg::execute(const EventContext& ctx) const
22{
24 ATH_CHECK(jets.isValid());
25
26 auto [copy, aux] = xAOD::shallowCopy(*jets, ctx);
27
28 ATH_CHECK(m_calibTool->modify(*copy));
29
30 if (!xAOD::setOriginalObjectLink(*jets, *copy)) {
31 ATH_MSG_ERROR("Failed to set original object links on " << m_copyKey);
32 return StatusCode::FAILURE;
33 }
34
36 ATH_CHECK(copyHandle.record(std::move(copy), std::move(aux)));
37
39 linkDec(m_linkKey, ctx);
40 for (size_t i = 0; i < jets->size(); ++i) {
41 linkDec(*jets->at(i)) =
42 ElementLink<xAOD::JetContainer>(*copyHandle, i, ctx);
43 }
44
45 return StatusCode::SUCCESS;
46}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x,...)
Handle class for reading from StoreGate.
Handle class for adding a decoration to an object.
Handle class for recording to StoreGate.
virtual StatusCode initialize() override
virtual StatusCode execute(const EventContext &ctx) const override
ToolHandle< IJetModifier > m_calibTool
SG::WriteHandleKey< xAOD::JetContainer > m_copyKey
SG::ReadHandleKey< xAOD::JetContainer > m_jetKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_linkKey
Handle class for adding a decoration to an object.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
ShallowCopyResult_t< T > shallowCopy(const T &cont, const EventContext &ctx)
Create a shallow copy of an existing container.
bool setOriginalObjectLink(const IParticle &original, IParticle &copy)
This function should be used by CP tools when they make a deep copy of an object in their correctedCo...