ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetCalibTools
src
JetCalibTestAlg.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 "
JetCalibTools/JetCalibTestAlg.h
"
6
#include "
AsgDataHandles/ReadHandle.h
"
7
#include "
xAODCore/ShallowCopy.h
"
8
9
#include <vector>
10
11
StatusCode
JetCalibTestAlg::initialize
() {
12
ATH_CHECK
(
m_jetCalibTool
.retrieve());
13
ATH_CHECK
(
m_jetKey
.initialize());
14
return
StatusCode::SUCCESS;
15
}
16
17
StatusCode
JetCalibTestAlg::execute
() {
18
// Retrieve jet container
19
SG::ReadHandle<xAOD::JetContainer>
jets(
m_jetKey
);
20
ATH_CHECK
(jets.isValid());
21
22
auto
shallowCopy =
xAOD::shallowCopy
(*jets);
23
auto
& calibJets = *shallowCopy.first;
24
25
// Record the pre-calibration pT so it can be compared afterwards
26
std::vector<double> ptBefore;
27
if
(
msgLvl
(MSG::DEBUG)) {
28
ptBefore.reserve(calibJets.size());
29
for
(
const
xAOD::Jet
*
jet
: calibJets) {
30
ptBefore.push_back(
jet
->pt());
31
}
32
}
33
34
ATH_CHECK
(
m_jetCalibTool
->calibrate(calibJets));
35
36
if
(
msgLvl
(MSG::DEBUG)) {
37
ATH_MSG_DEBUG
(
"Calibrated "
<< calibJets.size() <<
" jets from "
<<
m_jetKey
.key());
38
for
(
size_t
i = 0; i < calibJets.size(); ++i) {
39
const
double
ptAfter = calibJets[i]->pt();
40
ATH_MSG_DEBUG
(
" jet "
<< i
41
<<
": pT before = "
<< ptBefore[i] / 1000. <<
" GeV"
42
<<
", pT after = "
<< ptAfter / 1000. <<
" GeV"
43
<<
", ratio = "
<< ptAfter / ptBefore[i]);
44
}
45
}
46
47
return
StatusCode::SUCCESS;
48
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ReadHandle.h
Handle class for reading from StoreGate.
JetCalibTestAlg.h
ShallowCopy.h
AthCommonAlgorithm< Gaudi::Algorithm >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition
AthCommonMsg.h:30
JetCalibTestAlg::execute
virtual StatusCode execute() override
Definition
JetCalibTestAlg.cxx:17
JetCalibTestAlg::m_jetKey
SG::ReadHandleKey< xAOD::JetContainer > m_jetKey
Definition
JetCalibTestAlg.h:23
JetCalibTestAlg::initialize
virtual StatusCode initialize() override
Definition
JetCalibTestAlg.cxx:11
JetCalibTestAlg::m_jetCalibTool
ToolHandle< IJetCalibTool > m_jetCalibTool
Definition
JetCalibTestAlg.h:21
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
jet
Definition
JetCalibTools_PlotJESFactors.cxx:23
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