ATLAS Offline Software
Reconstruction
Jet
JetCalibTools
src
JESCalibStep.cxx
Go to the documentation of this file.
1
3
/*
4
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
// EtaMassJESCalibStep.cxx
8
// Implementation file for class EtaMassJESCalibStep
9
// Author: Max Swiatlowski <mswiatlo@cern.ch>
11
12
#include "
JetCalibTools/JESCalibStep.h
"
13
14
EtaMassJESCalibStep::EtaMassJESCalibStep
(
const
std::string&
name
)
15
:
asg
::AsgTool(
name
){ }
16
17
18
StatusCode
EtaMassJESCalibStep::initialize
(){
19
ATH_MSG_DEBUG
(
"Initializing "
<<
name
() );
20
21
ATH_CHECK
(
m_textTool_JES
.retrieve() );
22
ATH_CHECK
(
m_textTool_Eta
.retrieve() );
23
ATH_CHECK
(
m_textTool_EmaxJES
.retrieve() );
24
25
return
StatusCode::SUCCESS;
26
}
27
28
StatusCode
EtaMassJESCalibStep::calibrate
(
xAOD::JetContainer
&
jets
)
const
{
29
ATH_MSG_DEBUG
(
"Calibrating jet collection."
);
30
31
32
// Change this to EtaMassJES? Or only if Mass is applied?
33
const
xAOD::JetAttributeAccessor::AccessorWrapper<xAOD::JetFourMom_t>
jesScaleMomAcc(
"JetEtaJESScaleMomentum"
);
34
35
for
(
const
auto
jet
:
jets
){
36
37
const
xAOD::JetFourMom_t
jetStartP4 =
jet
->jetP4();
38
39
// Extract the maximum energy, and store in the context
40
JetHelper::JetContext
jc;
41
jc.
setValue
(
"Emax"
,
m_textTool_EmaxJES
->getValue(*
jet
, jc));
42
43
// Extract JES from the text handling tool
44
// TODO: Check that textTool uses DetectorEta properly
45
float
jesCorrection =
m_textTool_JES
->getValue(*
jet
, jc);
46
ATH_MSG_INFO
(jesCorrection);
47
48
ATH_MSG_INFO
(
"above is JES, below is eta"
);
49
50
xAOD::JetFourMom_t
calibP4 = jetStartP4 * jesCorrection;
51
52
53
const
float
etaCorr = calibP4.eta() +
m_textTool_Eta
->getValue(*
jet
, jc);
54
ATH_MSG_INFO
(etaCorr);
55
56
// Apply the eta correction, use TLV from ROOT to do some math for us
57
TLorentzVector TLVjet;
58
TLVjet.SetPtEtaPhiM( calibP4.P()/cosh(etaCorr), etaCorr, calibP4.phi(), calibP4.M() );
59
calibP4.SetPxPyPzE( TLVjet.Px(), TLVjet.Py(), TLVjet.Pz(), TLVjet.E() );
60
61
// Set the decorations of this scale
62
jesScaleMomAcc.
setAttribute
(*
jet
, calibP4);
63
jet
->setJetP4(calibP4);
64
}
65
66
return
StatusCode::SUCCESS;
67
}
EtaMassJESCalibStep::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition:
JESCalibStep.cxx:18
EtaMassJESCalibStep::m_textTool_EmaxJES
ToolHandle< JetHelper::IVarTool > m_textTool_EmaxJES
Definition:
JESCalibStep.h:45
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition:
AthMsgStreamMacros.h:31
JetHelper::JetContext
Class JetContext Designed to read AOD information related to the event, N vertices,...
Definition:
JetContext.h:24
xAOD::JetAttributeAccessor::AccessorWrapper::setAttribute
void setAttribute(SG::AuxElement &p, const TYPE &v) const
Definition:
JetAccessors.h:54
EtaMassJESCalibStep::EtaMassJESCalibStep
EtaMassJESCalibStep(const std::string &name="EtaMassJESCalibStep")
Definition:
JESCalibStep.cxx:14
asg
Definition:
DataHandleTestTool.h:28
JESCalibStep.h
EtaMassJESCalibStep::calibrate
virtual StatusCode calibrate(xAOD::JetContainer &) const override
Apply calibration to a jet container.
Definition:
JESCalibStep.cxx:28
jet
Definition:
JetCalibTools_PlotJESFactors.cxx:23
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition:
AthMsgStreamMacros.h:29
ATH_CHECK
#define ATH_CHECK
Definition:
AthCheckMacros.h:40
DataVector
Derived DataVector<T>.
Definition:
DataVector.h:581
EtaMassJESCalibStep::m_textTool_Eta
ToolHandle< JetHelper::IVarTool > m_textTool_Eta
Definition:
JESCalibStep.h:44
xAOD::JetFourMom_t
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.
Definition:
JetTypes.h:17
EtaMassJESCalibStep::m_textTool_JES
ToolHandle< JetHelper::IVarTool > m_textTool_JES
Definition:
JESCalibStep.h:43
name
std::string name
Definition:
Control/AthContainers/Root/debug.cxx:221
xAOD::JetAttributeAccessor::AccessorWrapper< xAOD::JetFourMom_t >
defineDB.jets
list jets
Definition:
JetTagCalibration/share/defineDB.py:24
JetHelper::JetContext::setValue
bool setValue(const std::string &name, const T value, bool allowOverwrite=false)
Definition:
JetContext.h:52
Generated on Thu Nov 7 2024 21:17:57 for ATLAS Offline Software by
1.8.18