47 {
48
49 MsgStream log(
msgSvc(),
"RecMdcKalTrackCnv");
50 log << MSG::DEBUG << "RecMdcKalTrackCnv::TObjectToDataObject" << endreq;
51 StatusCode sc = StatusCode::SUCCESS;
52
53
55 refpObject = recMdcKalTrackCol;
56
57
58 if (!m_recMdcKalTrackCol) return sc;
59 TIter recMdcKalTrackIter(m_recMdcKalTrackCol);
60
61 IDataProviderSvc* dataSvc = 0;
62 sc = serviceLocator()->getService ("EventDataSvc",
63 IDataProviderSvc::interfaceID(), (IInterface*&)dataSvc);
64 if (!sc.isSuccess()) {
65 log << MSG::FATAL << "Could not get EventDataSvc in RecMdcTrackCnv" << endreq;
66 return( StatusCode::FAILURE);
67 }
68 SmartDataPtr<RecMdcKalHelixSegCol> recMdcKalHelixSegCol(dataSvc,"/Event/Recon/RecMdcKalHelixSegCol");
69 if (!recMdcKalHelixSegCol) {
70 log << MSG::FATAL << "Could not find RecMdcKalHelixSegCol" << endreq;
71 return( StatusCode::FAILURE);
72 }
73
75 while ((recMdcKalTrackRoot = (
TRecMdcKalTrack*)recMdcKalTrackIter.Next())) {
76
77 std::vector<HepVector> zhelixs;
78 std::vector<HepSymMatrix> zerrors;
79 std::vector<HepVector> fhelixs;
80 std::vector<HepSymMatrix> ferrors;
81 std::vector<HepVector> lhelixs;
82 std::vector<HepSymMatrix> lerrors;
83 std::vector<HepPoint3D> pocas;
84 std::vector<HepPoint3D> lpivots;
85 std::vector<HepPoint3D> lpoints;
86
87
88 HepVector zhelix(5);
89 HepSymMatrix zerror(5);
90 HepVector fhelix(5);
91 HepSymMatrix ferror(5);
92 HepVector lhelix(5);
93 HepSymMatrix lerror(5);
94 HepVector thelix(5);
95 HepSymMatrix terror(5);
99
100
101 HepVector zhelix_e(5);
102 HepSymMatrix zerror_e(5);
103 HepVector fhelix_e(5);
104 HepSymMatrix ferror_e(5);
105 HepVector lhelix_e(5);
106 HepSymMatrix lerror_e(5);
110
111
112 HepVector zhelix_mu(5);
113 HepSymMatrix zerror_mu(5);
114 HepVector fhelix_mu(5);
115 HepSymMatrix ferror_mu(5);
116 HepVector lhelix_mu(5);
117 HepSymMatrix lerror_mu(5);
121
122
123 HepVector zhelix_k(5);
124 HepSymMatrix zerror_k(5);
125 HepVector fhelix_k(5);
126 HepSymMatrix ferror_k(5);
127 HepVector lhelix_k(5);
128 HepSymMatrix lerror_k(5);
132
133
134 HepVector zhelix_p(5);
135 HepSymMatrix zerror_p(5);
136 HepVector fhelix_p(5);
137 HepSymMatrix ferror_p(5);
138 HepVector lhelix_p(5);
139 HepSymMatrix lerror_p(5);
143
144
145 int stat[2][5];
146 double chisq[2][5];
147 int ndf[2][5];
148
150 double length[5];
151 double tof[5];
153 int nlayer[5];
154 int trackId;
155 double pathSM[5];
156 double fiTerm[5];
157
158
159
161
162
163
165
167
168 for (int u=0; u<5; u++){
170 length[u] = recMdcKalTrackRoot->
getLength(u);
171 tof[u] = recMdcKalTrackRoot->
getTof(u);
173 fiTerm[u]=recMdcKalTrackRoot->
getfiTerm(u);
174 pathSM[u]=recMdcKalTrackRoot->
getPathSM(u);
175 nlayer[u]=recMdcKalTrackRoot->
getNlayer(u);
176
178 recMdcKalTrackTds->
setLength(length[u],u);
179 recMdcKalTrackTds->
setTof(tof[u],u);
181 recMdcKalTrackTds->
setFiTerm(fiTerm[u],u);
182 recMdcKalTrackTds->
setPathSM(pathSM[u],u);
183 recMdcKalTrackTds->
setNlayer(nlayer[u],u);
184 }
185
186
187 for(
int v=0;
v<3;
v++){
190 poca[
v] = recMdcKalTrackRoot->
getPoca(
v);
203
204
205
206
207 }
208
209 for (int i=0, k=0; i<5; i++){
210 zhelix[i] = recMdcKalTrackRoot->
getZHelix(i);
211 zhelix_e[i] = recMdcKalTrackRoot->
getZHelixE(i);
213 zhelix_k[i] = recMdcKalTrackRoot->
getZHelixK(i);
214 zhelix_p[i] = recMdcKalTrackRoot->
getZHelixP(i);
215
216
217 fhelix[i] = recMdcKalTrackRoot->
getFHelix(i);
218 fhelix_e[i] = recMdcKalTrackRoot->
getFHelixE(i);
220 fhelix_k[i] = recMdcKalTrackRoot->
getFHelixK(i);
221 fhelix_p[i] = recMdcKalTrackRoot->
getFHelixP(i);
222
223 lhelix[i] = recMdcKalTrackRoot->
getLHelix(i);
224 lhelix_e[i] = recMdcKalTrackRoot->
getLHelixE(i);
226 lhelix_k[i] = recMdcKalTrackRoot->
getLHelixK(i);
227 lhelix_p[i] = recMdcKalTrackRoot->
getLHelixP(i);
228
229 thelix[i] = recMdcKalTrackRoot->
getTHelix(i);
230
231 for (int j=0; j<=i; j++){
232
233 zerror[i][j] = recMdcKalTrackRoot->
getZError(i,j);
234 zerror_e[i][j] = recMdcKalTrackRoot->
getZErrorE(i,j);
235 zerror_mu[i][j] = recMdcKalTrackRoot->
getZErrorMu(i,j);
236 zerror_k[i][j] = recMdcKalTrackRoot->
getZErrorK(i,j);
237 zerror_p[i][j] = recMdcKalTrackRoot->
getZErrorP(i,j);
238 zerror[j][i] = zerror[i][j];
239 zerror_e[j][i] = zerror_e[i][j];
240 zerror_mu[j][i] = zerror_mu[i][j];
241 zerror_k[j][i] = zerror_k[i][j];
242 zerror_p[j][i] = zerror_p[i][j];
243
244 ferror[i][j] = recMdcKalTrackRoot->
getFError(i,j);
245 ferror_e[i][j] = recMdcKalTrackRoot->
getFErrorE(i,j);
246 ferror_mu[i][j] = recMdcKalTrackRoot->
getFErrorMu(i,j);
247 ferror_k[i][j] = recMdcKalTrackRoot->
getFErrorK(i,j);
248 ferror_p[i][j] = recMdcKalTrackRoot->
getFErrorP(i,j);
249 ferror[j][i] = ferror[i][j];
250 ferror_e[j][i] = ferror_e[i][j];
251 ferror_mu[j][i] = ferror_mu[i][j];
252 ferror_k[j][i] = ferror_k[i][j];
253 ferror_p[j][i] = ferror_p[i][j];
254
255 lerror[i][j] = recMdcKalTrackRoot->
getLError(i,j);
256 lerror_e[i][j] = recMdcKalTrackRoot->
getLErrorE(i,j);
257 lerror_mu[i][j] = recMdcKalTrackRoot->
getLErrorMu(i,j);
258 lerror_k[i][j] = recMdcKalTrackRoot->
getLErrorK(i,j);
259 lerror_p[i][j] = recMdcKalTrackRoot->
getLErrorP(i,j);
260 lerror[j][i] = lerror[i][j];
261 lerror_e[j][i] = lerror_e[i][j];
262 lerror_mu[j][i] = lerror_mu[i][j];
263 lerror_k[j][i] = lerror_k[i][j];
264 lerror_p[j][i] = lerror_p[i][j];
265
266 terror[i][j] = recMdcKalTrackRoot->
getTError(k++);
267 terror[j][i] = terror[i][j];
268
269 }
270 }
271
272
273
274
275
276
277
278 zhelixs.push_back(zhelix_e);
279 zhelixs.push_back(zhelix_mu);
280 zhelixs.push_back(zhelix);
281 zhelixs.push_back(zhelix_k);
282 zhelixs.push_back(zhelix_p);
283 zerrors.push_back(zerror_e);
284 zerrors.push_back(zerror_mu);
285 zerrors.push_back(zerror);
286 zerrors.push_back(zerror_k);
287 zerrors.push_back(zerror_p);
288
289 fhelixs.push_back(fhelix_e);
290 fhelixs.push_back(fhelix_mu);
291 fhelixs.push_back(fhelix);
292 fhelixs.push_back(fhelix_k);
293 fhelixs.push_back(fhelix_p);
294 ferrors.push_back(ferror_e);
295 ferrors.push_back(ferror_mu);
296 ferrors.push_back(ferror);
297 ferrors.push_back(ferror_k);
298 ferrors.push_back(ferror_p);
299
300 lhelixs.push_back(lhelix_e);
301 lhelixs.push_back(lhelix_mu);
302 lhelixs.push_back(lhelix);
303 lhelixs.push_back(lhelix_k);
304 lhelixs.push_back(lhelix_p);
305 lerrors.push_back(lerror_e);
306 lerrors.push_back(lerror_mu);
307 lerrors.push_back(lerror);
308 lerrors.push_back(lerror_k);
309 lerrors.push_back(lerror_p);
310
311
312 pocas.push_back(poca_e);
313 pocas.push_back(poca_mu);
314 pocas.push_back(poca);
315 pocas.push_back(poca_k);
316 pocas.push_back(poca_p);
317 lpivots.push_back(lpivot_e);
318 lpivots.push_back(lpivot_mu);
319 lpivots.push_back(lpivot);
320 lpivots.push_back(lpivot_k);
321 lpivots.push_back(lpivot_p);
322 lpoints.push_back(lpoint_e);
323 lpoints.push_back(lpoint_mu);
324 lpoints.push_back(lpoint);
325 lpoints.push_back(lpoint_k);
326 lpoints.push_back(lpoint_p);
327
328 for(int m=0; m<5; m++){
330 double pxy(0.),px(0.),py(0.),pz(0.),ptot(0.),dr(0.),phi0(0.),kappa(0.),dz(0.),tanl(0.),
x(0.),
y(0.),z(0.),vx0(0.),vy0(0.),vz0(0.);
331 dr = zhelixs[m][0];
332 phi0 = zhelixs[m][1];
333 kappa = zhelixs[m][2];
334 dz = zhelixs[m][3];
335 tanl = zhelixs[m][4];
336
337
338
339
342 z = dz;
343
344
345 if (kappa > 0.0000000001)
347 else if (kappa < -0.0000000001)
349 else
351
352 if(kappa!=0) pxy = 1.0/fabs(kappa);
353 else pxy = 0;
354
355 px = pxy * (-
sin(phi0));
356 py = pxy *
cos(phi0);
357 pz = pxy * tanl;
358 ptot = sqrt(px*px+py*py+pz*pz);
359
361 recMdcKalTrackTds->
setPxy(pxy,m);
362 recMdcKalTrackTds->
setPx(px,m);
363 recMdcKalTrackTds->
setPy(py,m);
364 recMdcKalTrackTds->
setPz(pz,m);
365 recMdcKalTrackTds->
setP(ptot,m);
366 recMdcKalTrackTds->
setTheta(acos(pz/ptot),m);
367 recMdcKalTrackTds->
setPhi(atan2(py,px),m);
368 recMdcKalTrackTds->
setX(x,m);
369 recMdcKalTrackTds->
setY(
y,m);
370 recMdcKalTrackTds->
setZ(z,m);
371 recMdcKalTrackTds->
setR(sqrt(x*x+
y*
y),m);
372
373
374 for(
int n=0;
n<2;
n++){
375 int stat = recMdcKalTrackRoot->
getStat(
n,m);
376 int chisq = recMdcKalTrackRoot->
getChisq(
n,m);
377 int ndf = recMdcKalTrackRoot->
getNdf(
n,m);
378 recMdcKalTrackTds->
setStat(stat,
n,m);
380 recMdcKalTrackTds->
setNdf(ndf,
n,m);
381 }
382 }
383
384
385
386
387
388 for(int jj=0; jj<5; jj++){
389
390
391
392 recMdcKalTrackTds->
setZHelix(zhelixs[jj],jj);
393
394
395 recMdcKalTrackTds->
setZError(zerrors[jj],jj);
396 recMdcKalTrackTds->
setFHelix(fhelixs[jj],jj);
397 recMdcKalTrackTds->
setFError(ferrors[jj],jj);
398
399
400 recMdcKalTrackTds->
setLHelix(lhelixs[jj],jj);
401 recMdcKalTrackTds->
setLError(lerrors[jj],jj);
402 recMdcKalTrackTds->
setPoca(pocas[jj],jj);
403
404
405 recMdcKalTrackTds->
setLPoint(lpoints[jj],jj);
406 recMdcKalTrackTds->
setLPivot(lpivots[jj],jj);
407 }
410
411
412
413
414 log<<MSG::DEBUG<<"T to REC TDS, zhelix: "<<zhelix<<endreq;
415 log<<MSG::DEBUG<<"T to REC TDS, zerror: "<<zerror<<endreq;
416
418
419 int nSegTot=0;
420 for(int i=0; i<5; i++) {
422
423 int nSeg=recMdcKalTrackRoot->
getNseg(i);
424 int iSeg=0;
425 RecMdcKalHelixSegCol::iterator
iter = recMdcKalHelixSegCol->begin();
426 for (;
iter != recMdcKalHelixSegCol->end();
iter++){
427
428
429 if((*iter)->getTrackId() == trackId){
430 if(iSeg>=nSegTot&&iSeg<nSeg+nSegTot) {
431 SmartRef<RecMdcKalHelixSeg> refhit(*
iter);
432 theKalHelixSegRefVec.push_back(refhit);
433 }
434 iSeg++;
435 }
436 }
437 nSegTot+=nSeg;
438
440 }
441
443
444
445
446 for(int ii=0; ii <nhelixsegs ; ii++){
447
448
449
453
454 }
455
456 recMdcKalTrackCol->push_back(recMdcKalTrackTds);
457
458 }
459
460 delete m_recMdcKalTrackCol;
461
462 m_recMdcKalTrackCol = 0;
463
464 return StatusCode::SUCCESS;
465}
double sin(const BesAngle a)
double cos(const BesAngle a)
SmartRefVector< RecMdcKalHelixSeg > HelixSegRefVec
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
void setFHelix(const HepVector &fhelix, const int pid)
void setPhi(const double phi, const int pid)
void setStat(int stat, int i, int pid)
void setY(const double y, const int pid)
void setPz(const double pz, const int pid)
void setChisq(double chisq, int i, int pid)
void setZError(const HepSymMatrix &error, const int pid)
void setX(const double x, const int pid)
void setP(const double p, const int pid)
void setPoca(const HepPoint3D &poca, const int pid)
void setPx(const double px, const int pid)
void setZ(const double z, const int pid)
void setTheta(const double theta, const int pid)
void setR(const double r, const int pid)
void setPxy(const double pxy, const int pid)
void setPy(const double py, const int pid)
void setFError(const HepSymMatrix &ferror, const int pid)
void setTrackId(int trackId)
void setZHelix(const HepVector &helix, const int pid)
void setCharge(const int charge, const int pid)
void setNdf(int ndf, int i, int pid)
void setNlayer(int nlayer, int pid)
static int layer(const Identifier &id)
Values of different levels (failure returns 0)
static int wire(const Identifier &id)
void setLHelix(const HepVector &helix, const int pid)
void setFiTerm(double fi, const int pid)
void setPathSM(double length, int pid)
void setLength(double length, int pid)
void setTError(const HepSymMatrix &error)
void setMass(double mass, int pid)
HelixSegRefVec getVecHelixSegs(int pid=-1) const
void setTHelix(const HepVector &helix)
void setVecHelixSegs(const HelixSegRefVec &vechelixsegs, int pid=-1)
void setLError(const HepSymMatrix &error, const int pid)
void setLPoint(const HepPoint3D &point, const int pid)
void setLPivot(const HepPoint3D &pivot, const int pid)
void setTof(double tof, int pid)
void setNhits(int nhits, int pid)
const Double_t getFError(Int_t i, Int_t j) const
const Double_t getLHelix(Int_t i) const
const Double_t getFErrorK(Int_t i, Int_t j) const
const Double_t getTof(Int_t pid) const
const Double_t getLHelixMu(Int_t i) const
const Double_t getZHelixE(Int_t i) const
const Double_t getPoca(Int_t i) const
const Double_t getFErrorP(Int_t i, Int_t j) const
const Double_t getZErrorP(Int_t i, Int_t j) const
const Int_t getNdf(Int_t i, Int_t pid) const
const Double_t getFHelixMu(Int_t i) const
const Int_t getTrackId() const
const Double_t getLPivotE(Int_t i) const
const Double_t getLPivotP(Int_t i) const
const Double_t getFHelix(Int_t i) const
const Double_t getZError(Int_t i, Int_t j) const
const Double_t getLength(Int_t pid) const
const Double_t getFErrorMu(Int_t i, Int_t j) const
const Double_t getFErrorE(Int_t i, Int_t j) const
const Double_t getLPointK(Int_t i) const
const Double_t getChisq(Int_t i, Int_t pid) const
const Double_t getMass(Int_t pid) const
const Double_t getPocaMu(Int_t i) const
const Double_t getLHelixK(Int_t i) const
const Double_t getTError(Int_t i) const
const Double_t getLPointMu(Int_t i) const
const Double_t getZErrorMu(Int_t i, Int_t j) const
const Double_t getFHelixK(Int_t i) const
const Double_t getLError(Int_t i, Int_t j) const
const Double_t getLHelixE(Int_t i) const
const Double_t getLErrorP(Int_t i, Int_t j) const
const Double_t getLErrorMu(Int_t i, Int_t j) const
const Int_t getNhits(Int_t pid) const
const Double_t getFHelixE(Int_t i) const
const Double_t getLPointE(Int_t i) const
const Double_t getZHelixK(Int_t i) const
const Double_t getfiTerm(Int_t pid) const
const Double_t getTHelix(Int_t i) const
const Double_t getLErrorE(Int_t i, Int_t j) const
const Double_t getLPivot(Int_t i) const
const Double_t getPocaK(Int_t i) const
const Double_t getLHelixP(Int_t i) const
const Int_t getStat(Int_t i, Int_t pid) const
const Double_t getLPoint(Int_t i) const
const Double_t getZErrorK(Int_t i, Int_t j) const
const Double_t getZHelixMu(Int_t i) const
const Double_t getLPivotK(Int_t i) const
const Int_t getNseg(Int_t pid) const
const Double_t getPathSM(Int_t pid) const
const Int_t getNlayer(Int_t pid) const
const Double_t getZHelixP(Int_t i) const
const Double_t getPocaE(Int_t i) const
const Double_t getPocaP(Int_t i) const
const Double_t getZErrorE(Int_t i, Int_t j) const
const Double_t getLPivotMu(Int_t i) const
const Double_t getFHelixP(Int_t i) const
const Double_t getLErrorK(Int_t i, Int_t j) const
const Double_t getLPointP(Int_t i) const
static std::map< const TObject *, const RecMdcKalTrack * > m_rootRecMdcKalTrackMap