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 
10  TruthEDDecorator::TruthEDDecorator(const std::string& t, const std::string& n, const IInterface* p)
11  : base_class(t,n,p)
12  {
13  }
14 
15 
17 
18 
20 
22  ATH_CHECK(m_eventShapeKeys.initialize());
23  for (size_t i=0;i<m_eventShapeKeys.size();++i){
25  }
26  ATH_CHECK(m_eventDensityDecorKeys.initialize());
27 
28  return StatusCode::SUCCESS;
29  }
30 
31 
33  ATH_MSG_VERBOSE("addBranches()");
34 
35  const EventContext& ctx = Gaudi::Hive::currentContext();
36 
38  if (!eventInfo.isValid()) {
39  ATH_MSG_ERROR("Couldn't retrieve " << m_eventInfoKey);
40  return StatusCode::FAILURE;
41  }
42 
43  for (size_t i=0;i<m_eventShapeKeys.size();++i){
44  // Get the event shapes from which we'll get the densities
46  if (!eventShape.isValid()) {
47  ATH_MSG_ERROR ("Could not retrieve " << m_eventShapeKeys[i]);
48  return StatusCode::FAILURE;
49  }
50 
51  // Decorate the densities onto the event info
53  dec_eventDensity(*eventInfo) = eventShape->getDensity(xAOD::EventShape::Density);
54  }
55 
56  return StatusCode::SUCCESS;
57  }
58 
59 }
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
StatusCode initialize() override final
Definition: TruthEDDecorator.cxx:19
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
DerivationFramework::TruthEDDecorator::m_eventShapeKeys
SG::ReadHandleKeyArray< xAOD::EventShape > m_eventShapeKeys
Definition: TruthEDDecorator.h:45
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
DerivationFramework::TruthEDDecorator::TruthEDDecorator
TruthEDDecorator(const std::string &t, const std::string &n, const IInterface *p)
Definition: TruthEDDecorator.cxx:10
DerivationFramework::TruthEDDecorator::addBranches
virtual StatusCode addBranches() const override final
Definition: TruthEDDecorator.cxx:32
xAOD::EventShape_v1::Density
@ Density
Definition: EventShape_v1.h:47
DerivationFramework::TruthEDDecorator::m_ed_suffix
Gaudi::Property< std::string > m_ed_suffix
Definition: TruthEDDecorator.h:42
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:729
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:44
TruthEDDecorator.h
DerivationFramework::TruthEDDecorator::~TruthEDDecorator
~TruthEDDecorator()
Definition: TruthEDDecorator.cxx:16
DerivationFramework::TruthEDDecorator::m_eventDensityDecorKeys
SG::WriteDecorHandleKeyArray< xAOD::EventInfo > m_eventDensityDecorKeys
Definition: TruthEDDecorator.h:46