diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamCnv.cxx b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamCnv.cxx index f964b1044e3460161fdda986eb30552a0353a157..7cb06b753bc1b4da8a10cd0ed52c82a8b70dcca4 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamCnv.cxx +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamCnv.cxx @@ -4,71 +4,66 @@ #include "SCTRawContByteStreamCnv.h" -// Gaudi -#include "GaudiKernel/DataObject.h" - -// Athena -#include "AthenaBaseComps/AthCheckMacros.h" +#include "SCT_RawDataByteStreamCnv/ISCTRawContByteStreamTool.h" #include "ByteStreamCnvSvcBase/ByteStreamAddress.h" #include "ByteStreamData/RawEvent.h" #include "ByteStreamCnvSvcBase/IByteStreamEventAccess.h" -#include "SCT_RawDataByteStreamCnv/ISCTRawContByteStreamTool.h" + +#include "AthenaBaseComps/AthCheckMacros.h" #include "StoreGate/StoreGateSvc.h" -/// ------------------------------------------------------ -/// constructor +#include "GaudiKernel/DataObject.h" +#include "GaudiKernel/MsgStream.h" + +// Constructor -SCTRawContByteStreamCnv::SCTRawContByteStreamCnv(ISvcLocator* svcloc) : - Converter(ByteStream_StorageType, classID(),svcloc), - m_tool{"SCTRawContByteStreamTool"}, +SCTRawContByteStreamCnv::SCTRawContByteStreamCnv(ISvcLocator* svcLoc) : + Converter(ByteStream_StorageType, classID(),svcLoc), + m_rawContByteStreamTool{"SCTRawContByteStreamTool"}, m_byteStreamEventAccess{"ByteStreamCnvSvc", "SCTRawContByteStreamCnv"}, m_log{msgSvc(), "SCTRawContByteStreamCnv"} { } -/// ------------------------------------------------------ -/// initialize +// Initialize -StatusCode -SCTRawContByteStreamCnv::initialize() +StatusCode SCTRawContByteStreamCnv::initialize() { ATH_CHECK(Converter::initialize()); m_log << MSG::DEBUG<< " initialize " << endmsg; - /** Retrieve ByteStreamCnvSvc */ + // Retrieve ByteStreamCnvSvc ATH_CHECK(m_byteStreamEventAccess.retrieve()); m_log << MSG::INFO << "Retrieved service " << m_byteStreamEventAccess << endmsg; - /** Retrieve byte stream tool */ - ATH_CHECK(m_tool.retrieve()); - m_log << MSG::INFO << "Retrieved tool " << m_tool << endmsg; + // Retrieve byte stream tool + ATH_CHECK(m_rawContByteStreamTool.retrieve()); + m_log << MSG::INFO << "Retrieved tool " << m_rawContByteStreamTool << endmsg; return StatusCode::SUCCESS; } -/// ------------------------------------------------------ -/// convert SCT Raw Data in the container into ByteStream +// Method to create RawEvent fragments -StatusCode -SCTRawContByteStreamCnv::createRep(DataObject* pObj, IOpaqueAddress*& pAddr) +StatusCode SCTRawContByteStreamCnv::createRep(DataObject* pDataObject, IOpaqueAddress*& pOpaqueAddress) { - /** get RawEvent pointer */ - RawEventWrite* re{m_byteStreamEventAccess->getRawEvent()}; + // Get RawEvent pointer + RawEventWrite* rawEvtWrite{m_byteStreamEventAccess->getRawEvent()}; - /** get IDC for SCT Raw Data */ - SCT_RDO_Container* cont{nullptr}; - StoreGateSvc::fromStorable(pObj, cont); - if (cont==nullptr) { + // Get IDC for SCT Raw Data + SCT_RDO_Container* sctRDOCont{nullptr}; + StoreGateSvc::fromStorable(pDataObject, sctRDOCont); + if (sctRDOCont==nullptr) { m_log << MSG::ERROR << " Can not cast to SCTRawContainer " << endmsg; return StatusCode::FAILURE; } - /** set up the IOpaqueAddress for Storegate */ - std::string nm{pObj->registry()->name()}; - pAddr = new ByteStreamAddress(classID(), nm, ""); + // Set up the IOpaqueAddress for Storegate + std::string dataObjectName{pDataObject->registry()->name()}; + pOpaqueAddress = new ByteStreamAddress(classID(), dataObjectName, ""); - /** now use the tool to do the conversion */ - ATH_CHECK(m_tool->convert(cont, re, m_log)); + // Use the tool to do the conversion + ATH_CHECK(m_rawContByteStreamTool->convert(sctRDOCont, rawEvtWrite, m_log)); return StatusCode::SUCCESS; } diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamCnv.h b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamCnv.h index a762d1893eee7bb4a507ee86f907d02d88a67dae..ed047e772bcf818fe1afe707db48525a4b684d4e 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamCnv.h +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamCnv.h @@ -2,61 +2,75 @@ Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ -#ifndef SCT_RAWDATABYTESTREAMCNV_SCTRAWCONTRAWEVENTCNV_H -#define SCT_RAWDATABYTESTREAMCNV_SCTRAWCONTRAWEVENTCNV_H +#ifndef SCT_RAWDATABYTESTREAMCNV_SCTRAWCONTBYTESTREAMCNV_H +#define SCT_RAWDATABYTESTREAMCNV_SCTRAWCONTBYTESTREAMCNV_H + +#include "ByteStreamCnvSvcBase/IByteStreamEventAccess.h" +#include "InDetRawData/InDetRawDataCLASS_DEF.h" -// Gaudi #include "GaudiKernel/Converter.h" #include "GaudiKernel/ServiceHandle.h" -#include "GaudiKernel/MsgStream.h" - -// C++ Standard Library -#include <string> - -// Athena -#include "InDetRawData/InDetRawDataCLASS_DEF.h" -#include "ByteStreamCnvSvcBase/IByteStreamEventAccess.h" class DataObject; class ISCTRawContByteStreamTool; +class MsgStream; -/** Externals */ extern long ByteStream_StorageType; -/** the converter for writing BS from SCT Raw Data - * This will do the conversion on demand, triggered by the - * ByteStreamAddressProviderSvc. - * Since it is not possible to configure a Converter with - * Python Configurables, we use a service (SCTRawContByteStreamService) - * which in turn uses the lightweight SCT_RodEncoder class, - * to do the actual converting. */ +/** + * @class SCTRawContByteStreamCnv + * + * @brief Converter for writing ByteStream from SCT Raw Data + * + * This will do the conversion on demand, triggered by the ByteStreamAddressProviderSvc. + * Since it is not possible to configure a Converter with Python Configurables, + * we use a service (SCTRawContByteStreamService) which in turn uses the lightweight + * SCT_RodEncoder class, to do the actual converting. + */ +class SCTRawContByteStreamCnv : public Converter +{ + public: -class SCTRawContByteStreamCnv: public Converter { + /** Constructor */ + SCTRawContByteStreamCnv(ISvcLocator* svcLoc); - public: - SCTRawContByteStreamCnv(ISvcLocator* svcloc); + /** Destructor */ + virtual ~SCTRawContByteStreamCnv() = default; + + /** Initialize */ + virtual StatusCode initialize() override; - typedef SCT_RDO_Container SCTRawContainer; - /** Storage type and class ID */ - virtual long repSvcType() const { return ByteStream_StorageType;} + virtual long repSvcType() const override { return ByteStream_StorageType; } static long storageType() { return ByteStream_StorageType; } - static const CLID& classID() { return ClassID_traits<SCTRawContainer>::ID(); } - - /** initialize */ - virtual StatusCode initialize(); + static const CLID& classID() { return ClassID_traits<SCT_RDO_Container>::ID(); } - /** create Obj is not used ! */ - virtual StatusCode createObj(IOpaqueAddress*, DataObject*&) - { return StatusCode::FAILURE;} + /** createObj method (not used!) */ + virtual StatusCode createObj(IOpaqueAddress*, DataObject*&) override { return StatusCode::FAILURE; } - /** this creates the RawEvent fragments for the SCT */ - virtual StatusCode createRep(DataObject* pObj, IOpaqueAddress*& pAddr); + /** + * @brief Method to convert SCT Raw Data into ByteStream + * + * Gets pointer to RawEvent, get ID container of SCT RDO. + * Sets up opaque address for Storegate. + * + * Uses SCT RawContByteStreamTool to convert Raw Data to ByteStream. + * + * @param pDataObject Pointer to data object + * @param pOpaqueAddress Opaque address to object + */ + virtual StatusCode createRep(DataObject* pDataObject, IOpaqueAddress*& pOpaqueAddress) override; private: - /** for BS infrastructure */ - ToolHandle<ISCTRawContByteStreamTool> m_tool; + + /** Tool to do coversion from SCT RDO container to ByteStream */ + ToolHandle<ISCTRawContByteStreamTool> m_rawContByteStreamTool; + + /** Interface for accessing raw data */ ServiceHandle<IByteStreamEventAccess> m_byteStreamEventAccess; + + /** Object used to transmit messages and log errors */ MsgStream m_log; }; -#endif // SCT_RAWDATABYTESTREAMCNV_SCTRAWCONTRAWEVENTCNV_H + +#endif // SCT_RAWDATABYTESTREAMCNV_SCTRAWCONTBYTESTREAMCNV_H diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamTool.cxx b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamTool.cxx index cad10c574e9e4d72f69c10e7f28584e53934401d..0e779ff564f5b648e18ac46b3361b3264c56bd77 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamTool.cxx +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamTool.cxx @@ -14,7 +14,7 @@ #include "StoreGate/ReadCondHandle.h" #include "eformat/SourceIdentifier.h" -// Contructor +// Constructor SCTRawContByteStreamTool::SCTRawContByteStreamTool(const std::string& type, const std::string& name, const IInterface* parent) : diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamTool.h b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamTool.h index cedfb6dc003ec1bfd63b4ca3c90ae1030e3bd928..e6b87651cc7178519126bb4216b5a375d36edbdc 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamTool.h +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamTool.h @@ -19,7 +19,6 @@ #include "GaudiKernel/ToolHandle.h" #include <mutex> -#include <string> class ISCT_RodEncoder; class ISCT_CablingTool;