BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
RawDataZddEventCnv.cxx
Go to the documentation of this file.
5#include "ZddEvent/ZddEvent.h"
6#include "GaudiKernel/ThreadGaudi.h"
7
9
10extern const CLID& CLID_ZddEvent;
11
14{
15}
16
18{
20}
21
23{
24 StatusCode sc = RawDataBaseCnv::initialize();
25 if ( sc.isFailure() ) return sc;
26
27 std::string PackedRawDataCnvSvc_Name("PackedRawDataCnvSvc");
28 std::string RawDataInputSvc_Name("RawDataInputSvc");
29 std::string RawDataZddEventCnv_Name("RawDataZddEventCnv");
30
31 SmartIF<IService> pCnvSvc(conversionSvc());
32 if (isGaudiThreaded(pCnvSvc->name())){
33 PackedRawDataCnvSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
34 RawDataInputSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
35 RawDataZddEventCnv_Name += getGaudiThreadIDfromName(pCnvSvc->name());
36 }
37
38 MsgStream log(messageService(), RawDataZddEventCnv_Name.c_str());
39
40 IService* svc ;
41 sc = serviceLocator()->getService(RawDataInputSvc_Name.c_str(), svc);
42 m_inputSvc = dynamic_cast<RawDataInputSvc*> (svc);
43 if ( m_inputSvc == 0 ) {
44 log<<MSG::WARNING<< " Cant cast to RawDataInputSvc " <<endreq;
45 return StatusCode::FAILURE ;
46 }
47
48 m_cnv = ZddConverter::instance( m_inputSvc->runMode() );
49
50 return StatusCode::SUCCESS;
51}
52
54{
55 return CLID_ZddEvent;
56}
57
58StatusCode RawDataZddEventCnv::createObj(IOpaqueAddress* /*pAddr*/, DataObject*& pObj)
59{
60 ZddEvent* zddEvt = new ZddEvent;
61 pObj = zddEvt;
62
63 RAWEVENT* evt = m_inputSvc->currentEvent();
64 if (evt == NULL) {
65 //log << MSG::ERROR << "RawDataZddEventCnv::createObj has no event!" << endreq;
66 return StatusCode::FAILURE;
67 }
68
69 const BufferHolder& zddBuf = evt->getZddBuf();
70
71 // Data decoding
72 uint32_t nbuf = zddBuf.nBuf();
73 for ( uint32_t i = 0; i < nbuf; ++i ) { //loop the buffers
74 uint32_t* buf = zddBuf(i);
75 m_cnv->convert(buf, zddBuf.bufSize(i), zddEvt);
76 }
77
78 return StatusCode::SUCCESS;
79}
80
81StatusCode RawDataZddEventCnv::updateObj(IOpaqueAddress* pAddr, DataObject* pObj)
82{
83 return Converter::updateObj(pAddr, pObj);
84}
85
86StatusCode RawDataZddEventCnv::createRep(DataObject* , IOpaqueAddress*& )
87{
88 // to be filled
89 return StatusCode::SUCCESS;
90}
unsigned const long PACKEDRAWEVENT_StorageType
Definition: ClassID_temp.h:17
const CLID & CLID_ZddEvent
Definition: EventModel.cxx:290
const CLID & CLID_ZddEvent
Definition: EventModel.cxx:290
#define NULL
uint32_t nBuf() const
Definition: BufferHolder.h:15
uint32_t bufSize(int i) const
Definition: BufferHolder.h:16
virtual int runMode()=0
virtual RAWEVENT * currentEvent()=0
const BufferHolder & getZddBuf() const
Definition: RAWEVENT.h:100
StatusCode initialize()
static const CLID & classID()
RawDataZddEventCnv(ISvcLocator *svc)
StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
virtual StatusCode updateObj(IOpaqueAddress *, DataObject *)
override the RawDataBaseCnv version
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr)
Convert the transient object to the requested representation.
static ZddConverter * instance(int runMode=2)
Definition: ZddConverter.cxx:9
static void destroy()
bool convert(uint32_t *pdata, int size, Event::ZddEvent *evt)