CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
McCnv Class Reference

Concrete converter for the Mc branch. More...

#include <McCnv.h>

+ Inheritance diagram for McCnv:

Public Member Functions

virtual ~McCnv ()
 
virtual StatusCode initialize ()
 
virtual ~McCnv ()
 
virtual StatusCode initialize ()
 
virtual ~McCnv ()
 
virtual StatusCode initialize ()
 
- 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
 
 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
 
 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
 
destinationoperator (const source &) const
 

Static Public Member Functions

static const CLID & classID ()
 
static TMcEventgetWriteObject ()
 returns object to be written (maintained here for all DIGI-converters)
 
static const CLID & classID ()
 
static TMcEventgetWriteObject ()
 returns object to be written (maintained here for all DIGI-converters)
 
static const CLID & classID ()
 
static TMcEventgetWriteObject ()
 returns object to be written (maintained here for all DIGI-converters)
 
- Static Public Member Functions inherited from RootEventBaseCnv
static const unsigned char storageType ()
 Storage type and class ID.
 
static const unsigned char storageType ()
 Storage type and class ID.
 
static const unsigned char storageType ()
 Storage type and class ID.
 

Protected Member Functions

 McCnv (ISvcLocator *svc)
 
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation from TDS object to ROOT
 
virtual StatusCode TObjectToDataObject (DataObject *&refpObject)
 do the transformation from ROOT to TDS object
 
 McCnv (ISvcLocator *svc)
 
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation from TDS object to ROOT
 
virtual StatusCode TObjectToDataObject (DataObject *&refpObject)
 do the transformation from ROOT to TDS object
 
 McCnv (ISvcLocator *svc)
 
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation from TDS object to ROOT
 
virtual StatusCode TObjectToDataObject (DataObject *&refpObject)
 do the transformation from ROOT to TDS object
 
- Protected Member Functions inherited from Converter< Ty1, Ty2 >
virtual destinationconvert (const source &) const =0
 
virtual destinationconvert (const source &) const =0
 

Friends

class CnvFactory< McCnv >
 

Additional Inherited Members

- Public Types inherited from Converter< Ty1, Ty2 >
typedef Ty1 source
 
typedef Ty2 destination
 
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

Concrete converter for the Mc branch.

Based on the McCnv of GLAST.

Definition at line 20 of file Event/RootCnvSvc/bak_RootCnvSvc-04-01-14/RootCnvSvc/Mc/McCnv.h.

Constructor & Destructor Documentation

◆ ~McCnv() [1/3]

virtual McCnv::~McCnv ( )
inlinevirtual

◆ McCnv() [1/3]

McCnv::McCnv ( ISvcLocator *  svc)
protected

Definition at line 27 of file bak_RootCnvSvc-04-01-14/src/Mc/McCnv.cxx.

29{
30 // Here we associate this converter with the path on the TDS.
31 //declareObject(EventModel::MC::Event, objType(), m_rootTreename, m_rootBranchname);
32
33 //m_objWrite=0;
34}

◆ ~McCnv() [2/3]

virtual McCnv::~McCnv ( )
inlinevirtual

◆ McCnv() [2/3]

McCnv::McCnv ( ISvcLocator *  svc)
protected

◆ ~McCnv() [3/3]

virtual McCnv::~McCnv ( )
inlinevirtual

Definition at line 30 of file InstallArea/include/RootCnvSvc/RootCnvSvc/Mc/McCnv.h.

30{ };

◆ McCnv() [3/3]

McCnv::McCnv ( ISvcLocator *  svc)
protected

Member Function Documentation

◆ classID() [1/3]

static const CLID & McCnv::classID ( )
inlinestatic

Definition at line 25 of file Event/RootCnvSvc/bak_RootCnvSvc-04-01-14/RootCnvSvc/Mc/McCnv.h.

26 {
27 return CLID_McEvent;
28 }
const CLID & CLID_McEvent
Definition: EventModel.cxx:224

◆ classID() [2/3]

static const CLID & McCnv::classID ( )
inlinestatic

Definition at line 25 of file Event/RootCnvSvc/RootCnvSvc-04-01-15/RootCnvSvc/Mc/McCnv.h.

26 {
27 return CLID_McEvent;
28 }

◆ classID() [3/3]

static const CLID & McCnv::classID ( )
inlinestatic

Definition at line 25 of file InstallArea/include/RootCnvSvc/RootCnvSvc/Mc/McCnv.h.

26 {
27 return CLID_McEvent;
28 }

◆ DataObjectToTObject() [1/3]

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

transformation from TDS object to ROOT

Implements RootEventBaseCnv.

Definition at line 69 of file bak_RootCnvSvc-04-01-14/src/Mc/McCnv.cxx.

69 {
70 // transforms TDS event to Mc event in root format
71 MsgStream log(msgSvc(), "McCnv");
72 log << MSG::DEBUG << "McCnv::DataObjectToTObject" << endreq;
73
74 // test if already done for this event
75 //zoujh: if (m_objWrite && (m_objWrite->getRunId()!=0 || m_objWrite->getEventId()!=0)) return StatusCode::SUCCESS;
76 if (m_common.m_mcEvt != NULL) return StatusCode::SUCCESS;
77
78/*
79 SmartDataPtr<Event::EventHeader> evtTds(m_eds, EventModel::EventHeader);
80
81 if (!evtTds) {
82 log << MSG::ERROR << "Failed to retrieve EventHeader in TDS" << endreq;
83 return StatusCode::FAILURE;
84 }
85 */
86 McEvent * devtTds=dynamic_cast<McEvent *> (obj);
87 if (!devtTds) {
88 log << MSG::ERROR << "Could not downcast to TDS McEvent" << endreq;
89 return StatusCode::FAILURE;
90 }
91
92 m_objWrite = new TMcEvent(); //zoujh
93 m_common.m_mcEvt = m_objWrite; //zoujh
94
95 // create branch if not yet done
96 if (m_branchNrMc<0) {
97 //zoujh: m_objWrite = new TMcEvent();
98 StatusCode sc = m_rootInterface->createBranch(rootaddr->getTreename(),"TMcEvent",m_objWrite->ClassName(),&m_objWrite,m_branchNrMc);
99 if (sc.isFailure()) {
100 log << MSG::ERROR << "Could not create branch TMcEvent" << endreq;
101 return sc;
102 }
103 }
104
105// Int_t evtId = evtTds->eventNumber();
106// Int_t runId = evtTds->runNumber();
107
108
109#ifdef DEBUG
110 std::cout<<"******************************"<<std::endl;
111 std::cout<<" eveId: "<<evtId<<std::endl;
112 std::cout<<" runId: "<<runId<<std::endl;
113 std::cout<<"******************************"<<std::endl;
114#endif
115 m_objWrite->initialize();
116
117 return StatusCode::SUCCESS;
118}
RootInterface * m_rootInterface
pointer to the RootInterface
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 TMcEvent * m_mcEvt
Provide access to the ROOT event pointers.

◆ DataObjectToTObject() [2/3]

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

transformation from TDS object to ROOT

Implements RootEventBaseCnv.

◆ DataObjectToTObject() [3/3]

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

transformation from TDS object to ROOT

Implements RootEventBaseCnv.

◆ getWriteObject() [1/3]

static TMcEvent * McCnv::getWriteObject ( )
inlinestatic

◆ getWriteObject() [2/3]

static TMcEvent * McCnv::getWriteObject ( )
inlinestatic

returns object to be written (maintained here for all DIGI-converters)

Definition at line 35 of file Event/RootCnvSvc/RootCnvSvc-04-01-15/RootCnvSvc/Mc/McCnv.h.

35{ return m_objWrite;}

◆ getWriteObject() [3/3]

static TMcEvent * McCnv::getWriteObject ( )
inlinestatic

returns object to be written (maintained here for all DIGI-converters)

Definition at line 35 of file InstallArea/include/RootCnvSvc/RootCnvSvc/Mc/McCnv.h.

35{ return m_objWrite;}

◆ initialize() [1/3]

StatusCode McCnv::initialize ( )
virtual

Reimplemented from RootEventBaseCnv.

Definition at line 36 of file bak_RootCnvSvc-04-01-14/src/Mc/McCnv.cxx.

36 {
37 MsgStream log(msgSvc(), "McCnv");
38 log << MSG::DEBUG << "McCnv::initialize"<< endreq;
39
40 StatusCode status = RootEventBaseCnv::initialize();
41
42 //pass dst converter to the conversion service
43 m_cnvSvc->setMcCnv(this);
44
45 return status;
46
47}

◆ initialize() [2/3]

virtual StatusCode McCnv::initialize ( )
virtual

Reimplemented from RootEventBaseCnv.

◆ initialize() [3/3]

virtual StatusCode McCnv::initialize ( )
virtual

Reimplemented from RootEventBaseCnv.

◆ TObjectToDataObject() [1/3]

StatusCode McCnv::TObjectToDataObject ( DataObject *&  refpObject)
protectedvirtual

do the transformation from ROOT to TDS object

Implements RootEventBaseCnv.

Definition at line 50 of file bak_RootCnvSvc-04-01-14/src/Mc/McCnv.cxx.

50 {
51 // fills the TDS object from the persistent one
52 StatusCode sc=StatusCode::SUCCESS;
53
54 MsgStream log(msgSvc(), "McCnv");
55 log << MSG::DEBUG << "TObjectToDataObject" << endreq;
56
57 SmartDataPtr<Event::EventHeader> evt(m_eds, EventModel::EventHeader);
58 if (!evt) {
59 log << MSG::ERROR << "Failed to retrieve McEvent" << endreq;
60 return StatusCode::FAILURE;
61 }
62
63 McEvent * tdsev = new McEvent();
64 refpObject = tdsev;
65
66 return sc;
67}

◆ TObjectToDataObject() [2/3]

virtual StatusCode McCnv::TObjectToDataObject ( DataObject *&  refpObject)
protectedvirtual

do the transformation from ROOT to TDS object

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [3/3]

virtual StatusCode McCnv::TObjectToDataObject ( DataObject *&  refpObject)
protectedvirtual

do the transformation from ROOT to TDS object

Implements RootEventBaseCnv.

Friends And Related Function Documentation

◆ CnvFactory< McCnv >

friend class CnvFactory< McCnv >
friend

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