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 AsgEventScaleFactorAlg ::
21 AsgEventScaleFactorAlg (const std::string& name,
22 ISvcLocator* pSvcLocator)
23 : AnaAlgorithm (name, pSvcLocator)
24 {}
25
26
27
28 StatusCode AsgEventScaleFactorAlg ::
29 initialize ()
30 {
32 {
33 ANA_MSG_ERROR ("no scale factor decoration name set");
34 return StatusCode::FAILURE;
35 }
36
42 ANA_CHECK (m_systematicsList.initialize());
43
44 return StatusCode::SUCCESS;
45 }
46
47
48
49 StatusCode AsgEventScaleFactorAlg ::
50 execute ()
51 {
52 for (const auto& sys : m_systematicsList.systematicsVector())
53 {
54 const xAOD::EventInfo *eventInfo = nullptr;
55 ANA_CHECK (m_eventInfoHandle.retrieve (eventInfo, sys));
56
57 const xAOD::IParticleContainer *particles = nullptr;
58 ANA_CHECK (m_particleHandle.retrieve (particles, sys));
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}
#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
AnaAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
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.