ATLAS Offline Software
SCTRawContByteStreamCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
11 
13 #include "StoreGate/StoreGateSvc.h"
14 
15 #include "GaudiKernel/DataObject.h"
16 #include "GaudiKernel/MsgStream.h"
17 
18 // Constructor
19 
21  AthConstConverter(storageType(), classID(), svcLoc, "SCTRawContByteStreamCnv"),
22  m_rawContByteStreamTool{"SCTRawContByteStreamTool"},
23  m_byteStreamEventAccess{"ByteStreamCnvSvc", "SCTRawContByteStreamCnv"}
24 {
25 }
26 
27 // Initialize
28 
30 {
32  ATH_MSG_DEBUG( " initialize " );
33 
34  // Retrieve ByteStreamCnvSvc
36  ATH_MSG_INFO( "Retrieved service " << m_byteStreamEventAccess );
37 
38  // Retrieve byte stream tool
40  ATH_MSG_INFO( "Retrieved tool " << m_rawContByteStreamTool );
41 
42  return StatusCode::SUCCESS;
43 }
44 
45 // Method to create RawEvent fragments
46 
47 StatusCode SCTRawContByteStreamCnv::createRepConst(DataObject* pDataObject, IOpaqueAddress*& pOpaqueAddress) const
48 {
49  // Get IDC for SCT Raw Data
50  SCT_RDO_Container* sctRDOCont{nullptr};
51  if (not SG::fromStorable(pDataObject, sctRDOCont)) {
52  ATH_MSG_ERROR( " Can not cast to SCTRawContainer " );
53  return StatusCode::FAILURE;
54  }
55 
56  // Set up the IOpaqueAddress for Storegate
57  std::string dataObjectName{pDataObject->registry()->name()};
58  if ( pOpaqueAddress != nullptr ) pOpaqueAddress->release();
59  pOpaqueAddress = new ByteStreamAddress(classID(), dataObjectName, "");
60  pOpaqueAddress->addRef();
61 
62  // Use the tool to do the conversion
63  ATH_CHECK(m_rawContByteStreamTool->convert(sctRDOCont) );
64 
65  return StatusCode::SUCCESS;
66 }
ISCTRawContByteStreamTool.h
AthCheckMacros.h
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::fromStorable
bool fromStorable(DataObject *pDObj, T *&pTrans, bool quiet=false, IRegisterTransient *irt=0, bool isConst=true)
Definition: StorableConversions.h:180
initialize
void initialize()
Definition: run_EoverP.cxx:894
SCTRawContByteStreamCnv::initialize
virtual StatusCode initialize() override
Initialize.
Definition: SCTRawContByteStreamCnv.cxx:29
InDetRawDataContainer
Definition: InDetRawDataContainer.h:27
IByteStreamEventAccess.h
AthConstConverter
Gaudi converter base class with const interfaces.
Definition: AthConstConverter.h:33
SCTRawContByteStreamCnv::m_rawContByteStreamTool
ToolHandle< ISCTRawContByteStreamTool > m_rawContByteStreamTool
Tool to do coversion from SCT RDO container to ByteStream.
Definition: SCTRawContByteStreamCnv.h:69
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
RawEvent.h
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
ByteStreamAddress
IOpaqueAddress for ByteStreamCnvSvc, with ROB ids.
Definition: ByteStreamAddress.h:28
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ByteStreamAddress.h
SCTRawContByteStreamCnv::SCTRawContByteStreamCnv
SCTRawContByteStreamCnv(ISvcLocator *svcLoc)
Constructor.
Definition: SCTRawContByteStreamCnv.cxx:20
SCTRawContByteStreamCnv::m_byteStreamEventAccess
ServiceHandle< IByteStreamEventAccess > m_byteStreamEventAccess
Interface for accessing raw data.
Definition: SCTRawContByteStreamCnv.h:72
SCTRawContByteStreamCnv::classID
static const CLID & classID()
Class ID.
Definition: SCTRawContByteStreamCnv.h:48
SCTRawContByteStreamCnv.h
StoreGateSvc.h
SCTRawContByteStreamCnv::createRepConst
virtual StatusCode createRepConst(DataObject *pDataObject, IOpaqueAddress *&pOpaqueAddress) const override
Method to convert SCT Raw Data into ByteStream.
Definition: SCTRawContByteStreamCnv.cxx:47