CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
RawDataDigiCnv.cxx
Go to the documentation of this file.
1//====================================================================
2// RawDataDigiCnv.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/StatusCode.h"
14#include "GaudiKernel/IRegistry.h"
15#include "GaudiKernel/Converter.h"
16// for Mutil-thread by tianhl
17#include "GaudiKernel/ThreadGaudi.h"
18// for Mutil-thread by tianhl
19
20#include "RawEvent/DigiEvent.h"
26
27
28extern const CLID& CLID_DigiEvent;
29
30// Constructor.
33{
34 //init();
35}
36
37// Return the identification number of this converter to the
38// persistency service.
40{
41 return CLID_DigiEvent;
42}
43
45{
46 std::string PackedRawDataCnvSvc_Name("PackedRawDataCnvSvc");
47 std::string RawDataInputSvc_Name("RawDataInputSvc");
48 std::string RawDataDigiCnv_Name("RawDataDigiCnv");
49
50 // for Mutil-thread by tianhl
51 //ConversionSvc* pCnvSvc = 0;
52 SmartIF<IService> pCnvSvc(conversionSvc());
53 //if (pCnvSvc = dynamic_cast<ConversionSvc*>(conversionSvc())){
54 if (isGaudiThreaded(pCnvSvc->name())){
55 PackedRawDataCnvSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
56 RawDataInputSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
57 RawDataDigiCnv_Name += getGaudiThreadIDfromName(pCnvSvc->name());
58 }
59 //}
60 // for Mutil-thread by tianhl
61 StatusCode sc = RawDataBaseCnv::initialize();
62 if(StatusCode::SUCCESS!=sc)
63 {
64 return sc;
65 }
66
67 MsgStream log(messageService(), RawDataDigiCnv_Name.c_str());
68
69 IService* svc = 0;
70 sc = serviceLocator()->service(PackedRawDataCnvSvc_Name.c_str(), svc);
71 if (sc != StatusCode::SUCCESS) {
72 log << MSG::ERROR << "Can't get RawDataAccess interface" << endreq;
73 return StatusCode::FAILURE;
74 }
75
76 m_RawDataAccess = dynamic_cast<PackedRawDataCnvSvc*> (svc);
77 if (m_RawDataAccess == 0 ) {
78 log << MSG::ERROR << "RawDataCnv: Cant cast to RawDataCnvSvc" << endreq;
79 return StatusCode::FAILURE;
80 }
81
82 sc = serviceLocator()->getService(RawDataInputSvc_Name.c_str(), svc);
83 if(sc != StatusCode::SUCCESS ) {
84 log << MSG::WARNING << "Cant get RawDataInputSvc " << endreq;
85 return sc ;
86 }
87
88 m_inputSvc = dynamic_cast<RawDataInputSvc*> (svc);
89 if(m_inputSvc == 0 ) {
90 log << MSG::ERROR << "Cant cast to RawDataInputSvc" << endreq;
91 return StatusCode::FAILURE ;
92 }
93
94 return StatusCode::SUCCESS;
95}
96
97
98StatusCode RawDataDigiCnv::updateObj(IOpaqueAddress* pAddr, DataObject* pObj) {
99 // Purpose and Method: This method does nothing other than announce it has
100 // been called.
101
102 //MsgStream log(msgSvc(), "RawDataDigiCnv");
103 //log << MSG::DEBUG << "RawDataDigiCnv::updateObj" << endreq;
104 return Converter::updateObj(pAddr, pObj);
105}
106
107// Create a converted object in the Transient Data Store.
108StatusCode RawDataDigiCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pObj)
109{
110 MsgStream log(msgSvc(), "RawDataDigiCnv");
111 //RawDataAddress *pEFAddr;
112
113 // Purpose and Method: This converter will create an empty EventHeader on
114 // the TDS.
115 DigiEvent *digi = new DigiEvent();
116 // Set fromMc to false
117 digi->initialize(false);
118 pObj = digi;
119 return StatusCode::SUCCESS;
120
121}
122
123StatusCode RawDataDigiCnv::createRep(DataObject* pObj, IOpaqueAddress*& pAddr)
124{
125 // convert Raws in the container into ByteStream
126 StatusCode sc = StatusCode::SUCCESS ;
127 //MsgStream log(messageService(), "RawDataDigiCnv");
128
129 //WriteRawEvent* re = static_cast<WriteRawEvent*>(m_RawDataAccess->getRawEvent());
130
131
132 std::string nm = pObj->registry()->name();
133
134 RawDataAddress* addr = new RawDataAddress(classID(), nm, "");
135
136 pAddr = addr;
137
138 return StatusCode::SUCCESS;
139
140}
141
142
unsigned const long PACKEDRAWEVENT_StorageType
const CLID & CLID_DigiEvent
Raw event and Digi IDs.
const CLID & CLID_DigiEvent
Raw event and Digi IDs.
IMessageSvc * msgSvc()
void initialize(bool fromMc)
Definition DigiEvent.h:30
StatusCode initialize()
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr)
Convert the transient object to the requested representation.
StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
virtual StatusCode updateObj(IOpaqueAddress *, DataObject *)
override the RawDataBaseCnv version
RawDataDigiCnv(ISvcLocator *svc)
static const CLID & classID()
StatusCode initialize()