ATLAS Offline Software
Loading...
Searching...
No Matches
SysTruthWeightAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7//
8// includes
9//
10
11// Local include(s):
14
15//
16// method implementations
17//
18
19namespace CP
20{
22{
23 if (m_decoration.empty())
24 {
25 ANA_MSG_ERROR("no decoration name set");
26 return StatusCode::FAILURE;
27 }
28
34 ANA_CHECK(m_systematicsList.initialize());
35
36 return StatusCode::SUCCESS;
37}
38
39StatusCode SysTruthWeightAlg::execute(const EventContext& ctx)
40{
41
42 // Retreive the truth particles container
44 ANA_CHECK(truthParticles.isValid());
45
46 for (const auto &sys : m_systematicsList.systematicsVector())
47 {
48 const xAOD::EventInfo *eventInfo = nullptr;
49 ANA_CHECK(m_eventInfoHandle.retrieve(eventInfo, sys, ctx));
50
51 m_decoration.set(*eventInfo, m_sysTruthWeightTool->getSysWeight(truthParticles.cptr(), sys), sys);
52 }
53
54 // return
55 return StatusCode::SUCCESS;
56}
57} // namespace CP
Handle class for reading from StoreGate.
#define ANA_MSG_ERROR(xmsg,...)
Macro printing error messages.
#define ANA_CHECK(EXP)
check whether the given expression was successful
ToolHandle< PMGTools::ISysTruthWeightTool > m_sysTruthWeightTool
the tool
StatusCode initialize() override
SysListHandle m_systematicsList
the systematics list we run
SysWriteDecorHandle< float > m_decoration
the decoration for the truth weights
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthParticleContainer
the truth particle container to use for the calculation
SysReadHandle< xAOD::EventInfo > m_eventInfoHandle
the event collection we run on
virtual::StatusCode execute()
execute this algorithm
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
Select isolated Photons, Electrons and Muons.
EventInfo_v1 EventInfo
Definition of the latest event info version.