ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetCalibTools
src
PileupAreaCalibStep.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 <TEnv.h>
6
#include "
JetCalibTools/IJetCalibrationTool.h
"
7
8
#include "
JetCalibTools/PileupAreaCalibStep.h
"
9
10
#include "
PathResolver/PathResolver.h
"
11
#include "
xAODJet/JetAccessors.h
"
12
#include "
AsgDataHandles/ReadDecorHandle.h
"
13
14
PileupAreaCalibStep::PileupAreaCalibStep
(
const
std::string& name)
15
:
asg
::
AsgTool
( name ) { }
16
17
18
19
20
StatusCode
PileupAreaCalibStep::initialize
() {
21
22
ATH_MSG_INFO
(
"Initializing pileup area correction."
);
23
24
ATH_MSG_DEBUG
(
"Reading from "
<<
m_jetInScale
<<
" and writing to "
<<
m_jetOutScale
);
25
26
ATH_CHECK
(
m_rhoKey
.initialize() );
27
return
StatusCode::SUCCESS;
28
}
29
30
StatusCode
PileupAreaCalibStep::calibrate
(
xAOD::JetContainer
& jetCont)
const
{
31
32
SG::ReadHandle<xAOD::EventShape>
rhRhoKey(
m_rhoKey
);
33
double
rho=0;
34
if
(!rhRhoKey.
isValid
()){
35
ATH_MSG_FATAL
(
"Could not retrieve xAOD::EventShape : "
<<
m_rhoKey
.key());
36
return
StatusCode::FAILURE;
37
}
38
const
xAOD::EventShape
* eventShape = rhRhoKey.
cptr
();
39
40
if
( !eventShape->
getDensity
(
xAOD::EventShape::Density
, rho ) ) {
41
ATH_MSG_FATAL
(
"Could not retrieve xAOD::EventShape::Density from xAOD::EventShape "
<<
m_rhoKey
.key());
42
return
StatusCode::FAILURE;
43
}
44
45
ATH_MSG_DEBUG
(
" Rho = "
<< 0.001*rho <<
" GeV"
);
46
47
const
xAOD::JetAttributeAccessor::AccessorWrapper<xAOD::JetFourMom_t>
areaAcc(
"ActiveArea4vec"
);
48
const
xAOD::JetAttributeAccessor::AccessorWrapper<xAOD::JetFourMom_t>
outScaleMomAcc(
m_jetOutScale
);
49
50
for
(
xAOD::Jet
*
jet
: jetCont){
51
52
const
xAOD::JetFourMom_t
jetStartP4 =
jet
->getAttribute<
xAOD::JetFourMom_t
>(
m_jetInScale
);
53
jet
->setJetP4(jetStartP4);
54
55
xAOD::JetFourMom_t
jetareaP4 = areaAcc.
getAttribute
(*
jet
);
56
ATH_MSG_VERBOSE
(
" Area = "
<< jetareaP4);
57
58
xAOD::JetFourMom_t
calibP4;
59
60
if
(
m_useFull4vectorArea
){
61
calibP4 = jetStartP4 - rho*jetareaP4;
62
}
else
{
63
ATH_MSG_VERBOSE
(
" Applying postive-only area-subtraction calibration to jet "
<<
jet
->index() <<
" with pT = "
<< 0.001*
jet
->pt() <<
" GeV"
);
64
const
double
pT_det = jetStartP4.pt();
65
const
double
E_det = jetStartP4.e();
66
//Set the jet pT to 10 MeV if the pT or energy is negative after the jet area correction
67
const
double
area_SF = (pT_det-rho*jetareaP4.pt()<=0 || E_det-rho*jetareaP4.e()<=0) ? 10/pT_det : (pT_det-rho*jetareaP4.pt())/pT_det;
68
calibP4 = jetStartP4*area_SF;
69
}
70
71
//Transfer calibrated jet properties to the Jet object
72
outScaleMomAcc.
setAttribute
(*
jet
, calibP4 );
73
jet
->setJetP4( calibP4 );
74
}
75
return
StatusCode::SUCCESS;
76
}
77
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
ReadDecorHandle.h
Handle class for reading a decoration on an object.
IJetCalibrationTool.h
JetAccessors.h
This header defines wrapper classes around SG::AuxElement::Accessor used internally in the Jet EDM.
PathResolver.h
PileupAreaCalibStep.h
PileupAreaCalibStep::PileupAreaCalibStep
PileupAreaCalibStep(const std::string &name="PileupAreaCalibStep")
Definition
PileupAreaCalibStep.cxx:14
PileupAreaCalibStep::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition
PileupAreaCalibStep.cxx:20
PileupAreaCalibStep::calibrate
virtual StatusCode calibrate(xAOD::JetContainer &jetCont) const override
Apply calibration to a jet container.
Definition
PileupAreaCalibStep.cxx:30
PileupAreaCalibStep::m_rhoKey
SG::ReadHandleKey< xAOD::EventShape > m_rhoKey
Definition
PileupAreaCalibStep.h:38
PileupAreaCalibStep::m_jetInScale
Gaudi::Property< std::string > m_jetInScale
Definition
PileupAreaCalibStep.h:43
PileupAreaCalibStep::m_useFull4vectorArea
Gaudi::Property< bool > m_useFull4vectorArea
Definition
PileupAreaCalibStep.h:40
PileupAreaCalibStep::m_jetOutScale
Gaudi::Property< std::string > m_jetOutScale
Definition
PileupAreaCalibStep.h:44
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
asg::AsgTool::AsgTool
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition
AsgTool.cxx:58
xAOD::EventShape_v1::Density
@ Density
Definition
EventShape_v1.h:47
xAOD::EventShape_v1::getDensity
bool getDensity(EventDensityID id, double &v) const
Get a density variable from the object.
Definition
EventShape_v1.cxx:135
xAOD::JetAttributeAccessor::AccessorWrapper
Definition
JetAccessors.h:49
xAOD::JetAttributeAccessor::AccessorWrapper::getAttribute
void getAttribute(const SG::AuxElement &p, TYPE &v) const
Definition
JetAccessors.h:58
xAOD::JetAttributeAccessor::AccessorWrapper::setAttribute
void setAttribute(SG::AuxElement &p, const TYPE &v) const
Definition
JetAccessors.h:54
asg
Definition
DataHandleTestTool.h:28
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::EventShape
EventShape_v1 EventShape
Definition of the current event format version.
Definition
EventShape.h:16
xAOD::JetContainer
JetContainer_v1 JetContainer
Definition of the current "jet container version".
Definition
JetContainer.h:17
xAOD::JetFourMom_t
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.
Definition
JetTypes.h:17
Generated on
for ATLAS Offline Software by
1.17.0