BOSS 7.0.7
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcTrackCnv Class Reference

#include <MdcTrackCnv.h>

+ Inheritance diagram for MdcTrackCnv:

Public Member Functions

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

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

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 MdcTrackCnv.h.

Constructor & Destructor Documentation

◆ ~MdcTrackCnv()

virtual MdcTrackCnv::~MdcTrackCnv ( )
inlinevirtual

Definition at line 25 of file MdcTrackCnv.h.

25{ };

◆ MdcTrackCnv()

MdcTrackCnv::MdcTrackCnv ( ISvcLocator *  svc)
protected

Definition at line 24 of file MdcTrackCnv.cxx.

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

Definition at line 20 of file MdcTrackCnv.h.

21 {
22 return CLID_DstMdcTrackCol;
23 }
const CLID & CLID_DstMdcTrackCol
Definition: EventModel.cxx:253

◆ DataObjectToTObject()

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

transformation to root

Implements RootEventBaseCnv.

Definition at line 126 of file MdcTrackCnv.cxx.

126 {
127
128 MsgStream log(msgSvc(), "MdcTrackCnv");
129 log << MSG::DEBUG << "MdcTrackCnv::DataObjectToTObject" << endreq;
130 StatusCode sc=StatusCode::SUCCESS;
131
132 DstMdcTrackCol * mdcTrackColTds=dynamic_cast<DstMdcTrackCol *> (obj);
133 if (!mdcTrackColTds) {
134 log << MSG::ERROR << "Could not downcast to MdcTrackCol" << endreq;
135 return StatusCode::FAILURE;
136 }
137
138 DataObject *evt;
139 m_eds->findObject(EventModel::Dst::Event,evt);
140 if (evt==NULL) {
141 log << MSG::ERROR << "Could not get DstEvent in TDS " << endreq;
142 return StatusCode::FAILURE;
143 }
144 DstEvent * devtTds=dynamic_cast<DstEvent *> (evt);
145 if (!devtTds) {
146 log << MSG::ERROR << "MdcTrackCnv:Could not downcast to TDS DstEvent" << endreq;
147 }
148 IOpaqueAddress *addr;
149
150 m_cnvSvc->getDstCnv()->createRep(evt,addr);
152
153 const TObjArray *m_mdcTrackCol = recEvt->getMdcTrackCol();
154 if (!m_mdcTrackCol) return sc;
155 recEvt->clearMdcTrackCol(); //necessary in case there is I/O at the same time since array is static
156 DstMdcTrackCol::const_iterator mdcTrackTds;
157
158 for (mdcTrackTds = mdcTrackColTds->begin(); mdcTrackTds != mdcTrackColTds->end(); mdcTrackTds++) {
159 Int_t trackId =(*mdcTrackTds)->trackId();
160 Double_t helix[5];
161 for(int i=0;i<5;i++){
162 helix[i] = (*mdcTrackTds)->helix(i) ;
163 }
164 Int_t stat = (*mdcTrackTds)->stat();
165 Double_t chi = (*mdcTrackTds)->chi2();
166 Int_t ndof = (*mdcTrackTds)->ndof();
167 Double_t err[15];
168 for (Int_t i=0; i<15; i++){
169 err[i] = (*mdcTrackTds)->err(i);
170 }
171 Int_t ns = (*mdcTrackTds)->nster();
172 Int_t fL = (*mdcTrackTds)->firstLayer();
173 Int_t lL = (*mdcTrackTds)->lastLayer();
174 Int_t nlayer = (*mdcTrackTds)->nlayer();
175
176 TMdcTrack *mdcTrackRoot = new TMdcTrack();
177 //m_common.m_mdcTrackMap[(*mdcTrackTds)] = mdcTrackRoot;
178 mdcTrackRoot->setTrackId( trackId );
179
180 mdcTrackRoot->setHelix(helix);
181 log<<MSG::INFO<<"test,trackId: "<<mdcTrackRoot->trackId()<<endreq;
182 log<<MSG::INFO<<"test,px: "<<mdcTrackRoot->px()
183 <<"test,py: "<<mdcTrackRoot->py()
184 <<"test,pz: "<<mdcTrackRoot->pz()<<endreq;
185
186 mdcTrackRoot->setStat( stat );
187 mdcTrackRoot->setChi2( chi );
188 mdcTrackRoot->setNdof( ndof );
189 mdcTrackRoot->setErr( err );
190 mdcTrackRoot->setNster( ns );
191 mdcTrackRoot->setFirstLayer(fL);
192 mdcTrackRoot->setLastLayer(lL);
193 mdcTrackRoot->setNlayer(nlayer);
194
195 recEvt->addMdcTrack(mdcTrackRoot);
196 }
197
198 return StatusCode::SUCCESS;
199}
ObjectVector< DstMdcTrack > DstMdcTrackCol
Definition: DstMdcTrack.h:133
static TDstEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
Definition: DstCnv.h:36
DstCnv * getDstCnv()
Definition: RootCnvSvc.h:155
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 addMdcTrack(TMdcTrack *Track)
Add a TkrTrack into the Mdc data collection.
Definition: TDstEvent.cxx:120
void clearMdcTrackCol()
clear the whole array (necessary because of the consts-s)
Definition: TDstEvent.h:45
const TObjArray * getMdcTrackCol() const
retrieve the whole TObjArray of MdcTrack Data
Definition: TDstEvent.h:36
const Double_t py() const
Definition: TMdcTrack.cxx:57
const Double_t pz() const
Definition: TMdcTrack.cxx:61
void setLastLayer(const Int_t lL)
Definition: TMdcTrack.h:48
const Double_t px() const
Definition: TMdcTrack.cxx:53
void setNster(const Int_t ns)
Definition: TMdcTrack.h:45
void setChi2(const Double_t chi)
Definition: TMdcTrack.h:43
void setNlayer(const Int_t nlayer)
Definition: TMdcTrack.h:46
const Int_t trackId() const
Definition: TMdcTrack.h:13
void setNdof(const Int_t ndof)
Definition: TMdcTrack.h:44
void setTrackId(const Int_t trackId)
Definition: TMdcTrack.h:41
void setFirstLayer(const Int_t fL)
Definition: TMdcTrack.h:47
void setErr(const Double_t err[15])
Definition: TMdcTrack.cxx:84
void setStat(const Int_t stat)
Definition: TMdcTrack.h:42
void setHelix(const Double_t helix[5])
Definition: TMdcTrack.cxx:78
_EXTERN_ std::string Event
Definition: EventModel.h:128
#define ns(x)
Definition: xmltok.c:1504

◆ TObjectToDataObject()

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

transformation from root

Implements RootEventBaseCnv.

Definition at line 34 of file MdcTrackCnv.cxx.

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

Friends And Related Function Documentation

◆ CnvFactory< MdcTrackCnv >

friend class CnvFactory< MdcTrackCnv >
friend

Definition at line 9 of file MdcTrackCnv.h.


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