BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcDigiCnv Class Reference

Concrete converter for the MdcDigi collection. More...

#include <MdcDigiCnv.h>

Inheritance diagram for MdcDigiCnv:

Public Member Functions

virtual ~MdcDigiCnv ()
 MdcDigiCnv (ISvcLocator *svc)
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
virtual ~MdcDigiCnv ()
 MdcDigiCnv (ISvcLocator *svc)
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
virtual ~MdcDigiCnv ()
 MdcDigiCnv (ISvcLocator *svc)
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
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.
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.
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.
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 const CLID & classID ()
static const CLID & classID ()
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< MdcDigiCnv >

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 MdcDigi collection.

Definition at line 19 of file Event/RootCnvSvc/include/RootCnvSvc/Digi/MdcDigiCnv.h.

Constructor & Destructor Documentation

◆ ~MdcDigiCnv() [1/3]

virtual MdcDigiCnv::~MdcDigiCnv ( )
inlinevirtual

Definition at line 26 of file Event/RootCnvSvc/include/RootCnvSvc/Digi/MdcDigiCnv.h.

26{};

◆ MdcDigiCnv() [1/3]

MdcDigiCnv::MdcDigiCnv ( ISvcLocator * svc)

Definition at line 24 of file MdcDigiCnv.cxx.

24 : RootEventBaseCnv( classID(), svc ) {
25 // Here we associate this converter with the /Event path on the TDS.
26 MsgStream log( msgSvc(), "MdcDigiCnv" );
27 // log << MSG::DEBUG << "Constructor called for " << objType() << endmsg;
28 m_rootBranchname = "m_mdcDigiCol";
29 // declareObject(EventModel::Digi::MdcDigiCol, objType(), m_rootTreename, m_rootBranchname);
30 m_adresses.push_back( &m_mdcDigiCol );
31 m_mdcDigiCol = 0;
32}
IMessageSvc * msgSvc()
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)

◆ ~MdcDigiCnv() [2/3]

virtual MdcDigiCnv::~MdcDigiCnv ( )
inlinevirtual

◆ MdcDigiCnv() [2/3]

MdcDigiCnv::MdcDigiCnv ( ISvcLocator * svc)

◆ ~MdcDigiCnv() [3/3]

virtual MdcDigiCnv::~MdcDigiCnv ( )
inlinevirtual

◆ MdcDigiCnv() [3/3]

MdcDigiCnv::MdcDigiCnv ( ISvcLocator * svc)

Member Function Documentation

◆ classID() [1/3]

const CLID & MdcDigiCnv::classID ( )
inlinestatic

Definition at line 24 of file Event/RootCnvSvc/include/RootCnvSvc/Digi/MdcDigiCnv.h.

24{ return CLID_MdcDigiCol; }
const CLID & CLID_MdcDigiCol

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

◆ classID() [2/3]

const CLID & MdcDigiCnv::classID ( )
inlinestatic

◆ classID() [3/3]

const CLID & MdcDigiCnv::classID ( )
inlinestatic

◆ DataObjectToTObject() [1/3]

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

transformation to root

Implements RootEventBaseCnv.

Definition at line 78 of file MdcDigiCnv.cxx.

78 {
79
80 MsgStream log( msgSvc(), "MdcDigiCnv" );
81 log << MSG::DEBUG << "MdcDigiCnv::DataObjectToTObject" << endmsg;
82 StatusCode sc = StatusCode::SUCCESS;
83
84 MdcDigiCol* mdcDigiColTds = dynamic_cast<MdcDigiCol*>( obj );
85 if ( !mdcDigiColTds )
86 {
87 log << MSG::ERROR << "Could not downcast to MdcDigiCol" << endmsg;
88 return StatusCode::FAILURE;
89 }
90
91 DataObject* evt;
92 m_eds->findObject( EventModel::Digi::Event, evt );
93 if ( evt == NULL )
94 {
95 log << MSG::ERROR << "Could not get DigiEvent in TDS " << endmsg;
96 return StatusCode::FAILURE;
97 }
98 DigiEvent* devtTds = dynamic_cast<DigiEvent*>( evt );
99 if ( !devtTds )
100 { log << MSG::ERROR << "MdcDigiCnv:Could not downcast to TDS DigiEvent" << endmsg; }
101
102 IOpaqueAddress* addr;
103
104 m_cnvSvc->getDigiCnv()->createRep( evt, addr );
105
106 // createRep(evt,addr);
107
108 TDigiEvent* recEvt = m_cnvSvc->getDigiCnv()->getWriteObject();
109
110 const TObjArray* m_mdcDigiCol = recEvt->getMdcDigiCol();
111 if ( !m_mdcDigiCol ) return sc;
112 recEvt->clearMdcDigiCol(); // necessary in case there is I/O at the same time since array is
113 // static
114 MdcDigiCol::const_iterator mdcDigiTds;
115
116 for ( mdcDigiTds = mdcDigiColTds->begin(); mdcDigiTds != mdcDigiColTds->end(); mdcDigiTds++ )
117 {
118 UInt_t overflow = ( *mdcDigiTds )->getOverflow();
119 UInt_t time = ( *mdcDigiTds )->getTimeChannel();
120 UInt_t charge = ( *mdcDigiTds )->getChargeChannel();
121 UInt_t id = ( *mdcDigiTds )->getIntId();
122 Int_t trackIndex = ( *mdcDigiTds )->getTrackIndex();
123
124 TMdcDigi* mdcDigiRoot = new TMdcDigi();
125 // m_common.m_mdcDigiMap[(*mdcDigiTds)] = mdcDigiRoot;
126
127 mdcDigiRoot->initialize( id, time, charge );
128 mdcDigiRoot->setOverflow( overflow );
129 mdcDigiRoot->setTrackIndex( trackIndex );
130 recEvt->addMdcDigi( mdcDigiRoot );
131 }
132
133 return StatusCode::SUCCESS;
134}
Double_t time
IDataProviderSvc * m_eds
pointer to eventdataservice
void clearMdcDigiCol()
clear the whole array (necessary because of the consts-s)
const TObjArray * getMdcDigiCol() const
retrieve the whole TObjArray of TkrDigi Data
void addMdcDigi(TMdcDigi *digi)
Add a TkrDigi into the TKR data collection.
void setOverflow(const UInt_t overflow)
Definition TMdcDigi.cxx:32
void initialize(UInt_t id, UInt_t time=0, UInt_t charge=0)
Definition TRawData.cxx:30
void setTrackIndex(const int trackIndex)
Definition TRawData.cxx:37

◆ DataObjectToTObject() [2/3]

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

transformation to root

Implements RootEventBaseCnv.

◆ DataObjectToTObject() [3/3]

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

transformation to root

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [1/3]

StatusCode MdcDigiCnv::TObjectToDataObject ( DataObject *& obj)
virtual

transformation from root

Implements RootEventBaseCnv.

Definition at line 34 of file MdcDigiCnv.cxx.

34 {
35 // creation of TDS object from root object
36
37 MsgStream log( msgSvc(), "MdcDigiCnv" );
38 log << MSG::DEBUG << "MdcDigiCnv::TObjectToDataObject" << endmsg;
39 StatusCode sc = StatusCode::SUCCESS;
40
41 // create the TDS location for the MdcDigi Collection
42 MdcDigiCol* mdcDigiTdsCol = new MdcDigiCol;
43 refpObject = mdcDigiTdsCol;
44 // sc = m_eds->registerObject(EventModel::Digi::MdcDigiCol, mdcDigiTdsCol);
45 // if (sc.isFailure()) {
46 // log << "Failed to register MdcDigi Collection" << endmsg;
47 // return StatusCode::FAILURE;
48 // }
49
50 // now convert
51 if ( !m_mdcDigiCol ) return sc;
52 TIter mdcDigiIter( m_mdcDigiCol );
53 TMdcDigi* mdcDigiRoot = 0;
54 while ( ( mdcDigiRoot = (TMdcDigi*)mdcDigiIter.Next() ) )
55 {
56 unsigned int id = mdcDigiRoot->getIntId();
57 unsigned int time = mdcDigiRoot->getTimeChannel();
58 unsigned int charge = mdcDigiRoot->getChargeChannel();
59 unsigned int overflow = mdcDigiRoot->getOverflow();
60 int trackIndex = mdcDigiRoot->getTrackIndex();
61
62 MdcDigi* mdcDigiTds = new MdcDigi( id );
63 m_common.m_rootMdcDigiMap[mdcDigiRoot] = mdcDigiTds;
64
65 mdcDigiTds->setTimeChannel( time );
66 mdcDigiTds->setChargeChannel( charge );
67 mdcDigiTds->setOverflow( overflow );
68 mdcDigiTds->setTrackIndex( trackIndex );
69
70 mdcDigiTdsCol->push_back( mdcDigiTds );
71 }
72 // m_mdcDigiCol->Delete(); // wensp add 2005/12/30
73 delete m_mdcDigiCol;
74 m_mdcDigiCol = 0;
75 return StatusCode::SUCCESS;
76}
void setTrackIndex(const int trackIndex)
Definition RawData.cxx:29
void setChargeChannel(const unsigned int chargeChannel)
Definition RawData.cxx:24
void setTimeChannel(const unsigned int timeChannel)
Definition RawData.cxx:21
UInt_t getOverflow() const
Definition TMdcDigi.cxx:35
UInt_t getIntId() const
Definition TRawData.cxx:42
int getTrackIndex() const
Definition TRawData.cxx:39
UInt_t getChargeChannel() const
Definition TRawData.cxx:48
UInt_t getTimeChannel() const
Definition TRawData.cxx:45

◆ TObjectToDataObject() [2/3]

virtual StatusCode MdcDigiCnv::TObjectToDataObject ( DataObject *& obj)
virtual

transformation from root

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [3/3]

virtual StatusCode MdcDigiCnv::TObjectToDataObject ( DataObject *& obj)
virtual

transformation from root

Implements RootEventBaseCnv.

◆ CnvFactory< MdcDigiCnv >

friend class CnvFactory< MdcDigiCnv >
friend

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