CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
RawDataEvtHeaderCnv.cxx
Go to the documentation of this file.
1#include "GaudiKernel/MsgStream.h"
2// for Mutil-thread by tianhl
3#include "GaudiKernel/ThreadGaudi.h"
4// for Mutil-thread by tianhl
5
12
13extern const CLID& CLID_EventHeader;
14
17{
18 // for Mutil-thread by tianhl
19 //init();
20 // for Mutil-thread by tianhl
21}
22
24{
25 StatusCode sc = RawDataBaseCnv::initialize();
26 if ( sc.isFailure() ) return sc;
27
28 std::string PackedRawDataCnvSvc_Name("PackedRawDataCnvSvc");
29 std::string RawDataInputSvc_Name("RawDataInputSvc");
30 std::string RawDataEvtHeaderCnv_Name("RawDataEvtHeaderCnv");
31
32 // for Mutil-thread by tianhl
33 //ConversionSvc* pCnvSvc = 0;
34 //if (pCnvSvc = dynamic_cast<ConversionSvc*>(conversionSvc())){
35 SmartIF<IService> pCnvSvc(conversionSvc());
36 if (isGaudiThreaded(pCnvSvc->name())){
37 PackedRawDataCnvSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
38 RawDataInputSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
39 RawDataEvtHeaderCnv_Name += getGaudiThreadIDfromName(pCnvSvc->name());
40 }
41 //}
42 // for Mutil-thread by tianhl
43 MsgStream log(messageService(), RawDataEvtHeaderCnv_Name.c_str());
44
45 IService* svc = 0;
46 sc = serviceLocator()->service(PackedRawDataCnvSvc_Name.c_str(), svc);
47 if ( sc.isFailure() ) {
48 log << MSG::ERROR << "Can't get RawDataAccess interface" << endreq;
49 return StatusCode::FAILURE;
50 }
51
52 m_RawDataAccess = dynamic_cast<PackedRawDataCnvSvc*> (svc);
53 if (m_RawDataAccess == 0 ) {
54 log << MSG::ERROR << "RawDataEvtHeaderCnv: Cant cast to RawDataCnvSvc" << endreq;
55 return StatusCode::FAILURE;
56 }
57
58 sc = serviceLocator()->getService(RawDataInputSvc_Name.c_str(), svc);
59 if ( sc.isFailure() ) {
60 log << MSG::WARNING << "Cant get RawDataInputSvc " << endreq;
61 return sc ;
62 }
63
64 m_inputSvc = dynamic_cast<RawDataInputSvc*> (svc);
65 if ( m_inputSvc == 0 ) {
66 log << MSG::ERROR << "Cant cast to RawDataInputSvc" << endreq;
67 return StatusCode::FAILURE ;
68 }
69
70 return StatusCode::SUCCESS;
71}
72
74{
75 return CLID_EventHeader;
76}
77
78StatusCode RawDataEvtHeaderCnv::updateObj(IOpaqueAddress* pAddr, DataObject* pObj) {
79 //MsgStream log(msgSvc(), "RawDataEvtHeaderCnv");
80 //log << MSG::DEBUG << "RawDataEvtHeaderCnv::updateObj" << endreq;
81 return Converter::updateObj(pAddr, pObj);
82}
83
84// Create a converted object in the Transient Data Store.
85StatusCode RawDataEvtHeaderCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pObj)
86{
87 StatusCode sc;
88 RawDataAddress *pEFAddr;
89 const RAWEVENT *evt;
90
92 pObj = header;
93
94 //if ( (pEFAddr = dynamic_cast<RawDataAddress*>(pAddr)) ) {
95 evt = m_inputSvc->currentEvent();
96
97 if (evt == NULL) return StatusCode::FAILURE;
98
99 header->setEventNumber(evt->eventHeader().event_number());
100 header->setRunNumber(evt->eventHeader().run_number());
101 header->setTime(evt->eventHeader().time());
102 header->setFlag1( evt->eventHeader().flag1() );
103 //header->setFlag2( evt->eventHeader().flag2() );
104
105
106 return StatusCode::SUCCESS;
107 //}
108 //else {
109 // return StatusCode::FAILURE;
110 //}
111
112}
unsigned const long PACKEDRAWEVENT_StorageType
Definition: ClassID_temp.h:17
const CLID & CLID_EventHeader
Definition: EventModel.cxx:217
const CLID & CLID_EventHeader
Definition: EventModel.cxx:217
void setRunNumber(int value)
Update run number.
Definition: EventHeader.h:44
void setTime(int value)
Definition: EventHeader.h:48
void setFlag1(unsigned int value)
Update flags.
Definition: EventHeader.h:59
void setEventNumber(int value)
Update event number.
Definition: EventHeader.h:39
virtual RAWEVENT * currentEvent()=0
uint32_t flag1() const
Definition: RAWEVENT.h:26
uint32_t run_number() const
Definition: RAWEVENT.h:22
uint32_t event_number() const
Definition: RAWEVENT.h:23
uint32_t time() const
Definition: RAWEVENT.h:24
const RawEventHeader & eventHeader() const
Definition: RAWEVENT.h:87
StatusCode initialize()
RawDataEvtHeaderCnv(ISvcLocator *svc)
StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
virtual StatusCode updateObj(IOpaqueAddress *, DataObject *)
override the RawDataBaseCnv version
static const CLID & classID()