ATLAS Offline Software
Loading...
Searching...
No Matches
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
9
10
12 const std::string& name, ISvcLocator* loc)
13 : AthReentrantAlgorithm(name, loc)
14{
15 declareProperty("JetCalibrationTool", m_calibTool, "Jet calibration tool");
16}
17
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
29 const EventContext& ctx) const
30{
32 ATH_CHECK(jets.isValid());
33
35 m_ptCalibKey, ctx);
37 m_etaCalibKey, ctx);
39 m_massCalibKey, ctx);
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}
#define ATH_CHECK
Evaluate an expression and check for errors.
Handle class for reading from StoreGate.
Handle class for adding a decoration to an object.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
An algorithm that can be simultaneously executed in multiple threads.
SG::WriteDecorHandleKey< xAOD::JetContainer > m_phiCalibKey
SG::ReadHandleKey< xAOD::JetContainer > m_jetKey
virtual StatusCode execute(const EventContext &ctx) const override
JetCalibrationDecoratorAlg(const std::string &name, ISvcLocator *pSvcLocator)
SG::WriteDecorHandleKey< xAOD::JetContainer > m_etaCalibKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_massCalibKey
ToolHandle< IJetModifier > m_calibTool
SG::WriteDecorHandleKey< xAOD::JetContainer > m_ptCalibKey
virtual StatusCode initialize() override
Handle class for adding a decoration to an object.
virtual double phi() const
The azimuthal angle ( ) of the particle.
Definition Jet_v1.cxx:54
virtual double pt() const
The transverse momentum ( ) of the particle.
Definition Jet_v1.cxx:44
virtual double m() const
The invariant mass of the particle.
Definition Jet_v1.cxx:59
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition Jet_v1.cxx:49
Jet_v1 Jet
Definition of the current "jet version".
ShallowCopyResult_t< T > shallowCopy(const T &cont, const EventContext &ctx)
Create a shallow copy of an existing container.