CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
CgemDigiCnv Class Reference

Concrete converter for the CgemDigi collection. More...

#include <CgemDigiCnv.h>

+ Inheritance diagram for CgemDigiCnv:

Public Member Functions

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

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

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

Definition at line 19 of file CgemDigiCnv.h.

Constructor & Destructor Documentation

◆ ~CgemDigiCnv()

virtual CgemDigiCnv::~CgemDigiCnv ( )
inlinevirtual

Definition at line 29 of file CgemDigiCnv.h.

29{ };

◆ CgemDigiCnv()

CgemDigiCnv::CgemDigiCnv ( ISvcLocator *  svc)
protected

Definition at line 25 of file CgemDigiCnv.cxx.

27{
28 // Here we associate this converter with the /Event path on the TDS.
29 MsgStream log(msgSvc(), "CgemDigiCnv");
30//myModify
31 log << MSG::INFO << "My Message::CgemDigiCnv:RootEventBaseCnv" << endreq;
32
33 //log << MSG::DEBUG << "Constructor called for " << objType() << endreq;
34 m_rootBranchname ="m_cgemDigiCol";
35 //declareObject(EventModel::Digi::CgemDigiCol, objType(), m_rootTreename, m_rootBranchname);
36 m_adresses.push_back(&m_cgemDigiCol);
37 m_cgemDigiCol=0;
38
39//myModify
40 log << MSG::INFO << "My Message::CgemDigiCnv:RootEventBaseCnv-finished" << endreq;
41
42}
IMessageSvc * msgSvc()
static const CLID & classID()
Definition: CgemDigiCnv.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 & CgemDigiCnv::classID ( )
inlinestatic

Definition at line 24 of file CgemDigiCnv.h.

25 {
26 return CLID_CgemDigiCol;
27 }
const CLID & CLID_CgemDigiCol
Definition: EventModel.cxx:278

◆ DataObjectToTObject()

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

transformation to root

Implements RootEventBaseCnv.

Definition at line 106 of file CgemDigiCnv.cxx.

106 {
107
108 MsgStream log(msgSvc(), "CgemDigiCnv");
109 //myModify
110 log << MSG::INFO << "My Message::CgemDigiCnv::DataObjectToTObject()" << endreq;
111
112 log << MSG::DEBUG << "CgemDigiCnv::DataObjectToTObject" << endreq;
113 StatusCode sc=StatusCode::SUCCESS;
114
115 CgemDigiCol * cgemDigiColTds=dynamic_cast<CgemDigiCol *> (obj);
116 if (!cgemDigiColTds) {
117 log << MSG::ERROR << "Could not downcast to CgemDigiCol" << endreq;
118 //myModify
119 log << MSG::INFO << "My Message::CgemDigiCnv::DataObjectToTObject()-finished" << endreq;
120
121 return StatusCode::FAILURE;
122 }
123
124 DataObject *evt;
125 m_eds->findObject(EventModel::Digi::Event,evt);
126 if (evt==NULL) {
127 log << MSG::ERROR << "Could not get DigiEvent in TDS " << endreq;
128//myModify
129 log << MSG::INFO << "My Message::CgemDigiCnv::DataObjectToTObject()-finished" << endreq;
130
131 return StatusCode::FAILURE;
132 }
133 DigiEvent * devtTds=dynamic_cast<DigiEvent *> (evt);
134 if (!devtTds) {
135//myModify
136 log << MSG::INFO << "My Message::CgemDigiCnv::DataObjectToTObject()-finished" << endreq;
137
138 log << MSG::ERROR << "CgemDigiCnv:Could not downcast to TDS DigiEvent" << endreq;
139 }
140
141 IOpaqueAddress *addr;
142
143
144 m_cnvSvc->getDigiCnv()->createRep(evt,addr);
145
146 //createRep(evt,addr);
147
149
150 const TObjArray *m_cgemDigiCol = recEvt->getCgemDigiCol();
151 if (!m_cgemDigiCol) return sc;
152 recEvt->clearCgemDigiCol(); //necessary in case there is I/O at the same time since array is static
153 CgemDigiCol::const_iterator cgemDigiTds;
154
155 for (cgemDigiTds=cgemDigiColTds->begin(); cgemDigiTds!=cgemDigiColTds->end(); cgemDigiTds++)
156 {
157 UInt_t overflow = (*cgemDigiTds)->getOverflow();
158 UInt_t time = (*cgemDigiTds)->getTimeChannel();
159 UInt_t charge = (*cgemDigiTds)->getChargeChannel();
160 UInt_t id = (*cgemDigiTds)->getIntId();
161 Int_t trackIndex = (*cgemDigiTds)->getTrackIndex();
162 Double_t time_ns = (*cgemDigiTds)->getTime_ns();
163 Double_t charge_fC= (*cgemDigiTds)->getCharge_fc();
164
165
166 TCgemDigi *cgemDigiRoot = new TCgemDigi();
167 //m_common.m_cgemDigiMap[(*cgemDigiTds)] = cgemDigiRoot;
168 //myModify
169 log << MSG::INFO << "My Message::CgemDigiCnv::DataObjectToTObject: "
170 << "id=" << id
171 << ",time=" << time
172 << ",charge=" << charge
173 << ",overflow=" << overflow << endreq;
174
175 cgemDigiRoot->initialize(id, time ,charge);
176 cgemDigiRoot->setOverflow(overflow);
177 cgemDigiRoot->setTrackIndex(trackIndex);
178 cgemDigiRoot->setTime_ns(time_ns);
179 cgemDigiRoot->setCharge_fc(charge_fC);
180 recEvt->addCgemDigi(cgemDigiRoot);
181 }
182
183 //myModify
184 log << MSG::INFO << "My Message::CgemDigiCnv::DataObjectToTObject()-finished" << endreq;
185
186 return StatusCode::SUCCESS;
187}
ObjectVector< CgemDigi > CgemDigiCol
Definition: CgemDigi.h:43
Double_t time
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 setTime_ns(Double_t t)
Definition: TCgemDigi.h:36
void setCharge_fc(Double_t q)
Definition: TCgemDigi.h:37
void setOverflow(const UInt_t overflow)
Definition: TCgemDigi.cxx:39
void clearCgemDigiCol()
clear the whole array (necessary because of the consts-s)
Definition: TDigiEvent.h:53
const TObjArray * getCgemDigiCol() const
retrieve the whole TObjArray of TkrDigi Data
Definition: TDigiEvent.h:44
void addCgemDigi(TCgemDigi *digi)
Add a TkrDigi into the TKR data collection.
Definition: TDigiEvent.cxx:146
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 CgemDigiCnv::TObjectToDataObject ( DataObject *&  obj)
protectedvirtual

transformation from root

Implements RootEventBaseCnv.

Definition at line 44 of file CgemDigiCnv.cxx.

44 {
45 // creation of TDS object from root object
46
47 MsgStream log(msgSvc(), "CgemDigiCnv");
48//myModify
49 log << MSG::INFO << "My Message::CgemDigiCnv::TObjectToDataObject()" << endreq;
50
51 log << MSG::DEBUG << "CgemDigiCnv::TObjectToDataObject" << endreq;
52 StatusCode sc=StatusCode::SUCCESS;
53
54 // create the TDS location for the CgemDigi Collection
55 CgemDigiCol* cgemDigiTdsCol = new CgemDigiCol;
56 refpObject=cgemDigiTdsCol;
57// sc = m_eds->registerObject(EventModel::Digi::CgemDigiCol, cgemDigiTdsCol);
58// if (sc.isFailure()) {
59// log << "Failed to register CgemDigi Collection" << endreq;
60// return StatusCode::FAILURE;
61// }
62
63 // now convert
64 if (!m_cgemDigiCol) return sc;
65 TIter cgemDigiIter(m_cgemDigiCol);
66 TCgemDigi *cgemDigiRoot = 0;
67 while ((cgemDigiRoot = (TCgemDigi*)cgemDigiIter.Next()))
68 {
69 unsigned int id = cgemDigiRoot->getIntId();
70 unsigned int time = cgemDigiRoot->getTimeChannel();
71 unsigned int charge = cgemDigiRoot->getChargeChannel();
72 unsigned int overflow = cgemDigiRoot->getOverflow();
73 unsigned int trackIndex = cgemDigiRoot->getTrackIndex();
74 double time_ns = cgemDigiRoot->getTime_ns();
75 double charge_fC = cgemDigiRoot->getCharge_fc();
76
77 CgemDigi *cgemDigiTds = new CgemDigi(id);
78 m_common.m_rootCgemDigiMap[cgemDigiRoot] = cgemDigiTds;
79
80 //myModify
81 log << MSG::INFO << "My Message::CgemDigiCnv::TObjectToDataObject: "
82 << "id=" << id
83 << ",time=" << time
84 << ",charge=" << charge
85 << ",overflow=" << overflow << endreq;
86
87 cgemDigiTds->setTimeChannel(time);
88 cgemDigiTds->setChargeChannel(charge);
89 cgemDigiTds->setOverflow(overflow);
90 cgemDigiTds->setTrackIndex(trackIndex);
91 cgemDigiTds->setTime_ns(time_ns);
92 cgemDigiTds->setCharge_fc(charge_fC);
93
94 cgemDigiTdsCol->push_back(cgemDigiTds);
95 }
96 //m_cgemDigiCol->Delete(); // wensp add 2005/12/30
97 delete m_cgemDigiCol;
98 m_cgemDigiCol = 0;
99
100 //myModify
101 log << MSG::INFO << "My Message::CgemDigiCnv::TObjectToDataObject()-finished" << endreq;
102
103 return StatusCode::SUCCESS;
104}
void setCharge_fc(double q)
Definition: CgemDigi.h:33
void setOverflow(const unsigned int overflow)
Definition: CgemDigi.h:19
void setTime_ns(double t)
Definition: CgemDigi.h:32
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
Double_t getTime_ns()
Definition: TCgemDigi.h:38
UInt_t getOverflow() const
Definition: TCgemDigi.cxx:45
Double_t getCharge_fc()
Definition: TCgemDigi.h:39
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 CgemDigi * > m_rootCgemDigiMap
Definition: commonData.h:145

Friends And Related Function Documentation

◆ CnvFactory< CgemDigiCnv >

friend class CnvFactory< CgemDigiCnv >
friend

Definition at line 9 of file CgemDigiCnv.h.


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