ATLAS Offline Software
ForwardEventInfoCnvAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Gaudi/Athena include(s):
7 
8 // Old mbts (tile) info!
10 
11 //New egamma
14 
15 // Local include(s):
16 #include "ForwardEventInfoCnvAlg.h"
17 
18 namespace xAODMaker
19 {
20 
22  ISvcLocator *svcLoc)
23  : AthReentrantAlgorithm(name, svcLoc) {}
24 
26  {
27 
29  ATH_CHECK(m_outputKey.initialize());
30  ATH_CHECK(m_cnvTool.retrieve());
31 
32  // Return gracefully:
33  return StatusCode::SUCCESS;
34  }
35 
36  StatusCode ForwardEventInfoCnvAlg::execute(const EventContext &ctx) const
37  {
38 
39  auto mbtsCollisionsTimeHandle = SG::makeHandle(m_inputKey, ctx);
40  ATH_MSG_INFO("Retrieved particles with key: " << m_inputKey.key());
41 
42  auto fwdEventInfo = std::make_unique<xAOD::ForwardEventInfoContainer>();
43  auto fwdEventInfoAux = std::make_unique<xAOD::ForwardEventInfoAuxContainer>();
44  fwdEventInfo->setStore(fwdEventInfoAux.get());
45 
46  ATH_CHECK(m_cnvTool->convert(mbtsCollisionsTimeHandle.ptr(), fwdEventInfo.get()));
47 
48  auto fwdEventInfoHandle = SG::makeHandle(m_outputKey, ctx);
49  ATH_CHECK(fwdEventInfoHandle.record(std::move(fwdEventInfo), std::move(fwdEventInfoAux)));
50  return StatusCode::SUCCESS;
51  }
52 
53 } // namespace xAODMaker
ForwardEventInfoCnvAlg.h
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
ForwardEventInfoContainer.h
xAODMaker::ForwardEventInfoCnvAlg::initialize
virtual StatusCode initialize() override
Function initialising the algorithm.
Definition: ForwardEventInfoCnvAlg.cxx:25
xAODMaker::ForwardEventInfoCnvAlg::ForwardEventInfoCnvAlg
ForwardEventInfoCnvAlg(const std::string &name, ISvcLocator *svcLoc)
Regular algorithm constructor.
Definition: ForwardEventInfoCnvAlg.cxx:21
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
xAODMaker
Definition: StoreGateSvc.h:72
xAODMaker::ForwardEventInfoCnvAlg::m_cnvTool
ToolHandle< IForwardEventInfoCnvTool > m_cnvTool
Definition: ForwardEventInfoCnvAlg.h:44
xAODMaker::ForwardEventInfoCnvAlg::m_inputKey
SG::ReadHandleKey< MBTSCollisionTime > m_inputKey
Definition: ForwardEventInfoCnvAlg.h:40
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
MBTSCollisionTime.h
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
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
xAODMaker::ForwardEventInfoCnvAlg::m_outputKey
SG::WriteHandleKey< xAOD::ForwardEventInfoContainer > m_outputKey
Definition: ForwardEventInfoCnvAlg.h:42
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
errorcheck.h
Helpers for checking error return status codes and reporting errors.
ForwardEventInfoAuxContainer.h
xAODMaker::ForwardEventInfoCnvAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Function executing the algorithm.
Definition: ForwardEventInfoCnvAlg.cxx:36