ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetCalibTools
src
components
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
CalibratedJetCopyAlg::CalibratedJetCopyAlg
(
14
const
std::string& name, ISvcLocator* loc)
15
:
AthReentrantAlgorithm
(name, loc)
16
{
17
declareProperty
(
"JetCalibrationTool"
,
m_calibTool
,
"Jet calibration tool"
);
18
}
19
20
StatusCode
CalibratedJetCopyAlg::initialize
() {
21
ATH_CHECK
(
m_calibTool
.retrieve());
22
ATH_CHECK
(
m_jetKey
.initialize());
23
ATH_CHECK
(
m_copyKey
.initialize());
24
ATH_CHECK
(
m_linkKey
.initialize());
25
return
StatusCode::SUCCESS;
26
}
27
28
StatusCode
CalibratedJetCopyAlg::execute
(
const
EventContext& ctx)
const
29
{
30
SG::ReadHandle<xAOD::JetContainer>
jets(
m_jetKey
, ctx);
31
ATH_CHECK
(jets.isValid());
32
33
auto
[copy, aux] =
xAOD::shallowCopy
(*jets, ctx);
34
35
ATH_CHECK
(
m_calibTool
->modify(*copy));
36
37
if
(!
xAOD::setOriginalObjectLink
(*jets, *copy)) {
38
ATH_MSG_ERROR
(
"Failed to set original object links on "
<<
m_copyKey
);
39
return
StatusCode::FAILURE;
40
}
41
42
SG::WriteHandle<xAOD::JetContainer>
copyHandle(
m_copyKey
, ctx);
43
ATH_CHECK
(copyHandle.
record
(std::move(copy), std::move(aux)));
44
45
SG::WriteDecorHandle<xAOD::JetContainer, ElementLink<xAOD::JetContainer>
>
46
linkDec(
m_linkKey
, ctx);
47
for
(
size_t
i = 0; i < jets->size(); ++i) {
48
linkDec(*jets->at(i)) =
49
ElementLink<xAOD::JetContainer>
(*copyHandle, i, ctx);
50
}
51
52
return
StatusCode::SUCCESS;
53
}
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:33
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.
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
CalibratedJetCopyAlg::initialize
virtual StatusCode initialize() override
Definition
CalibratedJetCopyAlg.cxx:20
CalibratedJetCopyAlg::CalibratedJetCopyAlg
CalibratedJetCopyAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
CalibratedJetCopyAlg.cxx:13
CalibratedJetCopyAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
CalibratedJetCopyAlg.cxx:28
CalibratedJetCopyAlg::m_calibTool
ToolHandle< IJetModifier > m_calibTool
Definition
CalibratedJetCopyAlg.h:27
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