ATLAS Offline Software
Loading...
Searching...
No Matches
RecCTPByteStreamCnv.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5
6// Gaudi/Athena include(s):
7#include "GaudiKernel/MsgStream.h"
11
13
14// Trigger include(s):
16
17// Local include(s):
18#include "RecCTPByteStreamCnv.h"
19
25 : Converter( storageType(), classID(), svcloc ),
26 m_tool( "RecCTPByteStreamTool" ),
27 m_robDataProvider( "ROBDataProviderSvc", "RecCTPByteStreamCnv" ) {
28
29}
30
40
44
49
50 //
51 // Initialise the base class:
52 //
53 ATH_CHECK( Converter::initialize() );
54
55 MsgStream log( msgSvc(), "RecCTPByteStreamCnv" );
56 log << MSG::DEBUG << "RecCTPByteStreamCnv in initialize()" << endmsg;
57
58 //
59 // Get RecCTPByteStreamTool:
60 //
61 ATH_CHECK( m_tool.retrieve() );
62 log << MSG::DEBUG << "Connected to RecCTPByteStreamTool" << endmsg;
63
64 //
65 // Get ROBDataProvider:
66 //
67 ATH_CHECK( m_robDataProvider.retrieve() );
68 log << MSG::DEBUG << "Connected to ROBDataProviderSvc" << endmsg;
69
70 return StatusCode::SUCCESS;
71}
72
78StatusCode RecCTPByteStreamCnv::createObj( IOpaqueAddress* pAddr, DataObject*& pObj ) {
79
80 MsgStream log( msgSvc(), "RecCTPByteStreamCnv" );
81 log << MSG::DEBUG << "RecCTPByteStreamCnv::createObj() called" << endmsg;
82
83 ByteStreamAddress* pBS_Addr{};
84 ATH_CHECK( (pBS_Addr = dynamic_cast<ByteStreamAddress*>(pAddr)) != nullptr );
85
86 const EventContext& ctx = pBS_Addr->getEventContext();
87
88 log << MSG::DEBUG << " Creating Objects: " << *( pBS_Addr->par() ) << endmsg;
89
90 //
91 // Get SourceID:
92 //
93 const uint32_t robId = m_srcIdMap.getRobID( m_srcIdMap.getRodID() );
94
95 log << MSG::DEBUG << "expected ROB sub-detector ID: " << std::hex
96 << robId << std::dec << endmsg;
97
98 std::vector< uint32_t > vID;
99 vID.push_back( robId );
100
101 // get ROB fragment
103 m_robDataProvider->getROBData(ctx, vID, robFrags );
104
105 // size check
106 if ( robFrags.size() != 1 ) {
107 log << MSG::WARNING << " Number of ROB fragments for source ID 0x" << MSG::hex << robId
108 << " is " << robFrags.size() << endmsg;
109
110 CTP_RIO* result = new CTP_RIO;
111 pObj = SG::asStorable( result ) ;
112 return StatusCode::SUCCESS;
113 }
114
115 IROBDataProviderSvc::VROBFRAG::const_iterator it = robFrags.begin();
116 CTP_RIO * result = 0;
117
118 ATH_CHECK( m_tool->convert( ROBData( *it ).getROBFragment(), result ) );
119 pObj = SG::asStorable( result );
120
121 return StatusCode::SUCCESS;
122}
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
uint32_t CLID
The Class ID type.
Defines the ROB data entity. The ROB data is an abstract entity that is used to decouple the raw even...
ROBData_T< OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment, OFFLINE_FRAGMENTS_NAMESPACE::PointerType > ROBData
Definition ROBData.h:225
convert to and from a SG storable
IOpaqueAddress for ByteStreamCnvSvc, with ROB ids.
const EventContext & getEventContext() const
static constexpr long storageType()
std::vector< const ROBF * > VROBFRAG
CTPSrcIdMap m_srcIdMap
Object storing the various IDs of the CTP fragment.
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj) override
Function creating the CTP_RIO object from a CTP ROB fragment.
virtual StatusCode initialize() override
Function connecting to all the needed services/tools.
static CLID classID()
Function needed by the framework.
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Service used when reading the BS data.
ToolHandle< RecCTPByteStreamTool > m_tool
Tool doing the actual conversion.
static long storageType()
Function needed by the framework.
RecCTPByteStreamCnv(ISvcLocator *svcloc)
Standard constructor.
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)