BOSS 7.0.6
BESIII Offline Software System
Loading...
Searching...
No Matches
RawDataLumiDigiCnv.cxx
Go to the documentation of this file.
1// Include files.
2#include "GaudiKernel/MsgStream.h"
3#include "GaudiKernel/IDataProviderSvc.h"
4// for Mutil-thread by tianhl
5#include "GaudiKernel/ThreadGaudi.h"
6// for Mutil-thread by tianhl
7
9#include "LumiDigi/LumiDigi.h"
12
13
14// REMOVE THIS LINE AFTER "PACKEDRAWEVENT_StorageType" IS ADDED TO
15// THE FILE "GaudiKernel/ClassID.h"
16extern const CLID& CLID_LumiDigiCol;
17
18// Constructor.
21{
22}
23
25{
26}
27
28// Return the identification number of this converter to the
29// persistency service.
31{
32 return CLID_LumiDigiCol;
33}
34
36{
37
38 std::string PackedRawDataCnvSvc_Name("PackedRawDataCnvSvc");
39 std::string RawDataInputSvc_Name("RawDataInputSvc");
40 std::string RawDataLumiDigiCnv_Name("RawDataLumiDigiCnv");
41
42 // for Mutil-thread by tianhl
43 //ConversionSvc* pCnvSvc = 0;
44 //if (pCnvSvc = dynamic_cast<ConversionSvc*>(conversionSvc())){
45 SmartIF<IService> pCnvSvc(conversionSvc());
46 if (isGaudiThreaded(pCnvSvc->name())){
47 PackedRawDataCnvSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
48 RawDataInputSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
49 RawDataLumiDigiCnv_Name += getGaudiThreadIDfromName(pCnvSvc->name());
50 }
51 //}
52
53 StatusCode sc = RawDataBaseCnv::initialize();
54 if(StatusCode::SUCCESS!=sc)
55 {
56 return sc;
57 }
58
59 MsgStream log(messageService(), RawDataLumiDigiCnv_Name.c_str());
60
61 // Check RawDataCnvSvc
62 IService* isvc = 0;
63 StatusCode status = serviceLocator()->service(PackedRawDataCnvSvc_Name.c_str(), isvc, true);
64
65 m_RawDataAccess = dynamic_cast<PackedRawDataCnvSvc*> (isvc);
66 if(m_RawDataAccess == 0 ) {
67 log<<MSG::ERROR<< " RawDataLumiCnv: Cant cast to RawDataCnvSvc " <<endreq;
68 return StatusCode::FAILURE ;
69 }
70
71 if(m_RawDataAccess)
72 log << MSG::INFO << "RawDataCnvSvc retrieved "<< endreq;
73
74 IService* svc ;
75 sc = serviceLocator()->getService(RawDataInputSvc_Name.c_str(), svc);
76 if(sc != StatusCode::SUCCESS ) {
77 log<<MSG::WARNING << " Cant get RawDataInputSvc " <<endreq;
78 return sc ;
79 }
80
81 m_inputSvc = dynamic_cast<RawDataInputSvc*> (svc);
82 if(m_inputSvc == 0 ) {
83 log<<MSG::WARNING<< " Cant cast to RawDataInputSvc " <<endreq;
84 return StatusCode::FAILURE ;
85 }
86
87 return StatusCode::SUCCESS;
88}
89
90
91StatusCode RawDataLumiDigiCnv::updateObj(IOpaqueAddress* pAddr, DataObject* pObj) {
92 // Purpose and Method: This method does nothing other than announce it has
93 // been called.
94
95 //MsgStream log(msgSvc(), "RawDataLumiDigiCnv");
96 //log << MSG::DEBUG << "RawDataLumiDigiCnv::updateObj" << endreq;
97 return Converter::updateObj(pAddr, pObj);
98}
99
100// Create a converted object in the Transient Data Store.
101StatusCode RawDataLumiDigiCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pObj)
102{
103 DataObject* pLumi;
104 dataProvider()->findObject("/Event/Digi/LumiDigiCol", pLumi);
105
106 if ( pLumi == NULL ) {
107 LumiDigiCol* lumiDigiCol = new LumiDigiCol;
108 dataProvider()->registerObject("/Event/Digi/LumiDigiCol", lumiDigiCol);
109 pObj = lumiDigiCol;
110 }
111 else {
112 pObj = pLumi;
113 }
114
115 return StatusCode::SUCCESS;
116}
117
118StatusCode RawDataLumiDigiCnv::createRep(DataObject* pObj, IOpaqueAddress*& pAddr)
119{
120 return StatusCode::SUCCESS;
121}
unsigned const long PACKEDRAWEVENT_StorageType
Definition: ClassID_temp.h:17
const CLID & CLID_LumiDigiCol
Definition: EventModel.cxx:247
ObjectVector< LumiDigi > LumiDigiCol
Definition: LumiDigi.h:36
const CLID & CLID_LumiDigiCol
Definition: EventModel.cxx:247
StatusCode initialize()
static const CLID & classID()
StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
virtual StatusCode updateObj(IOpaqueAddress *, DataObject *)
override the RawDataBaseCnv version
RawDataLumiDigiCnv(ISvcLocator *svc)
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr)
Convert the transient object to the requested representation.