BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtRecCnv.cxx
Go to the documentation of this file.
1#include "GaudiKernel/MsgStream.h"
2
6
9
10TEvtRecObject* EvtRecCnv::m_objWrite = 0;
11
12EvtRecCnv::EvtRecCnv(ISvcLocator* svc)
13 : RootEventBaseCnv(classID(), svc)
14{
16}
17
19 StatusCode status = RootEventBaseCnv::initialize();
20
22
23 return status;
24}
25
26StatusCode EvtRecCnv::TObjectToDataObject(DataObject*& refpObject) {
27 MsgStream log(msgSvc(), "EvtRecCnv");
28 log << MSG::DEBUG << "EvtRecCnv::TObjectToDataObject" << endreq;
29
30 // create the TDS location for the EvtRecObject
31 EvtRecObject* evtRecObject = new EvtRecObject;
32 refpObject = evtRecObject;
33
34 return StatusCode::SUCCESS;
35}
36
37StatusCode EvtRecCnv::DataObjectToTObject(DataObject* obj, RootAddress* rootaddr) {
38
39 MsgStream log(msgSvc(), "EvtRecCnv");
40 log << MSG::DEBUG << "EvtRecCnv::DataObjectToTObject" << endreq;
41
42 if ( m_common.m_evtRecObject != NULL ) return StatusCode::SUCCESS;
43
44 EvtRecObject* evtRecObject = dynamic_cast<EvtRecObject*> (obj);
45 if ( ! evtRecObject ) {
46 log << MSG::ERROR << "Could not downcast to EvtRecObject" << endreq;
47 return StatusCode::FAILURE;
48 }
49
50 m_objWrite = new TEvtRecObject();
51 m_common.m_evtRecObject = m_objWrite;
52
53 // create branch if not yet done
54 if ( m_branchNrEvtRec < 0 ) {
55 StatusCode sc = m_rootInterface->createBranch(rootaddr->getTreename(),"TEvtRecObject",m_objWrite->ClassName(),&m_objWrite,m_branchNrEvtRec);
56
57 if ( sc.isFailure() ) {
58 cout<<"Could not create branch TEvtRecObject"<<endl;
59 log << MSG::ERROR << "Could not create branch TEvtRecObject" << endreq;
60 return sc;
61 }
62 }
63
64 m_objWrite->initialize();
65
66 return StatusCode::SUCCESS;
67}
IMessageSvc * msgSvc()
#define NULL
virtual StatusCode initialize()
Definition EvtRecCnv.cxx:18
virtual StatusCode DataObjectToTObject(DataObject *obj, RootAddress *addr)
transformation to root
Definition EvtRecCnv.cxx:37
virtual StatusCode TObjectToDataObject(DataObject *&obj)
transformation from root
Definition EvtRecCnv.cxx:26
EvtRecCnv(ISvcLocator *svc)
Definition EvtRecCnv.cxx:12
Definition of a Root address, derived from IOpaqueAddress.
Definition RootAddress.h:21
std::string getTreename() const
Definition RootAddress.h:27
void setEvtRecCnv(EvtRecCnv *evtreccnv)
Definition RootCnvSvc.h:166
Base class for all Root Converters.
RootCnvSvc * m_cnvSvc
virtual StatusCode initialize()
RootInterface * m_rootInterface
pointer to the RootInterface
std::string m_rootBranchname
root branchname (may be concatenated of severals)
virtual StatusCode createBranch(const std::string &tree, const std::string &branch, const char *classname, void *addr, int &branchnr)
create a branch in this tree
static TEvtRecObject * m_evtRecObject
Definition commonData.h:266