BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
RawDataMcCnv.cxx
Go to the documentation of this file.
1//====================================================================
2// RawDataMcCnv.cxx
3//====================================================================
4//
5// Description: A converter class to unpack Event Filter packed raw
6// event persistent data and place it in the Transient
7// Data Store of Athena.
8//
9//--------------------------------------------------------------------
10
11// Include files.
12#include "GaudiKernel/MsgStream.h"
13#include "GaudiKernel/IRegistry.h"
14// for Mutil-thread by tianhl
15#include "GaudiKernel/ThreadGaudi.h"
16// for Mutil-thread by tianhl
17
18#include "McTruth/McEvent.h"
22
23
24extern const CLID& CLID_McEvent;
25
26// Constructor.
27RawDataMcCnv::RawDataMcCnv(ISvcLocator* svc) :
29{
30 //init();
31}
32
33// Return the identification number of this converter to the
34// persistency service.
36{
37 return CLID_McEvent;
38}
39
41{
42 std::string PackedRawDataCnvSvc_Name("PackedRawDataCnvSvc");
43 std::string RawDataInputSvc_Name("RawDataInputSvc");
44 std::string RawDataMcCnv_Name("RawDataMcCnv");
45
46 // for Mutil-thread by tianhl
47 //ConversionSvc* pCnvSvc = 0;
48 //if (pCnvSvc = dynamic_cast<ConversionSvc*>(conversionSvc())){
49 SmartIF<IService> pCnvSvc(conversionSvc());
50 if (isGaudiThreaded(pCnvSvc->name())){
51 PackedRawDataCnvSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
52 RawDataInputSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
53 RawDataMcCnv_Name += getGaudiThreadIDfromName(pCnvSvc->name());
54 }
55 //}
56
57
58 MsgStream log(messageService(), RawDataMcCnv_Name.c_str());
59
60 StatusCode sc = RawDataBaseCnv::initialize();
61 if (StatusCode::SUCCESS != sc) {
62 log << MSG::ERROR << "RawDataBaseCnv: Cant initialize PackedRawDataCnvSvc" << endreq;
63 return sc;
64 }
65
66 // Check RawDataCnvSvc
67 IService* isvc = 0;
68 sc = serviceLocator()->service(PackedRawDataCnvSvc_Name.c_str(), isvc, true);
69 if (sc != StatusCode::SUCCESS) {
70 log << MSG::ERROR << "Cant get PackedRawDataCnvSvc" << endreq;
71 }
72
73 m_RawDataAccess = dynamic_cast<PackedRawDataCnvSvc*> (isvc);
74 if (m_RawDataAccess == 0 ) {
75 log << MSG::ERROR << "RawDataMdcCnv: Cant cast to RawDataCnvSvc " << endreq;
76 return StatusCode::FAILURE;
77 }
78
79 sc = serviceLocator()->getService(RawDataInputSvc_Name.c_str(), isvc);
80 if (sc != StatusCode::SUCCESS ) {
81 log << MSG::WARNING << "Cant get RawDataInputSvc " << endreq;
82 return sc ;
83 }
84
85 m_inputSvc = dynamic_cast<RawDataInputSvc*> (isvc);
86 if (m_inputSvc == 0 ) {
87 log << MSG::ERROR << "Cant cast to RawDataInputSvc " << endreq;
88 return StatusCode::FAILURE ;
89 }
90
91 return StatusCode::SUCCESS;
92}
93
94
95StatusCode RawDataMcCnv::updateObj(IOpaqueAddress* pAddr, DataObject* pObj) {
96 // Purpose and Method: This method does nothing other than announce it has
97 // been called.
98
99 //MsgStream log(msgSvc(), "RawDataMcCnv");
100 //log << MSG::DEBUG << "RawDataMcCnv::updateObj" << endreq;
101 return Converter::updateObj(pAddr, pObj);
102}
103
104// Create a converted object in the Transient Data Store.
105StatusCode RawDataMcCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pObj)
106{
107 //MsgStream log(msgSvc(), "RawDataMcCnv");
108
109 McEvent *mcEvent = new McEvent;
110 pObj = mcEvent;
111
112 return StatusCode::SUCCESS;
113
114}
115
116StatusCode RawDataMcCnv::createRep(DataObject* pObj, IOpaqueAddress*& pAddr)
117{
118 // convert PixelRaw in the container into ByteStream
119 //MsgStream log(messageService(), "RawDataMcCnv");
120
121 std::string nm = pObj->registry()->name();
122
123 RawDataAddress* addr = new RawDataAddress(classID(), nm, "");
124
125 pAddr = addr;
126
127 return StatusCode::SUCCESS;
128}
129
130
unsigned const long PACKEDRAWEVENT_StorageType
Definition: ClassID_temp.h:17
const CLID & CLID_McEvent
Definition: EventModel.cxx:203
const CLID & CLID_McEvent
Definition: EventModel.cxx:203
Definition: McEvent.h:8
StatusCode initialize()
virtual StatusCode updateObj(IOpaqueAddress *, DataObject *)
override the RawDataBaseCnv version
StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
StatusCode initialize()
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr)
Convert the transient object to the requested representation.
static const CLID & classID()
RawDataMcCnv(ISvcLocator *svc)