ATLAS Offline Software
Loading...
Searching...
No Matches
RecMuCTPIByteStreamCnv.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"
10
12
13// Trigger include(s):
15
16// Local include(s):
18
24 : Converter( storageType(), classID(), svcloc ),
25 m_tool( "RecMuCTPIByteStreamTool" ),
26 m_robDataProvider( "ROBDataProviderSvc", "RecMuCTPIByteStreamCnv" ) {
27
28}
29
39
43
48
49 //
50 // Initialise the base class:
51 //
52 ATH_CHECK( Converter::initialize() );
53
54 MsgStream log( msgSvc(), "RecMuCTPIByteStreamCnv" );
55 log << MSG::DEBUG << "RecMuCTPIByteStreamCnv in initialize()" << endmsg;
56
57 //
58 // Get RecMuCTPIByteStreamTool:
59 //
60 ATH_CHECK( m_tool.retrieve() );
61 log << MSG::DEBUG << "Connected to RecMuCTPIByteStreamTool" << endmsg;
62
63 //
64 // Get ROBDataProvider:
65 //
66 ATH_CHECK( m_robDataProvider.retrieve() );
67 log << MSG::DEBUG << "Connected to ROBDataProviderSvc" << endmsg;
68
69 return StatusCode::SUCCESS;
70}
71
77StatusCode RecMuCTPIByteStreamCnv::createObj( IOpaqueAddress* pAddr, DataObject*& pObj ) {
78
79 MsgStream log( msgSvc(), "RecMuCTPIByteStreamCnv" );
80 log << MSG::DEBUG << "executing createObj()" << endmsg;
81
82 ByteStreamAddress *pBS_Addr;
83 pBS_Addr = dynamic_cast< ByteStreamAddress* >( pAddr );
84 if ( !pBS_Addr ) {
85 log << MSG::ERROR << " Cannot cast to ByteStreamAddress " << endmsg ;
86 return StatusCode::FAILURE;
87 }
88
89 log << MSG::DEBUG << " Creating Objects " << *( pBS_Addr->par() ) << endmsg;
90
91 // get SourceID
92 const uint32_t robId = m_srcIdMap.getRobID( m_srcIdMap.getRodID() );
93
94 std::vector< uint32_t > vID;
95 vID.push_back( robId );
96
97 // get ROB fragment
99 m_robDataProvider->getROBData(Gaudi::Hive::currentContext(), vID, robFrags );
100
101 // size check
102 if ( robFrags.size() == 0 ) {
103 // This is a hack - in early data the rob id of the MuCTPI was
104 // wrong, i.e. 0x76000b
105 uint32_t newRobId = robId;
106 newRobId |= 0x00000b;
107 vID[0] = ( newRobId );
108 m_robDataProvider->getROBData(Gaudi::Hive::currentContext(), vID, robFrags );
109 // size check
110 if ( robFrags.size() != 1 ) {
111 log << MSG::WARNING << " Number of ROB fragments for source ROB ID " << MSG::hex << newRobId << " (ROD ID "
112 << m_srcIdMap.getRodID() << MSG::dec << ") is " << robFrags.size() << endmsg;
114 pObj = SG::asStorable( result ) ;
115 return StatusCode::SUCCESS;
116 }
117 }
118
119 IROBDataProviderSvc::VROBFRAG::const_iterator it = robFrags.begin();
121 // Convert to Object
122 ATH_CHECK( m_tool->convert( ROBData( *it ).getROBFragment(), result ) );
123 pObj = SG::asStorable( result ) ;
124
125 return StatusCode::SUCCESS;
126}
#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
Reconstruction Input Object of the MuCTPI hardware and simulation.
Definition MuCTPI_RIO.h:43
virtual StatusCode initialize() override
Function connecting to all the needed services/tools.
ToolHandle< RecMuCTPIByteStreamTool > m_tool
Tool doing the actual conversion.
static long storageType()
Function needed by the framework.
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Service used when reading the BS data.
RecMuCTPIByteStreamCnv(ISvcLocator *svcloc)
Standard constructor.
static const CLID & classID()
Function needed by the framework.
MuCTPISrcIdMap m_srcIdMap
Object storing the various IDs of the MuCTPI fragment.
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj) override
Function creating the MuCTPI_RIO object from a MuCTPI ROB fragment.
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)