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-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
7
//
8
// includes
9
//
10
11
// EDM include(s):
12
#include "
xAODTruth/TruthParticleContainer.h
"
13
14
// Local include(s):
15
#include <
AsgAnalysisAlgorithms/SysTruthWeightAlg.h
>
16
17
//
18
// method implementations
19
//
20
21
namespace
CP
22
{
23
SysTruthWeightAlg::SysTruthWeightAlg
(
const
std::string &
name
, ISvcLocator *pSvcLocator)
24
:
AnaAlgorithm
(
name
, pSvcLocator),
m_sysTruthWeightTool
(
"PMGTools::PMGHFProductionFractionTool"
, this)
25
{
26
// The truth particle container
27
declareProperty
(
"TruthParticleContainer"
,
m_truthParticleContainer
=
"TruthParticles"
);
28
29
// The production fraction rw tool
30
declareProperty
(
"sysTruthWeightTool"
,
m_sysTruthWeightTool
);
31
}
32
33
StatusCode
SysTruthWeightAlg::initialize
()
34
{
35
if
(
m_decoration
.empty())
36
{
37
ANA_MSG_ERROR
(
"no decoration name set"
);
38
return
StatusCode::FAILURE;
39
}
40
41
ANA_CHECK
(
m_sysTruthWeightTool
.retrieve());
42
ANA_CHECK
(
m_eventInfoHandle
.initialize(
m_systematicsList
,
SG::AllowEmpty
));
43
ANA_CHECK
(
m_decoration
.initialize(
m_systematicsList
,
m_eventInfoHandle
,
SG::AllowEmpty
));
44
ANA_CHECK
(
m_systematicsList
.addSystematics(*
m_sysTruthWeightTool
));
45
ANA_CHECK
(
m_systematicsList
.initialize());
46
47
return
StatusCode::SUCCESS;
48
}
49
50
StatusCode
SysTruthWeightAlg::execute
(
const
EventContext& ctx)
51
{
52
53
// Retreive the truth particles container
54
const
xAOD::TruthParticleContainer
*truthParticles =
nullptr
;
55
ANA_CHECK
(
evtStore
()->retrieve(truthParticles,
m_truthParticleContainer
));
56
57
for
(
const
auto
&sys :
m_systematicsList
.systematicsVector())
58
{
59
const
xAOD::EventInfo
*eventInfo =
nullptr
;
60
ANA_CHECK
(
m_eventInfoHandle
.retrieve(eventInfo, sys, ctx));
61
62
m_decoration
.set(*eventInfo,
m_sysTruthWeightTool
->getSysWeight(truthParticles, sys), sys);
63
}
64
65
// return
66
return
StatusCode::SUCCESS;
67
}
68
}
// namespace CP
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
TruthParticleContainer.h
SysTruthWeightAlg.h
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthCommonAlgorithm< Gaudi::Algorithm >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
Definition
AthCommonDataStore.h:85
CP::SysTruthWeightAlg::m_truthParticleContainer
std::string m_truthParticleContainer
the truth particle container to use for the calculation
Definition
SysTruthWeightAlg.h:34
CP::SysTruthWeightAlg::SysTruthWeightAlg
SysTruthWeightAlg(const std::string &name, ISvcLocator *pSvcLocator)
the standard constructor
Definition
SysTruthWeightAlg.cxx:23
CP::SysTruthWeightAlg::m_sysTruthWeightTool
ToolHandle< PMGTools::ISysTruthWeightTool > m_sysTruthWeightTool
the tool
Definition
SysTruthWeightAlg.h:38
CP::SysTruthWeightAlg::initialize
StatusCode initialize() override
Definition
SysTruthWeightAlg.cxx:33
CP::SysTruthWeightAlg::m_systematicsList
SysListHandle m_systematicsList
the systematics list we run
Definition
SysTruthWeightAlg.h:42
CP::SysTruthWeightAlg::m_decoration
SysWriteDecorHandle< float > m_decoration
the decoration for the truth weights
Definition
SysTruthWeightAlg.h:51
CP::SysTruthWeightAlg::m_eventInfoHandle
SysReadHandle< xAOD::EventInfo > m_eventInfoHandle
the event collection we run on
Definition
SysTruthWeightAlg.h:46
EL::AnaAlgorithm::AnaAlgorithm
AnaAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
Definition
AnaAlgorithm.cxx:40
EL::AnaAlgorithm::execute
virtual::StatusCode execute()
execute this algorithm
Definition
AnaAlgorithm.cxx:315
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
SG::AllowEmpty
@ AllowEmpty
Definition
StoreGate/StoreGate/VarHandleKey.h:27
xAOD::name
name
Definition
TriggerMenuJson_v1.cxx:29
xAOD::EventInfo
EventInfo_v1 EventInfo
Definition of the latest event info version.
Definition
IEventInfoCnvTool.h:16
xAOD::TruthParticleContainer
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.
Definition
Event/xAOD/xAODTruth/xAODTruth/TruthParticleContainer.h:17
Generated on
for ATLAS Offline Software by
1.17.0