ATLAS Offline Software
Loading...
Searching...
No Matches
RecCTPByteStreamCnv.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 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 pBS_Addr = dynamic_cast< ByteStreamAddress* >( pAddr );
85 if( !pBS_Addr ) {
86 log << MSG::ERROR << " Can not cast to ByteStreamAddress " << endmsg ;
87 return StatusCode::FAILURE;
88 }
89
90 log << MSG::DEBUG << " Creating Objects: " << *( pBS_Addr->par() ) << endmsg;
91
92 //
93 // Get SourceID:
94 //
95 const uint32_t robId = m_srcIdMap.getRobID( m_srcIdMap.getRodID() );
96
97 log << MSG::DEBUG << "expected ROB sub-detector ID: " << std::hex
98 << robId << std::dec << endmsg;
99
100 std::vector< uint32_t > vID;
101 vID.push_back( robId );
102
103 // get ROB fragment
105 m_robDataProvider->getROBData(Gaudi::Hive::currentContext(), vID, robFrags );
106
107 // size check
108 if ( robFrags.size() != 1 ) {
109 log << MSG::WARNING << " Number of ROB fragments for source ID 0x" << MSG::hex << robId
110 << " is " << robFrags.size() << endmsg;
111
112 CTP_RIO* result = new CTP_RIO;
113 pObj = SG::asStorable( result ) ;
114 return StatusCode::SUCCESS;
115 }
116
117 IROBDataProviderSvc::VROBFRAG::const_iterator it = robFrags.begin();
118 CTP_RIO * result = 0;
119
120 ATH_CHECK( m_tool->convert( ROBData( *it ).getROBFragment(), result ) );
121 pObj = SG::asStorable( result );
122
123 return StatusCode::SUCCESS;
124}
#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.
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 const 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)