ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetCalibTools
src
components
JetCalibrationDecoratorAlg.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 "
JetCalibrationDecoratorAlg.h
"
6
#include "
StoreGate/ReadHandle.h
"
7
#include "
StoreGate/WriteDecorHandle.h
"
8
#include "
xAODCore/ShallowCopy.h
"
9
10
11
JetCalibrationDecoratorAlg::JetCalibrationDecoratorAlg
(
12
const
std::string& name, ISvcLocator* loc)
13
:
AthReentrantAlgorithm
(name, loc)
14
{
15
declareProperty
(
"JetCalibrationTool"
,
m_calibTool
,
"Jet calibration tool"
);
16
}
17
18
StatusCode
JetCalibrationDecoratorAlg::initialize
() {
19
ATH_CHECK
(
m_calibTool
.retrieve());
20
ATH_CHECK
(
m_jetKey
.initialize());
21
ATH_CHECK
(
m_ptCalibKey
.initialize());
22
ATH_CHECK
(
m_etaCalibKey
.initialize());
23
ATH_CHECK
(
m_massCalibKey
.initialize());
24
ATH_CHECK
(
m_phiCalibKey
.initialize());
25
return
StatusCode::SUCCESS;
26
}
27
28
StatusCode
JetCalibrationDecoratorAlg::execute
(
29
const
EventContext& ctx)
const
30
{
31
SG::ReadHandle<xAOD::JetContainer>
jets(
m_jetKey
, ctx);
32
ATH_CHECK
(jets.isValid());
33
34
SG::WriteDecorHandle<xAOD::JetContainer, float>
ptDec(
35
m_ptCalibKey
, ctx);
36
SG::WriteDecorHandle<xAOD::JetContainer, float>
etaDec(
37
m_etaCalibKey
, ctx);
38
SG::WriteDecorHandle<xAOD::JetContainer, float>
massDec(
39
m_massCalibKey
, ctx);
40
SG::WriteDecorHandle<xAOD::JetContainer, float>
phiDec(
41
m_phiCalibKey
, ctx);
42
43
// Shallow-copy jets so calibration doesn't modify originals
44
auto
[copyUP, auxUP] =
xAOD::shallowCopy
(*jets, ctx);
45
46
// Apply calibration to the copies
47
ATH_CHECK
(
m_calibTool
->modify(*copyUP));
48
49
// Decorate originals with calibrated kinematics from copies
50
for
(
size_t
i = 0; i < jets->size(); ++i) {
51
const
xAOD::Jet
& originalJet = *jets->at(i);
52
const
xAOD::Jet
& calibratedJet = *copyUP->at(i);
53
54
ptDec(originalJet) = calibratedJet.
pt
();
55
etaDec(originalJet) = calibratedJet.
eta
();
56
massDec(originalJet) = calibratedJet.
m
();
57
phiDec(originalJet) = calibratedJet.
phi
();
58
}
59
60
return
StatusCode::SUCCESS;
61
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
JetCalibrationDecoratorAlg.h
ShallowCopy.h
ReadHandle.h
Handle class for reading from StoreGate.
WriteDecorHandle.h
Handle class for adding a decoration to an object.
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
JetCalibrationDecoratorAlg::m_phiCalibKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_phiCalibKey
Definition
JetCalibrationDecoratorAlg.h:44
JetCalibrationDecoratorAlg::m_jetKey
SG::ReadHandleKey< xAOD::JetContainer > m_jetKey
Definition
JetCalibrationDecoratorAlg.h:28
JetCalibrationDecoratorAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
JetCalibrationDecoratorAlg.cxx:28
JetCalibrationDecoratorAlg::JetCalibrationDecoratorAlg
JetCalibrationDecoratorAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
JetCalibrationDecoratorAlg.cxx:11
JetCalibrationDecoratorAlg::m_etaCalibKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_etaCalibKey
Definition
JetCalibrationDecoratorAlg.h:36
JetCalibrationDecoratorAlg::m_massCalibKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_massCalibKey
Definition
JetCalibrationDecoratorAlg.h:40
JetCalibrationDecoratorAlg::m_calibTool
ToolHandle< IJetModifier > m_calibTool
Definition
JetCalibrationDecoratorAlg.h:26
JetCalibrationDecoratorAlg::m_ptCalibKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_ptCalibKey
Definition
JetCalibrationDecoratorAlg.h:32
JetCalibrationDecoratorAlg::initialize
virtual StatusCode initialize() override
Definition
JetCalibrationDecoratorAlg.cxx:18
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
xAOD::Jet_v1::phi
virtual double phi() const
The azimuthal angle ( ) of the particle.
Definition
Jet_v1.cxx:54
xAOD::Jet_v1::pt
virtual double pt() const
The transverse momentum ( ) of the particle.
Definition
Jet_v1.cxx:44
xAOD::Jet_v1::m
virtual double m() const
The invariant mass of the particle.
Definition
Jet_v1.cxx:59
xAOD::Jet_v1::eta
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition
Jet_v1.cxx:49
xAOD::Jet
Jet_v1 Jet
Definition of the current "jet version".
Definition
Event/xAOD/xAODJet/xAODJet/Jet.h:17
xAOD::shallowCopy
ShallowCopyResult_t< T > shallowCopy(const T &cont, const EventContext &ctx)
Create a shallow copy of an existing container.
Generated on
for ATLAS Offline Software by
1.17.0