ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
AsgAnalysisAlgorithms
Root
PDFinfoAlg.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
#include "
AsgAnalysisAlgorithms/PDFinfoAlg.h
"
8
9
namespace
CP
{
10
11
StatusCode
PDFinfoAlg::initialize
() {
12
13
ANA_CHECK
(
m_truthEventsKey
.initialize());
14
15
return
StatusCode::SUCCESS;
16
}
17
18
StatusCode
PDFinfoAlg::execute
(
const
EventContext &ctx)
const
{
19
20
SG::ReadHandle<xAOD::TruthEventContainer>
truthEvents(
m_truthEventsKey
, ctx);
21
22
const
xAOD::EventInfo
*evtInfo = 0;
23
ANA_CHECK
(
evtStore
()->retrieve(evtInfo,
"EventInfo"
));
24
25
// accessors
26
static
const
SG::ConstAccessor<int>
acc_pdfid1(
"PDFID1"
);
27
static
const
SG::ConstAccessor<int>
acc_pdfid2(
"PDFID2"
);
28
static
const
SG::ConstAccessor<int>
acc_pdgid1(
"PDGID1"
);
29
static
const
SG::ConstAccessor<int>
acc_pdgid2(
"PDGID2"
);
30
static
const
SG::ConstAccessor<float>
acc_Q(
"Q"
);
31
static
const
SG::ConstAccessor<float>
acc_X1(
"X1"
);
32
static
const
SG::ConstAccessor<float>
acc_X2(
"X2"
);
33
static
const
SG::ConstAccessor<float>
acc_XF1(
"XF1"
);
34
static
const
SG::ConstAccessor<float>
acc_XF2(
"XF2"
);
35
36
// decorators
37
static
const
SG::Decorator<int>
dec_pdfid1(
"PDFID1"
);
38
static
const
SG::Decorator<int>
dec_pdfid2(
"PDFID2"
);
39
static
const
SG::Decorator<int>
dec_pdgid1(
"PDGID1"
);
40
static
const
SG::Decorator<int>
dec_pdgid2(
"PDGID2"
);
41
static
const
SG::Decorator<float>
dec_Q(
"Q"
);
42
static
const
SG::Decorator<float>
dec_X1(
"X1"
);
43
static
const
SG::Decorator<float>
dec_X2(
"X2"
);
44
static
const
SG::Decorator<float>
dec_XF1(
"XF1"
);
45
static
const
SG::Decorator<float>
dec_XF2(
"XF2"
);
46
47
// for now we only look at the 0th element - do we need any others?
48
for
(
const
auto
* truthEvent : *truthEvents) {
49
50
// decorate onto EventInfo
51
dec_pdfid1(*evtInfo) = acc_pdfid1(*truthEvent);
52
dec_pdfid2(*evtInfo) = acc_pdfid2(*truthEvent);
53
dec_pdgid1(*evtInfo) = acc_pdgid1(*truthEvent);
54
dec_pdgid2(*evtInfo) = acc_pdgid2(*truthEvent);
55
dec_Q(*evtInfo) = acc_Q(*truthEvent);
56
dec_X1(*evtInfo) = acc_X1(*truthEvent);
57
dec_X2(*evtInfo) = acc_X2(*truthEvent);
58
dec_XF1(*evtInfo) = acc_XF1(*truthEvent);
59
dec_XF2(*evtInfo) = acc_XF2(*truthEvent);
60
61
// skip any other element
62
break
;
63
}
64
65
return
StatusCode::SUCCESS;
66
}
67
68
}
// namespace CP
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
PDFinfoAlg.h
AthCommonAlgorithm< Gaudi::Algorithm >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
Definition
AthCommonDataStore.h:85
CP::PDFinfoAlg::m_truthEventsKey
SG::ReadHandleKey< xAOD::TruthEventContainer > m_truthEventsKey
Definition
PDFinfoAlg.h:28
CP::PDFinfoAlg::initialize
virtual StatusCode initialize() final
Definition
PDFinfoAlg.cxx:11
CP::PDFinfoAlg::execute
virtual StatusCode execute(const EventContext &ctx) const final
Definition
PDFinfoAlg.cxx:18
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition
ConstAccessor.h:55
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
SG::Decorator
SG::Decorator< T, ALLOC > Decorator
Helper class to provide type-safe access to aux data, specialized for JaggedVecElt.
Definition
AuxElement.h:576
xAOD::EventInfo
EventInfo_v1 EventInfo
Definition of the latest event info version.
Definition
IEventInfoCnvTool.h:16
Generated on
for ATLAS Offline Software by
1.17.0