ATLAS Offline Software
PMGTruthWeightAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
8 //
9 // includes
10 //
11 
13 
14 //
15 // method implementations
16 //
17 
18 namespace CP
19 {
20 
22  initialize ()
23  {
24  if (m_decoration.empty())
25  {
26  ANA_MSG_ERROR ("no decoration name set");
27  return StatusCode::FAILURE;
28  }
29 
30  ANA_CHECK (m_truthWeightTool.retrieve());
35 
36  return StatusCode::SUCCESS;
37  }
38 
39 
41  execute ()
42  {
43  for (const auto& sys : m_systematicsList.systematicsVector())
44  {
45  const xAOD::EventInfo *eventInfo = nullptr;
46  ANA_CHECK (m_eventInfoHandle.retrieve (eventInfo, sys));
47 
48  m_decoration.set (*eventInfo, m_truthWeightTool->getSysWeight(eventInfo,sys), sys);
49  }
50 
51  return StatusCode::SUCCESS;
52  }
53 }
CP::SysWriteDecorHandle::set
void set(const SG::AuxElement &object, const T &value, const CP::SystematicSet &sys) const
set the object decoration for the given systematic
CP::PMGTruthWeightAlg::m_decoration
SysWriteDecorHandle< float > m_decoration
the decoration for the truth weights
Definition: PMGTruthWeightAlg.h:43
PMGTruthWeightAlg.h
CP::PMGTruthWeightAlg::initialize
StatusCode initialize() override
Definition: PMGTruthWeightAlg.cxx:22
CP::SysListHandle::addSystematics
StatusCode addSystematics(const CP::SystematicSet &recommended, const CP::SystematicSet &affecting)
register a set of affecting variables for the current algorithm (usually obtained from an CP::ISystem...
Definition: SysListHandle.cxx:48
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:294
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
CP::PMGTruthWeightAlg::m_truthWeightTool
ToolHandle< PMGTools::IPMGTruthWeightTool > m_truthWeightTool
the tool
Definition: PMGTruthWeightAlg.h:30
CP::SysListHandle::systematicsVector
const std::vector< CP::SystematicSet > & systematicsVector() const
the list of systematics to loop over
Definition: SysListHandle.cxx:96
CP::PMGTruthWeightAlg::m_eventInfoHandle
SysReadHandle< xAOD::EventInfo > m_eventInfoHandle
the event info we decorate
Definition: PMGTruthWeightAlg.h:38
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
CP::SysListHandle::initialize
::StatusCode initialize()
intialize this property
Definition: SysListHandle.cxx:69
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CP::SysWriteDecorHandle::initialize
StatusCode initialize(SysListHandle &sysListHandle, const ISysHandleBase &objectHandle)
initialize this handle
CP::PMGTruthWeightAlg::m_systematicsList
SysListHandle m_systematicsList
the systematics list we run
Definition: PMGTruthWeightAlg.h:34
CP::SysWriteDecorHandle::empty
virtual bool empty() const noexcept override
whether we have a name configured
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
CP::PMGTruthWeightAlg::execute
StatusCode execute() override
Definition: PMGTruthWeightAlg.cxx:41