ATLAS Offline Software
TruthEDDecorator.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Class header file
6 #include "TruthEDDecorator.h"
7 
8 // EDM includes
11 
12 namespace DerivationFramework {
13 
14  static const SG::AuxElement::Accessor<float> acc_Density("Density");
15 
16  TruthEDDecorator::TruthEDDecorator(const std::string& t, const std::string& n, const IInterface* p)
17  : AthAlgTool(t,n,p)
18  {
19  declareInterface<DerivationFramework::IAugmentationTool>(this);
20 
21  declareProperty("EventInfoName",m_eventInfoName="EventInfo");
22  declareProperty("EnergyDensityKeys",m_edKeys={"TruthIsoCentralEventShape","TruthIsoForwardEventShape"});
23  declareProperty("DecorationSuffix",m_ed_suffix="_rho");
24  }
25 
26 
28 
29 
31  for (size_t i=0;i<m_edKeys.size();++i){
32  m_dec_eventShape.emplace_back(m_edKeys[i]+m_ed_suffix );
33  }
34  return StatusCode::SUCCESS;
35  }
36 
37 
39  ATH_MSG_VERBOSE("addBranches()");
40 
41  // Get the event info that we will decorate onto
42  const xAOD::EventInfo* eventInfo(nullptr);
43  if (evtStore()->retrieve(eventInfo,m_eventInfoName).isFailure()) {
44  ATH_MSG_ERROR("could not retrieve event info " <<m_eventInfoName);
45  return StatusCode::FAILURE;
46  }
47 
48  const xAOD::EventShape* eventShape(nullptr);
49  for (size_t i=0;i<m_edKeys.size();++i){
50  // Get the event shapes from which we'll get the densities
51  ATH_CHECK( evtStore()->retrieve(eventShape,m_edKeys[i]) );
52  // Decorate the densities onto the event info
53  m_dec_eventShape[i](*eventInfo) = acc_Density(*eventShape);
54  }
55 
56  return StatusCode::SUCCESS;
57  }
58 
59 } /// namespace
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
DerivationFramework::TruthEDDecorator::m_eventInfoName
std::string m_eventInfoName
Definition: TruthEDDecorator.h:37
DerivationFramework::TruthEDDecorator::initialize
StatusCode initialize() override final
Definition: TruthEDDecorator.cxx:30
DerivationFramework::TruthEDDecorator::m_dec_eventShape
std::vector< SG::AuxElement::Decorator< float > > m_dec_eventShape
Definition: TruthEDDecorator.h:40
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
DerivationFramework::TruthEDDecorator::m_ed_suffix
std::string m_ed_suffix
Definition: TruthEDDecorator.h:39
EventShape.h
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
DerivationFramework::TruthEDDecorator::TruthEDDecorator
TruthEDDecorator(const std::string &t, const std::string &n, const IInterface *p)
Definition: TruthEDDecorator.cxx:16
DerivationFramework::TruthEDDecorator::addBranches
virtual StatusCode addBranches() const override final
Pass the thinning service
Definition: TruthEDDecorator.cxx:38
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
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:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DerivationFramework
THE reconstruction tool.
Definition: ParticleSortingAlg.h:24
xAOD::EventShape_v1
Data class for event shapes.
Definition: EventShape_v1.h:28
EventInfo.h
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
TruthEDDecorator.h
AthAlgTool
Definition: AthAlgTool.h:26
DerivationFramework::TruthEDDecorator::m_edKeys
std::vector< std::string > m_edKeys
Definition: TruthEDDecorator.h:38
DerivationFramework::TruthEDDecorator::~TruthEDDecorator
~TruthEDDecorator()
Definition: TruthEDDecorator.cxx:27