BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
RawDataTofDigiCnv.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "LumiDigi/LumiDigi.h"
4#include "RawDataCnv/Util/TofConverter.h"
5
6#include "RawDataBaseCnv.h"
7
8extern const CLID& CLID_TofDigiCol;
9
11private:
12 /// TofConverter for packing or unpacking data
13 TofConverter* m_cnv;
14
15public:
16 RawDataTofDigiCnv( ISvcLocator* svc ) : RawDataBaseCnv( svc, classID() ) {}
17
19
20 static const CLID& classID() { return CLID_TofDigiCol; }
21
22 StatusCode initialize() override {
23 MsgStream log( msgSvc(), "RawDataTofDigiCnv" );
24 log << MSG::INFO << "RawDataTofDigiCnv::initialize()" << endmsg;
25
27 if ( sc.isFailure() )
28 {
29 log << MSG::ERROR << "Failed to initialize RawDataBaseCnv" << endmsg;
30 return sc;
31 }
32
33 m_cnv = TofConverter::instance();
34 return StatusCode::SUCCESS;
35 }
36
37 StatusCode createObj( IOpaqueAddress* pAddr, DataObject*& pObj ) {
38 MsgStream log( msgSvc(), "RawDataTofDigiCnv" );
39
40 uint32_t TEId, TEData, TEOverflow, TETorQ;
41 TofDigi* tofDigi;
42 // Purpose and Method: This converter will create an empty TofDigiCol on
43 // the TDS.
44 TofDigiCol* digiCol = new TofDigiCol;
45 pObj = digiCol;
46
47 // zoujh: for luminosity begin ...................
48 LumiDigiCol* lumiDigiCol = 0;
49 DataObject* pLumi;
50 dataProvider()->findObject( "/Event/Digi/LumiDigiCol", pLumi );
51 if ( pLumi == NULL )
52 {
53 lumiDigiCol = new LumiDigiCol;
54 StatusCode sc = dataProvider()->registerObject( "/Event/Digi/LumiDigiCol", lumiDigiCol );
55 if ( sc.isFailure() )
56 { log << MSG::ERROR << "Could not register LumiDigiCol in TDS!" << endmsg; }
57 }
58 else { lumiDigiCol = dynamic_cast<LumiDigiCol*>( pLumi ); }
59 // zoujh: for luminosity end ^^^^^^^^^^^^^^^^^^^^^
60
61 RAWEVENT* evt = m_inputSvc->currentEvent();
62 if ( evt == NULL )
63 {
64 cout << "RawDataTofDigiCnv::createObj has no event!" << endl;
65 return StatusCode::FAILURE;
66 }
67
68 const BufferHolder& tofBuf = evt->getTofBuf();
69 const BufferHolder& etfBuf = evt->getEtfBuf();
70
71 return m_cnv->convert( tofBuf, etfBuf, digiCol, lumiDigiCol );
72 }
73
74 StatusCode createRep( DataObject* pObj, IOpaqueAddress*& pAddr ) {
75 // convert PixelRaw in the container into ByteStream
76 // MsgStream log(msgSvc(), "RawDataTofDigiCnv");
77
78 WriteRawEvent*& re = m_cnvSvc->getRawEvent();
79 if ( re == 0 )
80 {
81 // log << " get RawEvent failed !" << endmsg;
82 return StatusCode::FAILURE;
83 }
84
85 SmartDataPtr<TofDigiCol> digiCol( dataProvider(), EventModel::Digi::TofDigiCol );
86 if ( digiCol == 0 )
87 {
88 // log << "no TofDigiCol found" << endmsg;
89 return StatusCode::FAILURE;
90 }
91
92 return m_cnv->convert( digiCol, re );
93 }
94};
const CLID & CLID_TofDigiCol
ObjectVector< LumiDigi > LumiDigiCol
eformat::write::FullEventFragment WriteRawEvent
const CLID & CLID_TofDigiCol
IMessageSvc * msgSvc()
IRawDataCnvSvc * m_cnvSvc
IRawDataInputSvc * m_inputSvc
RawDataBaseCnv(long storageType, const CLID &clid, ISvcLocator *svc)
StatusCode initialize()
StatusCode initialize() override
static const CLID & classID()
StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr)
StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
RawDataTofDigiCnv(ISvcLocator *svc)
static void destroy()
static TofConverter * instance()