ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetCalibTools
src
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
5
#include "
CalibratedJetCopyAlg.h
"
6
#include "
StoreGate/ReadHandle.h
"
7
#include "
StoreGate/WriteHandle.h
"
8
#include "
StoreGate/WriteDecorHandle.h
"
9
#include "
xAODBase/IParticleHelpers.h
"
10
#include "
xAODCore/ShallowCopy.h
"
11
12
13
StatusCode
CalibratedJetCopyAlg::initialize
() {
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
21
StatusCode
CalibratedJetCopyAlg::execute
(
const
EventContext& ctx)
const
22
{
23
SG::ReadHandle<xAOD::JetContainer>
jets(
m_jetKey
, ctx);
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
35
SG::WriteHandle<xAOD::JetContainer>
copyHandle(
m_copyKey
, ctx);
36
ATH_CHECK
(copyHandle.
record
(std::move(copy), std::move(aux)));
37
38
SG::WriteDecorHandle<xAOD::JetContainer, ElementLink<xAOD::JetContainer>
>
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
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x,...)
Definition
AthMsgStreamMacros.h:47
CalibratedJetCopyAlg.h
IParticleHelpers.h
ShallowCopy.h
ReadHandle.h
Handle class for reading from StoreGate.
WriteDecorHandle.h
Handle class for adding a decoration to an object.
WriteHandle.h
Handle class for recording to StoreGate.
CalibratedJetCopyAlg::initialize
virtual StatusCode initialize() override
Definition
CalibratedJetCopyAlg.cxx:13
CalibratedJetCopyAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
CalibratedJetCopyAlg.cxx:21
CalibratedJetCopyAlg::m_calibTool
ToolHandle< IJetModifier > m_calibTool
Definition
CalibratedJetCopyAlg.h:26
CalibratedJetCopyAlg::m_copyKey
SG::WriteHandleKey< xAOD::JetContainer > m_copyKey
Definition
CalibratedJetCopyAlg.h:33
CalibratedJetCopyAlg::m_jetKey
SG::ReadHandleKey< xAOD::JetContainer > m_jetKey
Definition
CalibratedJetCopyAlg.h:29
CalibratedJetCopyAlg::m_linkKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_linkKey
Definition
CalibratedJetCopyAlg.h:37
ElementLink
ElementLink implementation for ROOT usage.
Definition
A/AthLinks/ElementLink.h:40
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition
StoreGate/StoreGate/WriteDecorHandle.h:100
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
xAOD::shallowCopy
ShallowCopyResult_t< T > shallowCopy(const T &cont, const EventContext &ctx)
Create a shallow copy of an existing container.
xAOD::setOriginalObjectLink
bool setOriginalObjectLink(const IParticle &original, IParticle ©)
This function should be used by CP tools when they make a deep copy of an object in their correctedCo...
Definition
IParticleHelpers.cxx:30
Generated on
for ATLAS Offline Software by
1.17.0