/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Event/RootCnvSvc/RootCnvSvc-02-01-12/src/EvtRec/EvtRecCnv.cxx

Go to the documentation of this file.
00001 #include "GaudiKernel/MsgStream.h"
00002 
00003 #include "EventModel/EventModel.h"
00004 #include "EvtRecEvent/EvtRecObject.h"
00005 #include "RootEventData/TEvtRecObject.h"
00006 
00007 #include "RootCnvSvc/RootAddress.h"
00008 #include "RootCnvSvc/EvtRec/EvtRecCnv.h"
00009 
00010 TEvtRecObject* EvtRecCnv::m_objWrite = 0;
00011 
00012 EvtRecCnv::EvtRecCnv(ISvcLocator* svc)
00013    : RootEventBaseCnv(classID(), svc)
00014 {
00015    m_rootBranchname = "";
00016 }
00017 
00018 StatusCode EvtRecCnv::initialize() {
00019    StatusCode status = RootEventBaseCnv::initialize();
00020 
00021    m_cnvSvc->setEvtRecCnv(this);
00022 
00023    return status;
00024 }
00025 
00026 StatusCode EvtRecCnv::TObjectToDataObject(DataObject*& refpObject) {
00027    MsgStream log(msgSvc(), "EvtRecCnv");
00028    log << MSG::DEBUG << "EvtRecCnv::TObjectToDataObject" << endreq;
00029 
00030    // create the TDS location for the EvtRecObject
00031    EvtRecObject* evtRecObject = new EvtRecObject;
00032    refpObject = evtRecObject;
00033 
00034    return StatusCode::SUCCESS;
00035 }
00036 
00037 StatusCode EvtRecCnv::DataObjectToTObject(DataObject* obj, RootAddress* rootaddr) {
00038 
00039    MsgStream log(msgSvc(), "EvtRecCnv");
00040    log << MSG::DEBUG << "EvtRecCnv::DataObjectToTObject" << endreq;
00041 
00042    if ( m_common.m_evtRecObject != NULL ) return StatusCode::SUCCESS;
00043 
00044    EvtRecObject* evtRecObject = dynamic_cast<EvtRecObject*> (obj);
00045    if ( ! evtRecObject ) {
00046       log << MSG::ERROR << "Could not downcast to EvtRecObject" << endreq;
00047       return StatusCode::FAILURE;
00048    }
00049 
00050    m_objWrite = new TEvtRecObject();
00051    m_common.m_evtRecObject = m_objWrite;
00052 
00053    // create branch if not yet done
00054    if ( m_branchNrEvtRec < 0 ) {
00055       StatusCode sc = m_rootInterface->createBranch(rootaddr->getTreename(),"TEvtRecObject",m_objWrite->ClassName(),&m_objWrite,m_branchNrEvtRec);
00056 
00057       if ( sc.isFailure() ) {
00058         cout<<"Could not create branch TEvtRecObject"<<endl;
00059         log << MSG::ERROR << "Could not create branch TEvtRecObject" << endreq;
00060         return sc;
00061       }
00062    }
00063 
00064    m_objWrite->initialize();
00065 
00066    return StatusCode::SUCCESS;
00067 }

Generated on Tue Nov 29 22:58:41 2016 for BOSS_7.0.2 by  doxygen 1.4.7