/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Event/RootCnvSvc/RootCnvSvc-02-01-12/src/EvtRec/EvtRecEventCnv.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 "EvtRecEvent/EvtRecEvent.h"
00006 #include "RootCnvSvc/RootAddress.h"
00007 #include "RootCnvSvc/EvtRec/EvtRecCnv.h"
00008 #include "RootCnvSvc/EvtRec/EvtRecEventCnv.h"
00009 
00010 EvtRecEventCnv::EvtRecEventCnv(ISvcLocator* svc)
00011    : RootEventBaseCnv(classID(), svc)
00012 {
00013    m_rootBranchname = "m_evtRecEvent";
00014    m_adresses.push_back(&m_evtRecEvent);
00015    m_evtRecEvent = 0;
00016 }
00017 
00018 StatusCode EvtRecEventCnv::TObjectToDataObject(DataObject*& refpObject) {
00019    MsgStream log(msgSvc(), "EvtRecEventCnv");
00020    log << MSG::DEBUG << "EvtRecEventCnv::TObjectToDataObject" << endreq;
00021 
00022    // create the TDS location for the EvtRecEvent
00023    EvtRecEvent* evtRecEvent = new EvtRecEvent;
00024    refpObject = evtRecEvent;
00025 
00026    if ( ! m_evtRecEvent ) return StatusCode::SUCCESS;
00027    // convert
00028    evtRecEvent->setTotalTracks ( m_evtRecEvent->totalTracks() );
00029    evtRecEvent->setTotalCharged( m_evtRecEvent->totalCharged() );
00030    evtRecEvent->setTotalNeutral( m_evtRecEvent->totalNeutral() );
00031    evtRecEvent->setNumberOfVee ( m_evtRecEvent->numberOfVee() );
00032    evtRecEvent->setNumberOfPi0 ( m_evtRecEvent->numberOfPi0() );
00033 
00034    delete m_evtRecEvent;
00035    m_evtRecEvent = 0;
00036 
00037    return StatusCode::SUCCESS;
00038 }
00039 
00040 StatusCode EvtRecEventCnv::DataObjectToTObject(DataObject* obj, RootAddress* rootaddr) {
00041 
00042    MsgStream log(msgSvc(), "EvtRecEventCnv");
00043    log << MSG::DEBUG << "EvtRecEventCnv::DataObjectToTObject" << endreq;
00044 
00045    EvtRecEvent* evtRecEvent = dynamic_cast<EvtRecEvent*> (obj);
00046    if ( ! evtRecEvent ) {
00047       log << MSG::ERROR << "Could not downcast to EvtRecEvent" << endreq;
00048       return StatusCode::FAILURE;
00049    }
00050 
00051    DataObject* evt = NULL;
00052    StatusCode sc = m_eds->findObject(EventModel::EvtRec::Event, evt);
00053    if ( sc.isFailure() ) {
00054       log << MSG::ERROR << "Could not get EvtRecObject in TDS" << endreq;
00055       return StatusCode::FAILURE;
00056    }
00057 
00058    EvtRecObject* devtTds = dynamic_cast<EvtRecObject*> (evt);
00059    if ( ! devtTds ) {
00060       log << MSG::ERROR << "EvtRecEventCnv: Could not downcast to TDS EvtRecObject" << endreq;
00061    }
00062 
00063    IOpaqueAddress* addr;
00064    m_cnvSvc->getEvtRecCnv()->createRep(evt, addr);
00065    TEvtRecObject* recEvt = m_cnvSvc->getEvtRecCnv()->getWriteObject();
00066 
00067    TEvtRecEvent* m_evtRecEvent = const_cast<TEvtRecEvent*>( recEvt->getEvtRecEvent() );
00068 
00069    m_evtRecEvent->setTotalTracks ( evtRecEvent->totalTracks() );
00070    m_evtRecEvent->setTotalCharged( evtRecEvent->totalCharged() );
00071    m_evtRecEvent->setTotalNeutral( evtRecEvent->totalNeutral() );
00072    m_evtRecEvent->setNumberOfVee ( evtRecEvent->numberOfVee() );
00073    m_evtRecEvent->setNumberOfPi0 ( evtRecEvent->numberOfPi0() );
00074 
00075    return StatusCode::SUCCESS;
00076 }

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