BOSS 7.1.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 ()
 
- 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

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

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

Definition at line 19 of file MdcDigiCnv.h.

Constructor & Destructor Documentation

◆ ~MdcDigiCnv()

virtual MdcDigiCnv::~MdcDigiCnv ( )
inlinevirtual

Definition at line 29 of file MdcDigiCnv.h.

29{ };

◆ MdcDigiCnv()

MdcDigiCnv::MdcDigiCnv ( ISvcLocator *  svc)
protected

Definition at line 25 of file MdcDigiCnv.cxx.

27{
28 // Here we associate this converter with the /Event path on the TDS.
29 MsgStream log(msgSvc(), "MdcDigiCnv");
30 //log << MSG::DEBUG << "Constructor called for " << objType() << endreq;
31 m_rootBranchname ="m_mdcDigiCol";
32 //declareObject(EventModel::Digi::MdcDigiCol, objType(), m_rootTreename, m_rootBranchname);
33 m_adresses.push_back(&m_mdcDigiCol);
34 m_mdcDigiCol=0;
35
36}
IMessageSvc * msgSvc()
static const CLID & classID()
Definition: MdcDigiCnv.h:24
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 & MdcDigiCnv::classID ( )
inlinestatic

Definition at line 24 of file MdcDigiCnv.h.

25 {
26 return CLID_MdcDigiCol;
27 }
const CLID & CLID_MdcDigiCol
Definition: EventModel.cxx:235

◆ DataObjectToTObject()

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

transformation to root

Implements RootEventBaseCnv.

Definition at line 82 of file MdcDigiCnv.cxx.

82 {
83
84 MsgStream log(msgSvc(), "MdcDigiCnv");
85 log << MSG::DEBUG << "MdcDigiCnv::DataObjectToTObject" << endreq;
86 StatusCode sc=StatusCode::SUCCESS;
87
88 MdcDigiCol * mdcDigiColTds=dynamic_cast<MdcDigiCol *> (obj);
89 if (!mdcDigiColTds) {
90 log << MSG::ERROR << "Could not downcast to MdcDigiCol" << endreq;
91 return StatusCode::FAILURE;
92 }
93
94 DataObject *evt;
95 m_eds->findObject(EventModel::Digi::Event,evt);
96 if (evt==NULL) {
97 log << MSG::ERROR << "Could not get DigiEvent in TDS " << endreq;
98 return StatusCode::FAILURE;
99 }
100 DigiEvent * devtTds=dynamic_cast<DigiEvent *> (evt);
101 if (!devtTds) {
102 log << MSG::ERROR << "MdcDigiCnv:Could not downcast to TDS DigiEvent" << endreq;
103 }
104
105 IOpaqueAddress *addr;
106
107
108 m_cnvSvc->getDigiCnv()->createRep(evt,addr);
109
110 //createRep(evt,addr);
111
113
114 const TObjArray *m_mdcDigiCol = recEvt->getMdcDigiCol();
115 if (!m_mdcDigiCol) return sc;
116 recEvt->clearMdcDigiCol(); //necessary in case there is I/O at the same time since array is static
117 MdcDigiCol::const_iterator mdcDigiTds;
118
119 for (mdcDigiTds = mdcDigiColTds->begin(); mdcDigiTds != mdcDigiColTds->end(); mdcDigiTds++) {
120 UInt_t overflow = (*mdcDigiTds)->getOverflow();
121 UInt_t time = (*mdcDigiTds)->getTimeChannel();
122 UInt_t charge = (*mdcDigiTds)->getChargeChannel();
123 UInt_t id = (*mdcDigiTds)->getIntId();
124 Int_t trackIndex = (*mdcDigiTds)->getTrackIndex();
125
126 TMdcDigi *mdcDigiRoot = new TMdcDigi();
127 //m_common.m_mdcDigiMap[(*mdcDigiTds)] = mdcDigiRoot;
128
129 mdcDigiRoot->initialize(id, time ,charge);
130 mdcDigiRoot->setOverflow(overflow);
131 mdcDigiRoot->setTrackIndex(trackIndex);
132 recEvt->addMdcDigi(mdcDigiRoot);
133 }
134
135 return StatusCode::SUCCESS;
136}
Double_t time
ObjectVector< MdcDigi > MdcDigiCol
Definition: MdcDigi.h:39
#define NULL
static TDigiEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
Definition: DigiCnv.h:35
DigiCnv * getDigiCnv()
Definition: RootCnvSvc.h:154
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 clearMdcDigiCol()
clear the whole array (necessary because of the consts-s)
Definition: TDigiEvent.h:40
const TObjArray * getMdcDigiCol() const
retrieve the whole TObjArray of TkrDigi Data
Definition: TDigiEvent.h:31
void addMdcDigi(TMdcDigi *digi)
Add a TkrDigi into the TKR data collection.
Definition: TDigiEvent.cxx:120
void setOverflow(const UInt_t overflow)
Definition: TMdcDigi.cxx:36
void initialize(UInt_t id, UInt_t time=0, UInt_t charge=0)
Definition: TRawData.cxx:34
void setTrackIndex(const int trackIndex)
Definition: TRawData.cxx:41
_EXTERN_ std::string Event
Definition: EventModel.h:56
float charge

◆ TObjectToDataObject()

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

transformation from root

Implements RootEventBaseCnv.

Definition at line 38 of file MdcDigiCnv.cxx.

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

Friends And Related Function Documentation

◆ CnvFactory< MdcDigiCnv >

friend class CnvFactory< MdcDigiCnv >
friend

Definition at line 9 of file MdcDigiCnv.h.


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