Skip to content
Snippets Groups Projects
Commit 8badbdbd authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

Merge branch 'master-sct-rdbsc-rcbsc-coding-guidlines' into 'master'

SCT_RawDataByteStreamCnv: Updating SCTRawContByteStreamCnv according to ATLAS Coding Guidelines

See merge request atlas/athena!16153
parents 385ffc78 79078373
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......@@ -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
......@@ -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) :
......
......@@ -19,7 +19,6 @@
#include "GaudiKernel/ToolHandle.h"
#include <mutex>
#include <string>
class ISCT_RodEncoder;
class ISCT_CablingTool;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment