ATLAS Offline Software
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 
11 
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 
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
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
40  dec_eventDensity(*eventInfo) = eventShape->getDensity(xAOD::EventShape::Density);
41  }
42 
43  return StatusCode::SUCCESS;
44  }
45 
46 }
xAOD::EventShape_v1::getDensity
bool getDensity(EventDensityID id, double &v) const
Get a density variable from the object.
Definition: EventShape_v1.cxx:135
DerivationFramework::TruthEDDecorator::initialize
virtual StatusCode initialize() override final
Definition: TruthEDDecorator.cxx:10
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
DerivationFramework::TruthEDDecorator::m_eventShapeKeys
SG::ReadHandleKeyArray< xAOD::EventShape > m_eventShapeKeys
Definition: TruthEDDecorator.h:43
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
xAOD::EventShape_v1::Density
@ Density
Definition: EventShape_v1.h:47
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:100
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DerivationFramework
THE reconstruction tool.
Definition: ParticleSortingAlg.h:24
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
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
TruthEDDecorator.h
DerivationFramework::TruthEDDecorator::m_eventDensityDecorKeys
SG::WriteDecorHandleKeyArray< xAOD::EventInfo > m_eventDensityDecorKeys
Definition: TruthEDDecorator.h:44