ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
DerivationFramework
DerivationFrameworkMCTruth
src
TruthEDDecorator.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// Class header file
6
#include "
TruthEDDecorator.h
"
7
8
namespace
DerivationFramework
{
9
10
StatusCode
TruthEDDecorator::initialize
(){
11
12
ATH_CHECK
(
m_eventInfoKey
.initialize());
13
ATH_CHECK
(
m_eventShapeKeys
.initialize());
14
ATH_CHECK
(
m_eventDensityDecorKeys
.initialize());
15
16
return
StatusCode::SUCCESS;
17
}
18
19
20
StatusCode
TruthEDDecorator::addBranches
(
const
EventContext& ctx)
const
{
21
ATH_MSG_VERBOSE
(
"addBranches()"
);
22
23
24
SG::ReadHandle<xAOD::EventInfo>
eventInfo(
m_eventInfoKey
, ctx);
25
if
(!eventInfo.
isValid
()) {
26
ATH_MSG_ERROR
(
"Couldn't retrieve "
<<
m_eventInfoKey
);
27
return
StatusCode::FAILURE;
28
}
29
30
for
(
size_t
i=0;i<
m_eventShapeKeys
.size();++i){
31
// Get the event shapes from which we'll get the densities
32
SG::ReadHandle<xAOD::EventShape>
eventShape(
m_eventShapeKeys
[i], ctx);
33
if
(!eventShape.
isValid
()) {
34
ATH_MSG_ERROR
(
"Could not retrieve "
<<
m_eventShapeKeys
[i]);
35
return
StatusCode::FAILURE;
36
}
37
38
// Decorate the densities onto the event info
39
SG::WriteDecorHandle<xAOD::EventInfo, double>
dec_eventDensity(
m_eventDensityDecorKeys
[i], ctx);
40
dec_eventDensity(*eventInfo) = eventShape->getDensity(
xAOD::EventShape::Density
);
41
}
42
43
return
StatusCode::SUCCESS;
44
}
45
46
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
TruthEDDecorator.h
DerivationFramework::TruthEDDecorator::initialize
virtual StatusCode initialize() override final
Definition
TruthEDDecorator.cxx:10
DerivationFramework::TruthEDDecorator::m_eventDensityDecorKeys
SG::WriteDecorHandleKeyArray< xAOD::EventInfo > m_eventDensityDecorKeys
Definition
TruthEDDecorator.h:44
DerivationFramework::TruthEDDecorator::m_eventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Definition
TruthEDDecorator.h:42
DerivationFramework::TruthEDDecorator::addBranches
virtual StatusCode addBranches(const EventContext &ctx) const override final
Definition
TruthEDDecorator.cxx:20
DerivationFramework::TruthEDDecorator::m_eventShapeKeys
SG::ReadHandleKeyArray< xAOD::EventShape > m_eventShapeKeys
Definition
TruthEDDecorator.h:43
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition
StoreGate/StoreGate/WriteDecorHandle.h:100
xAOD::EventShape_v1::Density
@ Density
Definition
EventShape_v1.h:47
DerivationFramework
THE reconstruction tool.
Definition
CascadeTools.h:16
Generated on
for ATLAS Offline Software by
1.17.0