ATLAS Offline Software
Loading...
Searching...
No Matches
HLT::HLTResultByteStreamCnv Class Reference

Gaudi bytestream Converter for the HLTResult class. More...

#include <HLTResultByteStreamCnv.h>

Inheritance diagram for HLT::HLTResultByteStreamCnv:
Collaboration diagram for HLT::HLTResultByteStreamCnv:

Public Member Functions

 HLTResultByteStreamCnv (ISvcLocator *svcloc)
 std Gaudi converter constructor
virtual StatusCode initialize ()
 Gaudi initialize.
virtual StatusCode finalize ()
 Gaudi finalize.
virtual StatusCode createObj (IOpaqueAddress *pAddr, DataObject *&pObj)
 create RDO (HLTResult) from bytestream
virtual StatusCode createRep (DataObject *pObj, IOpaqueAddress *&pAddr)
 create bytestream from RDOs (HLTResult)
long repSvcType () const
 return repSvcType

Static Public Member Functions

static long storageType ()
 storageType
static CLID classID ()
 CLID.

Private Attributes

MsgStream * m_log
 std message stream
ToolHandle< HLTResultByteStreamTool > m_tool
 tool for conversion work
ServiceHandle< IByteStreamEventAccess > m_ByteStreamEventAccess
 Gaudi helper.
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
 Gaudi ROB helper.

Detailed Description

Gaudi bytestream Converter for the HLTResult class.

An AlgTool to provide conversion of Run-1&2 HLTResult from/to ByteStream.

This class essentially provides two methods:

  1. createObj(IOpaqueAddress*, DataObject*&)
  2. createRep(DataObject*, IOpaqueAddress*& )

The first one creates a DataObject from persistent information, captured in IOpaqueAddress, and the second is supposed to write the DataObject to a persistent representation. Here, DataObject will be casted to HLTResult

see here for a general ByteStream converter description: http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/offline/Event/ByteStreamCnvSvc/doc/ByteStream.txt

beginning of this file:
ByteStream conversion Service (ByteStreamCnvSvc) provides a means to convert the raw data in the ByteStream format to and from the transient representation, Raw Data Objects (RDO). In Gaudi's terminology, ByteStream can be considered as a persistency for reading and storing raw data. In practice, the source of the ByteStream can be a file, or the online data source (or its emulation) through network, for example. Together with the IdentifiableContainer, used to contain the Raw Data Objects, ByteStreamCnvSvc provides a mechanism for creating the RDOs on demand.

This tool is used by the Gaudi converter class: HLTResultByteStreamCnv.

Definition at line 69 of file HLTResultByteStreamCnv.h.

Constructor & Destructor Documentation

◆ HLTResultByteStreamCnv()

HLT::HLTResultByteStreamCnv::HLTResultByteStreamCnv ( ISvcLocator * svcloc)

std Gaudi converter constructor

Constructor.

Definition at line 34 of file HLTResultByteStreamCnv.cxx.

34 :
35 Converter(storageType(), classID(),svcloc),
36 m_log(0),
37 m_tool("HLT::HLTResultByteStreamTool"),
38 m_ByteStreamEventAccess("ByteStreamCnvSvc", "HLTResultByteStreamCnv"),
39 m_robDataProvider("ROBDataProviderSvc", "HLTResultByteStreamCnv")
40{ }
ServiceHandle< IByteStreamEventAccess > m_ByteStreamEventAccess
Gaudi helper.
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Gaudi ROB helper.
static long storageType()
storageType
MsgStream * m_log
std message stream
ToolHandle< HLTResultByteStreamTool > m_tool
tool for conversion work

Member Function Documentation

◆ classID()

CLID HLT::HLTResultByteStreamCnv::classID ( )
static

CLID.

Definition at line 45 of file HLTResultByteStreamCnv.cxx.

◆ createObj()

StatusCode HLT::HLTResultByteStreamCnv::createObj ( IOpaqueAddress * pAddr,
DataObject *& pObj )
virtual

create RDO (HLTResult) from bytestream

createObj should create the RDO from bytestream.

Definition at line 148 of file HLTResultByteStreamCnv.cxx.

149{
150 HLTResult* result = new HLTResult();
151
152 ByteStreamAddress *pBS_Addr = dynamic_cast<ByteStreamAddress*>(pAddr);
153 if(pBS_Addr==nullptr) {
154 (*m_log) << MSG::ERROR << " Can not cast to ByteStreamAddress " << endmsg ;
155 delete result;
156 return StatusCode::FAILURE;
157 }
158
159 const std::string nm = *(pBS_Addr->par()) ;
160 std::vector<ROBData> vRobData;
161
162 StatusCode sc = m_tool->convert(*m_robDataProvider, result, nm);
163 if (sc != StatusCode::SUCCESS) {
164 (*m_log) << MSG::ERROR << "Failed to create object " << nm << endmsg;
165 return sc;
166 }
167
168 pObj = SG::asStorable(result);
169 return sc;
170}
#define endmsg
static Double_t sc
::StatusCode StatusCode
StatusCode definition for legacy code.
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)

◆ createRep()

StatusCode HLT::HLTResultByteStreamCnv::createRep ( DataObject * pObj,
IOpaqueAddress *& pAddr )
virtual

create bytestream from RDOs (HLTResult)

createRep should create the bytestream from RDOs.

Definition at line 175 of file HLTResultByteStreamCnv.cxx.

176{
177
178 HLTResult* result = 0;
179 SG::fromStorable(pObj, result);
180
181 if (!result) {
182 (*m_log) << MSG::ERROR << " Cannot cast to HLTResult " << endmsg ;
183 return StatusCode::FAILURE;
184 }
185
186 std::string nm = pObj->registry()->name();
187
188 RawEventWrite* re = m_ByteStreamEventAccess->getRawEvent();
189 // Convert to ByteStream
190 StatusCode sc = m_tool->convert(result, re, nm);
191
192 if ( pAddr != nullptr ) pAddr->release();
193 ByteStreamAddress* addr = new ByteStreamAddress(classID(), nm, "");
194 pAddr = addr;
195 pAddr->addRef();
196
197 return sc;
198
199}
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)

◆ finalize()

StatusCode HLT::HLTResultByteStreamCnv::finalize ( )
virtual

Gaudi finalize.

Definition at line 55 of file HLTResultByteStreamCnv.cxx.

56{
57 delete m_log;
58 return StatusCode::SUCCESS;
59}

◆ initialize()

StatusCode HLT::HLTResultByteStreamCnv::initialize ( )
virtual

Gaudi initialize.

Init method gets all necessary services etc.

Definition at line 65 of file HLTResultByteStreamCnv.cxx.

66{
67 StatusCode sc = Converter::initialize();
68 if(StatusCode::SUCCESS!=sc)
69 {
70 return sc;
71 }
72
73 m_log = new MsgStream(msgSvc(), "HLTResultByteStreamCnv");
74
75 (*m_log) << MSG::DEBUG << "HLTResultByteStreamCnv in initialize() " <<endmsg;
76
77 //Get ByteStreamCnvSvc
78 if ( m_ByteStreamEventAccess.retrieve().isFailure() ) {
79 (*m_log) << MSG::FATAL << "failed to retrieve ByteStreamEventAccess service: "
81 return StatusCode::FAILURE;
82 } else {
83 (*m_log) << MSG::DEBUG << "successfully retrieved ByteStreamEventAccess service: "
85 }
86// if(StatusCode::SUCCESS != service("ByteStreamCnvSvc",m_ByteStreamEventAccess)){
87// (*m_log) << MSG::ERROR << " Can't get ByteStreamEventAccess interface " << endmsg;
88// return StatusCode::FAILURE;
89// }
90
91
92
93 // Retrieve Tool
94 // IToolSvc* toolSvc;
95 // if(StatusCode::SUCCESS != service("ToolSvc",toolSvc)){
96 // (*m_log) << MSG::ERROR << " Can't get ToolSvc " << endmsg;
97 // return StatusCode::FAILURE;
98 // }
99
100// std::string toolType = "HLT::HLTResultByteStreamTool" ;
101// if(StatusCode::SUCCESS !=toolSvc->retrieveTool(toolType,m_tool))
102// {
103// (*m_log) << MSG::ERROR << " Can't get ByteStreamTool " << endmsg;
104// return StatusCode::FAILURE;
105// }
106 // get the converter tool:
107 if ( m_tool.retrieve().isFailure() ) {
108 (*m_log) << MSG::FATAL << "failed to retrieve converter tool : "
109 << m_tool << endmsg;
110 return StatusCode::FAILURE;
111 } else {
112 (*m_log) << MSG::DEBUG << "successfully retrieved converter tool: "
113 << m_tool << endmsg;
114 }
115
116
117 // Get ROBDataProvider
118 if (m_robDataProvider.retrieve().isFailure()) {
119 (*m_log) << MSG::FATAL << "failed to retrieve ROBDataProviderSvc service: "
121 return StatusCode::FAILURE;
122 }
123 (*m_log) << MSG::DEBUG << "successfully retrieved ROBDataProviderSvc service: "
125
126// IService* robSvc ;
127// sc = serviceLocator()->getService("ROBDataProviderSvc", robSvc);
128// if(sc != StatusCode::SUCCESS ) {
129// (*m_log)<<MSG::ERROR << " Cant get ROBDataProviderSvc " <<endmsg;
130
131// //DBG:
132// // return sc ;
133// return StatusCode::SUCCESS;
134// }
135
136// m_robDataProvider = dynamic_cast<IROBDataProviderSvc*> (robSvc);
137// if(m_robDataProvider == 0 ) {
138// (*m_log)<<MSG::ERROR<< " Cant cast to ROBDataProviderSvc " <<endmsg;
139// // return StatusCode::FAILURE ;
140// }
141
142 return StatusCode::SUCCESS;
143}

◆ repSvcType()

long HLT::HLTResultByteStreamCnv::repSvcType ( ) const
inline

return repSvcType

Definition at line 85 of file HLTResultByteStreamCnv.h.

◆ storageType()

long HLT::HLTResultByteStreamCnv::storageType ( )
static

storageType

Definition at line 50 of file HLTResultByteStreamCnv.cxx.

51{
53}
static constexpr long storageType()

Member Data Documentation

◆ m_ByteStreamEventAccess

ServiceHandle< IByteStreamEventAccess > HLT::HLTResultByteStreamCnv::m_ByteStreamEventAccess
private

Gaudi helper.

Definition at line 93 of file HLTResultByteStreamCnv.h.

◆ m_log

MsgStream* HLT::HLTResultByteStreamCnv::m_log
private

std message stream

Definition at line 89 of file HLTResultByteStreamCnv.h.

◆ m_robDataProvider

ServiceHandle< IROBDataProviderSvc > HLT::HLTResultByteStreamCnv::m_robDataProvider
private

Gaudi ROB helper.

Definition at line 95 of file HLTResultByteStreamCnv.h.

◆ m_tool

ToolHandle< HLTResultByteStreamTool > HLT::HLTResultByteStreamCnv::m_tool
private

tool for conversion work

Definition at line 91 of file HLTResultByteStreamCnv.h.


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