BOSS 8.0.0
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 ()
 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
virtual ~DigiCnv ()
virtual StatusCode initialize ()
 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
virtual ~DigiCnv ()
virtual StatusCode initialize ()
 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
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
 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
 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
destinationoperator (const source &) const
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 const CLID & classID ()
static TDigiEventgetWriteObject ()
 returns object to be written (maintained here for all DIGI-converters)
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.
static const unsigned char storageType ()
 Storage type and class ID.
static const unsigned char storageType ()
 Storage type and class ID.

Friends

class CnvFactory< DigiCnv >

Additional Inherited Members

Public Types inherited from Converter< Ty1, Ty2 >
typedef Ty1 source
typedef Ty2 destination
typedef Ty1 source
typedef Ty2 destination
typedef Ty1 source
typedef Ty2 destination
Protected Member Functions inherited from Converter< Ty1, Ty2 >
virtual destinationconvert (const source &) const =0
virtual destinationconvert (const source &) const =0
virtual destinationconvert (const source &) const =0
Protected Attributes inherited from RootEventBaseCnv
IRootCnvSvcm_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 Event/RootCnvSvc/include/RootCnvSvc/Digi/DigiCnv.h.

Constructor & Destructor Documentation

◆ ~DigiCnv() [1/3]

virtual DigiCnv::~DigiCnv ( )
inlinevirtual

Definition at line 27 of file Event/RootCnvSvc/include/RootCnvSvc/Digi/DigiCnv.h.

27{};

◆ DigiCnv() [1/3]

DigiCnv::DigiCnv ( ISvcLocator * svc)

Definition at line 26 of file DigiCnv.cxx.

26 : RootEventBaseCnv( classID(), svc ) {
27 // Here we associate this converter with the path on the TDS.
28 m_rootBranchname = "m_fromMc";
29 // declareObject(EventModel::Digi::Event, objType(), m_rootTreename, m_rootBranchname);
30 m_adresses.push_back( &m_fromMc );
31
32 // m_objWrite=0;
33}
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)

◆ ~DigiCnv() [2/3]

virtual DigiCnv::~DigiCnv ( )
inlinevirtual

◆ DigiCnv() [2/3]

DigiCnv::DigiCnv ( ISvcLocator * svc)

◆ ~DigiCnv() [3/3]

virtual DigiCnv::~DigiCnv ( )
inlinevirtual

◆ DigiCnv() [3/3]

DigiCnv::DigiCnv ( ISvcLocator * svc)

Member Function Documentation

◆ classID() [1/3]

const CLID & DigiCnv::classID ( )
inlinestatic

Definition at line 25 of file Event/RootCnvSvc/include/RootCnvSvc/Digi/DigiCnv.h.

25{ return CLID_DigiEvent; }
const CLID & CLID_DigiEvent
Raw event and Digi IDs.

Referenced by RootCnvSvc::createConverter(), and DigiCnv().

◆ classID() [2/3]

const CLID & DigiCnv::classID ( )
inlinestatic

◆ classID() [3/3]

const CLID & DigiCnv::classID ( )
inlinestatic

◆ DataObjectToTObject() [1/3]

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

transformation from TDS object to ROOT

Implements RootEventBaseCnv.

Definition at line 68 of file DigiCnv.cxx.

68 {
69 // transforms TDS event to digi event in root format
70 MsgStream log( msgSvc(), "DigiCnv" );
71 log << MSG::DEBUG << "DigiCnv::DataObjectToTObject" << endmsg;
72
73 // test if already done for this event
74 // zoujh: if (m_objWrite && (m_objWrite->getRunId()!=0 || m_objWrite->getEventId()!=0))
75 // return StatusCode::SUCCESS;
76 if ( m_common.m_recEvt != 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" << endmsg;
83 return StatusCode::FAILURE;
84 }
85 */
86 DigiEvent* devtTds = dynamic_cast<DigiEvent*>( obj );
87 if ( !devtTds )
88 {
89 log << MSG::ERROR << "Could not downcast to TDS RecEvent" << endmsg;
90 return StatusCode::FAILURE;
91 }
92
93 m_objWrite = new TDigiEvent(); // zoujh
94 m_common.m_recEvt = m_objWrite; // zoujh
95
96 // create branch if not yet done
97 if ( m_branchNr < 0 )
98 {
99 // zoujh: m_objWrite = new TDigiEvent();
100 StatusCode sc =
101 m_rootInterface->createBranch( rootaddr->getTreename(), "TDigiEvent",
102 m_objWrite->ClassName(), &m_objWrite, m_branchNr );
103 if ( sc.isFailure() )
104 {
105 log << MSG::ERROR << "Could not create branch TDigiEvent" << endmsg;
106 return sc;
107 }
108 }
109
110 // Int_t evtId = evtTds->eventNumber();
111 // Int_t runId = evtTds->runNumber();
112
113 Bool_t fromMc = devtTds->fromMc();
114
115 // const bool m_fromMc = fromMc;
116
117#ifdef DEBUG
118 std::cout << "******************************" << std::endl;
119 std::cout << " eveId: " << evtId << std::endl;
120 std::cout << " runId: " << runId << std::endl;
121 std::cout << " fromMc: " << fromMc << std::endl;
122 std::cout << "******************************" << std::endl;
123#endif
124 m_objWrite->initialize( fromMc );
125
126 return StatusCode::SUCCESS;
127}
IMessageSvc * msgSvc()
bool fromMc() const
Retrieve flag of origin.
int m_branchNr
the branchNr of this converter for writing
RootInterface * m_rootInterface
pointer to the RootInterface

◆ DataObjectToTObject() [2/3]

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

transformation from TDS object to ROOT

Implements RootEventBaseCnv.

◆ DataObjectToTObject() [3/3]

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

transformation from TDS object to ROOT

Implements RootEventBaseCnv.

◆ getWriteObject() [1/3]

TDigiEvent * DigiCnv::getWriteObject ( )
inlinestatic

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

Definition at line 32 of file Event/RootCnvSvc/include/RootCnvSvc/Digi/DigiCnv.h.

32{ return m_objWrite; }

◆ getWriteObject() [2/3]

TDigiEvent * DigiCnv::getWriteObject ( )
inlinestatic

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

Definition at line 32 of file InstallArea/x86_64-el9-gcc13-dbg/include/RootCnvSvc/Digi/DigiCnv.h.

32{ return m_objWrite; }

◆ getWriteObject() [3/3]

TDigiEvent * DigiCnv::getWriteObject ( )
inlinestatic

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

Definition at line 32 of file InstallArea/x86_64-el9-gcc13-opt/include/RootCnvSvc/Digi/DigiCnv.h.

32{ return m_objWrite; }

◆ initialize() [1/3]

StatusCode DigiCnv::initialize ( )
virtual

Reimplemented from RootEventBaseCnv.

Definition at line 35 of file DigiCnv.cxx.

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

◆ initialize() [2/3]

virtual StatusCode DigiCnv::initialize ( )
virtual

Reimplemented from RootEventBaseCnv.

◆ initialize() [3/3]

virtual StatusCode DigiCnv::initialize ( )
virtual

Reimplemented from RootEventBaseCnv.

◆ TObjectToDataObject() [1/3]

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

do the transformation from ROOT to TDS object

Implements RootEventBaseCnv.

Definition at line 47 of file DigiCnv.cxx.

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

◆ TObjectToDataObject() [2/3]

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

do the transformation from ROOT to TDS object

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [3/3]

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

do the transformation from ROOT to TDS object

Implements RootEventBaseCnv.

◆ CnvFactory< DigiCnv >

friend class CnvFactory< DigiCnv >
friend

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