ATLAS Offline Software
Loading...
Searching...
No Matches
PDFinfoAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6
8
10
11namespace CP {
12
14
15 ANA_CHECK(m_truthEventsKey.initialize());
16 ANA_CHECK(m_eventInfoKey.initialize());
17
18 ANA_CHECK(m_pdfid1Key.initialize());
19 ANA_CHECK(m_pdfid2Key.initialize());
20 ANA_CHECK(m_pdgid1Key.initialize());
21 ANA_CHECK(m_pdgid2Key.initialize());
22 ANA_CHECK(m_QKey.initialize());
23 ANA_CHECK(m_X1Key.initialize());
24 ANA_CHECK(m_X2Key.initialize());
25 ANA_CHECK(m_XF1Key.initialize());
26 ANA_CHECK(m_XF2Key.initialize());
27
28 return StatusCode::SUCCESS;
29}
30
31StatusCode PDFinfoAlg::execute(const EventContext &ctx) const {
32
34 ANA_CHECK(truthEvents.isValid());
35
37 ANA_CHECK(evtInfo.isValid());
38
39 // for now we only look at the 0th element - do we need any others?
40 if (truthEvents->empty()) {
41 ANA_MSG_WARNING("TruthEvents container is empty, PDF info decorations will not be written for this event");
42 return StatusCode::SUCCESS;
43 }
44 const xAOD::TruthEvent *truthEvent = truthEvents->front();
45
46 // accessors
47 static const SG::ConstAccessor<int> acc_pdfid1("PDFID1");
48 static const SG::ConstAccessor<int> acc_pdfid2("PDFID2");
49 static const SG::ConstAccessor<int> acc_pdgid1("PDGID1");
50 static const SG::ConstAccessor<int> acc_pdgid2("PDGID2");
51 static const SG::ConstAccessor<float> acc_Q("Q");
52 static const SG::ConstAccessor<float> acc_X1("X1");
53 static const SG::ConstAccessor<float> acc_X2("X2");
54 static const SG::ConstAccessor<float> acc_XF1("XF1");
55 static const SG::ConstAccessor<float> acc_XF2("XF2");
56
57 // decorators
67
68 // decorate onto EventInfo
69 dec_pdfid1(*evtInfo) = acc_pdfid1(*truthEvent);
70 dec_pdfid2(*evtInfo) = acc_pdfid2(*truthEvent);
71 dec_pdgid1(*evtInfo) = acc_pdgid1(*truthEvent);
72 dec_pdgid2(*evtInfo) = acc_pdgid2(*truthEvent);
73 dec_Q(*evtInfo) = acc_Q(*truthEvent);
74 dec_X1(*evtInfo) = acc_X1(*truthEvent);
75 dec_X2(*evtInfo) = acc_X2(*truthEvent);
76 dec_XF1(*evtInfo) = acc_XF1(*truthEvent);
77 dec_XF2(*evtInfo) = acc_XF2(*truthEvent);
78
79 return StatusCode::SUCCESS;
80}
81
82} // namespace CP
Handle class for adding a decoration to an object.
#define ANA_CHECK(EXP)
check whether the given expression was successful
#define ANA_MSG_WARNING(xmsg,...)
Macro printing warning messages.
SG::WriteDecorHandleKey< xAOD::EventInfo > m_X1Key
Definition PDFinfoAlg.h:43
SG::ReadHandleKey< xAOD::TruthEventContainer > m_truthEventsKey
Definition PDFinfoAlg.h:29
virtual StatusCode initialize() final
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Definition PDFinfoAlg.h:31
SG::WriteDecorHandleKey< xAOD::EventInfo > m_QKey
Definition PDFinfoAlg.h:41
SG::WriteDecorHandleKey< xAOD::EventInfo > m_XF1Key
Definition PDFinfoAlg.h:47
virtual StatusCode execute(const EventContext &ctx) const final
SG::WriteDecorHandleKey< xAOD::EventInfo > m_X2Key
Definition PDFinfoAlg.h:45
SG::WriteDecorHandleKey< xAOD::EventInfo > m_XF2Key
Definition PDFinfoAlg.h:49
SG::WriteDecorHandleKey< xAOD::EventInfo > m_pdfid2Key
Definition PDFinfoAlg.h:35
SG::WriteDecorHandleKey< xAOD::EventInfo > m_pdfid1Key
Definition PDFinfoAlg.h:33
SG::WriteDecorHandleKey< xAOD::EventInfo > m_pdgid2Key
Definition PDFinfoAlg.h:39
SG::WriteDecorHandleKey< xAOD::EventInfo > m_pdgid1Key
Definition PDFinfoAlg.h:37
Helper class to provide constant type-safe access to aux data.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Handle class for adding a decoration to an object.
Select isolated Photons, Electrons and Muons.
TruthEvent_v1 TruthEvent
Typedef to implementation.
Definition TruthEvent.h:17