BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
RawDataMucDigiCnv.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "MucRawEvent/MucDigi.h"
4#include "RawDataCnv/Util/MucConverter.h"
5
6#include "RawDataBaseCnv.h"
7
8extern const CLID& CLID_MucDigiCol;
9
11private:
12 MucConverter* m_cnv;
13
14public:
15 RawDataMucDigiCnv( ISvcLocator* svc ) : RawDataBaseCnv( svc, classID() ) {}
16
18
19 static const CLID& classID() { return CLID_MucDigiCol; }
20
21 StatusCode initialize() override {
22 MsgStream log( msgSvc(), "RawDataMucDigiCnv" );
23 log << MSG::INFO << "RawDataMucDigiCnv::initialize()" << endmsg;
24
26 if ( sc.isFailure() )
27 {
28 log << MSG::ERROR << "Failed to initialize RawDataBaseCnv" << endmsg;
29 return sc;
30 }
31
32 m_cnv = MucConverter::instance();
33 return StatusCode::SUCCESS;
34 }
35
36 StatusCode createObj( IOpaqueAddress* pAddr, DataObject*& pObj ) {
37 // MsgStream log(msgSvc(), "RawDataMucDigiCnv");
38 // Purpose and Method: This converter will create an empty MucDigiCol on
39 // the TDS.
40 MucDigiCol* digiCol = new MucDigiCol;
41 pObj = digiCol;
42
43 RAWEVENT* evt = m_inputSvc->currentEvent();
44 if ( evt == NULL )
45 {
46 cout << "RawDataMucDigiCnv::createObj has event!" << endl;
47 return StatusCode::FAILURE;
48 }
49
50 const BufferHolder& mucBuf = evt->getMucBuf();
51
52 return m_cnv->convert( mucBuf, digiCol );
53 }
54
55 StatusCode createRep( DataObject* pObj, IOpaqueAddress*& pAddr ) {
56 // convert PixelRaw in the container into ByteStream
57 // MsgStream log(msgSvc(), "RawDataMucDigiCnv");
58
59 WriteRawEvent*& re = m_cnvSvc->getRawEvent();
60 if ( re == 0 )
61 {
62 // log << " get RawEvent failed !" << endmsg;
63 return StatusCode::FAILURE;
64 }
65
66 SmartDataPtr<MucDigiCol> digiCol( dataProvider(), EventModel::Digi::MucDigiCol );
67 if ( digiCol == 0 )
68 {
69 // log << "no MucDigiCol found" << endmsg;
70 return StatusCode::FAILURE;
71 }
72
73 return m_cnv->convert( digiCol, re );
74 }
75};
const CLID & CLID_MucDigiCol
eformat::write::FullEventFragment WriteRawEvent
const CLID & CLID_MucDigiCol
IMessageSvc * msgSvc()
static MucConverter * instance()
static void destroy()
IRawDataCnvSvc * m_cnvSvc
IRawDataInputSvc * m_inputSvc
RawDataBaseCnv(long storageType, const CLID &clid, ISvcLocator *svc)
StatusCode initialize()
StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr)
RawDataMucDigiCnv(ISvcLocator *svc)
StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
static const CLID & classID()
StatusCode initialize() override