diff --git a/MuonSpectrometer/MuonCnv/MuonByteStream/MuonByteStream/RpcPadContByteStreamCnv.h b/MuonSpectrometer/MuonCnv/MuonByteStream/MuonByteStream/RpcPadContByteStreamCnv.h index 4aaed4d0090ce223b3e40e3a514590d11645e147..e2c571c25d62fef9bb581b5ecdab4ef2407b59db 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStream/MuonByteStream/RpcPadContByteStreamCnv.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStream/MuonByteStream/RpcPadContByteStreamCnv.h @@ -5,36 +5,26 @@ #ifndef MUONBYTESTREAM_RPCPADCONTBYTESTREAMCNV_H #define MUONBYTESTREAM_RPCPADCONTBYTESTREAMCNV_H -#include "GaudiKernel/Converter.h" -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/ServiceHandle.h" - -#include "ByteStreamData/RawEvent.h" #include "ByteStreamCnvSvcBase/ByteStreamAddress.h" -#include "ByteStreamCnvSvcBase/IByteStreamEventAccess.h" - #include "MuonRPC_CnvTools/IRPC_RDOtoByteStreamTool.h" +#include "AthenaBaseComps/AthConstConverter.h" +#include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/ServiceHandle.h" class DataObject; class StatusCode; -class IByteStreamEventAccess; -class StoreGateSvc; -// Abstract factory to create the converter -template <class TYPE> class CnvFactory; -class RpcPadContByteStreamCnv: public Converter { +class RpcPadContByteStreamCnv: public AthConstConverter { public: RpcPadContByteStreamCnv(ISvcLocator* svcloc); - typedef Muon::IRPC_RDOtoByteStreamTool BYTESTREAMTOOL ; - virtual StatusCode initialize() override; - virtual StatusCode createObj(IOpaqueAddress* /*pAddr*/, DataObject*& /*pObj*/) override { + virtual StatusCode createObjConst(IOpaqueAddress* /*pAddr*/, DataObject*& /*pObj*/) const override { return StatusCode::FAILURE; } - virtual StatusCode createRep(DataObject* pObj, IOpaqueAddress*& pAddr) override; + virtual StatusCode createRepConst(DataObject* pObj, IOpaqueAddress*& pAddr) const override; /// Storage type and class ID virtual long repSvcType() const override { return i_repSvcType(); } @@ -42,9 +32,7 @@ class RpcPadContByteStreamCnv: public Converter { static const CLID& classID(); private: - ToolHandle<BYTESTREAMTOOL> m_tool ; - ServiceHandle<IByteStreamEventAccess> m_byteStreamEventAccess; - ServiceHandle<StoreGateSvc> m_storeGate; + ToolHandle<Muon::IRPC_RDOtoByteStreamTool> m_tool ; }; #endif diff --git a/MuonSpectrometer/MuonCnv/MuonByteStream/src/RpcPadContByteStreamCnv.cxx b/MuonSpectrometer/MuonCnv/MuonByteStream/src/RpcPadContByteStreamCnv.cxx index d0928eb6df24cae5202cb40c8dd2f769d364eca8..41b076ae430210b8b67f4557e045b4e6fb8db406 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStream/src/RpcPadContByteStreamCnv.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStream/src/RpcPadContByteStreamCnv.cxx @@ -1,36 +1,22 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #include "MuonByteStream/RpcPadContByteStreamCnv.h" - -#include "ByteStreamCnvSvcBase/ByteStreamCnvSvcBase.h" #include "ByteStreamCnvSvcBase/ByteStreamAddress.h" -#include "ByteStreamData/RawEvent.h" - -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/StatusCode.h" -#include "GaudiKernel/DataObject.h" -#include "GaudiKernel/IRegistry.h" - #include "MuonRDO/RpcPadContainer.h" -#include "MuonRDO/RpcSectorLogicContainer.h" - -#include "StoreGate/StoreGateSvc.h" - -#include <sstream> -#include <map> +#include "AthenaBaseComps/AthCheckMacros.h" +#include "AthenaKernel/StorableConversions.h" #include <string> + RpcPadContByteStreamCnv::RpcPadContByteStreamCnv(ISvcLocator* svcloc) : - Converter(storageType(), classID(),svcloc), - m_tool("Muon::RpcPadContByteStreamTool"), - m_byteStreamEventAccess("ByteStreamCnvSvc", "RpcPadContByteStreamCnv"), - m_storeGate("StoreGateSvc", "RpcPadContByteStreamCnv") + AthConstConverter(storageType(), classID(),svcloc,"RpcPadContByteStreamCnv"), + m_tool("Muon::RpcPadContByteStreamTool") {} const CLID& RpcPadContByteStreamCnv::classID(){ -return ClassID_traits<RpcPadContainer>::ID() ; + return ClassID_traits<RpcPadContainer>::ID() ; } long RpcPadContByteStreamCnv::storageType(){ @@ -38,58 +24,22 @@ long RpcPadContByteStreamCnv::storageType(){ } StatusCode RpcPadContByteStreamCnv::initialize() { - MsgStream log(msgSvc(), "RpcPadContByteStreamCnv"); - log << MSG::DEBUG<< " initialize " <<endmsg; - - // initialize base class - StatusCode sc = Converter::initialize(); - if (StatusCode::SUCCESS != sc) - return sc; - - // get ByteStreamEventAccess interface - if (m_byteStreamEventAccess.retrieve().isFailure()) - { - log << MSG::ERROR << " Can't get ByteStreamEventAccess interface" << endmsg; - return StatusCode::FAILURE; - } - - // retrieve Tool - if(m_tool.retrieve().isFailure()) - { - log << MSG::ERROR << " Can't get ByteStreamTool " << endmsg; - return StatusCode::FAILURE; - } - - if(m_storeGate.retrieve().isFailure()) - { - log << MSG::ERROR << " Can't get StoreGateSvc" << endmsg; - return StatusCode::FAILURE; - } - - return StatusCode::SUCCESS; + ATH_MSG_DEBUG( " initialize " ); + ATH_CHECK( AthConstConverter::initialize() ); + ATH_CHECK( m_tool.retrieve() ); + return StatusCode::SUCCESS; } StatusCode -RpcPadContByteStreamCnv::createRep(DataObject* pObj, IOpaqueAddress*& pAddr) { - // convert Rpc pads in the container into ByteStream - - MsgStream log(msgSvc(), "RpcPadContByteStreamCnv"); - - RawEventWrite* re = m_byteStreamEventAccess->getRawEvent(); - - RpcPadContainer* cont=NULL ; - StoreGateSvc::fromStorable(pObj, cont ); - if(!cont) { - log << MSG::ERROR << " Can not cast to RpcPadContainer " << endmsg ; - return StatusCode::FAILURE; - } - - std::string nm = pObj->registry()->name(); - - ByteStreamAddress* addr = new ByteStreamAddress(classID(),nm,""); - - pAddr = addr; - - return m_tool->convert(cont, re); - +RpcPadContByteStreamCnv::createRepConst(DataObject* pObj, IOpaqueAddress*& pAddr) const { + RpcPadContainer* cont = nullptr; + SG::fromStorable(pObj, cont ); + if(!cont) { + ATH_MSG_ERROR( " Can not cast to RpcPadContainer " ); + return StatusCode::FAILURE; + } + + std::string nm = pObj->registry()->name(); + pAddr = new ByteStreamAddress(classID(),nm,""); + return m_tool->convert(cont); } diff --git a/MuonSpectrometer/MuonCnv/MuonCnvToolInterfaces/MuonCnvToolInterfaces/IRPC_RDOtoByteStreamTool.h b/MuonSpectrometer/MuonCnv/MuonCnvToolInterfaces/MuonCnvToolInterfaces/IRPC_RDOtoByteStreamTool.h index 0e4bb569698023b020c4411e9dc80947c3c76a5a..00a9a33345522e35203217976c21c9aef3099ed4 100755 --- a/MuonSpectrometer/MuonCnv/MuonCnvToolInterfaces/MuonCnvToolInterfaces/IRPC_RDOtoByteStreamTool.h +++ b/MuonSpectrometer/MuonCnv/MuonCnvToolInterfaces/MuonCnvToolInterfaces/IRPC_RDOtoByteStreamTool.h @@ -6,7 +6,6 @@ #define MUONCNVTOOLINTERFACES_IRPC_RDOTOBYTESTREAMTOOL_H #include "GaudiKernel/IAlgTool.h" -#include "ByteStreamData/RawEvent.h" class RpcPadContainer; class MsgStream ; @@ -33,9 +32,8 @@ public: /** Conversion method, which takes the RDO container and converts it into raw data, filled into RawEventWrite. @param cont RDO container which will be used to fill the raw event - @param re Raw event to be filled by this method. */ - virtual StatusCode convert(RpcPadContainer* cont, RawEventWrite* re ) const =0; + virtual StatusCode convert(RpcPadContainer* cont) const =0; }; } diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.cxx b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.cxx index 8eb46b5b9bec8c79fda8431d4724a833e4ce42fa..09d88fbc4f1f3c79e8f44148edd70f9064a30817 100755 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.cxx @@ -37,7 +37,7 @@ StatusCode Muon::RpcPadContByteStreamTool::initialize() { return StatusCode::SUCCESS; } -StatusCode Muon::RpcPadContByteStreamTool::convert(CONTAINER* cont, RawEventWrite* /*re*/) const +StatusCode Muon::RpcPadContByteStreamTool::convert(RpcPadContainer* cont) const { FullEventAssembler<RPC_Hid2RESrcID>* fea = nullptr; ATH_CHECK( m_byteStreamCnvSvc->getFullEventAssembler (fea, diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.h b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.h index 96260997e92a92c5f4244e8dd5d85200567d6726..b65e6ab7d160d3ef32cf9de875cf806dd95b1080 100755 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.h +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.h @@ -40,8 +40,6 @@ class RpcPadContByteStreamTool : public AthAlgTool, virtual public IRPC_RDOtoByt public: - typedef RpcPadContainer CONTAINER ; - /** constructor */ RpcPadContByteStreamTool( const std::string& type, const std::string& name, const IInterface* parent); @@ -54,7 +52,7 @@ public: virtual StatusCode initialize() override; - virtual StatusCode convert(CONTAINER* cont, RawEventWrite* re) const override; + virtual StatusCode convert(RpcPadContainer* cont) const override; private: SG::ReadCondHandleKey<RpcCablingCondData> m_readKey{this, "ReadKey", "RpcCablingCondData", "Key of RpcCablingCondData"};