ATLAS Offline Software
Loading...
Searching...
No Matches
EventDecoratorAlg.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//
9// includes
10//
12
13// /// Anonymous namespace for helpers
14// namespace {
15// const static SG::ConstAuxElement::ConstAccessor<unsigned int> accRRN("RandomRunNumber");
16// const static SG::ConstAuxElement::Decorator<unsigned int> decRRN("RandomRunNumber");
17// const static SG::ConstAuxElement::Decorator<unsigned int> decRLBN("RandomLumiBlockNumber");
18// const static SG::ConstAuxElement::Decorator<uint64_t> decHash("PRWHash");
19// }
20
21//
22// method implementations
23//
24
25namespace CP
26{
27
28 StatusCode EventDecoratorAlg ::
29 initialize ()
30 {
31 for (auto& [name, value] : m_uint32Decorations)
32 {
33 ANA_MSG_INFO ("Adding uint32_t decoration " << name << " with value " << value << " to EventInfo");
34 m_decFunctions.push_back([dec = SG::Decorator<uint32_t>(name), value](const xAOD::EventInfo& ei) { dec(ei) = value; });
35 }
36
38 ANA_CHECK (m_systematicsList.initialize());
39 return StatusCode::SUCCESS;
40 }
41
42
43
44 StatusCode EventDecoratorAlg ::
45 execute ()
46 {
47 // Take care of the weight (which is the only thing depending on systematics)
48 for (const auto& sys : m_systematicsList.systematicsVector())
49 {
50 const xAOD::EventInfo* systEvtInfo = nullptr;
51 ANA_CHECK( m_eventInfoHandle.retrieve(systEvtInfo, sys));
52 for (const auto& decFunc : m_decFunctions)
53 {
54 decFunc(*systEvtInfo);
55 }
56 };
57 return StatusCode::SUCCESS;
58 }
59}
#define ANA_MSG_INFO(xmsg)
Macro printing info messages.
#define ANA_CHECK(EXP)
check whether the given expression was successful
CP::SysReadHandle< xAOD::EventInfo > m_eventInfoHandle
the name of the event info object
std::vector< std::function< void(const xAOD::EventInfo &)> > m_decFunctions
the functions to add decorations
Gaudi::Property< std::map< std::string, uint32_t > > m_uint32Decorations
the uint32_t decorations to add
SysListHandle m_systematicsList
the systematics list we run
Helper class to provide type-safe access to aux data.
Definition Decorator.h:59
Select isolated Photons, Electrons and Muons.
EventInfo_v1 EventInfo
Definition of the latest event info version.