ATLAS Offline Software
Loading...
Searching...
No Matches
RecMuCTPIByteStreamCnv.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"
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 ATH_CHECK( (pBS_Addr = dynamic_cast<ByteStreamAddress*>(pAddr)) != nullptr );
84
85 const EventContext& ctx = pBS_Addr->getEventContext();
86
87 log << MSG::DEBUG << " Creating Objects " << *( pBS_Addr->par() ) << endmsg;
88
89 // get SourceID
90 const uint32_t robId = m_srcIdMap.getRobID( m_srcIdMap.getRodID() );
91
92 std::vector< uint32_t > vID;
93 vID.push_back( robId );
94
95 // get ROB fragment
97 m_robDataProvider->getROBData(ctx, vID, robFrags );
98
99 // size check
100 if ( robFrags.size() == 0 ) {
101 // This is a hack - in early data the rob id of the MuCTPI was
102 // wrong, i.e. 0x76000b
103 uint32_t newRobId = robId;
104 newRobId |= 0x00000b;
105 vID[0] = ( newRobId );
106 m_robDataProvider->getROBData(ctx, vID, robFrags );
107 // size check
108 if ( robFrags.size() != 1 ) {
109 log << MSG::WARNING << " Number of ROB fragments for source ROB ID " << MSG::hex << newRobId << " (ROD ID "
110 << m_srcIdMap.getRodID() << MSG::dec << ") is " << robFrags.size() << endmsg;
111 MuCTPI_RIO * result = new MuCTPI_RIO;
112 pObj = SG::asStorable( result ) ;
113 return StatusCode::SUCCESS;
114 }
115 }
116
117 IROBDataProviderSvc::VROBFRAG::const_iterator it = robFrags.begin();
118 MuCTPI_RIO* result{};
119 // Convert to Object
120 auto sc = m_tool->convert( ROBData( *it ).getROBFragment(), result ) ;
121 if (sc.isFailure()){
122 log << MSG::ERROR<<"RecMuCTPIByteStreamCnv::createObj failed."<<endmsg;
123 delete result; //object new'ed in convert
124 return sc;
125 }
126 pObj = SG::asStorable( result ) ;
127
128 return StatusCode::SUCCESS;
129}
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
uint32_t CLID
The Class ID type.
static Double_t sc
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
Reconstruction Input Object of the MuCTPI hardware and simulation.
Definition MuCTPI_RIO.h:43
const ROBFragment * getROBFragment() const
Return the ROBFragment.
Definition ROBData.h:184
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.
static CLID classID()
Function needed by the framework.
RecMuCTPIByteStreamCnv(ISvcLocator *svcloc)
Standard constructor.
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)