ATLAS Offline Software
BJetCorrectionTool.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 // JetCalibrationTool.cxx
8 // Implementation file for class BJetCorrectionTool
10 
13 
14 BJetCorrectionTool::BJetCorrectionTool(const std::string& name) : asg::AsgTool (name) { }
15 
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  m_Semi_Histo->SetDirectory(nullptr);
26  m_Had_Histo.reset(dynamic_cast<TH1F*>(calibFile->Get("Correction_Hadronic_ttbar_mean")));
27  m_Had_Histo->SetDirectory(nullptr);
28  calibFile->Close();
29 
30  return StatusCode::SUCCESS;
31 }
32 
34  float calibFactor = (isSemiLep ? m_Semi_Histo : m_Had_Histo)->Interpolate(std::log(jet.pt() * 0.001));
35  TLorentzVector j = calibFactor * jet.p4();
36  xAOD::JetFourMom_t new_jet(j.Pt(),j.Eta(),j.Phi(),j.M());
37  jet.setJetP4(new_jet);
38  return StatusCode::SUCCESS;
39 }
BJetCorrectionTool::m_calibFileName
Gaudi::Property< std::string > m_calibFileName
Definition: BJetCorrectionTool.h:46
asg
Definition: DataHandleTestTool.h:28
BJetCorrectionTool::m_Had_Histo
std::unique_ptr< TH1F > m_Had_Histo
Definition: BJetCorrectionTool.h:52
BJetCorrectionTool.h
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
BJetCorrectionTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: BJetCorrectionTool.cxx:16
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
BJetCorrectionTool::BJetCorrectionTool
BJetCorrectionTool(const std::string &name)
Constructor with parameters:
Definition: BJetCorrectionTool.cxx:14
ANA_MSG_FATAL
#define ANA_MSG_FATAL(xmsg)
Macro printing fatal messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:296
BJetCorrectionTool::m_Semi_Histo
std::unique_ptr< TH1F > m_Semi_Histo
Definition: BJetCorrectionTool.h:51
xAOD::JetFourMom_t
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.
Definition: JetTypes.h:17
PathResolver.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
BJetCorrectionTool::applyBJetCorrection
virtual StatusCode applyBJetCorrection(xAOD::Jet &jet, bool isSemiLep) const override
Definition: BJetCorrectionTool.cxx:33
PathResolverFindCalibFile
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Definition: PathResolver.cxx:431
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
TRT_PAI_utils::Interpolate
float Interpolate(const float &xval, const std::vector< float > &xtabulated, const std::vector< float > &ytabulated)
Interpolation function.
Definition: TRT_PAI_utils.cxx:14