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