BOSS 7.0.6
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtRecEventCnv.cxx
Go to the documentation of this file.
1#include "GaudiKernel/MsgStream.h"
2
9
11 : RootEventBaseCnv(classID(), svc)
12{
13 m_rootBranchname = "m_evtRecEvent";
14 m_adresses.push_back(&m_evtRecEvent);
15 m_evtRecEvent = 0;
16}
17
18StatusCode EvtRecEventCnv::TObjectToDataObject(DataObject*& refpObject) {
19 MsgStream log(msgSvc(), "EvtRecEventCnv");
20 log << MSG::DEBUG << "EvtRecEventCnv::TObjectToDataObject" << endreq;
21
22 // create the TDS location for the EvtRecEvent
23 EvtRecEvent* evtRecEvent = new EvtRecEvent;
24 refpObject = evtRecEvent;
25
26 if ( ! m_evtRecEvent ) return StatusCode::SUCCESS;
27 // convert
28 evtRecEvent->setTotalTracks ( m_evtRecEvent->totalTracks() );
29 evtRecEvent->setTotalCharged( m_evtRecEvent->totalCharged() );
30 evtRecEvent->setTotalNeutral( m_evtRecEvent->totalNeutral() );
31 evtRecEvent->setNumberOfVee ( m_evtRecEvent->numberOfVee() );
32 evtRecEvent->setNumberOfPi0 ( m_evtRecEvent->numberOfPi0() );
33
34 delete m_evtRecEvent;
35 m_evtRecEvent = 0;
36
37 return StatusCode::SUCCESS;
38}
39
40StatusCode EvtRecEventCnv::DataObjectToTObject(DataObject* obj, RootAddress* rootaddr) {
41
42 MsgStream log(msgSvc(), "EvtRecEventCnv");
43 log << MSG::DEBUG << "EvtRecEventCnv::DataObjectToTObject" << endreq;
44
45 EvtRecEvent* evtRecEvent = dynamic_cast<EvtRecEvent*> (obj);
46 if ( ! evtRecEvent ) {
47 log << MSG::ERROR << "Could not downcast to EvtRecEvent" << endreq;
48 return StatusCode::FAILURE;
49 }
50
51 DataObject* evt = NULL;
52 StatusCode sc = m_eds->findObject(EventModel::EvtRec::Event, evt);
53 if ( sc.isFailure() ) {
54 log << MSG::ERROR << "Could not get EvtRecObject in TDS" << endreq;
55 return StatusCode::FAILURE;
56 }
57
58 EvtRecObject* devtTds = dynamic_cast<EvtRecObject*> (evt);
59 if ( ! devtTds ) {
60 log << MSG::ERROR << "EvtRecEventCnv: Could not downcast to TDS EvtRecObject" << endreq;
61 }
62
63 IOpaqueAddress* addr;
64 m_cnvSvc->getEvtRecCnv()->createRep(evt, addr);
66
67 TEvtRecEvent* m_evtRecEvent = const_cast<TEvtRecEvent*>( recEvt->getEvtRecEvent() );
68
69 m_evtRecEvent->setTotalTracks ( evtRecEvent->totalTracks() );
70 m_evtRecEvent->setTotalCharged( evtRecEvent->totalCharged() );
71 m_evtRecEvent->setTotalNeutral( evtRecEvent->totalNeutral() );
72 m_evtRecEvent->setNumberOfVee ( evtRecEvent->numberOfVee() );
73 m_evtRecEvent->setNumberOfPi0 ( evtRecEvent->numberOfPi0() );
74
75 return StatusCode::SUCCESS;
76}
IMessageSvc * msgSvc()
static TEvtRecObject * getWriteObject()
Definition: EvtRecCnv.h:26
EvtRecEventCnv(ISvcLocator *svc)
virtual StatusCode TObjectToDataObject(DataObject *&obj)
transformation from root
virtual StatusCode DataObjectToTObject(DataObject *obj, RootAddress *addr)
transformation to root
void setTotalTracks(const int tottks)
Definition: EvtRecEvent.h:22
void setNumberOfPi0(const int npi0)
Definition: EvtRecEvent.h:34
int numberOfVee() const
Definition: EvtRecEvent.h:30
void setNumberOfVee(const int nvee)
Definition: EvtRecEvent.h:31
void setTotalNeutral(const int nneu)
Definition: EvtRecEvent.h:28
int numberOfPi0() const
Definition: EvtRecEvent.h:33
int totalTracks() const
Definition: EvtRecEvent.h:21
void setTotalCharged(const int nchrg)
Definition: EvtRecEvent.h:25
int totalNeutral() const
Definition: EvtRecEvent.h:27
int totalCharged() const
Definition: EvtRecEvent.h:24
Definition of a Root address, derived from IOpaqueAddress.
Definition: RootAddress.h:21
EvtRecCnv * getEvtRecCnv()
Definition: RootCnvSvc.h:159
Base class for all Root Converters.
std::vector< void * > m_adresses
each converter knows the corresponding adresses
RootCnvSvc * m_cnvSvc
IDataProviderSvc * m_eds
pointer to eventdataservice
std::string m_rootBranchname
root branchname (may be concatenated of severals)
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
Int_t numberOfPi0() const
Definition: TEvtRecEvent.h:24
Int_t totalNeutral() const
Definition: TEvtRecEvent.h:22
void setNumberOfVee(const int nvee)
Definition: TEvtRecEvent.h:31
void setTotalCharged(const int nchrg)
Definition: TEvtRecEvent.h:29
Int_t totalCharged() const
Definition: TEvtRecEvent.h:21
void setNumberOfPi0(const int npi0)
Definition: TEvtRecEvent.h:32
Int_t totalTracks() const
Definition: TEvtRecEvent.h:20
void setTotalNeutral(const int nneu)
Definition: TEvtRecEvent.h:30
void setTotalTracks(const int tottks)
Definition: TEvtRecEvent.h:28
Int_t numberOfVee() const
Definition: TEvtRecEvent.h:23
const TEvtRecEvent * getEvtRecEvent() const
Definition: TEvtRecObject.h:29
_EXTERN_ std::string Event
Definition: EventModel.h:115