2#define MdcTrackCnv_CXX 1
4#include "GaudiKernel/MsgStream.h"
5#include "GaudiKernel/DataObject.h"
6#include "GaudiKernel/ObjectVector.h"
7#include "TClonesArray.h"
8#include "EventModel/EventModel.h"
9#include "DstEvent/DstEvent.h"
10#include "DstEvent/DstMdcTrack.h"
11#include "RootEventData/TMdcTrack.h"
12#include "RootEventData/TDstEvent.h"
13#include "RootCnvSvc/Dst/DstCnv.h"
14#include "RootCnvSvc/Dst/MdcTrackCnv.h"
15#include "RootCnvSvc/RootAddress.h"
17#include "CLHEP/Matrix/Vector.h"
18#include "CLHEP/Matrix/SymMatrix.h"
19#include "CLHEP/Geometry/Point3D.h"
28 MsgStream log(
msgSvc(),
"MdcTrackCnv");
36 MsgStream log(
msgSvc(),
"MdcTrackCnv");
37 log << MSG::DEBUG <<
"MdcTrackCnv::TObjectToDataObject" << endreq;
38 StatusCode sc=StatusCode::SUCCESS;
42 refpObject=mdcTrackTdsCol;
45 if (!m_mdcTrackCol)
return sc;
46 TIter mdcTrackIter(m_mdcTrackCol);
48 while ((mdcTrackRoot = (
TMdcTrack*)mdcTrackIter.Next())) {
50 int trackId = mdcTrackRoot->
trackId();
51 int charge = mdcTrackRoot->
charge();
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;
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();
72 int nlayer = mdcTrackRoot->
nlayer();
75 for (
int i=0; i<15; i++){
76 err[i] = mdcTrackRoot->
err(i);
84 log<<MSG::INFO<<
"in MdcTrackCnv, mdcTrackRoot.nster "<<
ns<<endreq;
90 log<<MSG::INFO<<
" dstMdcTrack trkid: "<<mdcTrackTds->
trackId()<<endreq;
96 log<<MSG::INFO<<
"dstMdcTrack helix: "<<mdcTrackTds->
helix()<<endreq;
98 mdcTrackTds->
setPxy( pxy );
99 mdcTrackTds->
setPx( px );
100 mdcTrackTds->
setPy( py );
101 mdcTrackTds->
setPz( pz );
102 mdcTrackTds->
setP( p );
104 mdcTrackTds->
setPhi( phi );
105 mdcTrackTds->
setX(
x );
106 mdcTrackTds->
setY( y );
107 mdcTrackTds->
setZ( z );
108 mdcTrackTds->
setR( r );
116 log<<MSG::INFO<<
" dstMdcTrack nster: "<<mdcTrackTds->
nster()<<endreq;
118 mdcTrackTdsCol->push_back(mdcTrackTds);
121 delete m_mdcTrackCol;
123 return StatusCode::SUCCESS;
128 MsgStream log(
msgSvc(),
"MdcTrackCnv");
129 log << MSG::DEBUG <<
"MdcTrackCnv::DataObjectToTObject" << endreq;
130 StatusCode sc=StatusCode::SUCCESS;
133 if (!mdcTrackColTds) {
134 log << MSG::ERROR <<
"Could not downcast to MdcTrackCol" << endreq;
135 return StatusCode::FAILURE;
141 log << MSG::ERROR <<
"Could not get DstEvent in TDS " << endreq;
142 return StatusCode::FAILURE;
146 log << MSG::ERROR <<
"MdcTrackCnv:Could not downcast to TDS DstEvent" << endreq;
148 IOpaqueAddress *addr;
154 if (!m_mdcTrackCol)
return sc;
156 DstMdcTrackCol::const_iterator mdcTrackTds;
158 for (mdcTrackTds = mdcTrackColTds->begin(); mdcTrackTds != mdcTrackColTds->end(); mdcTrackTds++) {
159 Int_t trackId =(*mdcTrackTds)->trackId();
161 for(
int i=0;i<5;i++){
162 helix[i] = (*mdcTrackTds)->helix(i) ;
164 Int_t stat = (*mdcTrackTds)->stat();
165 Double_t chi = (*mdcTrackTds)->chi2();
166 Int_t ndof = (*mdcTrackTds)->ndof();
168 for (Int_t i=0; i<15; i++){
169 err[i] = (*mdcTrackTds)->err(i);
171 Int_t
ns = (*mdcTrackTds)->nster();
172 Int_t fL = (*mdcTrackTds)->firstLayer();
173 Int_t lL = (*mdcTrackTds)->lastLayer();
174 Int_t nlayer = (*mdcTrackTds)->nlayer();
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;
189 mdcTrackRoot->
setErr( err );
198 return StatusCode::SUCCESS;
ObjectVector< DstMdcTrack > DstMdcTrackCol
static TDstEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
void setPxy(const double pxy)
void setTrackId(const int trackId)
void setPy(const double py)
void setZ(const double z)
void setNster(const int ns)
void setX(const double x)
void setError(double err[15])
void setNdof(const int ndof)
void setTheta(const double theta)
void setStat(const int stat)
const int trackId() const
void setNlayer(const int nlayer)
void setP(const double p)
void setHelix(double helix[5])
void setPoca(double poca[3])
void setR(const double r)
void setCharge(const int charge)
const HepVector helix() const
......
void setY(const double y)
void setChi2(const double chi)
void setPhi(const double phi)
void setPz(const double pz)
void setPx(const double px)
virtual StatusCode DataObjectToTObject(DataObject *obj, RootAddress *addr)
transformation to root
virtual StatusCode TObjectToDataObject(DataObject *&obj)
transformation from root
MdcTrackCnv(ISvcLocator *svc)
Definition of a Root address, derived from IOpaqueAddress.
Base class for all Root Converters.
IDataProviderSvc * m_eds
pointer to eventdataservice
std::vector< void * > m_adresses
each converter knows the corresponding adresses
std::string m_rootBranchname
root branchname (may be concatenated of severals)
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.
void clearMdcTrackCol()
clear the whole array (necessary because of the consts-s)
const TObjArray * getMdcTrackCol() const
retrieve the whole TObjArray of MdcTrack Data
const Double_t py() const
const Int_t charge() const
const Double_t pz() const
const Double_t helix(Int_t i) const
const Double_t chi2() const
const Double_t phi() const
void setLastLayer(const Int_t lL)
const Double_t px() const
void setNster(const Int_t ns)
void setChi2(const Double_t chi)
const Double_t theta() const
const Double_t pxy() const
void setNlayer(const Int_t nlayer)
const Int_t nster() const
const Double_t err(Int_t i) const
const Int_t trackId() const
void setNdof(const Int_t ndof)
void setTrackId(const Int_t trackId)
void setFirstLayer(const Int_t fL)
const Int_t nlayer() const
void setErr(const Double_t err[15])
void setStat(const Int_t stat)
void setHelix(const Double_t helix[5])
static std::map< const TObject *, const DstMdcTrack * > m_rootMdcTrackMap
_EXTERN_ std::string Event