CGEM BOSS 6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
DigiCnv Class Reference

Concrete converter for the Rec branch. More...

#include <DigiCnv.h>

+ Inheritance diagram for DigiCnv:

Public Member Functions

virtual ~DigiCnv ()
 
virtual StatusCode initialize ()
 
- Public Member Functions inherited from RootEventBaseCnv
 RootEventBaseCnv (const CLID &clid, ISvcLocator *svc)
 
virtual ~RootEventBaseCnv ()
 
virtual long repSvcType () const
 
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.
 
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 TDigiEventgetWriteObject ()
 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.
 

Protected Member Functions

 DigiCnv (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
 

Friends

class CnvFactory< DigiCnv >
 

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

Concrete converter for the Rec branch.

Based on the DigiCnv of GLAST.

Definition at line 20 of file DigiCnv.h.

Constructor & Destructor Documentation

◆ ~DigiCnv()

virtual DigiCnv::~DigiCnv ( )
inlinevirtual

Definition at line 30 of file DigiCnv.h.

30{ };

◆ DigiCnv()

DigiCnv::DigiCnv ( ISvcLocator * svc)
protected

Definition at line 26 of file DigiCnv.cxx.

28{
29 // Here we associate this converter with the path on the TDS.
30 m_rootBranchname ="m_fromMc";
31 //declareObject(EventModel::Digi::Event, objType(), m_rootTreename, m_rootBranchname);
32 m_adresses.push_back(&m_fromMc);
33
34 //m_objWrite=0;
35
36}
static const CLID & classID()
Definition DigiCnv.h:25
std::vector< void * > m_adresses
each converter knows the corresponding adresses
std::string m_rootBranchname
root branchname (may be concatenated of severals)
RootEventBaseCnv(const CLID &clid, ISvcLocator *svc)

Member Function Documentation

◆ classID()

static const CLID & DigiCnv::classID ( )
inlinestatic

Definition at line 25 of file DigiCnv.h.

26 {
27 return CLID_DigiEvent;
28 }
const CLID & CLID_DigiEvent
Raw event and Digi IDs.

◆ DataObjectToTObject()

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

transformation from TDS object to ROOT

Implements RootEventBaseCnv.

Definition at line 72 of file DigiCnv.cxx.

72 {
73 // transforms TDS event to digi event in root format
74 MsgStream log(msgSvc(), "DigiCnv");
75 log << MSG::DEBUG << "DigiCnv::DataObjectToTObject" << endreq;
76
77 // test if already done for this event
78 //zoujh: if (m_objWrite && (m_objWrite->getRunId()!=0 || m_objWrite->getEventId()!=0)) return StatusCode::SUCCESS;
79 if (m_common.m_recEvt != NULL) return StatusCode::SUCCESS;
80
81/*
82 SmartDataPtr<Event::EventHeader> evtTds(m_eds, EventModel::EventHeader);
83
84 if (!evtTds) {
85 log << MSG::ERROR << "Failed to retrieve EventHeader in TDS" << endreq;
86 return StatusCode::FAILURE;
87 }
88 */
89 DigiEvent * devtTds=dynamic_cast<DigiEvent *> (obj);
90 if (!devtTds) {
91 log << MSG::ERROR << "Could not downcast to TDS RecEvent" << endreq;
92 return StatusCode::FAILURE;
93 }
94
95 m_objWrite = new TDigiEvent(); //zoujh
96 m_common.m_recEvt = m_objWrite; //zoujh
97
98 // create branch if not yet done
99 if (m_branchNr<0) {
100 //zoujh: m_objWrite = new TDigiEvent();
101 StatusCode sc = m_rootInterface->createBranch(rootaddr->getTreename(),"TDigiEvent",m_objWrite->ClassName(),&m_objWrite,m_branchNr);
102 if (sc.isFailure()) {
103 log << MSG::ERROR << "Could not create branch TDigiEvent" << endreq;
104 return sc;
105 }
106 }
107
108 //Int_t evtId = evtTds->eventNumber();
109 //Int_t runId = evtTds->runNumber();
110
111 Bool_t fromMc = devtTds->fromMc();
112
113 // const bool m_fromMc = fromMc;
114
115#ifdef DEBUG
116 std::cout<<"******************************"<<std::endl;
117 std::cout<<" eveId: "<<evtId<<std::endl;
118 std::cout<<" runId: "<<runId<<std::endl;
119 std::cout<<" fromMc: "<<fromMc<<std::endl;
120 std::cout<<"******************************"<<std::endl;
121#endif
122 m_objWrite->initialize(fromMc);
123
124 return StatusCode::SUCCESS;
125}
IMessageSvc * msgSvc()
bool fromMc() const
Retrieve flag of origin.
Definition DigiEvent.h:37
RootInterface * m_rootInterface
pointer to the RootInterface
int m_branchNr
the branchNr of this converter for writing
virtual StatusCode createBranch(const std::string &tree, const std::string &branch, const char *classname, void *addr, int &branchnr)
create a branch in this tree
void initialize(Bool_t fromMc=true)
static TDigiEvent * m_recEvt
Provide access to the ROOT event pointers.
Definition commonData.h:149

◆ getWriteObject()

static TDigiEvent * DigiCnv::getWriteObject ( )
inlinestatic

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

Definition at line 35 of file DigiCnv.h.

35{ return m_objWrite;}

Referenced by RootCnvSvc::commitOutput(), CgemDigiCnv::DataObjectToTObject(), EmcDigiCnv::DataObjectToTObject(), LumiDigiCnv::DataObjectToTObject(), MdcDigiCnv::DataObjectToTObject(), MucDigiCnv::DataObjectToTObject(), and TofDigiCnv::DataObjectToTObject().

◆ initialize()

StatusCode DigiCnv::initialize ( )
virtual

Reimplemented from RootEventBaseCnv.

Definition at line 38 of file DigiCnv.cxx.

38 {
39 MsgStream log(msgSvc(), "DigiCnv");
40 log << MSG::DEBUG << "DigiCnv::initialize"<< endreq;
41
42 StatusCode status = RootEventBaseCnv::initialize();
43
44 //pass dst converter to the conversion service
45 m_cnvSvc->setDigiCnv(this);
46
47 return status;
48
49}
void setDigiCnv(DigiCnv *reccnv)
Definition RootCnvSvc.h:154
RootCnvSvc * m_cnvSvc
virtual StatusCode initialize()

◆ TObjectToDataObject()

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

do the transformation from ROOT to TDS object

Implements RootEventBaseCnv.

Definition at line 51 of file DigiCnv.cxx.

51 {
52 // fills the TDS object from the persistent one
53 StatusCode sc=StatusCode::SUCCESS;
54
55 MsgStream log(msgSvc(), "DigiCnv");
56 log << MSG::DEBUG << "TObjectToDataObject" << endreq;
57/*
58 SmartDataPtr<Event::EventHeader> evt(m_eds, EventModel::EventHeader);
59 if (!evt) {
60 log << MSG::ERROR << "Failed to retrieve RecEvent" << endreq;
61 return StatusCode::FAILURE;
62 }
63*/
64 DigiEvent * tdsev = new DigiEvent();
65 refpObject = tdsev;
66
67 tdsev->initialize(m_fromMc);
68
69 return sc;
70}
void initialize(bool fromMc)
Definition DigiEvent.h:30

Friends And Related Symbol Documentation

◆ CnvFactory< DigiCnv >

friend class CnvFactory< DigiCnv >
friend

Definition at line 9 of file DigiCnv.h.


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