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

#include <CgemTrackCnv.h>

+ Inheritance diagram for CgemTrackCnv:

Public Member Functions

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

Protected Member Functions

 CgemTrackCnv (ISvcLocator *svc)
 
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
 
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
 
 CgemTrackCnv (ISvcLocator *svc)
 
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
 
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
 
 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
 
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
 
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

Constructor & Destructor Documentation

◆ ~CgemTrackCnv() [1/3]

virtual CgemTrackCnv::~CgemTrackCnv ( )
inlinevirtual

◆ CgemTrackCnv() [1/3]

CgemTrackCnv::CgemTrackCnv ( ISvcLocator *  svc)
protected

Definition at line 24 of file bak_RootCnvSvc-04-01-14/src/Dst/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}
std::vector< void * > m_adresses
each converter knows the corresponding adresses
std::string m_rootBranchname
root branchname (may be concatenated of severals)

◆ ~CgemTrackCnv() [2/3]

virtual CgemTrackCnv::~CgemTrackCnv ( )
inlinevirtual

◆ CgemTrackCnv() [2/3]

CgemTrackCnv::CgemTrackCnv ( ISvcLocator *  svc)
protected

◆ ~CgemTrackCnv() [3/3]

virtual CgemTrackCnv::~CgemTrackCnv ( )
inlinevirtual

◆ CgemTrackCnv() [3/3]

CgemTrackCnv::CgemTrackCnv ( ISvcLocator *  svc)
protected

Member Function Documentation

◆ classID() [1/3]

static const CLID & CgemTrackCnv::classID ( )
inlinestatic

Definition at line 20 of file Event/RootCnvSvc/bak_RootCnvSvc-04-01-14/RootCnvSvc/Dst/CgemTrackCnv.h.

21 {
23 }
const CLID & CLID_DstCgemTrackCol
Definition: EventModel.cxx:312

◆ classID() [2/3]

static const CLID & CgemTrackCnv::classID ( )
inlinestatic

◆ classID() [3/3]

static const CLID & CgemTrackCnv::classID ( )
inlinestatic

◆ DataObjectToTObject() [1/3]

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

transformation to root

Implements RootEventBaseCnv.

Definition at line 127 of file bak_RootCnvSvc-04-01-14/src/Dst/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)
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
void setErr(const Double_t err[15])
void setHelix(const Double_t helix[5])
const TObjArray * getCgemTrackCol() const
retrieve the whole TObjArray of CgemTrack Data
void addCgemTrack(TCgemTrack *Track)
Add a tkrtrack into the Cgem data collection.
void clearCgemTrackCol()
clear the whole array (necessary because of the consts-s)

◆ DataObjectToTObject() [2/3]

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

transformation to root

Implements RootEventBaseCnv.

◆ DataObjectToTObject() [3/3]

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

transformation to root

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [1/3]

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

transformation from root

Implements RootEventBaseCnv.

Definition at line 34 of file bak_RootCnvSvc-04-01-14/src/Dst/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 setHelix(double helix[5])
void setError(double err[15])
void setPoca(double poca[3])
const HepVector helix() const
......
static std::map< const TObject *, const DstCgemTrack * > m_rootCgemTrackMap

◆ TObjectToDataObject() [2/3]

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

transformation from root

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [3/3]

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

transformation from root

Implements RootEventBaseCnv.

Friends And Related Function Documentation

◆ CnvFactory< CgemTrackCnv >


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