BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
RawDataZddEventCnv.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "RawDataCnv/Util/ZddConverter.h"
4#include "ZddEvent/ZddEvent.h"
5
6#include "RawDataBaseCnv.h"
7
8extern const CLID& CLID_ZddEvent;
9
11private:
12 ZddConverter* m_cnv;
13
14public:
18
19 static const CLID& classID() { return CLID_ZddEvent; }
20
21 StatusCode initialize() override {
22 MsgStream log( msgSvc(), "RawDataZddEventCnv" );
23 log << MSG::INFO << "RawDataZddEventCnv::initialize" << endmsg;
24
25 StatusCode sc = RawDataBaseCnv::initialize();
26 if ( sc.isFailure() )
27 {
28 log << MSG::ERROR << "Failed to initialize Converter" << endmsg;
29 return sc;
30 }
31
32 m_cnv = ZddConverter::instance( m_inputSvc->runMode() );
33
34 return StatusCode::SUCCESS;
35 }
36
37 StatusCode createObj( IOpaqueAddress* /*pAddr*/, DataObject*& pObj ) {
38 Event::ZddEvent* zddEvt = new Event::ZddEvent;
39 pObj = zddEvt;
40
41 RAWEVENT* evt = m_inputSvc->currentEvent();
42 if ( evt == NULL )
43 {
44 // log << MSG::ERROR << "RawDataZddEventCnv::createObj has no event!" << endmsg;
45 return StatusCode::FAILURE;
46 }
47
48 const BufferHolder& zddBuf = evt->getZddBuf();
49
50 // Data decoding
51 uint32_t nbuf = zddBuf.nBuf();
52 for ( uint32_t i = 0; i < nbuf; ++i )
53 { // loop the buffers
54 uint32_t* buf = zddBuf( i );
55 m_cnv->convert( buf, zddBuf.bufSize( i ), zddEvt );
56 }
57
58 return StatusCode::SUCCESS;
59 }
60};
const CLID & CLID_ZddEvent
const CLID & CLID_ZddEvent
IMessageSvc * msgSvc()
IRawDataInputSvc * m_inputSvc
RawDataBaseCnv(long storageType, const CLID &clid, ISvcLocator *svc)
StatusCode initialize()
RawDataZddEventCnv(ISvcLocator *svc)
StatusCode initialize() override
static const CLID & classID()
StatusCode createObj(IOpaqueAddress *, DataObject *&pObj)
static ZddConverter * instance(int runMode=2)
static void destroy()