ATLAS Offline Software
Loading...
Searching...
No Matches
InsituJMSCalibStep.cxx
Go to the documentation of this file.
1
2
3/*
4 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
5*/
6
7// InSituJMSCalibStep.cxx
8// Implementation file for class InSituJMSCalibStep
10
12
14 : asg::AsgTool( name ){ }
15
17// Public methods:
19
21 ATH_MSG_DEBUG ("Initializing " << name() );
22 ATH_MSG_DEBUG("Reading from " << m_jetInScale << " and writing to " << m_jetOutScale);
23
24 if ( m_isMC )
25 ATH_MSG_WARNING("InSituJMSCalibStep::calibrate : Running over MC, will not calibrate unless expert option CalibrateMC is set to true");
26
27 ATH_CHECK(m_histTool_AbsJMS.retrieve());
28
29 return StatusCode::SUCCESS;
30}
31
32
34
35 ATH_MSG_DEBUG("Starting InSitu JMS calibration of jet collection.");
36
38
39 for(xAOD::Jet* jet : jets){
40 const xAOD::JetFourMom_t jetStartP4 = jet->getAttribute<xAOD::JetFourMom_t>(m_jetInScale);
41
42 jet->setJetP4(jetStartP4);
43
44 double calibFactor = 1.0;
45
46 calibFactor = 1/m_histTool_AbsJMS->getValue(*jet, jc);
47
48 xAOD::JetFourMom_t calibP4=jetStartP4*calibFactor;
49
50 // pT doesn't change while applying in situ JMS
51 TLorentzVector TLVjet;
52 TLVjet.SetPtEtaPhiM( jetStartP4.pt(), jetStartP4.eta(), jetStartP4.phi(), calibP4.M() );
53 calibP4.SetPxPyPzE( TLVjet.Px(), TLVjet.Py(), TLVjet.Pz(), TLVjet.E() );
54
55 // Set the output scale
56 jet->setAttribute<xAOD::JetFourMom_t>(m_jetOutScale, calibP4);
57 jet->setJetP4(calibP4);
58 }
59
60 return StatusCode::SUCCESS;
61}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Gaudi::Property< std::string > m_jetInScale
Gaudi::Property< bool > m_isMC
ToolHandle< JetHelper::IVarTool > m_histTool_AbsJMS
virtual StatusCode calibrate(xAOD::JetContainer &) const override
Apply calibration to a jet container.
InSituJMSCalibStep(const std::string &name="InSituJMSCalibStep")
Constructor with parameters:
Gaudi::Property< std::string > m_jetOutScale
Class JetContext Designed to read AOD information related to the event, N vertices,...
Definition JetContext.h:24
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition AsgTool.cxx:58
Jet_v1 Jet
Definition of the current "jet version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.
Definition JetTypes.h:17