ATLAS Offline Software
Loading...
Searching...
No Matches
CTPByteStreamCnv Class Reference

ByteStream converter for the CTP_RDO object. More...

#include <CTPByteStreamCnv.h>

Inheritance diagram for CTPByteStreamCnv:
Collaboration diagram for CTPByteStreamCnv:

Public Member Functions

 CTPByteStreamCnv (ISvcLocator *svcloc)
 Standard constructor.
virtual StatusCode initialize () override
 Function connecting to all the needed services/tools.
virtual StatusCode createObj (IOpaqueAddress *pAddr, DataObject *&pObj) override
 Function creating the CTP_RDO object from a CTP ROB fragment.
virtual StatusCode createRep (DataObject *pObj, IOpaqueAddress *&pAddr) override
 Function creating the CTP ROB fragment from a CTP_RDO object.
virtual long repSvcType () const override
 Function needed by the framework.

Static Public Member Functions

static long storageType ()
 Function needed by the framework.
static CLID classID ()
 Function needed by the framework.

Private Attributes

ToolHandle< CTPByteStreamTool > m_tool
 Tool doing the actual conversion.
CTPSrcIdMap m_srcIdMap
 Object storing the various IDs of the CTP fragment.
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
 Service used when reading the BS data.
ServiceHandle< IByteStreamEventAccess > m_ByteStreamEventAccess
 Service used when writing the BS data.

Detailed Description

ByteStream converter for the CTP_RDO object.

   This is a quite standard BS converter for the output sent from the
   Central Trigger Processor to the DAQ. It uses an external tool
   (CTPByteStreamTool) to do the actual work of the conversion, this
   converter is "only" supposed to communicate with the framework.
See also
CTPByteStreamTool
Author
David Berge

Definition at line 35 of file CTPByteStreamCnv.h.

Constructor & Destructor Documentation

◆ CTPByteStreamCnv()

CTPByteStreamCnv::CTPByteStreamCnv ( ISvcLocator * svcloc)

Standard constructor.

The constructor sets up all the ToolHandle and ServiceHandle objects and initialises the base class in the correct way.

Definition at line 24 of file CTPByteStreamCnv.cxx.

25 : Converter( storageType(), classID(), svcloc ),
26 m_tool( "CTPByteStreamTool" ),
27 m_robDataProvider( "ROBDataProviderSvc", "CTPByteStreamCnv" ),
28 m_ByteStreamEventAccess( "ByteStreamCnvSvc", "CTPByteStreamCnv" ) {
29
30}
ToolHandle< CTPByteStreamTool > m_tool
Tool doing the actual conversion.
static CLID classID()
Function needed by the framework.
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Service used when reading the BS data.
static long storageType()
Function needed by the framework.
ServiceHandle< IByteStreamEventAccess > m_ByteStreamEventAccess
Service used when writing the BS data.

Member Function Documentation

◆ classID()

CLID CTPByteStreamCnv::classID ( )
static

Function needed by the framework.

Function telling the framework the Class ID of the object that this converter is for (CTP_RDO).

Definition at line 36 of file CTPByteStreamCnv.cxx.

36 {
37
39
40}

◆ createObj()

StatusCode CTPByteStreamCnv::createObj ( IOpaqueAddress * pAddr,
DataObject *& pObj )
overridevirtual

Function creating the CTP_RDO object from a CTP ROB fragment.

This function creates the CTP_RDO object from the BS data.

It requests the ROB fragment with the ROB Id of the CTP and gives this fragment to the CTPByteStreamTool for conversion.

Definition at line 89 of file CTPByteStreamCnv.cxx.

89 {
90
91 MsgStream log( msgSvc(), "CTPByteStreamCnv" );
92 log << MSG::DEBUG << "createObj() called" << endmsg;
93
94 ByteStreamAddress* pBS_Addr{};
95 ATH_CHECK( (pBS_Addr = dynamic_cast<ByteStreamAddress*>(pAddr)) != nullptr );
96
97 const EventContext& ctx = pBS_Addr->getEventContext();
98
99 log << MSG::DEBUG << "Creating Objects: " << *( pBS_Addr->par() ) << endmsg;
100
101 //
102 // Get the SourceID:
103 //
104 const uint32_t robId = m_srcIdMap.getRobID( m_srcIdMap.getRodID() );
105
106 log << MSG::DEBUG << "expected ROB sub-detector ID: " << std::hex
107 << robId << std::dec << endmsg;
108
109 std::vector< uint32_t > vID;
110 vID.push_back( robId );
111
112 //
113 // Get the ROB fragment:
114 //
116 m_robDataProvider->getROBData( ctx, vID, robFrags );
117
118 //
119 // Size check:
120 //
121 if( robFrags.size() != 1 ) {
122 log << MSG::WARNING << "Number of ROB fragments is " << robFrags.size() << endmsg;
123 log << MSG::WARNING << "Creating empty CTP_RDO object" << endmsg;
124
125 CTP_RDO* result = new CTP_RDO(3,0,0);
126 pObj = SG::asStorable( result );
127 return StatusCode::SUCCESS;
128 }
129
130 //
131 // Do the actual conversion:
132 //
133 IROBDataProviderSvc::VROBFRAG::const_iterator it = robFrags.begin();
134 CTP_RDO* result = 0;
135
136 ATH_CHECK( m_tool->convert( ROBData( *it ).getROBFragment(), result ) );
137 pObj = SG::asStorable( result ) ;
138
139 return StatusCode::SUCCESS;
140}
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
ROBData_T< OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment, OFFLINE_FRAGMENTS_NAMESPACE::PointerType > ROBData
Definition ROBData.h:225
const EventContext & getEventContext() const
CTPSrcIdMap m_srcIdMap
Object storing the various IDs of the CTP fragment.
std::vector< const ROBF * > VROBFRAG
const ROBFragment * getROBFragment() const
Return the ROBFragment.
Definition ROBData.h:184
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)
setEventNumber uint32_t

◆ createRep()

StatusCode CTPByteStreamCnv::createRep ( DataObject * pObj,
IOpaqueAddress *& pAddr )
overridevirtual

Function creating the CTP ROB fragment from a CTP_RDO object.

This function receives a CTP_RDO object as input, and adds the ROB fragment of the CTP to the current raw event using the IByteStreamEventAccess interface.

Definition at line 147 of file CTPByteStreamCnv.cxx.

147 {
148
149 MsgStream log( msgSvc(), "CTPByteStreamCnv" );
150 log << MSG::DEBUG << "createRep() called" << endmsg;
151
152 RawEventWrite* re = m_ByteStreamEventAccess->getRawEvent();
153
155 if( ! SG::fromStorable( pObj, result ) ) {
156 log << MSG::ERROR << " Cannot cast to CTP_RDO" << endmsg;
157 return StatusCode::FAILURE;
158 }
159
160 ByteStreamAddress* addr = new ByteStreamAddress( classID(), pObj->registry()->name(), "" );
161
162 pAddr = addr;
163
164 // Convert to ByteStream
165 return m_tool->convert( result, re );
166}
const std::regex re(r_e)
OFFLINE_FRAGMENTS_NAMESPACE_WRITE::FullEventFragment RawEventWrite
data type for writing raw event
Definition RawEvent.h:39
bool fromStorable(DataObject *pDObj, T *&pTrans, bool quiet=false, IRegisterTransient *irt=0, bool isConst=true)

◆ initialize()

StatusCode CTPByteStreamCnv::initialize ( )
overridevirtual

Function connecting to all the needed services/tools.

Init method gets all necessary services etc.

Definition at line 49 of file CTPByteStreamCnv.cxx.

49 {
50
51 //
52 // Initialise the base class:
53 //
54 ATH_CHECK( Converter::initialize() );
55
56 MsgStream log( msgSvc(), "CTPByteStreamCnv" );
57 log << MSG::DEBUG << "CTPByteStreamCnv in initialize() " << endmsg;
58
59 //
60 // Get ByteStreamCnvSvc:
61 //
63 log << MSG::DEBUG << "Connected to ByteStreamEventAccess interface" << endmsg;
64
65 //
66 // Get CTPByteStreamTool:
67 //
68 ATH_CHECK( m_tool.retrieve() );
69 log << MSG::DEBUG << "Connected to CTPByteStreamTool" << endmsg;
70
71 //
72 // Get ROBDataProvider:
73 //
74 if( m_robDataProvider.retrieve().isFailure() ) {
75 log << MSG::WARNING << "Can't get ROBDataProviderSvc" << endmsg;
76 // return is disabled for Write BS which does not requre ROBDataProviderSvc
77 } else {
78 log << MSG::DEBUG << "Connected to ROBDataProviderSvc" << endmsg;
79 }
80
81 return StatusCode::SUCCESS;
82}

◆ repSvcType()

virtual long CTPByteStreamCnv::repSvcType ( ) const
inlineoverridevirtual

Function needed by the framework.

Definition at line 49 of file CTPByteStreamCnv.h.

49{ return i_repSvcType(); }

◆ storageType()

long CTPByteStreamCnv::storageType ( )
static

Function needed by the framework.

Definition at line 42 of file CTPByteStreamCnv.cxx.

42 {
44}
static constexpr long storageType()

Member Data Documentation

◆ m_ByteStreamEventAccess

ServiceHandle< IByteStreamEventAccess > CTPByteStreamCnv::m_ByteStreamEventAccess
private

Service used when writing the BS data.

Definition at line 65 of file CTPByteStreamCnv.h.

◆ m_robDataProvider

ServiceHandle< IROBDataProviderSvc > CTPByteStreamCnv::m_robDataProvider
private

Service used when reading the BS data.

Definition at line 63 of file CTPByteStreamCnv.h.

◆ m_srcIdMap

CTPSrcIdMap CTPByteStreamCnv::m_srcIdMap
private

Object storing the various IDs of the CTP fragment.

Definition at line 60 of file CTPByteStreamCnv.h.

◆ m_tool

ToolHandle< CTPByteStreamTool > CTPByteStreamCnv::m_tool
private

Tool doing the actual conversion.

Definition at line 57 of file CTPByteStreamCnv.h.


The documentation for this class was generated from the following files: