ATLAS Offline Software
FJvtEfficiencyTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // Get the systematic definitions from here
8 
11 
12 namespace CP {
14  m_minEta = 2.5;
15  m_maxEta = 4.5;
16  }
17 
22  if (!addAffectingSystematic(fJvtEfficiencyUp, true) ||
23  !addAffectingSystematic(fJvtEfficiencyDown, true)) {
24  ATH_MSG_ERROR("failed to set up fJvt systematics");
25  return StatusCode::FAILURE;
26  }
27  return StatusCode::SUCCESS;
28  }
29 
31  if (sys.find(fJvtEfficiencyUp) != sys.end())
33  else if (sys.find(fJvtEfficiencyDown) != sys.end())
34  m_appliedSysSigma = -1;
35  else
37  return StatusCode::SUCCESS;
38  }
39 
42  if (!isInRange(jet)) {
43  sf = -1;
45  }
47  if (!m_accIsHS->isAvailable(jet)) {
48  ATH_MSG_ERROR("Truth tagging required but not available");
49  return CorrectionCode::Error;
50  }
51  if (!(*m_accIsHS)(jet)) {
52  sf = 1;
53  return CorrectionCode::Ok;
54  }
55  }
56  auto evtInfo = SG::makeHandle(m_evtInfoKey);
57  if (!evtInfo.isValid()) {
58  ATH_MSG_ERROR("Failed to retrieve " << m_evtInfoKey.key());
59  return CorrectionCode::Error;
60  }
61  return getEffImpl(jet.pt(), evtInfo->actualInteractionsPerCrossing(), sf);
62  }
63 
66  if (!isInRange(jet)) {
67  sf = -1;
69  }
71  if (!m_accIsHS->isAvailable(jet)) {
72  ATH_MSG_ERROR("Truth tagging required but not available");
73  return CorrectionCode::Error;
74  }
75  if (!(*m_accIsHS)(jet)) {
76  sf = 1;
77  return CorrectionCode::Ok;
78  }
79  }
80  auto evtInfo = SG::makeHandle(m_evtInfoKey);
81  if (!evtInfo.isValid()) {
82  ATH_MSG_ERROR("Failed to retrieve " << m_evtInfoKey.key());
83  return CorrectionCode::Error;
84  }
85  return getIneffImpl(jet.pt(), evtInfo->actualInteractionsPerCrossing(), sf);
86  }
87 } // namespace CP
CP::JvtEfficiencyToolBase::getIneffImpl
CorrectionCode getIneffImpl(float x, float y, float &sf) const
Definition: JvtEfficiencyToolBase.cxx:137
CP::FJvtEfficiencyTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: FJvtEfficiencyTool.cxx:18
CP::FJvtEfficiencyTool::sysApplySystematicVariation
virtual StatusCode sysApplySystematicVariation(const CP::SystematicSet &sys) override
effects: configure this tool for the given list of systematic variations.
Definition: FJvtEfficiencyTool.cxx:30
CP::JvtEfficiencyToolBase::m_appliedSysSigma
int m_appliedSysSigma
Definition: JvtEfficiencyToolBase.h:61
CP::FJvtEfficiencyTool::FJvtEfficiencyTool
FJvtEfficiencyTool(const std::string &name)
Definition: FJvtEfficiencyTool.cxx:13
CP::JvtEfficiencyToolBase::m_doTruthRequirement
Gaudi::Property< bool > m_doTruthRequirement
Definition: JvtEfficiencyToolBase.h:37
CP::JvtEfficiencyToolBase::initHists
StatusCode initHists(const std::string &file, const std::string &wp)
Read the input histograms. Passing an empty 'file' string uses dummy SFs.
Definition: JvtEfficiencyToolBase.cxx:85
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
CP::FJvtEfficiencyTool::getInefficiencyScaleFactor
virtual CorrectionCode getInefficiencyScaleFactor(const xAOD::Jet &jet, float &sf) const override
Calculate the inefficiency scale factor for the provided jet.
Definition: FJvtEfficiencyTool.cxx:65
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
CP::JvtEfficiencyToolBase
Definition: JvtEfficiencyToolBase.h:20
CP::FJvtEfficiencyTool::m_evtInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_evtInfoKey
Definition: FJvtEfficiencyTool.h:31
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
CP::CorrectionCode::OutOfValidityRange
@ OutOfValidityRange
Input object is out of validity range.
Definition: CorrectionCode.h:37
CP::CorrectionCode::Error
@ Error
Some error happened during the object correction.
Definition: CorrectionCode.h:36
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
FJvtEfficiencyTool.h
CP::JvtEfficiencyToolBase::m_maxEta
Gaudi::Property< float > m_maxEta
Definition: JvtEfficiencyToolBase.h:44
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
CP::JvtEfficiencyToolBase::isInRange
bool isInRange(const xAOD::Jet &jet) const
Definition: JvtEfficiencyToolBase.cxx:155
CP::JvtEfficiencyToolBase::getEffImpl
CorrectionCode getEffImpl(float x, float y, float &sf) const
Definition: JvtEfficiencyToolBase.cxx:124
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
ReadHandle.h
Handle class for reading from StoreGate.
CP::FJvtEfficiencyTool::m_wp
Gaudi::Property< std::string > m_wp
Definition: FJvtEfficiencyTool.h:33
CP::JvtEfficiencyToolBase::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: JvtEfficiencyToolBase.cxx:31
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
CP::CorrectionCode::Ok
@ Ok
The correction was done successfully.
Definition: CorrectionCode.h:38
CP::FJvtEfficiencyTool::m_file
Gaudi::Property< std::string > m_file
Definition: FJvtEfficiencyTool.h:35
mapkey::sf
@ sf
Definition: TElectronEfficiencyCorrectionTool.cxx:38
CP::JvtEfficiencyToolBase::m_minEta
Gaudi::Property< float > m_minEta
Definition: JvtEfficiencyToolBase.h:42
CP::CorrectionCode
Return value from object correction CP tools.
Definition: CorrectionCode.h:31
ReadDecorHandle.h
Handle class for reading a decoration on an object.
CP::SystematicsTool::addAffectingSystematic
StatusCode addAffectingSystematic(const SystematicVariation &systematic, bool recommended)
effects: add a systematic to the list of registered systematics.
Definition: SystematicsTool.cxx:112
IJetJvtEfficiency.h
CP::JvtEfficiencyToolBase::m_accIsHS
std::optional< SG::AuxElement::ConstAccessor< char > > m_accIsHS
Definition: JvtEfficiencyToolBase.h:63
CP::FJvtEfficiencyTool::getEfficiencyScaleFactor
virtual CorrectionCode getEfficiencyScaleFactor(const xAOD::Jet &jet, float &sf) const override
Calculate the efficiency scale factor for the provided jet.
Definition: FJvtEfficiencyTool.cxx:41