ATLAS Offline Software
MBTSModuleCnvAlg.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 "MBTSModuleCnvAlg.h"
17 
18 namespace xAODMaker
19 {
20 
22  ISvcLocator *svcLoc)
23  : AthReentrantAlgorithm(name, svcLoc) {}
24 
26  {
27  ATH_CHECK(m_inputKey.initialize());
28  ATH_CHECK(m_outputKey.initialize());
29  ATH_CHECK(m_cnvTool.retrieve());
30  return StatusCode::SUCCESS;
31  }
32 
33  StatusCode MBTSModuleCnvAlg::execute(const EventContext &ctx) const
34  {
35 
36  auto tileCellsHandle = SG::makeHandle(m_inputKey, ctx);
37  ATH_CHECK(tileCellsHandle.isValid()); // technically not needed
38  ATH_MSG_DEBUG("Retrieved tile cells with key: " << m_inputKey.key() << " of size " << tileCellsHandle->size());
39 
40  auto modulesContainer = std::make_unique<xAOD::MBTSModuleContainer>();
41  auto modulesAuxContainer = std::make_unique<xAOD::MBTSModuleAuxContainer>();
42  modulesContainer->setStore(modulesAuxContainer.get());
43 
44  ATH_CHECK(m_cnvTool->convert(tileCellsHandle.ptr(), modulesContainer.get()));
45 
46  auto modulesHandle = SG::makeHandle(m_outputKey, ctx);
47  ATH_CHECK(modulesHandle.record(std::move(modulesContainer), std::move(modulesAuxContainer)));
48  ATH_MSG_DEBUG("Recorded xAODMBTSModules with key: " << m_outputKey.key() << " of size " << modulesContainer->size());
49 
50  return StatusCode::SUCCESS;
51  }
52 }
MBTSModuleAuxContainer.h
xAODMaker::MBTSModuleCnvAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: MBTSModuleCnvAlg.cxx:33
xAODMaker
Definition: StoreGateSvc.h:72
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
xAODMaker::MBTSModuleCnvAlg::MBTSModuleCnvAlg
MBTSModuleCnvAlg(const std::string &name, ISvcLocator *svcLoc)
Definition: MBTSModuleCnvAlg.cxx:21
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
xAODMaker::MBTSModuleCnvAlg::initialize
virtual StatusCode initialize() override
Definition: MBTSModuleCnvAlg.cxx:25
xAODMaker::MBTSModuleCnvAlg::m_inputKey
SG::ReadHandleKey< TileCellContainer > m_inputKey
Definition: MBTSModuleCnvAlg.h:41
MBTSModuleContainer.h
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
xAODMaker::MBTSModuleCnvAlg::m_cnvTool
ToolHandle< IMBTSModuleCnvTool > m_cnvTool
Handle to the converter tool.
Definition: MBTSModuleCnvAlg.h:46
xAODMaker::MBTSModuleCnvAlg::m_outputKey
SG::WriteHandleKey< xAOD::MBTSModuleContainer > m_outputKey
Definition: MBTSModuleCnvAlg.h:43
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
MBTSModuleCnvAlg.h
errorcheck.h
Helpers for checking error return status codes and reporting errors.
TileCellContainer.h