BOSS 7.0.7
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtRecEventCnv Class Reference

#include <EvtRecEventCnv.h>

+ Inheritance diagram for EvtRecEventCnv:

Public Member Functions

virtual ~EvtRecEventCnv ()
 
- Public Member Functions inherited from RootEventBaseCnv
 RootEventBaseCnv (const CLID &clid, ISvcLocator *svc)
 
virtual ~RootEventBaseCnv ()
 
virtual long repSvcType () const
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
void declareObject (const std::string &fullPath, const CLID &clid, const std::string &treename, const std::string &branchname)
 Store TDS path to link a particular converter to an object on the TDS.
 
virtual StatusCode createObj (IOpaqueAddress *addr, DataObject *&dat)
 Convert the persistent object to transient.
 
virtual StatusCode createRep (DataObject *pObject, IOpaqueAddress *&refpAddress)
 Convert the transient object to the requested representation.
 
virtual StatusCode fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the converted object.
 
virtual StatusCode fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the converted object.
 
virtual StatusCode DataObjectToTObject (DataObject *dat, RootAddress *addr)=0
 Do the concrete conversion from TDS to ROOT.
 
virtual StatusCode TObjectToDataObject (DataObject *&dat)=0
 Do the concrete conversion from ROOT to TDS.
 
TObject * getReadObject () const
 get the object to be read
 
- Public Member Functions inherited from Converter< Ty1, Ty2 >
destinationoperator (const source &) const
 

Static Public Member Functions

static const CLID & classID ()
 
- Static Public Member Functions inherited from RootEventBaseCnv
static const unsigned char storageType ()
 Storage type and class ID.
 

Protected Member Functions

 EvtRecEventCnv (ISvcLocator *svc)
 
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
 
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
 
- Protected Member Functions inherited from Converter< Ty1, Ty2 >
virtual destinationconvert (const source &) const =0
 

Friends

class CnvFactory< EvtRecEventCnv >
 

Additional Inherited Members

- Public Types inherited from Converter< Ty1, Ty2 >
typedef Ty1 source
 
typedef Ty2 destination
 
- Protected Attributes inherited from RootEventBaseCnv
RootCnvSvcm_cnvSvc
 
std::vector< RootCnvSvc::Leafm_leaves
 
RootInterfacem_rootInterface
 pointer to the RootInterface
 
IDataProviderSvc * m_eds
 pointer to eventdataservice
 
int m_branchNr
 the branchNr of this converter for writing
 
int m_branchNrDst
 
int m_branchNrMc
 
int m_branchNrRecon
 
int m_branchNrEvtRec
 
int m_branchNrEvtHeader
 
int m_branchNrEvtNavigator
 
TObject * m_objRead
 the object that was read
 
CLID CLID_top
 the CLID of the upper converter if any
 
TArrayS * m_branchNumbers
 array with number of branches for reading
 
std::string m_rootBranchname
 root branchname (may be concatenated of severals)
 
std::string m_rootTreename
 each converter knows it's treename
 
std::string m_currentFileName
 
std::vector< void * > m_adresses
 each converter knows the corresponding adresses
 
RootEvtSelectorm_evtsel
 

Detailed Description

Definition at line 15 of file EvtRecEventCnv.h.

Constructor & Destructor Documentation

◆ ~EvtRecEventCnv()

virtual EvtRecEventCnv::~EvtRecEventCnv ( )
inlinevirtual

Definition at line 22 of file EvtRecEventCnv.h.

22{}

◆ EvtRecEventCnv()

EvtRecEventCnv::EvtRecEventCnv ( ISvcLocator *  svc)
protected

Definition at line 10 of file EvtRecEventCnv.cxx.

12{
13 m_rootBranchname = "m_evtRecEvent";
14 m_adresses.push_back(&m_evtRecEvent);
15 m_evtRecEvent = 0;
16}
static const CLID & classID()
Base class for all Root Converters.
std::vector< void * > m_adresses
each converter knows the corresponding adresses
std::string m_rootBranchname
root branchname (may be concatenated of severals)

Member Function Documentation

◆ classID()

static const CLID & EvtRecEventCnv::classID ( )
inlinestatic

Definition at line 20 of file EvtRecEventCnv.h.

20{ return CLID_EvtRecEvent; }
const CLID & CLID_EvtRecEvent
Definition: EventModel.cxx:372

◆ DataObjectToTObject()

StatusCode EvtRecEventCnv::DataObjectToTObject ( DataObject *  obj,
RootAddress addr 
)
protectedvirtual

transformation to root

Implements RootEventBaseCnv.

Definition at line 40 of file EvtRecEventCnv.cxx.

40 {
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
int numberOfVee() const
Definition: EvtRecEvent.h:30
int numberOfPi0() const
Definition: EvtRecEvent.h:33
int totalTracks() const
Definition: EvtRecEvent.h:21
int totalNeutral() const
Definition: EvtRecEvent.h:27
int totalCharged() const
Definition: EvtRecEvent.h:24
EvtRecCnv * getEvtRecCnv()
Definition: RootCnvSvc.h:159
RootCnvSvc * m_cnvSvc
IDataProviderSvc * m_eds
pointer to eventdataservice
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
void setNumberOfVee(const int nvee)
Definition: TEvtRecEvent.h:31
void setTotalCharged(const int nchrg)
Definition: TEvtRecEvent.h:29
void setNumberOfPi0(const int npi0)
Definition: TEvtRecEvent.h:32
void setTotalNeutral(const int nneu)
Definition: TEvtRecEvent.h:30
void setTotalTracks(const int tottks)
Definition: TEvtRecEvent.h:28
const TEvtRecEvent * getEvtRecEvent() const
Definition: TEvtRecObject.h:29
_EXTERN_ std::string Event
Definition: EventModel.h:115

◆ TObjectToDataObject()

StatusCode EvtRecEventCnv::TObjectToDataObject ( DataObject *&  obj)
protectedvirtual

transformation from root

Implements RootEventBaseCnv.

Definition at line 18 of file EvtRecEventCnv.cxx.

18 {
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}
void setTotalTracks(const int tottks)
Definition: EvtRecEvent.h:22
void setNumberOfPi0(const int npi0)
Definition: EvtRecEvent.h:34
void setNumberOfVee(const int nvee)
Definition: EvtRecEvent.h:31
void setTotalNeutral(const int nneu)
Definition: EvtRecEvent.h:28
void setTotalCharged(const int nchrg)
Definition: EvtRecEvent.h:25
Int_t numberOfPi0() const
Definition: TEvtRecEvent.h:24
Int_t totalNeutral() const
Definition: TEvtRecEvent.h:22
Int_t totalCharged() const
Definition: TEvtRecEvent.h:21
Int_t totalTracks() const
Definition: TEvtRecEvent.h:20
Int_t numberOfVee() const
Definition: TEvtRecEvent.h:23

Friends And Related Function Documentation

◆ CnvFactory< EvtRecEventCnv >

friend class CnvFactory< EvtRecEventCnv >
friend

Definition at line 10 of file EvtRecEventCnv.h.


The documentation for this class was generated from the following files: