45 {
46
47 MsgStream log(
msgSvc(),
"RecMdcTrackCnv");
48 log << MSG::DEBUG << "RecMdcTrackCnv::TObjectToDataObject" << endreq;
49
50
52 refpObject = recMdcTrackCol;
53
54 if (!m_recMdcTrackCol) return StatusCode::SUCCESS;
55 TIter mdcTrackIter(m_recMdcTrackCol);
56
57
58
59
60
61
62
63 IDataProviderSvc* dataSvc = 0;
64 StatusCode sc = serviceLocator()->getService ("EventDataSvc",
65 IDataProviderSvc::interfaceID(), (IInterface*&)dataSvc);
66 if (!sc.isSuccess()) {
67 log << MSG::FATAL << "Could not get EventDataSvc in RecMdcTrackCnv" << endreq;
68 return( StatusCode::FAILURE);
69 }
70 SmartDataPtr<RecMdcHitCol> recMdcHitCol(dataSvc,"/Event/Recon/RecMdcHitCol");
71 if (!recMdcHitCol) {
72 log << MSG::FATAL << "Could not find RecMdcHitCol" << endreq;
73 return( StatusCode::FAILURE);
74 }
75
76
77
78
79
80
81 SmartDataPtr<RecCgemClusterCol> aCgemClusterCol(dataSvc,"/Event/Recon/RecCgemClusterCol");
82 if(!aCgemClusterCol) {
83 log << MSG::FATAL << "Could not find RecCgemClusterCol" << endreq;
84 return( StatusCode::FAILURE);
85 }
86
87 mdcTrackIter = m_recMdcTrackCol;
89 while ((recMdcTrackRoot = (
TRecMdcTrack*)mdcTrackIter.Next())) {
90 int trackId = recMdcTrackRoot->
trackId();
91 int charge = recMdcTrackRoot->
charge();
92 double helix[5];
93 for(int i=0;i<5; i++){
94 helix[i] = recMdcTrackRoot->
helix(i);
95 }
96 double pxy = recMdcTrackRoot->
pxy();
97 double px = recMdcTrackRoot->
px();
98 double py = recMdcTrackRoot->
py();
99 double pz = recMdcTrackRoot->
pz();
100 double p = recMdcTrackRoot->
p();
101 double theta = recMdcTrackRoot->
theta();
102 double phi = recMdcTrackRoot->
phi();
103 double x = recMdcTrackRoot->
x();
104 double y = recMdcTrackRoot->
y();
105 double z = recMdcTrackRoot->
z();
106 double r = recMdcTrackRoot->
r();
107 int stat = recMdcTrackRoot->
stat();
108 double chi = recMdcTrackRoot->
chi2();
109 int ndof = recMdcTrackRoot->
ndof();
110 int nlayer= recMdcTrackRoot->
nlayer();
111
112
113 double err[15];
114 for (int i=0; i<15; i++){
115 err[i] = recMdcTrackRoot->
err(i);
116 }
117 int nh = recMdcTrackRoot->
nhits();
118 int ns = recMdcTrackRoot->
nster();
119
120 double vx0 = recMdcTrackRoot->
vx0();
121 double vy0 = recMdcTrackRoot->
vy0();
122 double vz0 = recMdcTrackRoot->
vz0();
123 double fiterm = recMdcTrackRoot->
fiTerm();
126
130 recMdcTrack->
setPxy( pxy );
131 recMdcTrack->
setPx( px );
132 recMdcTrack->
setPy( py );
133 recMdcTrack->
setPz( pz );
134 recMdcTrack->
setP( p );
136 recMdcTrack->
setPhi( phi );
137 recMdcTrack->
setX( x );
138 recMdcTrack->
setY( y );
139 recMdcTrack->
setZ( z );
140 recMdcTrack->
setR( r );
148
149
150 recMdcTrack->
setVX0( vx0 );
151 recMdcTrack->
setVY0( vy0 );
152 recMdcTrack->
setVZ0( vz0 );
154
155
156
158
159 RecMdcHitCol::iterator
iter = recMdcHitCol->begin();
160 for (;
iter != recMdcHitCol->end();
iter++){
161
162
163 if((*iter)->getTrkId() == trackId){
164 SmartRef<RecMdcHit> refhit(*
iter);
165 theHitRefVec.push_back(refhit);
166 }
167 }
168
170
172
173
174
175 for(int ii=0; ii <nhits ; ii++){
176
177
178
182
183 }
184
185
187 map<int,int> clusterFitStat;
188 vector<Int_t> vecClusterId = recMdcTrackRoot->
vecClusterId();
189 cout<<"recMdcTrackRoot gets a vecClusterId with size "<<vecClusterId.size()<<endl;
190 vector<Int_t>::iterator it_clusterId = vecClusterId.begin();
191 RecCgemClusterCol::iterator iter_cluster=aCgemClusterCol->begin();
192
193 for(; it_clusterId!=vecClusterId.end(); it_clusterId++)
194 {
195
196 iter_cluster=aCgemClusterCol->begin()+(*it_clusterId);
197 if((*iter_cluster)->getclusterid()==(*it_clusterId))
198 {
200 clusterRefVec.push_back(recCgemCluster);
202 clusterFitStat[clusterid] = 1;
203 }
204 else cout<<"wrong clusterRefVec assignment in RecMdcTrackCnv"<<endl;
205 }
206
208
209 recMdcTrackCol->push_back(recMdcTrack);
210 }
211
212 delete m_recMdcTrackCol;
213 m_recMdcTrackCol = 0;
214 return StatusCode::SUCCESS;
215}
SmartRefVector< RecMdcHit > HitRefVec
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)
void setNlayer(const int nlayer)
void setP(const double p)
void setHelix(double helix[5])
void setR(const double r)
void setCharge(const int charge)
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)
static int layer(const Identifier &id)
Values of different levels (failure returns 0)
static int wire(const Identifier &id)
int getclusterid(void) const
const HitRefVec getVecHits(void) const
void setVecClusters(ClusterRefVec vecclusters)
void setVecHits(HitRefVec vechits)
void setFiTerm(double fiterm)
const Double_t phi() const
const Int_t nster() const
const Double_t vz0(void) const
const Int_t nhits() const
const Double_t chi2() const
const Int_t trackId() const
const Double_t vy0(void) const
const Double_t fiTerm(void) const
const Double_t pxy() const
const Double_t err(Int_t i) const
const Double_t theta() const
vector< Int_t > vecClusterId() const
const Int_t nlayer() const
const Int_t charge() const
const Double_t vx0(void) const
const Double_t helix(Int_t i) const
static std::map< const TObject *, const RecMdcTrack * > m_rootRecMdcTrackMap