ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
AsgAnalysisAlgorithms
Root
AsgEventScaleFactorAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
7
8
//
9
// includes
10
//
11
12
#include <
AsgAnalysisAlgorithms/AsgEventScaleFactorAlg.h
>
13
14
//
15
// method implementations
16
//
17
18
namespace
CP
19
{
20
AsgEventScaleFactorAlg ::
21
AsgEventScaleFactorAlg (
const
std::string&
name
,
22
ISvcLocator* pSvcLocator)
23
:
AnaAlgorithm
(
name
, pSvcLocator)
24
{}
25
26
27
28
StatusCode AsgEventScaleFactorAlg ::
29
initialize ()
30
{
31
if
(
m_scaleFactorInputDecoration
.empty() ||
m_scaleFactorOutputDecoration
.empty())
32
{
33
ANA_MSG_ERROR
(
"no scale factor decoration name set"
);
34
return
StatusCode::FAILURE;
35
}
36
37
ANA_CHECK
(
m_eventInfoHandle
.initialize (
m_systematicsList
));
38
ANA_CHECK
(
m_particleHandle
.initialize (
m_systematicsList
));
39
ANA_CHECK
(
m_preselection
.initialize (
m_systematicsList
,
m_particleHandle
,
SG::AllowEmpty
));
40
ANA_CHECK
(
m_scaleFactorInputDecoration
.initialize (
m_systematicsList
,
m_particleHandle
));
41
ANA_CHECK
(
m_scaleFactorOutputDecoration
.initialize (
m_systematicsList
,
m_eventInfoHandle
));
42
ANA_CHECK
(
m_systematicsList
.initialize());
43
44
return
StatusCode::SUCCESS;
45
}
46
47
48
49
StatusCode AsgEventScaleFactorAlg ::
50
execute (
const
EventContext& ctx)
51
{
52
for
(
const
auto
& sys :
m_systematicsList
.systematicsVector())
53
{
54
const
xAOD::EventInfo
*eventInfo =
nullptr
;
55
ANA_CHECK
(
m_eventInfoHandle
.retrieve (eventInfo, sys, ctx));
56
57
const
xAOD::IParticleContainer
*particles =
nullptr
;
58
ANA_CHECK
(
m_particleHandle
.retrieve (particles, sys, ctx));
59
60
float
scaleFactor = 1;
61
for
(
const
xAOD::IParticle
*particle : *particles)
62
{
63
if
(
m_preselection
.getBool (*particle, sys))
64
{
65
scaleFactor *=
m_scaleFactorInputDecoration
.get (*particle, sys);
66
}
67
}
68
69
m_scaleFactorOutputDecoration
.set (*eventInfo, scaleFactor, sys);
70
}
71
72
return
StatusCode::SUCCESS;
73
}
74
}
AsgEventScaleFactorAlg.h
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::AsgEventScaleFactorAlg::m_particleHandle
SysReadHandle< xAOD::IParticleContainer > m_particleHandle
the jet collection we run on
Definition
AsgEventScaleFactorAlg.h:50
CP::AsgEventScaleFactorAlg::m_preselection
SysReadSelectionHandle m_preselection
the preselection we apply to our input
Definition
AsgEventScaleFactorAlg.h:55
CP::AsgEventScaleFactorAlg::m_eventInfoHandle
SysReadHandle< xAOD::EventInfo > m_eventInfoHandle
the event info we run on (empty by default)
Definition
AsgEventScaleFactorAlg.h:45
CP::AsgEventScaleFactorAlg::m_scaleFactorOutputDecoration
SysWriteDecorHandle< float > m_scaleFactorOutputDecoration
the decoration for writing the scale factor
Definition
AsgEventScaleFactorAlg.h:65
CP::AsgEventScaleFactorAlg::m_systematicsList
SysListHandle m_systematicsList
the systematics list we run
Definition
AsgEventScaleFactorAlg.h:41
CP::AsgEventScaleFactorAlg::m_scaleFactorInputDecoration
SysReadDecorHandle< float > m_scaleFactorInputDecoration
the decoration for reading the scale factor
Definition
AsgEventScaleFactorAlg.h:60
EL::AnaAlgorithm::AnaAlgorithm
AnaAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
Definition
AnaAlgorithm.cxx:40
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition
Event/xAOD/xAODBase/xAODBase/IParticle.h:41
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::IParticleContainer
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.
Definition
xAOD/xAODBase/xAODBase/IParticleContainer.h:32
Generated on
for ATLAS Offline Software by
1.17.0