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

#include <CgemTrackCnv.h>

+ Inheritance diagram for CgemTrackCnv:

Public Member Functions

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

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

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

Definition at line 15 of file CgemTrackCnv.h.

Constructor & Destructor Documentation

◆ ~CgemTrackCnv()

virtual CgemTrackCnv::~CgemTrackCnv ( )
inlinevirtual

Definition at line 25 of file CgemTrackCnv.h.

25{ };

◆ CgemTrackCnv()

CgemTrackCnv::CgemTrackCnv ( ISvcLocator * svc)
protected

Definition at line 24 of file CgemTrackCnv.cxx.

26{
27 // Here we associate this converter with the /Event path on the TDS.
28 MsgStream log(msgSvc(), "CgemTrackCnv");
29 m_rootBranchname ="m_cgemTrackCol";
30 m_adresses.push_back(&m_cgemTrackCol);
31 m_cgemTrackCol=0;
32}
IMessageSvc * msgSvc()
static const CLID & classID()
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 & CgemTrackCnv::classID ( )
inlinestatic

Definition at line 20 of file CgemTrackCnv.h.

21 {
23 }
const CLID & CLID_DstCgemTrackCol

◆ DataObjectToTObject()

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

transformation to root

Implements RootEventBaseCnv.

Definition at line 127 of file CgemTrackCnv.cxx.

127 {
128
129 MsgStream log(msgSvc(), "CgemTrackCnv");
130//myModify
131 log << MSG::INFO << "My Message::CgemTrackCnv::DataObjectToTObject("<<rootaddr->getTreename()<<")"<<endreq;
132
133 log << MSG::DEBUG << "CgemTrackCnv::DataObjectToTObject" << endreq;
134 StatusCode sc=StatusCode::SUCCESS;
135
136 DstCgemTrackCol * cgemTrackColTds=dynamic_cast<DstCgemTrackCol *> (obj);
137 if (!cgemTrackColTds) {
138 log << MSG::ERROR << "Could not downcast to CgemTrackCol" << endreq;
139//myModify
140 log << MSG::INFO << "My Message::CgemTrackCnv::DataObjectToTObject("<<rootaddr->getTreename()<<")-finished"<<endreq;
141
142 return StatusCode::FAILURE;
143 }
144
145 DataObject *evt;
146 m_eds->findObject(EventModel::Dst::Event,evt);
147 if (evt==NULL) {
148 log << MSG::ERROR << "Could not get DstEvent in TDS " << endreq;
149//myModify
150 log << MSG::INFO << "My Message::CgemTrackCnv::DataObjectToTObject("<<rootaddr->getTreename()<<")-finished"<<endreq;
151
152 return StatusCode::FAILURE;
153 }
154 DstEvent * devtTds=dynamic_cast<DstEvent *> (evt);
155 if (!devtTds) {
156 log << MSG::ERROR << "CgemTrackCnv:Could not downcast to TDS DstEvent" << endreq;
157 }
158 IOpaqueAddress *addr;
159
160//myModify
161 log << MSG::INFO << "My Message::CgemTrackCnv::DataObjectToTObject("<<rootaddr->getTreename()<<")::DstCnv"<<endreq;
162
163 m_cnvSvc->getDstCnv()->createRep(evt,addr);
165
166 const TObjArray *m_cgemTrackCol = recEvt->getCgemTrackCol();
167 if (!m_cgemTrackCol) return sc;
168 recEvt->clearCgemTrackCol(); //necessary in case there is I/O at the same time since array is static
169 DstCgemTrackCol::const_iterator cgemTrackTds;
170
171 for (cgemTrackTds = cgemTrackColTds->begin(); cgemTrackTds != cgemTrackColTds->end(); cgemTrackTds++) {
172 Int_t trackId =(*cgemTrackTds)->trackId();
173 Double_t helix[5];
174 for(int i=0;i<5;i++){
175 helix[i] = (*cgemTrackTds)->helix(i) ;
176 }
177 Int_t stat = (*cgemTrackTds)->stat();
178 Double_t chi = (*cgemTrackTds)->chi2();
179 Int_t ndof = (*cgemTrackTds)->ndof();
180 Double_t err[15];
181 for (Int_t i=0; i<15; i++){
182 err[i] = (*cgemTrackTds)->err(i);
183 }
184 Int_t fL = (*cgemTrackTds)->firstLayer();
185 Int_t lL = (*cgemTrackTds)->lastLayer();
186
187 TCgemTrack *cgemTrackRoot = new TCgemTrack();
188 //m_common.m_cgemTrackMap[(*cgemTrackTds)] = cgemTrackRoot;
189 cgemTrackRoot->setTrackId( trackId );
190
191 cgemTrackRoot->setHelix(helix);
192 log<<MSG::INFO<<"test,trackId: "<<cgemTrackRoot->trackId()<<endreq;
193 log<<MSG::INFO<<"test,px: "<<cgemTrackRoot->px()
194 <<"test,py: "<<cgemTrackRoot->py()
195 <<"test,pz: "<<cgemTrackRoot->pz()<<endreq;
196
197 cgemTrackRoot->setStat( stat );
198 cgemTrackRoot->setChi2( chi );
199 cgemTrackRoot->setNdof( ndof );
200 cgemTrackRoot->setErr( err );
201 cgemTrackRoot->setFirstLayer(fL);
202 cgemTrackRoot->setLastLayer(lL);
203
204 recEvt->addCgemTrack(cgemTrackRoot);
205 }
206
207//myModify
208 log << MSG::INFO << "My Message::CgemTrackCnv::DataObjectToTObject("<<rootaddr->getTreename()<<")-finished"<<endreq;
209
210 return StatusCode::SUCCESS;
211}
ObjectVector< DstCgemTrack > DstCgemTrackCol
static TDstEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
Definition DstCnv.h:36
std::string getTreename() const
Definition RootAddress.h:27
DstCnv * getDstCnv()
Definition RootCnvSvc.h:148
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 setLastLayer(const Int_t lL)
Definition TCgemTrack.h:44
void setTrackId(const Int_t trackId)
Definition TCgemTrack.h:39
const Int_t trackId() const
Definition TCgemTrack.h:13
void setStat(const Int_t stat)
Definition TCgemTrack.h:40
void setErr(const Double_t err[15])
void setHelix(const Double_t helix[5])
const Double_t pz() const
void setFirstLayer(const Int_t fL)
Definition TCgemTrack.h:43
const Double_t px() const
const Double_t py() const
void setNdof(const Int_t ndof)
Definition TCgemTrack.h:42
void setChi2(const Double_t chi)
Definition TCgemTrack.h:41
const TObjArray * getCgemTrackCol() const
retrieve the whole TObjArray of CgemTrack Data
Definition TDstEvent.h:52
void addCgemTrack(TCgemTrack *Track)
Add a tkrtrack into the Cgem data collection.
void clearCgemTrackCol()
clear the whole array (necessary because of the consts-s)
Definition TDstEvent.h:61
_EXTERN_ std::string Event
Definition EventModel.h:146

◆ TObjectToDataObject()

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

transformation from root

Implements RootEventBaseCnv.

Definition at line 34 of file CgemTrackCnv.cxx.

34 {
35 // creation of TDS object from root object
36 MsgStream log(msgSvc(), "CgemTrackCnv");
37//myModify
38 log << MSG::INFO << "My Message::CgemTrackCnv::TObjectToDataObject()"<<endreq;
39
40 log << MSG::DEBUG << "CgemTrackCnv::TObjectToDataObject" << endreq;
41 StatusCode sc=StatusCode::SUCCESS;
42
43 // create the TDS location for the CgemTrack Collection
44 DstCgemTrackCol* cgemTrackTdsCol = new DstCgemTrackCol;
45 refpObject=cgemTrackTdsCol;
46
47 // now convert
48 if (!m_cgemTrackCol) return sc;
49 TIter cgemTrackIter(m_cgemTrackCol);
50 TCgemTrack *cgemTrackRoot = 0;
51 while ((cgemTrackRoot = (TCgemTrack*)cgemTrackIter.Next())) {
52
53 int trackId = cgemTrackRoot->trackId();
54 int charge = cgemTrackRoot->charge();
55 double helix[5];
56 for(int i=0; i<5; i++){
57 helix[i] = cgemTrackRoot->helix(i);
58 log<<MSG::INFO<<"in CgemTrackCnv, helix["<<i<<"]: "<<helix[i]<<endreq;
59 }
60 double pxy = cgemTrackRoot->pxy();
61 double px = cgemTrackRoot->px();
62 double py = cgemTrackRoot->py();
63 double pz = cgemTrackRoot->pz();
64 double p = cgemTrackRoot->p();
65 double theta = cgemTrackRoot->theta();
66 double phi = cgemTrackRoot->phi();
67 double x = cgemTrackRoot->x();
68 double y = cgemTrackRoot->y();
69 double z = cgemTrackRoot->z();
70 double r = cgemTrackRoot->r();
71 int stat = cgemTrackRoot->stat();
72 double chi = cgemTrackRoot->chi2();
73 int ndof = cgemTrackRoot->ndof();
74
75 double err[15];
76 for (int i=0; i<15; i++){
77 err[i] = cgemTrackRoot->err(i);
78 }
79
80 double poca[3];
81 poca[0] = x;
82 poca[1] = y;
83 poca[2] = z;
84
85//myModify
86 log << MSG::INFO << "My Message::CgemTrackCnv::TObjectToDataObject::charge:"<<charge<<",p:"<<p<<",r:"<<r<<",z:"<<z<<endreq;
87
88 DstCgemTrack *cgemTrackTds = new DstCgemTrack();
89 m_common.m_rootCgemTrackMap[cgemTrackRoot] = cgemTrackTds;
90
91 cgemTrackTds->setTrackId( trackId );
92 log<<MSG::INFO<<" dstCgemTrack trkid: "<<cgemTrackTds->trackId()<<endreq;
93
94 cgemTrackTds->setCharge( charge );
95 cgemTrackTds->setHelix(helix);
96 cgemTrackTds->setPoca(poca);
97
98 log<<MSG::INFO<<"dstCgemTrack helix: "<<cgemTrackTds->helix()<<endreq;
99
100 cgemTrackTds->setPxy( pxy );
101 cgemTrackTds->setPx( px );
102 cgemTrackTds->setPy( py );
103 cgemTrackTds->setPz( pz );
104 cgemTrackTds->setP( p );
105 cgemTrackTds->setTheta( theta );
106 cgemTrackTds->setPhi( phi );
107 cgemTrackTds->setX( x );
108 cgemTrackTds->setY( y );
109 cgemTrackTds->setZ( z );
110 cgemTrackTds->setR( r );
111 cgemTrackTds->setStat( stat );
112 cgemTrackTds->setChi2( chi );
113 cgemTrackTds->setNdof( ndof );
114 cgemTrackTds->setError( err );
115
116 cgemTrackTdsCol->push_back(cgemTrackTds);
117
118 }
119 delete m_cgemTrackCol;
120 m_cgemTrackCol = 0;
121//myModify
122 log << MSG::INFO << "My Message::CgemTrackCnv::TObjectToDataObject()-finished"<<endreq;
123
124 return StatusCode::SUCCESS;
125}
Double_t x[10]
void setStat(const int stat)
void setPx(const double px)
void setPhi(const double phi)
void setTheta(const double theta)
void setCharge(const int charge)
void setHelix(double helix[5])
void setZ(const double z)
void setP(const double p)
const int trackId() const
void setTrackId(const int trackId)
void setError(double err[15])
void setPxy(const double pxy)
void setPy(const double py)
void setY(const double y)
void setPoca(double poca[3])
void setX(const double x)
void setNdof(const int ndof)
void setR(const double r)
void setPz(const double pz)
void setChi2(const double chi)
const HepVector helix() const
......
const Int_t ndof() const
Definition TCgemTrack.h:17
const Double_t x() const
const Double_t p() const
const Double_t r() const
const Int_t stat() const
Definition TCgemTrack.h:15
const Double_t y() const
const Double_t theta() const
const Int_t charge() const
const Double_t z() const
const Double_t phi() const
const Double_t helix(Int_t i) const
Definition TCgemTrack.h:14
const Double_t chi2() const
Definition TCgemTrack.h:16
const Double_t err(Int_t i) const
Definition TCgemTrack.h:18
const Double_t pxy() const
static std::map< const TObject *, const DstCgemTrack * > m_rootCgemTrackMap
Definition commonData.h:172

Friends And Related Symbol Documentation

◆ CnvFactory< CgemTrackCnv >

friend class CnvFactory< CgemTrackCnv >
friend

Definition at line 9 of file CgemTrackCnv.h.


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