BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
RawDataTrigGTDCnv.cxx
Go to the documentation of this file.
1#include "GaudiKernel/MsgStream.h"
2#include "TrigEvent/TrigGTD.h"
7
8extern const CLID& CLID_TrigGTDCol;
9
10// Constructor
13{
14 init();
15}
16
17// Return the identification number of this converter to the persistency service.
19{
20 return CLID_TrigGTDCol;
21}
22
24{
25 StatusCode sc = RawDataBaseCnv::initialize();
26 if (sc.isFailure()) {
27 return sc;
28 }
29
30 MsgStream log(messageService(), "RawDataTrigGTDCnv");
31
32 IService* isvc = 0;
33 StatusCode status = serviceLocator()->service("PackedRawDataCnvSvc", isvc, true);
34
35 m_RawDataAccess = dynamic_cast<PackedRawDataCnvSvc*> (isvc);
36 if (m_RawDataAccess == 0) {
37 log << MSG::ERROR << "RawDataTrigGTDCnv: Cant cast to RawDataCnvSvc" << endreq;
38 return StatusCode::FAILURE;
39 }
40
41 if (m_RawDataAccess) log << MSG::INFO << "RawDataCnvSvc retrieved" << endreq;
42
43 IService* svc;
44 sc = serviceLocator()->getService("RawDataInputSvc", svc);
45 if (sc.isFailure()) {
46 log << MSG::WARNING << "Cant get RawDataInputSvc" << endreq;
47 return sc;
48 }
49
50 m_inputSvc = dynamic_cast<RawDataInputSvc*> (svc);
51 if (m_inputSvc == 0) {
52 log << MSG::WARNING << "Cant cast to RawDataInputSvc" << endreq;
53 return StatusCode::FAILURE;
54 }
55
56 return StatusCode::SUCCESS;
57}
58
59StatusCode RawDataTrigGTDCnv::updateObj(IOpaqueAddress* pAddr, DataObject* pObj) {
60 MsgStream log(msgSvc(), "RawDataTrigGTDCnv");
61 log << MSG::DEBUG << "RawDataTrigGTDCnv::updateObj" << endreq;
62 return Converter::updateObj(pAddr, pObj);
63}
64
65// Create a converted object in the Transient Data Store.
66StatusCode RawDataTrigGTDCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pObj)
67{
68 MsgStream log(msgSvc(), "RawDataTrigGTDCnv");
69 RawDataAddress* pEFAddr;
70
71 RAWEVENT* evt;
72 TrigGTD* trigGTD;
73
74 TrigGTDCol* gtdCol = new TrigGTDCol;
75 pObj = gtdCol;
76
77 evt = m_inputSvc->currentEvent();
78 if (evt == NULL) {
79 log << MSG::ERROR << "RawDataTrigGTDCnv::createObj has no event!" << endreq;
80 return StatusCode::FAILURE;
81 }
82
83 const BufferHolder& gtdBuf = evt->getGTDBuf();
84 uint32_t nbuf = gtdBuf.nBuf();
85
86 for (uint32_t i = 0; i < nbuf; i++) {
87 uint32_t* buf = gtdBuf(i);
88 uint32_t bufSize = gtdBuf.bufSize(i);
89 uint32_t index = 0;
90 while (bufSize - index > 1) {
91 uint32_t blockSize = ( ((*(buf+index))>>14) & 0x3FF);
92 uint32_t id = ((*(buf+index))>>24);
93 if (blockSize == 0 || (index+blockSize) > bufSize) break;
94 if ((id> 0xD1 && id < 0xD8 && id != 0xD5) || id == 0xDA || (id > 0xE1 && id < 0xED)) {
95 trigGTD = new TrigGTD(buf+index);
96 gtdCol->push_back(trigGTD);
97 }
98 index += blockSize;
99 }
100 }
101
102 return StatusCode::SUCCESS;
103}
104
105StatusCode RawDataTrigGTDCnv::createRep(DataObject* pObj, IOpaqueAddress*& pAddr)
106{
107 MsgStream log(messageService(), "RawDataTrigGTDCnv");
108
109 return StatusCode::SUCCESS;
110}
unsigned const long PACKEDRAWEVENT_StorageType
const CLID & CLID_TrigGTDCol
const CLID & CLID_TrigGTDCol
IMessageSvc * msgSvc()
ObjectVector< TrigGTD > TrigGTDCol
Definition TrigGTD.h:39
#define NULL
uint32_t nBuf() const
uint32_t bufSize(int i) const
virtual RAWEVENT * currentEvent()=0
const BufferHolder & getGTDBuf() const
Definition RAWEVENT.h:99
StatusCode initialize()
static const CLID & classID()
virtual StatusCode updateObj(IOpaqueAddress *, DataObject *)
StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
RawDataTrigGTDCnv(ISvcLocator *svc)
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr)
Convert the transient object to the requested representation.