ATLAS Offline Software
Loading...
Searching...
No Matches
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
8
9#include <vector>
10
12 ATH_CHECK(m_jetCalibTool.retrieve());
13 ATH_CHECK(m_jetKey.initialize());
14 return StatusCode::SUCCESS;
15}
16
18 // Retrieve jet container
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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
Handle class for reading from StoreGate.
bool msgLvl(const MSG::Level lvl) const
virtual StatusCode execute() override
SG::ReadHandleKey< xAOD::JetContainer > m_jetKey
virtual StatusCode initialize() override
ToolHandle< IJetCalibTool > m_jetCalibTool
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.