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

Concrete converter for the EmcDigi collection. More...

#include <EmcDigiCnv.h>

+ Inheritance diagram for EmcDigiCnv:

Public Member Functions

virtual ~EmcDigiCnv ()
 
- 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
 
- 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

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

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

Definition at line 19 of file EmcDigiCnv.h.

Constructor & Destructor Documentation

◆ ~EmcDigiCnv()

virtual EmcDigiCnv::~EmcDigiCnv ( )
inlinevirtual

Definition at line 29 of file EmcDigiCnv.h.

29{ };

◆ EmcDigiCnv()

EmcDigiCnv::EmcDigiCnv ( ISvcLocator * svc)
protected

Definition at line 25 of file EmcDigiCnv.cxx.

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

Definition at line 24 of file EmcDigiCnv.h.

25 {
26 return CLID_EmcDigiCol;
27 }
const CLID & CLID_EmcDigiCol

◆ DataObjectToTObject()

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

transformation to root

Implements RootEventBaseCnv.

Definition at line 76 of file EmcDigiCnv.cxx.

76 {
77
78 MsgStream log(msgSvc(), "EmcDigiCnv");
79 log << MSG::DEBUG << "EmcDigiCnv::DataObjectToTObject" << endreq;
80 StatusCode sc=StatusCode::SUCCESS;
81
82 EmcDigiCol * emcDigiColTds=dynamic_cast<EmcDigiCol *> (obj);
83 if (!emcDigiColTds) {
84 log << MSG::ERROR << "Could not downcast to EmcDigiCol" << endreq;
85 return StatusCode::FAILURE;
86 }
87
88 DataObject *evt;
89 m_eds->findObject(EventModel::Digi::Event,evt);
90 if (evt==NULL) {
91 log << MSG::ERROR << "Could not get DigiEvent in TDS " << endreq;
92 return StatusCode::FAILURE;
93 }
94 DigiEvent * devtTds=dynamic_cast<DigiEvent *> (evt);
95 if (!devtTds) {
96 log << MSG::ERROR << "EmcDigiCnv:Could not downcast to TDS DigiEvent" << endreq;
97 }
98 IOpaqueAddress *addr;
99
100 m_cnvSvc->getDigiCnv()->createRep(evt,addr);
102
103 const TObjArray *m_emcDigiCol = recEvt->getEmcDigiCol();
104 if (!m_emcDigiCol) return sc;
105 recEvt->clearEmcDigiCol(); //necessary in case there is I/O at the same time since array is static
106 EmcDigiCol::const_iterator emcDigiTds;
107
108 for (emcDigiTds = emcDigiColTds->begin(); emcDigiTds != emcDigiColTds->end(); emcDigiTds++) {
109 UInt_t measure = (*emcDigiTds)->getMeasure();
110 UInt_t time = (*emcDigiTds)->getTimeChannel();
111 UInt_t charge = (*emcDigiTds)->getChargeChannel();
112 UInt_t id = (*emcDigiTds)->getIntId();
113 Int_t trackIndex = (*emcDigiTds)->getTrackIndex();
114
115 TEmcDigi *emcDigiRoot = new TEmcDigi();
116 //m_common.m_emcDigiMap[(*emcDigiTds)] = emcDigiRoot;
117
118 emcDigiRoot->initialize(id, time ,charge);
119 emcDigiRoot->setMeasure(measure);
120 emcDigiRoot->setTrackIndex(trackIndex);
121
122 recEvt->addEmcDigi(emcDigiRoot);
123 }
124
125 return StatusCode::SUCCESS;
126}
Double_t time
ObjectVector< EmcDigi > EmcDigiCol
Definition EmcDigi.h:43
static TDigiEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
Definition DigiCnv.h:35
DigiCnv * getDigiCnv()
Definition RootCnvSvc.h:147
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 addEmcDigi(TEmcDigi *digi)
Add a TkrDigi into the TKR data collection.
void clearEmcDigiCol()
clear the whole array (necessary because of the consts-s)
Definition TDigiEvent.h:66
const TObjArray * getEmcDigiCol() const
retrieve the whole TObjArray of TkrDigi Data
Definition TDigiEvent.h:57
void setMeasure(const UInt_t measure)
Definition TEmcDigi.cxx:33
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:60

◆ TObjectToDataObject()

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

transformation from root

Implements RootEventBaseCnv.

Definition at line 37 of file EmcDigiCnv.cxx.

37 {
38 // creation of TDS object from root object
39
40 MsgStream log(msgSvc(), "EmcDigiCnv");
41 log << MSG::DEBUG << "EmcDigiCnv::TObjectToDataObject" << endreq;
42 StatusCode sc=StatusCode::SUCCESS;
43
44 // create the TDS location for the MdcDigi Collection
45 EmcDigiCol* emcDigiTdsCol = new EmcDigiCol;
46 refpObject=emcDigiTdsCol;
47
48
49 // now convert
50 if (!m_emcDigiCol) return sc;
51 TIter emcDigiIter(m_emcDigiCol);
52 TEmcDigi *emcDigiRoot = 0;
53 while ((emcDigiRoot = (TEmcDigi*)emcDigiIter.Next())) {
54 unsigned int id = emcDigiRoot->getIntId();
55 unsigned int time = emcDigiRoot->getTimeChannel();
56 unsigned int charge = emcDigiRoot->getChargeChannel();
57 unsigned int measure = emcDigiRoot->getMeasure();
58 int trackIndex = emcDigiRoot->getTrackIndex();
59
60 EmcDigi *emcDigiTds = new EmcDigi(id);
61 m_common.m_rootEmcDigiMap[emcDigiRoot] = emcDigiTds;
62
63 emcDigiTds->setTimeChannel(time);
64 emcDigiTds->setChargeChannel(charge);
65 emcDigiTds->setMeasure( measure);
66 emcDigiTds->setTrackIndex(trackIndex);
67
68 emcDigiTdsCol->push_back(emcDigiTds);
69 }
70 //m_emcDigiCol->Delete(); // wensp add 2005/12/30
71 delete m_emcDigiCol;
72 m_emcDigiCol = 0;
73 return StatusCode::SUCCESS;
74}
void setMeasure(const unsigned int measure)
Definition EmcDigi.h:24
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 getMeasure() const
Definition TEmcDigi.cxx:37
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 EmcDigi * > m_rootEmcDigiMap
Definition commonData.h:152

Friends And Related Symbol Documentation

◆ CnvFactory< EmcDigiCnv >

friend class CnvFactory< EmcDigiCnv >
friend

Definition at line 9 of file EmcDigiCnv.h.


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