ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
JetAnalysisAlgorithms
Root
BJetCalibrationAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
7
8
//
9
// includes
10
//
11
12
#include <
JetAnalysisAlgorithms/BJetCalibrationAlg.h
>
13
14
//
15
// method implementations
16
//
17
18
namespace
CP
19
{
20
21
StatusCode BJetCalibrationAlg ::
22
initialize ()
23
{
24
ANA_CHECK
(
m_jetHandle
.initialize (
m_systematicsList
));
25
ANA_CHECK
(
m_jetPreselection
.initialize
26
(
m_systematicsList
,
m_jetHandle
,
SG::AllowEmpty
));
27
ANA_CHECK
(
m_muonHandle
.initialize (
m_systematicsList
));
28
ANA_CHECK
(
m_muonPreselection
.initialize
29
(
m_systematicsList
,
m_muonHandle
,
SG::AllowEmpty
));
30
31
ANA_CHECK
(
m_nmuons
.initialize(
m_systematicsList
,
m_jetHandle
));
32
33
if
(!
m_muonSelectionTool
.empty()){
34
ANA_CHECK
(
m_muonSelectionTool
.retrieve());
35
if
(!
m_muonPreselection
.empty()){
36
ATH_MSG_ERROR
(
"muonSelectionTool and muonPreselection should not be configured simultaneously"
);
37
return
StatusCode::FAILURE;
38
}
39
}
40
41
ANA_CHECK
(
m_muonInJetTool
.retrieve());
42
if
(!
m_bJetTool
.empty())
ANA_CHECK
(
m_bJetTool
.retrieve());
43
44
ANA_CHECK
(
m_systematicsList
.initialize());
45
return
StatusCode::SUCCESS;
46
}
47
48
StatusCode BJetCalibrationAlg ::
49
execute (
const
EventContext& ctx)
50
{
51
52
53
for
(
const
auto
& sys :
m_systematicsList
.systematicsVector())
54
{
55
xAOD::JetContainer
*jets =
nullptr
;
56
ANA_CHECK
(
m_jetHandle
.getCopy (jets, sys, ctx));
57
58
const
xAOD::MuonContainer
*muons =
nullptr
;
59
ANA_CHECK
(
m_muonHandle
.retrieve (muons, sys, ctx));
60
61
std::vector<const xAOD::Muon*> muons_for_correction;
62
muons_for_correction.reserve(muons->
size
());
63
for
(
const
xAOD::Muon
*
muon
: *muons)
64
{
65
if
(
// For analysis frameworks
66
(
m_muonSelectionTool
.empty() &&
m_muonPreselection
.getBool(*
muon
, sys)) ||
67
// For other frameworks
68
(!
m_muonSelectionTool
.empty() &&
m_muonSelectionTool
->accept(*
muon
)))
69
{
70
muons_for_correction.emplace_back(
muon
);
71
}
72
}
73
74
for
(
xAOD::Jet
*
jet
: *jets)
75
{
76
static
const
std::string noCalib{
"NoBJetCalibMomentum"
};
77
static
const
std::string muonCorr{
"MuonCorrMomentum"
};
78
static
const
std::string calib{
"BJetCalibMomentum"
};
79
jet
->setJetP4(noCalib,
jet
->jetP4());
80
81
int
nmuons = 0;
82
if
(!
m_jetPreselection
.getBool(*
jet
, sys))
83
{
84
jet
->setJetP4(muonCorr,
jet
->jetP4());
85
if
(!
m_bJetTool
.empty())
86
{
87
jet
->setJetP4(calib,
jet
->jetP4());
88
}
89
}
90
else
91
{
92
ANA_CHECK
(
m_muonInJetTool
->applyMuonInJetCorrection(*
jet
, muons_for_correction, nmuons));
93
jet
->setJetP4(muonCorr,
jet
->jetP4());
94
if
(!
m_bJetTool
.empty())
95
{
96
ANA_CHECK
(
m_bJetTool
->applyBJetCorrection(*
jet
, nmuons>0));
97
jet
->setJetP4(calib,
jet
->jetP4());
98
}
99
100
if
(
m_onlyDecorate
)
101
{
102
// Reset the jet 4-vector to the original one
103
jet
->setJetP4(
jet
->jetP4(noCalib));
104
}
105
}
106
107
m_nmuons
.set(*
jet
, nmuons, sys);
108
}
109
}
110
111
return
StatusCode::SUCCESS;
112
}
113
}
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x,...)
Definition
AthMsgStreamMacros.h:47
BJetCalibrationAlg.h
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:325
CP::BJetCalibrationAlg::m_bJetTool
ToolHandle< IBJetCorrectionTool > m_bJetTool
the b-jet pt correction tool
Definition
BJetCalibrationAlg.h:45
CP::BJetCalibrationAlg::m_jetPreselection
SysReadSelectionHandle m_jetPreselection
Definition
BJetCalibrationAlg.h:52
CP::BJetCalibrationAlg::m_jetHandle
SysCopyHandle< xAOD::JetContainer > m_jetHandle
Definition
BJetCalibrationAlg.h:49
CP::BJetCalibrationAlg::m_muonPreselection
SysReadSelectionHandle m_muonPreselection
Definition
BJetCalibrationAlg.h:58
CP::BJetCalibrationAlg::m_muonSelectionTool
ToolHandle< CP::IMuonSelectionTool > m_muonSelectionTool
the muon-in-jet selection tool, unused if muonPreselection set
Definition
BJetCalibrationAlg.h:39
CP::BJetCalibrationAlg::m_systematicsList
SysListHandle m_systematicsList
Definition
BJetCalibrationAlg.h:47
CP::BJetCalibrationAlg::m_onlyDecorate
Gaudi::Property< bool > m_onlyDecorate
Definition
BJetCalibrationAlg.h:64
CP::BJetCalibrationAlg::m_muonHandle
SysReadHandle< xAOD::MuonContainer > m_muonHandle
Definition
BJetCalibrationAlg.h:55
CP::BJetCalibrationAlg::m_muonInJetTool
ToolHandle< IMuonInJetCorrectionTool > m_muonInJetTool
the muon-in-jet correction tool
Definition
BJetCalibrationAlg.h:42
CP::BJetCalibrationAlg::m_nmuons
SysWriteDecorHandle< int > m_nmuons
Definition
BJetCalibrationAlg.h:61
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
SG::AllowEmpty
@ AllowEmpty
Definition
StoreGate/StoreGate/VarHandleKey.h:29
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::Muon
Muon_v1 Muon
Reference the current persistent version:
Definition
Event/xAOD/xAODMuon/xAODMuon/Muon.h:13
xAOD::JetContainer
JetContainer_v1 JetContainer
Definition of the current "jet container version".
Definition
JetContainer.h:17
xAOD::muon
@ muon
Definition
TrackingPrimitives.h:196
xAOD::MuonContainer
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
Definition
Event/xAOD/xAODMuon/xAODMuon/MuonContainer.h:14
Generated on
for ATLAS Offline Software by
1.17.0