22 |
image = -1; |
image = -1; |
23 |
chi2 = 0; |
chi2 = 0; |
24 |
for(int it1=0;it1<5;it1++){ |
for(int it1=0;it1<5;it1++){ |
25 |
al[it1] = 0; |
al[it1] = 0; |
26 |
for(int it2=0;it2<5;it2++) |
for(int it2=0;it2<5;it2++)coval[it1][it2] = 0; |
|
coval[it1][it2] = 0; |
|
27 |
}; |
}; |
28 |
for(int ip=0;ip<6;ip++){ |
for(int ip=0;ip<6;ip++){ |
29 |
xgood[ip] = 0; |
xgood[ip] = 0; |
30 |
ygood[ip] = 0; |
ygood[ip] = 0; |
31 |
xm[ip] = 0; |
xm[ip] = 0; |
32 |
ym[ip] = 0; |
ym[ip] = 0; |
33 |
zm[ip] = 0; |
zm[ip] = 0; |
34 |
resx[ip] = 0; |
resx[ip] = 0; |
35 |
resy[ip] = 0; |
resy[ip] = 0; |
36 |
xv[ip] = 0; |
xv[ip] = 0; |
37 |
yv[ip] = 0; |
yv[ip] = 0; |
38 |
zv[ip] = 0; |
zv[ip] = 0; |
39 |
axv[ip] = 0; |
axv[ip] = 0; |
40 |
ayv[ip] = 0; |
ayv[ip] = 0; |
41 |
dedx_x[ip] = 0; |
dedx_x[ip] = 0; |
42 |
dedx_y[ip] = 0; |
dedx_y[ip] = 0; |
43 |
}; |
// clx[ip] = 0; |
44 |
|
// cly[ip] = 0; |
45 |
|
}; |
46 |
|
clx = new TRefArray(6,0); |
47 |
|
cly = new TRefArray(6,0); |
48 |
}; |
}; |
49 |
//-------------------------------------- |
//-------------------------------------- |
50 |
// |
// |
55 |
image = t.image; |
image = t.image; |
56 |
chi2 = t.chi2; |
chi2 = t.chi2; |
57 |
for(int it1=0;it1<5;it1++){ |
for(int it1=0;it1<5;it1++){ |
58 |
al[it1] = t.al[it1]; |
al[it1] = t.al[it1]; |
59 |
for(int it2=0;it2<5;it2++) |
for(int it2=0;it2<5;it2++)coval[it1][it2] = t.coval[it1][it2]; |
|
coval[it1][it2] = t.coval[it1][it2]; |
|
60 |
}; |
}; |
61 |
for(int ip=0;ip<6;ip++){ |
for(int ip=0;ip<6;ip++){ |
62 |
xgood[ip] = t.xgood[ip]; |
xgood[ip] = t.xgood[ip]; |
63 |
ygood[ip] = t.ygood[ip]; |
ygood[ip] = t.ygood[ip]; |
64 |
xm[ip] = t.xm[ip]; |
xm[ip] = t.xm[ip]; |
65 |
ym[ip] = t.ym[ip]; |
ym[ip] = t.ym[ip]; |
66 |
zm[ip] = t.zm[ip]; |
zm[ip] = t.zm[ip]; |
67 |
resx[ip] = t.resx[ip]; |
resx[ip] = t.resx[ip]; |
68 |
resy[ip] = t.resy[ip]; |
resy[ip] = t.resy[ip]; |
69 |
xv[ip] = t.xv[ip]; |
xv[ip] = t.xv[ip]; |
70 |
yv[ip] = t.yv[ip]; |
yv[ip] = t.yv[ip]; |
71 |
zv[ip] = t.zv[ip]; |
zv[ip] = t.zv[ip]; |
72 |
axv[ip] = t.axv[ip]; |
axv[ip] = t.axv[ip]; |
73 |
ayv[ip] = t.ayv[ip]; |
ayv[ip] = t.ayv[ip]; |
74 |
dedx_x[ip] = t.dedx_x[ip]; |
dedx_x[ip] = t.dedx_x[ip]; |
75 |
dedx_y[ip] = t.dedx_y[ip]; |
dedx_y[ip] = t.dedx_y[ip]; |
76 |
}; |
// clx[ip] = 0;//<<<<pointer |
77 |
|
// cly[ip] = 0;//<<<<pointer |
78 |
|
}; |
79 |
|
clx = new TRefArray(*(t.clx)); |
80 |
|
cly = new TRefArray(*(t.cly)); |
81 |
|
|
82 |
}; |
}; |
83 |
//-------------------------------------- |
//-------------------------------------- |
84 |
// |
// |
213 |
coord[0] = 0; |
coord[0] = 0; |
214 |
coord[1] = 0; |
coord[1] = 0; |
215 |
sgnl = 0; |
sgnl = 0; |
216 |
|
cls = 0; |
217 |
}; |
}; |
218 |
//-------------------------------------- |
//-------------------------------------- |
219 |
// |
// |
224 |
coord[0] = s.coord[0]; |
coord[0] = s.coord[0]; |
225 |
coord[1] = s.coord[1]; |
coord[1] = s.coord[1]; |
226 |
sgnl = s.sgnl; |
sgnl = s.sgnl; |
227 |
|
// cls = 0;//<<<<pointer |
228 |
|
cls = TRef(s.cls); |
229 |
}; |
}; |
230 |
//-------------------------------------- |
//-------------------------------------- |
231 |
// |
// |
296 |
// *** TRACKS *** |
// *** TRACKS *** |
297 |
TClonesArray &t = *Track; |
TClonesArray &t = *Track; |
298 |
for(int i=0; i<l2->ntrk; i++){ |
for(int i=0; i<l2->ntrk; i++){ |
299 |
t_track->seqno = i; |
t_track->seqno = i;// NBNBNBNB deve sempre essere = i |
300 |
t_track->image = l2->image[i]-1; |
t_track->image = l2->image[i]-1; |
301 |
// cout << "track "<<i<<t_track->seqno << t_track->image<<endl; |
// cout << "track "<<i<<t_track->seqno << t_track->image<<endl; |
302 |
t_track->chi2 = l2->chi2_nt[i]; |
t_track->chi2 = l2->chi2_nt[i]; |
303 |
for(int it1=0;it1<5;it1++){ |
for(int it1=0;it1<5;it1++){ |
304 |
t_track->al[it1] = l2->al_nt[i][it1]; |
t_track->al[it1] = l2->al_nt[i][it1]; |
305 |
for(int it2=0;it2<5;it2++) |
for(int it2=0;it2<5;it2++) |
306 |
t_track->coval[it1][it2] = l2->coval[i][it2][it1]; |
t_track->coval[it1][it2] = l2->coval[i][it2][it1]; |
307 |
}; |
}; |
308 |
for(int ip=0;ip<6;ip++){ |
for(int ip=0;ip<6;ip++){ |
309 |
t_track->xgood[ip] = l2->xgood_nt[i][ip]; |
t_track->xgood[ip] = l2->xgood_nt[i][ip]; |
310 |
t_track->ygood[ip] = l2->ygood_nt[i][ip]; |
t_track->ygood[ip] = l2->ygood_nt[i][ip]; |
311 |
t_track->xm[ip] = l2->xm_nt[i][ip]; |
t_track->xm[ip] = l2->xm_nt[i][ip]; |
312 |
t_track->ym[ip] = l2->ym_nt[i][ip]; |
t_track->ym[ip] = l2->ym_nt[i][ip]; |
313 |
t_track->zm[ip] = l2->zm_nt[i][ip]; |
t_track->zm[ip] = l2->zm_nt[i][ip]; |
314 |
t_track->resx[ip] = l2->resx_nt[i][ip]; |
t_track->resx[ip] = l2->resx_nt[i][ip]; |
315 |
t_track->resy[ip] = l2->resy_nt[i][ip]; |
t_track->resy[ip] = l2->resy_nt[i][ip]; |
316 |
t_track->xv[ip] = l2->xv_nt[i][ip]; |
t_track->xv[ip] = l2->xv_nt[i][ip]; |
317 |
t_track->yv[ip] = l2->yv_nt[i][ip]; |
t_track->yv[ip] = l2->yv_nt[i][ip]; |
318 |
t_track->zv[ip] = l2->zv_nt[i][ip]; |
t_track->zv[ip] = l2->zv_nt[i][ip]; |
319 |
t_track->axv[ip] = l2->axv_nt[i][ip]; |
t_track->axv[ip] = l2->axv_nt[i][ip]; |
320 |
t_track->ayv[ip] = l2->ayv_nt[i][ip]; |
t_track->ayv[ip] = l2->ayv_nt[i][ip]; |
321 |
t_track->dedx_x[ip] = l2->dedx_x[i][ip]; |
t_track->dedx_x[ip] = l2->dedx_x[i][ip]; |
322 |
t_track->dedx_y[ip] = l2->dedx_y[i][ip]; |
t_track->dedx_y[ip] = l2->dedx_y[i][ip]; |
323 |
}; |
// t_track->clx[ip] = 0; |
324 |
new(t[i]) TrkTrack(*t_track); |
// t_track->cly[ip] = 0; |
325 |
t_track->Clear(); |
}; |
326 |
|
new(t[i]) TrkTrack(*t_track); |
327 |
|
t_track->Clear(); |
328 |
}; |
}; |
329 |
// *** SINGLETS *** |
// *** SINGLETS *** |
330 |
TClonesArray &sx = *SingletX; |
TClonesArray &sx = *SingletX; |
331 |
for(int i=0; i<l2->nclsx; i++){ |
for(int i=0; i<l2->nclsx; i++){ |
332 |
t_singlet->plane = l2->planex[i]; |
t_singlet->plane = l2->planex[i]; |
333 |
t_singlet->coord[0] = l2->xs[i][0]; |
t_singlet->coord[0] = l2->xs[i][0]; |
334 |
t_singlet->coord[1] = l2->xs[i][1]; |
t_singlet->coord[1] = l2->xs[i][1]; |
335 |
t_singlet->sgnl = l2->signlxs[i]; |
t_singlet->sgnl = l2->signlxs[i]; |
336 |
new(sx[i]) TrkSinglet(*t_singlet); |
// t_singlet->cls = 0; |
337 |
t_singlet->Clear(); |
new(sx[i]) TrkSinglet(*t_singlet); |
338 |
|
t_singlet->Clear(); |
339 |
} |
} |
340 |
TClonesArray &sy = *SingletY; |
TClonesArray &sy = *SingletY; |
341 |
for(int i=0; i<l2->nclsy; i++){ |
for(int i=0; i<l2->nclsy; i++){ |
342 |
t_singlet->plane = l2->planey[i]; |
t_singlet->plane = l2->planey[i]; |
343 |
t_singlet->coord[0] = l2->ys[i][0]; |
t_singlet->coord[0] = l2->ys[i][0]; |
344 |
t_singlet->coord[1] = l2->ys[i][1]; |
t_singlet->coord[1] = l2->ys[i][1]; |
345 |
t_singlet->sgnl = l2->signlys[i]; |
t_singlet->sgnl = l2->signlys[i]; |
346 |
new(sy[i]) TrkSinglet(*t_singlet); |
// t_singlet->cls = 0; |
347 |
t_singlet->Clear(); |
new(sy[i]) TrkSinglet(*t_singlet); |
348 |
|
t_singlet->Clear(); |
349 |
|
}; |
350 |
|
|
351 |
|
delete t_track; |
352 |
|
delete t_singlet; |
353 |
|
} |
354 |
|
//-------------------------------------- |
355 |
|
// |
356 |
|
// |
357 |
|
//-------------------------------------- |
358 |
|
/** |
359 |
|
* Fills a TrkLevel2 object with values from a struct cTrkLevel2 (to get data from F77 common). |
360 |
|
* Ref to Level1 data (clusters) is also set. |
361 |
|
*/ |
362 |
|
void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2, TrkLevel1 *l1){ |
363 |
|
|
364 |
|
// temporary objects: |
365 |
|
TrkSinglet* t_singlet = new TrkSinglet(); |
366 |
|
TrkTrack* t_track = new TrkTrack(); |
367 |
|
// general variables |
368 |
|
good2 = l2->good2; |
369 |
|
for(Int_t i=0; i<12 ; i++){ |
370 |
|
crc[i] = l2->crc[i]; |
371 |
|
}; |
372 |
|
// *** TRACKS *** |
373 |
|
TClonesArray &t = *Track; |
374 |
|
for(int i=0; i<l2->ntrk; i++){ |
375 |
|
t_track->seqno = i;// NBNBNBNB deve sempre essere = i |
376 |
|
t_track->image = l2->image[i]-1; |
377 |
|
// cout << "track "<<i<<t_track->seqno << t_track->image<<endl; |
378 |
|
t_track->chi2 = l2->chi2_nt[i]; |
379 |
|
for(int it1=0;it1<5;it1++){ |
380 |
|
t_track->al[it1] = l2->al_nt[i][it1]; |
381 |
|
for(int it2=0;it2<5;it2++) |
382 |
|
t_track->coval[it1][it2] = l2->coval[i][it2][it1]; |
383 |
|
}; |
384 |
|
for(int ip=0;ip<6;ip++){ |
385 |
|
t_track->xgood[ip] = l2->xgood_nt[i][ip]; |
386 |
|
t_track->ygood[ip] = l2->ygood_nt[i][ip]; |
387 |
|
t_track->xm[ip] = l2->xm_nt[i][ip]; |
388 |
|
t_track->ym[ip] = l2->ym_nt[i][ip]; |
389 |
|
t_track->zm[ip] = l2->zm_nt[i][ip]; |
390 |
|
t_track->resx[ip] = l2->resx_nt[i][ip]; |
391 |
|
t_track->resy[ip] = l2->resy_nt[i][ip]; |
392 |
|
t_track->xv[ip] = l2->xv_nt[i][ip]; |
393 |
|
t_track->yv[ip] = l2->yv_nt[i][ip]; |
394 |
|
t_track->zv[ip] = l2->zv_nt[i][ip]; |
395 |
|
t_track->axv[ip] = l2->axv_nt[i][ip]; |
396 |
|
t_track->ayv[ip] = l2->ayv_nt[i][ip]; |
397 |
|
t_track->dedx_x[ip] = l2->dedx_x[i][ip]; |
398 |
|
t_track->dedx_y[ip] = l2->dedx_y[i][ip]; |
399 |
|
// cout << "traccia "<<i<<" -- "<< ip << " "<< l2->cltrx[i][ip] <<" "<< l2->cltry[i][ip] <<" "<< t_track->xgood[ip] << t_track->ygood[ip]<<endl; |
400 |
|
//----------------------------------------------------- |
401 |
|
// t_track->clx[ip] = l1->GetCluster(l2->cltrx[i][ip]-1); |
402 |
|
// t_track->cly[ip] = l1->GetCluster(l2->cltry[i][ip]-1); |
403 |
|
if(t_track->xgood[ip])t_track->clx->AddAt(l1->GetCluster(l2->cltrx[i][ip]-1),ip); |
404 |
|
if(t_track->ygood[ip])t_track->cly->AddAt(l1->GetCluster(l2->cltry[i][ip]-1),ip); |
405 |
|
//----------------------------------------------------- |
406 |
|
}; |
407 |
|
new(t[i]) TrkTrack(*t_track); |
408 |
|
t_track->Clear(); |
409 |
|
}; |
410 |
|
// *** SINGLETS *** |
411 |
|
TClonesArray &sx = *SingletX; |
412 |
|
for(int i=0; i<l2->nclsx; i++){ |
413 |
|
t_singlet->plane = l2->planex[i]; |
414 |
|
t_singlet->coord[0] = l2->xs[i][0]; |
415 |
|
t_singlet->coord[1] = l2->xs[i][1]; |
416 |
|
t_singlet->sgnl = l2->signlxs[i]; |
417 |
|
//----------------------------------------------------- |
418 |
|
// cout << "singolo x "<<i<<" -- "<< l2->clsx[i] <<endl; |
419 |
|
t_singlet->cls = l1->GetCluster(l2->clsx[i]-1); |
420 |
|
//----------------------------------------------------- |
421 |
|
new(sx[i]) TrkSinglet(*t_singlet); |
422 |
|
t_singlet->Clear(); |
423 |
|
} |
424 |
|
TClonesArray &sy = *SingletY; |
425 |
|
for(int i=0; i<l2->nclsy; i++){ |
426 |
|
t_singlet->plane = l2->planey[i]; |
427 |
|
t_singlet->coord[0] = l2->ys[i][0]; |
428 |
|
t_singlet->coord[1] = l2->ys[i][1]; |
429 |
|
t_singlet->sgnl = l2->signlys[i]; |
430 |
|
//----------------------------------------------------- |
431 |
|
// cout << "singolo y "<<i<<" -- "<< l2->clsy[i] <<endl; |
432 |
|
t_singlet->cls = l1->GetCluster(l2->clsy[i]-1); |
433 |
|
//----------------------------------------------------- |
434 |
|
new(sy[i]) TrkSinglet(*t_singlet); |
435 |
|
t_singlet->Clear(); |
436 |
}; |
}; |
437 |
|
|
438 |
delete t_track; |
delete t_track; |
623 |
while(N != 0){ |
while(N != 0){ |
624 |
int nfit =0; |
int nfit =0; |
625 |
float chi2ref = numeric_limits<float>::max(); |
float chi2ref = numeric_limits<float>::max(); |
626 |
|
|
627 |
// first loop to search maximum num. of fit points |
// first loop to search maximum num. of fit points |
628 |
for(int i=0; i < ntrk(); i++){ |
for(int i=0; i < ntrk(); i++){ |
|
// if(N==ntrk())cout << "** "<<i<< " " << ((TrkTrack *)t[i])->GetImageSeqNo()<< " " <<((TrkTrack *)t[i])->GetNtot() << " " <<((TrkTrack *)t[i])->chi2 << endl; |
|
629 |
if( ((TrkTrack *)t[i])->GetNtot() >= nfit && m[i]==1){ |
if( ((TrkTrack *)t[i])->GetNtot() >= nfit && m[i]==1){ |
630 |
nfit = ((TrkTrack *)t[i])->GetNtot(); |
nfit = ((TrkTrack *)t[i])->GetNtot(); |
631 |
} |
} |
632 |
} |
} |
633 |
//second loop to search minimum chi2 among selected |
//second loop to search minimum chi2 among selected |
634 |
for(int i=0; i<this->ntrk(); i++){ |
for(int i=0; i<this->ntrk(); i++){ |
635 |
if( ((TrkTrack *)t[i])->chi2 < chi2ref |
Float_t chi2 = ((TrkTrack *)t[i])->chi2; |
636 |
&& ((TrkTrack *)t[i])->GetNtot()== nfit |
if(chi2 < 0) chi2 = chi2*1000; |
637 |
&& m[i]==1){ |
if( chi2 < chi2ref |
638 |
|
&& ((TrkTrack *)t[i])->GetNtot() == nfit |
639 |
|
&& m[i]==1){ |
640 |
chi2ref = ((TrkTrack *)t[i])->chi2; |
chi2ref = ((TrkTrack *)t[i])->chi2; |
641 |
indi = i; |
indi = i; |
642 |
// cout << "2** "<<i<< " " << nfit <<" "<<chi2ref<<endl; |
}; |
643 |
} |
}; |
|
} |
|
644 |
if( ((TrkTrack *)t[indi])->HasImage() ){ |
if( ((TrkTrack *)t[indi])->HasImage() ){ |
645 |
m[((TrkTrack *)t[indi])->image] = 0; |
m[((TrkTrack *)t[indi])->image] = 0; |
646 |
N--; |
N--; |
649 |
// Float_t chi2i=((TrkTrack *)t[((TrkTrack *)t[indi])->image ])->chi2; |
// Float_t chi2i=((TrkTrack *)t[((TrkTrack *)t[indi])->image ])->chi2; |
650 |
|
|
651 |
// cout << "i** "<< ((TrkTrack *)t[indi])->image << " " << nfiti <<" "<<chi2i<<endl; |
// cout << "i** "<< ((TrkTrack *)t[indi])->image << " " << nfiti <<" "<<chi2i<<endl; |
652 |
} |
}; |
653 |
// new(ts[indo]) TrkTrack(*(TrkTrack*)t[indi]); |
// new(ts[indo]) TrkTrack(*(TrkTrack*)t[indi]); |
654 |
// cout << "GetTracks_NFitSorted(it): Add("<<indo<<")"<< endl; |
// cout << "GetTracks_NFitSorted(it): Add("<<indo<<")"<< endl; |
655 |
sorted->Add( (TrkTrack*)t[indi] ); |
sorted->Add( (TrkTrack*)t[indi] ); |
935 |
tl = new float[npoint]; |
tl = new float[npoint]; |
936 |
int i=0; |
int i=0; |
937 |
do{ |
do{ |
938 |
x[i] = 0; |
x[i] = 0; |
939 |
y[i] = 0; |
y[i] = 0; |
940 |
z[i] = zin[i]; |
z[i] = zin[i]; |
941 |
thx[i] = 0; |
thx[i] = 0; |
942 |
thy[i] = 0; |
thy[i] = 0; |
943 |
tl[i] = 0; |
tl[i] = 0; |
944 |
i++; |
i++; |
945 |
}while(zin[i-1] > zin[i] && i < npoint); |
}while(zin[i-1] > zin[i] && i < npoint); |
946 |
npoint=i; |
npoint=i; |
947 |
if(npoint != n)cout << "NB! Trajectory created with "<<npoint<<" points"<<endl; |
if(npoint != n)cout << "NB! Trajectory created with "<<npoint<<" points"<<endl; |