ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetCalibTools
src
BJetCorrectionTool.cxx
Go to the documentation of this file.
1
2
3
/*
4
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
// JetCalibrationTool.cxx
8
// Implementation file for class BJetCorrectionTool
10
11
#include "
JetCalibTools/BJetCorrectionTool.h
"
12
#include "
PathResolver/PathResolver.h
"
13
14
BJetCorrectionTool::BJetCorrectionTool
(
const
std::string& name) :
asg
::
AsgTool
(name) { }
15
16
StatusCode
BJetCorrectionTool::initialize
() {
17
std::string filename =
PathResolverFindCalibFile
(
"BJetPtCorrection/"
+
m_calibFileName
);
18
std::unique_ptr<TFile> calibFile = std::make_unique<TFile>(filename.c_str(),
"READ"
);
19
if
(!calibFile){
20
ANA_MSG_FATAL
(
"Calibration file is not found "
<< filename );
21
return
StatusCode::FAILURE;
22
}
23
24
m_Semi_Histo
.reset(
dynamic_cast<
TH1F*
>
(calibFile->Get(
"Correction_SemiLeptonic_ttbar_mean"
)));
25
if
(!
m_Semi_Histo
) {
26
ATH_MSG_FATAL
(
"Cannot get Correction_SemiLeptonic_ttbar_mean from calib file"
);
27
return
StatusCode::FAILURE;
28
}
29
m_Semi_Histo
->SetDirectory(
nullptr
);
30
m_Had_Histo
.reset(
dynamic_cast<
TH1F*
>
(calibFile->Get(
"Correction_Hadronic_ttbar_mean"
)));
31
if
(!
m_Had_Histo
) {
32
ATH_MSG_FATAL
(
"Cannot get Correction_Hadronic_ttbar_mean from calib file"
);
33
return
StatusCode::FAILURE;
34
}
35
m_Had_Histo
->SetDirectory(
nullptr
);
36
calibFile->Close();
37
38
return
StatusCode::SUCCESS;
39
}
40
41
StatusCode
BJetCorrectionTool::applyBJetCorrection
(
xAOD::Jet
&
jet
,
bool
isSemiLep)
const
{
42
float
calibFactor = (isSemiLep ?
m_Semi_Histo
:
m_Had_Histo
)->Interpolate(std::log(
jet
.pt() * 0.001));
43
TLorentzVector j = calibFactor *
jet
.p4();
44
xAOD::JetFourMom_t
new_jet(j.Pt(),j.Eta(),j.Phi(),j.M());
45
jet
.setJetP4(new_jet);
46
return
StatusCode::SUCCESS;
47
}
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
BJetCorrectionTool.h
ANA_MSG_FATAL
#define ANA_MSG_FATAL(xmsg)
Macro printing fatal messages.
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:296
PathResolver.h
PathResolverFindCalibFile
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Definition
PathResolver.cxx:325
BJetCorrectionTool::BJetCorrectionTool
BJetCorrectionTool(const std::string &name)
Constructor with parameters:
Definition
BJetCorrectionTool.cxx:14
BJetCorrectionTool::applyBJetCorrection
virtual StatusCode applyBJetCorrection(xAOD::Jet &jet, bool isSemiLep) const override
Definition
BJetCorrectionTool.cxx:41
BJetCorrectionTool::m_Semi_Histo
std::unique_ptr< TH1F > m_Semi_Histo
Definition
BJetCorrectionTool.h:51
BJetCorrectionTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition
BJetCorrectionTool.cxx:16
BJetCorrectionTool::m_Had_Histo
std::unique_ptr< TH1F > m_Had_Histo
Definition
BJetCorrectionTool.h:52
BJetCorrectionTool::m_calibFileName
Gaudi::Property< std::string > m_calibFileName
Definition
BJetCorrectionTool.h:46
asg::AsgTool::AsgTool
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition
AsgTool.cxx:58
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::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