ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
AsgAnalysisAlgorithms
Root
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):
12
#include <
AsgAnalysisAlgorithms/SysTruthWeightAlg.h
>
13
#include <
AsgDataHandles/ReadHandle.h
>
14
15
//
16
// method implementations
17
//
18
19
namespace
CP
20
{
21
StatusCode
SysTruthWeightAlg::initialize
()
22
{
23
if
(
m_decoration
.empty())
24
{
25
ANA_MSG_ERROR
(
"no decoration name set"
);
26
return
StatusCode::FAILURE;
27
}
28
29
ANA_CHECK
(
m_truthParticleContainer
.initialize());
30
ANA_CHECK
(
m_sysTruthWeightTool
.retrieve());
31
ANA_CHECK
(
m_eventInfoHandle
.initialize(
m_systematicsList
));
32
ANA_CHECK
(
m_decoration
.initialize(
m_systematicsList
,
m_eventInfoHandle
));
33
ANA_CHECK
(
m_systematicsList
.addSystematics(*
m_sysTruthWeightTool
));
34
ANA_CHECK
(
m_systematicsList
.initialize());
35
36
return
StatusCode::SUCCESS;
37
}
38
39
StatusCode
SysTruthWeightAlg::execute
(
const
EventContext& ctx)
40
{
41
42
// Retreive the truth particles container
43
SG::ReadHandle<xAOD::TruthParticleContainer>
truthParticles(
m_truthParticleContainer
, ctx);
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
ReadHandle.h
Handle class for reading from StoreGate.
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg,...)
Macro printing error messages.
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:295
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:325
SysTruthWeightAlg.h
CP::SysTruthWeightAlg::m_sysTruthWeightTool
ToolHandle< PMGTools::ISysTruthWeightTool > m_sysTruthWeightTool
the tool
Definition
SysTruthWeightAlg.h:41
CP::SysTruthWeightAlg::initialize
StatusCode initialize() override
Definition
SysTruthWeightAlg.cxx:21
CP::SysTruthWeightAlg::m_systematicsList
SysListHandle m_systematicsList
the systematics list we run
Definition
SysTruthWeightAlg.h:46
CP::SysTruthWeightAlg::m_decoration
SysWriteDecorHandle< float > m_decoration
the decoration for the truth weights
Definition
SysTruthWeightAlg.h:55
CP::SysTruthWeightAlg::m_truthParticleContainer
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthParticleContainer
the truth particle container to use for the calculation
Definition
SysTruthWeightAlg.h:36
CP::SysTruthWeightAlg::m_eventInfoHandle
SysReadHandle< xAOD::EventInfo > m_eventInfoHandle
the event collection we run on
Definition
SysTruthWeightAlg.h:50
EL::AnaAlgorithm::execute
virtual::StatusCode execute()
execute this algorithm
Definition
AnaAlgorithm.cxx:315
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:66
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
xAOD::EventInfo
EventInfo_v1 EventInfo
Definition of the latest event info version.
Definition
IEventInfoCnvTool.h:16
Generated on
for ATLAS Offline Software by
1.17.0