ATLAS Offline Software
Loading...
Searching...
No Matches
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
13
14//
15// method implementations
16//
17
18namespace CP
19{
20 StatusCode AsgEventScaleFactorAlg ::
21 initialize ()
22 {
24 {
25 ANA_MSG_ERROR ("no scale factor decoration name set");
26 return StatusCode::FAILURE;
27 }
28
34 ANA_CHECK (m_systematicsList.initialize());
35
36 return StatusCode::SUCCESS;
37 }
38
39
40
41 StatusCode AsgEventScaleFactorAlg ::
42 execute (const EventContext& ctx)
43 {
44 for (const auto& sys : m_systematicsList.systematicsVector())
45 {
46 const xAOD::EventInfo *eventInfo = nullptr;
47 ANA_CHECK (m_eventInfoHandle.retrieve (eventInfo, sys, ctx));
48
49 const xAOD::IParticleContainer *particles = nullptr;
50 ANA_CHECK (m_particleHandle.retrieve (particles, sys, ctx));
51
52 float scaleFactor = 1;
53 for (const xAOD::IParticle *particle : *particles)
54 {
55 if (m_preselection.getBool (*particle, sys))
56 {
57 scaleFactor *= m_scaleFactorInputDecoration.get (*particle, sys);
58 }
59 }
60
61 m_scaleFactorOutputDecoration.set (*eventInfo, scaleFactor, sys);
62 }
63
64 return StatusCode::SUCCESS;
65 }
66}
#define ANA_MSG_ERROR(xmsg,...)
Macro printing error messages.
#define ANA_CHECK(EXP)
check whether the given expression was successful
SysReadHandle< xAOD::IParticleContainer > m_particleHandle
the jet collection we run on
SysReadSelectionHandle m_preselection
the preselection we apply to our input
SysReadHandle< xAOD::EventInfo > m_eventInfoHandle
the event info we run on (empty by default)
SysWriteDecorHandle< float > m_scaleFactorOutputDecoration
the decoration for writing the scale factor
SysListHandle m_systematicsList
the systematics list we run
SysReadDecorHandle< float > m_scaleFactorInputDecoration
the decoration for reading the scale factor
Class providing the definition of the 4-vector interface.
Select isolated Photons, Electrons and Muons.
EventInfo_v1 EventInfo
Definition of the latest event info version.
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.