22 |
// |
// |
23 |
//-------------------------------------- |
//-------------------------------------- |
24 |
TrkTrack::TrkTrack(){ |
TrkTrack::TrkTrack(){ |
25 |
|
// cout << "TrkTrack::TrkTrack()" << endl; |
26 |
seqno = -1; |
seqno = -1; |
27 |
image = -1; |
image = -1; |
28 |
chi2 = 0; |
chi2 = 0; |
32 |
for(int it2=0;it2<5;it2++)coval[it1][it2] = 0; |
for(int it2=0;it2<5;it2++)coval[it1][it2] = 0; |
33 |
}; |
}; |
34 |
for(int ip=0;ip<6;ip++){ |
for(int ip=0;ip<6;ip++){ |
35 |
xgood[ip] = 0; |
xgood[ip] = 0; |
36 |
ygood[ip] = 0; |
ygood[ip] = 0; |
37 |
xm[ip] = 0; |
xm[ip] = 0; |
38 |
ym[ip] = 0; |
ym[ip] = 0; |
39 |
zm[ip] = 0; |
zm[ip] = 0; |
40 |
resx[ip] = 0; |
resx[ip] = 0; |
41 |
resy[ip] = 0; |
resy[ip] = 0; |
42 |
xv[ip] = 0; |
xv[ip] = 0; |
43 |
yv[ip] = 0; |
yv[ip] = 0; |
44 |
zv[ip] = 0; |
zv[ip] = 0; |
45 |
axv[ip] = 0; |
axv[ip] = 0; |
46 |
ayv[ip] = 0; |
ayv[ip] = 0; |
47 |
dedx_x[ip] = 0; |
dedx_x[ip] = 0; |
48 |
dedx_y[ip] = 0; |
dedx_y[ip] = 0; |
49 |
// clx[ip] = 0; |
}; |
50 |
// cly[ip] = 0; |
clx = 0; |
51 |
}; |
cly = 0; |
|
clx = new TRefArray(6,0); |
|
|
cly = new TRefArray(6,0); |
|
52 |
}; |
}; |
53 |
//-------------------------------------- |
//-------------------------------------- |
54 |
// |
// |
64 |
for(int it2=0;it2<5;it2++)coval[it1][it2] = t.coval[it1][it2]; |
for(int it2=0;it2<5;it2++)coval[it1][it2] = t.coval[it1][it2]; |
65 |
}; |
}; |
66 |
for(int ip=0;ip<6;ip++){ |
for(int ip=0;ip<6;ip++){ |
67 |
xgood[ip] = t.xgood[ip]; |
xgood[ip] = t.xgood[ip]; |
68 |
ygood[ip] = t.ygood[ip]; |
ygood[ip] = t.ygood[ip]; |
69 |
xm[ip] = t.xm[ip]; |
xm[ip] = t.xm[ip]; |
70 |
ym[ip] = t.ym[ip]; |
ym[ip] = t.ym[ip]; |
71 |
zm[ip] = t.zm[ip]; |
zm[ip] = t.zm[ip]; |
72 |
resx[ip] = t.resx[ip]; |
resx[ip] = t.resx[ip]; |
73 |
resy[ip] = t.resy[ip]; |
resy[ip] = t.resy[ip]; |
74 |
xv[ip] = t.xv[ip]; |
xv[ip] = t.xv[ip]; |
75 |
yv[ip] = t.yv[ip]; |
yv[ip] = t.yv[ip]; |
76 |
zv[ip] = t.zv[ip]; |
zv[ip] = t.zv[ip]; |
77 |
axv[ip] = t.axv[ip]; |
axv[ip] = t.axv[ip]; |
78 |
ayv[ip] = t.ayv[ip]; |
ayv[ip] = t.ayv[ip]; |
79 |
dedx_x[ip] = t.dedx_x[ip]; |
dedx_x[ip] = t.dedx_x[ip]; |
80 |
dedx_y[ip] = t.dedx_y[ip]; |
dedx_y[ip] = t.dedx_y[ip]; |
81 |
// clx[ip] = 0;//<<<<pointer |
}; |
82 |
// cly[ip] = 0;//<<<<pointer |
clx = 0; |
83 |
}; |
cly = 0; |
84 |
clx = new TRefArray(*(t.clx)); |
if(t.clx)clx = new TRefArray(*(t.clx)); |
85 |
cly = new TRefArray(*(t.cly)); |
if(t.cly)cly = new TRefArray(*(t.cly)); |
86 |
|
|
87 |
}; |
}; |
88 |
//-------------------------------------- |
//-------------------------------------- |
89 |
// |
// |
90 |
// |
// |
91 |
//-------------------------------------- |
//-------------------------------------- |
92 |
|
void TrkTrack::Copy(TrkTrack& t){ |
93 |
|
|
94 |
|
t.seqno = seqno; |
95 |
|
t.image = image; |
96 |
|
t.chi2 = chi2; |
97 |
|
t.nstep = nstep; |
98 |
|
for(int it1=0;it1<5;it1++){ |
99 |
|
t.al[it1] = al[it1]; |
100 |
|
for(int it2=0;it2<5;it2++)t.coval[it1][it2] = coval[it1][it2]; |
101 |
|
}; |
102 |
|
for(int ip=0;ip<6;ip++){ |
103 |
|
t.xgood[ip] = xgood[ip]; |
104 |
|
t.ygood[ip] = ygood[ip]; |
105 |
|
t.xm[ip] = xm[ip]; |
106 |
|
t.ym[ip] = ym[ip]; |
107 |
|
t.zm[ip] = zm[ip]; |
108 |
|
t.resx[ip] = resx[ip]; |
109 |
|
t.resy[ip] = resy[ip]; |
110 |
|
t.xv[ip] = xv[ip]; |
111 |
|
t.yv[ip] = yv[ip]; |
112 |
|
t.zv[ip] = zv[ip]; |
113 |
|
t.axv[ip] = axv[ip]; |
114 |
|
t.ayv[ip] = ayv[ip]; |
115 |
|
t.dedx_x[ip] = dedx_x[ip]; |
116 |
|
t.dedx_y[ip] = dedx_y[ip]; |
117 |
|
|
118 |
|
}; |
119 |
|
|
120 |
|
}; |
121 |
|
//-------------------------------------- |
122 |
|
// |
123 |
|
// |
124 |
|
//-------------------------------------- |
125 |
/** |
/** |
126 |
* Evaluates the trajectory in the apparatus associated to the track. |
* Evaluates the trajectory in the apparatus associated to the track. |
127 |
* It integrates the equations of motion in the magnetic field. The magnetic field should be previously loaded ( by calling TrkLevel2::LoadField() ), otherwise an error message is returned. |
* It integrates the equations of motion in the magnetic field. The magnetic field should be previously loaded ( by calling TrkLevel2::LoadField() ), otherwise an error message is returned. |
407 |
// for(int j=0; j<5; j++) coval[i][j]=track_.cov[i][j]; |
// for(int j=0; j<5; j++) coval[i][j]=track_.cov[i][j]; |
408 |
// } |
// } |
409 |
|
|
410 |
// if(fail && iprint){ |
if(fail){ |
411 |
// cout << " >>>> fit failed >>>> drawing initial par"<<endl; |
if(iprint)cout << " >>>> fit failed >>>> drawing initial par"<<endl; |
412 |
// for(int i=0; i<5; i++) al[i]=al_ini[i]; |
for(int i=0; i<5; i++) al[i]=al_ini[i]; |
413 |
// } |
} |
414 |
|
|
415 |
}; |
}; |
416 |
/* |
/* |
435 |
// |
// |
436 |
//-------------------------------------- |
//-------------------------------------- |
437 |
void TrkTrack::Clear(){ |
void TrkTrack::Clear(){ |
438 |
seqno = -1; |
// cout << "TrkTrack::Clear()"<<endl; |
439 |
image = -1; |
seqno = -1; |
440 |
chi2 = 0; |
image = -1; |
441 |
nstep = 0; |
chi2 = 0; |
442 |
for(int it1=0;it1<5;it1++){ |
nstep = 0; |
443 |
al[it1] = 0; |
for(int it1=0;it1<5;it1++){ |
444 |
for(int it2=0;it2<5;it2++)coval[it1][it2] = 0; |
al[it1] = 0; |
445 |
}; |
for(int it2=0;it2<5;it2++)coval[it1][it2] = 0; |
446 |
for(int ip=0;ip<6;ip++){ |
}; |
447 |
xgood[ip] = 0; |
for(int ip=0;ip<6;ip++){ |
448 |
ygood[ip] = 0; |
xgood[ip] = 0; |
449 |
xm[ip] = 0; |
ygood[ip] = 0; |
450 |
ym[ip] = 0; |
xm[ip] = 0; |
451 |
zm[ip] = 0; |
ym[ip] = 0; |
452 |
resx[ip] = 0; |
zm[ip] = 0; |
453 |
resy[ip] = 0; |
resx[ip] = 0; |
454 |
xv[ip] = 0; |
resy[ip] = 0; |
455 |
yv[ip] = 0; |
xv[ip] = 0; |
456 |
zv[ip] = 0; |
yv[ip] = 0; |
457 |
axv[ip] = 0; |
zv[ip] = 0; |
458 |
ayv[ip] = 0; |
axv[ip] = 0; |
459 |
dedx_x[ip] = 0; |
ayv[ip] = 0; |
460 |
dedx_y[ip] = 0; |
dedx_x[ip] = 0; |
461 |
// clx[ip] = 0; |
dedx_y[ip] = 0; |
462 |
// cly[ip] = 0; |
|
463 |
}; |
}; |
464 |
clx->Clear(); |
if(clx)clx->Clear(); |
465 |
cly->Clear(); |
if(cly)cly->Clear(); |
466 |
}; |
}; |
467 |
//-------------------------------------- |
//-------------------------------------- |
468 |
// |
// |
469 |
// |
// |
470 |
//-------------------------------------- |
//-------------------------------------- |
471 |
void TrkTrack::Delete(){ |
void TrkTrack::Delete(){ |
472 |
Clear(); |
// cout << "TrkTrack::Delete()"<<endl; |
473 |
clx->Delete(); |
// Clear(); |
474 |
cly->Delete(); |
if(clx)delete clx; |
475 |
|
if(cly)delete cly; |
476 |
}; |
}; |
477 |
//-------------------------------------- |
//-------------------------------------- |
478 |
// |
// |
479 |
// |
// |
480 |
//-------------------------------------- |
//-------------------------------------- |
484 |
// |
// |
485 |
//-------------------------------------- |
//-------------------------------------- |
486 |
TrkSinglet::TrkSinglet(){ |
TrkSinglet::TrkSinglet(){ |
487 |
|
// cout << "TrkSinglet::TrkSinglet() " << GetUniqueID()<<endl; |
488 |
plane = 0; |
plane = 0; |
489 |
coord[0] = 0; |
coord[0] = 0; |
490 |
coord[1] = 0; |
coord[1] = 0; |
491 |
sgnl = 0; |
sgnl = 0; |
492 |
cls = 0; |
// cls = 0; |
493 |
}; |
}; |
494 |
//-------------------------------------- |
//-------------------------------------- |
495 |
// |
// |
496 |
// |
// |
497 |
//-------------------------------------- |
//-------------------------------------- |
498 |
TrkSinglet::TrkSinglet(const TrkSinglet& s){ |
TrkSinglet::TrkSinglet(const TrkSinglet& s){ |
499 |
|
// cout << "TrkSinglet::TrkSinglet(const TrkSinglet& s) " << GetUniqueID()<<endl; |
500 |
plane = s.plane; |
plane = s.plane; |
501 |
coord[0] = s.coord[0]; |
coord[0] = s.coord[0]; |
502 |
coord[1] = s.coord[1]; |
coord[1] = s.coord[1]; |
503 |
sgnl = s.sgnl; |
sgnl = s.sgnl; |
504 |
// cls = 0;//<<<<pointer |
// cls = 0;//<<<<pointer |
505 |
cls = TRef(s.cls); |
cls = TRef(s.cls); |
506 |
}; |
}; |
507 |
//-------------------------------------- |
//-------------------------------------- |
508 |
// |
// |
519 |
// |
// |
520 |
// |
// |
521 |
//-------------------------------------- |
//-------------------------------------- |
522 |
|
void TrkSinglet::Clear(){ |
523 |
|
// cout << "TrkSinglet::Clear() " << GetUniqueID()<<endl; |
524 |
|
// cls=0; |
525 |
|
plane=-1; |
526 |
|
coord[0]=-999; |
527 |
|
coord[1]=-999; |
528 |
|
sgnl=0; |
529 |
|
|
530 |
|
} |
531 |
|
//-------------------------------------- |
532 |
|
// |
533 |
|
// |
534 |
|
//-------------------------------------- |
535 |
TrkLevel2::TrkLevel2(){ |
TrkLevel2::TrkLevel2(){ |
536 |
// good2 = -1; |
// cout <<"TrkLevel2::TrkLevel2()"<<endl; |
537 |
for(Int_t i=0; i<12 ; i++){ |
for(Int_t i=0; i<12 ; i++){ |
|
// crc[i] = -1; |
|
538 |
good[i] = -1; |
good[i] = -1; |
539 |
}; |
}; |
540 |
Track = new TClonesArray("TrkTrack"); |
// Track = new TClonesArray("TrkTrack"); |
541 |
SingletX = new TClonesArray("TrkSinglet"); |
// SingletX = new TClonesArray("TrkSinglet"); |
542 |
SingletY = new TClonesArray("TrkSinglet"); |
// SingletY = new TClonesArray("TrkSinglet"); |
543 |
|
Track = 0; |
544 |
|
SingletX = 0; |
545 |
|
SingletY = 0; |
546 |
|
|
|
// PhysicalTrack = new TClonesArray("TrkTrack"); |
|
|
//sostituire con TRefArray... appena ho capito come si usa |
|
547 |
} |
} |
548 |
//-------------------------------------- |
//-------------------------------------- |
549 |
// |
// |
551 |
//-------------------------------------- |
//-------------------------------------- |
552 |
void TrkLevel2::Dump(){ |
void TrkLevel2::Dump(){ |
553 |
|
|
|
TClonesArray &t = *Track; |
|
|
TClonesArray &sx = *SingletX; |
|
|
TClonesArray &sy = *SingletY; |
|
554 |
// |
// |
555 |
cout << endl << endl << "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"; |
cout << endl << endl << "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"; |
556 |
cout << endl << "good : "; for(int i=0; i<12; i++) cout << good[i]<<" "; |
cout << endl << "good : "; for(int i=0; i<12; i++) cout << good[i]<<" "; |
557 |
cout << endl << "ntrk() : " << this->ntrk() ; |
cout << endl << "ntrk() : " << this->ntrk() ; |
558 |
cout << endl << "nclsx() : " << this->nclsx(); |
cout << endl << "nclsx() : " << this->nclsx(); |
559 |
cout << endl << "nclsy() : " << this->nclsy(); |
cout << endl << "nclsy() : " << this->nclsy(); |
560 |
for(int i=0; i<this->ntrk(); i++) ((TrkTrack *)t[i])->Dump(); |
// TClonesArray &t = *Track; |
561 |
for(int i=0; i<this->nclsx(); i++) ((TrkSinglet *)sx[i])->Dump(); |
// TClonesArray &sx = *SingletX; |
562 |
for(int i=0; i<this->nclsy(); i++) ((TrkSinglet *)sy[i])->Dump(); |
// TClonesArray &sy = *SingletY; |
563 |
|
// for(int i=0; i<ntrk(); i++) ((TrkTrack *)t[i])->Dump(); |
564 |
|
// for(int i=0; i<nclsx(); i++) ((TrkSinglet *)sx[i])->Dump(); |
565 |
|
// for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump(); |
566 |
|
if(Track){ |
567 |
|
TClonesArray &t = *Track; |
568 |
|
for(int i=0; i<ntrk(); i++) ((TrkTrack *)t[i])->Dump(); |
569 |
|
} |
570 |
|
if(SingletX){ |
571 |
|
TClonesArray &sx = *SingletX; |
572 |
|
for(int i=0; i<nclsx(); i++) ((TrkSinglet *)sx[i])->Dump(); |
573 |
|
} |
574 |
|
if(SingletY){ |
575 |
|
TClonesArray &sy = *SingletY; |
576 |
|
for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump(); |
577 |
|
} |
578 |
} |
} |
579 |
//-------------------------------------- |
//-------------------------------------- |
580 |
// |
// |
596 |
good[i] = l2->good[i]; |
good[i] = l2->good[i]; |
597 |
}; |
}; |
598 |
// *** TRACKS *** |
// *** TRACKS *** |
599 |
|
if(!Track) Track = new TClonesArray("TrkTrack"); |
600 |
TClonesArray &t = *Track; |
TClonesArray &t = *Track; |
601 |
for(int i=0; i<l2->ntrk; i++){ |
for(int i=0; i<l2->ntrk; i++){ |
602 |
t_track->seqno = i;// NBNBNBNB deve sempre essere = i |
t_track->seqno = i;// NBNBNBNB deve sempre essere = i |
603 |
t_track->image = l2->image[i]-1; |
t_track->image = l2->image[i]-1; |
604 |
// cout << "track "<<i<<t_track->seqno << t_track->image<<endl; |
// cout << "track "<<i<<t_track->seqno << t_track->image<<endl; |
605 |
t_track->chi2 = l2->chi2_nt[i]; |
t_track->chi2 = l2->chi2_nt[i]; |
606 |
t_track->nstep = l2->nstep_nt[i]; |
t_track->nstep = l2->nstep_nt[i]; |
607 |
for(int it1=0;it1<5;it1++){ |
for(int it1=0;it1<5;it1++){ |
608 |
t_track->al[it1] = l2->al_nt[i][it1]; |
t_track->al[it1] = l2->al_nt[i][it1]; |
609 |
for(int it2=0;it2<5;it2++) |
for(int it2=0;it2<5;it2++) |
610 |
t_track->coval[it1][it2] = l2->coval[i][it2][it1]; |
t_track->coval[it1][it2] = l2->coval[i][it2][it1]; |
611 |
}; |
}; |
612 |
for(int ip=0;ip<6;ip++){ |
for(int ip=0;ip<6;ip++){ |
613 |
t_track->xgood[ip] = l2->xgood_nt[i][ip]; |
t_track->xgood[ip] = l2->xgood_nt[i][ip]; |
614 |
t_track->ygood[ip] = l2->ygood_nt[i][ip]; |
t_track->ygood[ip] = l2->ygood_nt[i][ip]; |
615 |
t_track->xm[ip] = l2->xm_nt[i][ip]; |
t_track->xm[ip] = l2->xm_nt[i][ip]; |
616 |
t_track->ym[ip] = l2->ym_nt[i][ip]; |
t_track->ym[ip] = l2->ym_nt[i][ip]; |
617 |
t_track->zm[ip] = l2->zm_nt[i][ip]; |
t_track->zm[ip] = l2->zm_nt[i][ip]; |
618 |
t_track->resx[ip] = l2->resx_nt[i][ip]; |
t_track->resx[ip] = l2->resx_nt[i][ip]; |
619 |
t_track->resy[ip] = l2->resy_nt[i][ip]; |
t_track->resy[ip] = l2->resy_nt[i][ip]; |
620 |
t_track->xv[ip] = l2->xv_nt[i][ip]; |
t_track->xv[ip] = l2->xv_nt[i][ip]; |
621 |
t_track->yv[ip] = l2->yv_nt[i][ip]; |
t_track->yv[ip] = l2->yv_nt[i][ip]; |
622 |
t_track->zv[ip] = l2->zv_nt[i][ip]; |
t_track->zv[ip] = l2->zv_nt[i][ip]; |
623 |
t_track->axv[ip] = l2->axv_nt[i][ip]; |
t_track->axv[ip] = l2->axv_nt[i][ip]; |
624 |
t_track->ayv[ip] = l2->ayv_nt[i][ip]; |
t_track->ayv[ip] = l2->ayv_nt[i][ip]; |
625 |
t_track->dedx_x[ip] = l2->dedx_x[i][ip]; |
t_track->dedx_x[ip] = l2->dedx_x[i][ip]; |
626 |
t_track->dedx_y[ip] = l2->dedx_y[i][ip]; |
t_track->dedx_y[ip] = l2->dedx_y[i][ip]; |
627 |
// t_track->clx[ip] = 0; |
// t_track->clx[ip] = 0; |
628 |
// t_track->cly[ip] = 0; |
// t_track->cly[ip] = 0; |
629 |
}; |
}; |
630 |
new(t[i]) TrkTrack(*t_track); |
new(t[i]) TrkTrack(*t_track); |
631 |
t_track->Clear(); |
t_track->Clear(); |
632 |
}; |
}; |
633 |
// *** SINGLETS *** |
// *** SINGLETS *** |
634 |
|
if(!SingletX)SingletX = new TClonesArray("TrkSinglet"); |
635 |
TClonesArray &sx = *SingletX; |
TClonesArray &sx = *SingletX; |
636 |
for(int i=0; i<l2->nclsx; i++){ |
for(int i=0; i<l2->nclsx; i++){ |
637 |
t_singlet->plane = l2->planex[i]; |
t_singlet->plane = l2->planex[i]; |
638 |
t_singlet->coord[0] = l2->xs[i][0]; |
t_singlet->coord[0] = l2->xs[i][0]; |
639 |
t_singlet->coord[1] = l2->xs[i][1]; |
t_singlet->coord[1] = l2->xs[i][1]; |
640 |
t_singlet->sgnl = l2->signlxs[i]; |
t_singlet->sgnl = l2->signlxs[i]; |
641 |
// t_singlet->cls = 0; |
// t_singlet->cls = 0; |
642 |
new(sx[i]) TrkSinglet(*t_singlet); |
new(sx[i]) TrkSinglet(*t_singlet); |
643 |
t_singlet->Clear(); |
t_singlet->Clear(); |
644 |
} |
} |
645 |
|
if(!SingletY)SingletY = new TClonesArray("TrkSinglet"); |
646 |
TClonesArray &sy = *SingletY; |
TClonesArray &sy = *SingletY; |
647 |
for(int i=0; i<l2->nclsy; i++){ |
for(int i=0; i<l2->nclsy; i++){ |
648 |
t_singlet->plane = l2->planey[i]; |
t_singlet->plane = l2->planey[i]; |
649 |
t_singlet->coord[0] = l2->ys[i][0]; |
t_singlet->coord[0] = l2->ys[i][0]; |
650 |
t_singlet->coord[1] = l2->ys[i][1]; |
t_singlet->coord[1] = l2->ys[i][1]; |
651 |
t_singlet->sgnl = l2->signlys[i]; |
t_singlet->sgnl = l2->signlys[i]; |
652 |
// t_singlet->cls = 0; |
// t_singlet->cls = 0; |
653 |
new(sy[i]) TrkSinglet(*t_singlet); |
new(sy[i]) TrkSinglet(*t_singlet); |
654 |
t_singlet->Clear(); |
t_singlet->Clear(); |
655 |
}; |
}; |
656 |
|
|
657 |
delete t_track; |
delete t_track; |
658 |
delete t_singlet; |
delete t_singlet; |
659 |
} |
} |
660 |
//-------------------------------------- |
//-------------------------------------- |
661 |
// |
// |
677 |
good[i] = l2->good[i]; |
good[i] = l2->good[i]; |
678 |
}; |
}; |
679 |
// *** TRACKS *** |
// *** TRACKS *** |
680 |
|
if(!Track) Track = new TClonesArray("TrkTrack"); |
681 |
TClonesArray &t = *Track; |
TClonesArray &t = *Track; |
682 |
|
if(!t_track->clx)t_track->clx = new TRefArray(6,0); |
683 |
|
if(!t_track->cly)t_track->cly = new TRefArray(6,0); |
684 |
for(int i=0; i<l2->ntrk; i++){ |
for(int i=0; i<l2->ntrk; i++){ |
685 |
t_track->seqno = i;// NBNBNBNB deve sempre essere = i |
t_track->seqno = i;// NBNBNBNB deve sempre essere = i |
686 |
t_track->image = l2->image[i]-1; |
t_track->image = l2->image[i]-1; |
709 |
t_track->dedx_y[ip] = l2->dedx_y[i][ip]; |
t_track->dedx_y[ip] = l2->dedx_y[i][ip]; |
710 |
// cout << "traccia "<<i<<" -- "<< ip << " "<< l2->cltrx[i][ip] <<" "<< l2->cltry[i][ip] <<" "<< t_track->xgood[ip] << t_track->ygood[ip]<<endl; |
// cout << "traccia "<<i<<" -- "<< ip << " "<< l2->cltrx[i][ip] <<" "<< l2->cltry[i][ip] <<" "<< t_track->xgood[ip] << t_track->ygood[ip]<<endl; |
711 |
//----------------------------------------------------- |
//----------------------------------------------------- |
712 |
// t_track->clx[ip] = l1->GetCluster(l2->cltrx[i][ip]-1); |
//----------------------------------------------------- |
|
// t_track->cly[ip] = l1->GetCluster(l2->cltry[i][ip]-1); |
|
713 |
if(t_track->xgood[ip])t_track->clx->AddAt(l1->GetCluster(l2->cltrx[i][ip]-1),ip); |
if(t_track->xgood[ip])t_track->clx->AddAt(l1->GetCluster(l2->cltrx[i][ip]-1),ip); |
714 |
if(t_track->ygood[ip])t_track->cly->AddAt(l1->GetCluster(l2->cltry[i][ip]-1),ip); |
if(t_track->ygood[ip])t_track->cly->AddAt(l1->GetCluster(l2->cltry[i][ip]-1),ip); |
715 |
// if(t_track->ygood[ip])cout<<" i "<<i<<" ip "<<ip<<" l2->cltry[i][ip] "<<l2->cltry[i][ip]<< " l1->GetCluster(l2->cltry[i][ip]-1) "<<l1->GetCluster(l2->cltry[i][ip]-1)<<endl; |
// if(t_track->ygood[ip])cout<<" i "<<i<<" ip "<<ip<<" l2->cltry[i][ip] "<<l2->cltry[i][ip]<< " l1->GetCluster(l2->cltry[i][ip]-1) "<<l1->GetCluster(l2->cltry[i][ip]-1)<<endl; |
716 |
// if(t_track->xgood[ip])cout<<" i "<<i<<" ip "<<ip<<" l2->cltrx[i][ip] "<<l2->cltrx[i][ip]<< " l1->GetCluster(l2->cltrx[i][ip]-1) "<<l1->GetCluster(l2->cltrx[i][ip]-1)<<endl; |
// if(t_track->xgood[ip])cout<<" i "<<i<<" ip "<<ip<<" l2->cltrx[i][ip] "<<l2->cltrx[i][ip]<< " l1->GetCluster(l2->cltrx[i][ip]-1) "<<l1->GetCluster(l2->cltrx[i][ip]-1)<<endl; |
717 |
//----------------------------------------------------- |
//----------------------------------------------------- |
718 |
|
//----------------------------------------------------- |
719 |
}; |
}; |
720 |
new(t[i]) TrkTrack(*t_track); |
new(t[i]) TrkTrack(*t_track); |
721 |
t_track->Clear(); |
t_track->Clear(); |
722 |
}; |
}; |
723 |
// *** SINGLETS *** |
// *** SINGLETS *** |
724 |
|
if(!SingletX)SingletX = new TClonesArray("TrkSinglet"); |
725 |
TClonesArray &sx = *SingletX; |
TClonesArray &sx = *SingletX; |
726 |
for(int i=0; i<l2->nclsx; i++){ |
for(int i=0; i<l2->nclsx; i++){ |
727 |
t_singlet->plane = l2->planex[i]; |
t_singlet->plane = l2->planex[i]; |
736 |
new(sx[i]) TrkSinglet(*t_singlet); |
new(sx[i]) TrkSinglet(*t_singlet); |
737 |
t_singlet->Clear(); |
t_singlet->Clear(); |
738 |
} |
} |
739 |
|
if(!SingletY)SingletY = new TClonesArray("TrkSinglet"); |
740 |
TClonesArray &sy = *SingletY; |
TClonesArray &sy = *SingletY; |
741 |
for(int i=0; i<l2->nclsy; i++){ |
for(int i=0; i<l2->nclsy; i++){ |
742 |
t_singlet->plane = l2->planey[i]; |
t_singlet->plane = l2->planey[i]; |
769 |
}; |
}; |
770 |
// *** TRACKS *** |
// *** TRACKS *** |
771 |
|
|
772 |
l2->ntrk = Track->GetEntries(); |
if(Track){ |
773 |
for(Int_t i=0;i<l2->ntrk;i++){ |
l2->ntrk = Track->GetEntries(); |
774 |
l2->image[i] = 1 + ((TrkTrack *)Track->At(i))->image; |
for(Int_t i=0;i<l2->ntrk;i++){ |
775 |
l2->chi2_nt[i] = ((TrkTrack *)Track->At(i))->chi2; |
l2->image[i] = 1 + ((TrkTrack *)Track->At(i))->image; |
776 |
l2->nstep_nt[i] = ((TrkTrack *)Track->At(i))->nstep; |
l2->chi2_nt[i] = ((TrkTrack *)Track->At(i))->chi2; |
777 |
for(int it1=0;it1<5;it1++){ |
l2->nstep_nt[i] = ((TrkTrack *)Track->At(i))->nstep; |
778 |
l2->al_nt[i][it1] = ((TrkTrack *)Track->At(i))->al[it1]; |
for(int it1=0;it1<5;it1++){ |
779 |
for(int it2=0;it2<5;it2++) |
l2->al_nt[i][it1] = ((TrkTrack *)Track->At(i))->al[it1]; |
780 |
l2->coval[i][it2][it1] = ((TrkTrack *)Track->At(i))->coval[it1][it2]; |
for(int it2=0;it2<5;it2++) |
781 |
}; |
l2->coval[i][it2][it1] = ((TrkTrack *)Track->At(i))->coval[it1][it2]; |
782 |
for(int ip=0;ip<6;ip++){ |
}; |
783 |
l2->xgood_nt[i][ip] = ((TrkTrack *)Track->At(i))->xgood[ip]; |
for(int ip=0;ip<6;ip++){ |
784 |
l2->ygood_nt[i][ip] = ((TrkTrack *)Track->At(i))->ygood[ip]; |
l2->xgood_nt[i][ip] = ((TrkTrack *)Track->At(i))->xgood[ip]; |
785 |
l2->xm_nt[i][ip] = ((TrkTrack *)Track->At(i))->xm[ip]; |
l2->ygood_nt[i][ip] = ((TrkTrack *)Track->At(i))->ygood[ip]; |
786 |
l2->ym_nt[i][ip] = ((TrkTrack *)Track->At(i))->ym[ip]; |
l2->xm_nt[i][ip] = ((TrkTrack *)Track->At(i))->xm[ip]; |
787 |
l2->zm_nt[i][ip] = ((TrkTrack *)Track->At(i))->zm[ip]; |
l2->ym_nt[i][ip] = ((TrkTrack *)Track->At(i))->ym[ip]; |
788 |
l2->resx_nt[i][ip] = ((TrkTrack *)Track->At(i))->resx[ip]; |
l2->zm_nt[i][ip] = ((TrkTrack *)Track->At(i))->zm[ip]; |
789 |
l2->resy_nt[i][ip] = ((TrkTrack *)Track->At(i))->resy[ip]; |
l2->resx_nt[i][ip] = ((TrkTrack *)Track->At(i))->resx[ip]; |
790 |
l2->xv_nt[i][ip] = ((TrkTrack *)Track->At(i))->xv[ip]; |
l2->resy_nt[i][ip] = ((TrkTrack *)Track->At(i))->resy[ip]; |
791 |
l2->yv_nt[i][ip] = ((TrkTrack *)Track->At(i))->yv[ip]; |
l2->xv_nt[i][ip] = ((TrkTrack *)Track->At(i))->xv[ip]; |
792 |
l2->zv_nt[i][ip] = ((TrkTrack *)Track->At(i))->zv[ip]; |
l2->yv_nt[i][ip] = ((TrkTrack *)Track->At(i))->yv[ip]; |
793 |
l2->axv_nt[i][ip] = ((TrkTrack *)Track->At(i))->axv[ip]; |
l2->zv_nt[i][ip] = ((TrkTrack *)Track->At(i))->zv[ip]; |
794 |
l2->ayv_nt[i][ip] = ((TrkTrack *)Track->At(i))->ayv[ip]; |
l2->axv_nt[i][ip] = ((TrkTrack *)Track->At(i))->axv[ip]; |
795 |
l2->dedx_x[i][ip] = ((TrkTrack *)Track->At(i))->dedx_x[ip]; |
l2->ayv_nt[i][ip] = ((TrkTrack *)Track->At(i))->ayv[ip]; |
796 |
l2->dedx_y[i][ip] = ((TrkTrack *)Track->At(i))->dedx_y[ip]; |
l2->dedx_x[i][ip] = ((TrkTrack *)Track->At(i))->dedx_x[ip]; |
797 |
}; |
l2->dedx_y[i][ip] = ((TrkTrack *)Track->At(i))->dedx_y[ip]; |
798 |
|
}; |
799 |
|
} |
800 |
} |
} |
|
|
|
801 |
// *** SINGLETS *** |
// *** SINGLETS *** |
802 |
l2->nclsx = SingletX->GetEntries(); |
if(SingletX){ |
803 |
for(Int_t i=0;i<l2->nclsx;i++){ |
l2->nclsx = SingletX->GetEntries(); |
804 |
l2->planex[i] = ((TrkSinglet *)SingletX->At(i))->plane; |
for(Int_t i=0;i<l2->nclsx;i++){ |
805 |
l2->xs[i][0] = ((TrkSinglet *)SingletX->At(i))->coord[0]; |
l2->planex[i] = ((TrkSinglet *)SingletX->At(i))->plane; |
806 |
l2->xs[i][1] = ((TrkSinglet *)SingletX->At(i))->coord[1]; |
l2->xs[i][0] = ((TrkSinglet *)SingletX->At(i))->coord[0]; |
807 |
l2->signlxs[i] = ((TrkSinglet *)SingletX->At(i))->sgnl; |
l2->xs[i][1] = ((TrkSinglet *)SingletX->At(i))->coord[1]; |
808 |
} |
l2->signlxs[i] = ((TrkSinglet *)SingletX->At(i))->sgnl; |
809 |
l2->nclsy = SingletY->GetEntries(); |
} |
810 |
for(Int_t i=0;i<l2->nclsy;i++){ |
} |
811 |
l2->planey[i] = ((TrkSinglet *)SingletY->At(i))->plane; |
|
812 |
l2->ys[i][0] = ((TrkSinglet *)SingletY->At(i))->coord[0]; |
if(SingletY){ |
813 |
l2->ys[i][1] = ((TrkSinglet *)SingletY->At(i))->coord[1]; |
l2->nclsy = SingletY->GetEntries(); |
814 |
l2->signlys[i] = ((TrkSinglet *)SingletY->At(i))->sgnl; |
for(Int_t i=0;i<l2->nclsy;i++){ |
815 |
|
l2->planey[i] = ((TrkSinglet *)SingletY->At(i))->plane; |
816 |
|
l2->ys[i][0] = ((TrkSinglet *)SingletY->At(i))->coord[0]; |
817 |
|
l2->ys[i][1] = ((TrkSinglet *)SingletY->At(i))->coord[1]; |
818 |
|
l2->signlys[i] = ((TrkSinglet *)SingletY->At(i))->sgnl; |
819 |
|
} |
820 |
} |
} |
821 |
} |
} |
822 |
//-------------------------------------- |
//-------------------------------------- |
824 |
// |
// |
825 |
//-------------------------------------- |
//-------------------------------------- |
826 |
void TrkLevel2::Clear(){ |
void TrkLevel2::Clear(){ |
|
// good2 = -1; |
|
827 |
for(Int_t i=0; i<12 ; i++){ |
for(Int_t i=0; i<12 ; i++){ |
828 |
// crc[i] = -1; |
good[i] = -1; |
829 |
good[i] = -1; |
}; |
830 |
}; |
// if(Track)Track->Clear("C"); |
831 |
/* Track->RemoveAll(); |
// if(SingletX)SingletX->Clear("C"); |
832 |
SingletX->RemoveAll(); |
// if(SingletY)SingletY->Clear("C"); |
833 |
SingletY->RemoveAll();*/ |
if(Track)Track->Delete(); |
834 |
// modify to avoid memory leakage |
if(SingletX)SingletX->Delete(); |
835 |
Track->Clear(); |
if(SingletY)SingletY->Delete(); |
836 |
SingletX->Clear(); |
} |
837 |
SingletY->Clear(); |
// //-------------------------------------- |
838 |
} |
// // |
839 |
//-------------------------------------- |
// // |
840 |
// |
// //-------------------------------------- |
|
// |
|
|
//-------------------------------------- |
|
841 |
void TrkLevel2::Delete(){ |
void TrkLevel2::Delete(){ |
842 |
|
|
843 |
Clear(); |
// cout << "void TrkLevel2::Delete()"<<endl; |
844 |
Track->Delete(); |
Clear(); |
845 |
SingletX->Delete(); |
if(Track)delete Track; |
846 |
SingletY->Delete(); |
if(SingletX)delete SingletX; |
847 |
|
if(SingletY)delete SingletY; |
848 |
|
|
849 |
} |
} |
850 |
//-------------------------------------- |
//-------------------------------------- |
851 |
// |
// |
857 |
*/ |
*/ |
858 |
TRefArray *TrkLevel2::GetTracks_NFitSorted(){ |
TRefArray *TrkLevel2::GetTracks_NFitSorted(){ |
859 |
|
|
860 |
TRefArray *sorted = new TRefArray(); |
if(!Track)return 0; |
861 |
|
|
862 |
|
TRefArray *sorted = new TRefArray(); |
863 |
|
|
864 |
TClonesArray &t = *Track; |
TClonesArray &t = *Track; |
865 |
// TClonesArray &ts = *PhysicalTrack; |
// TClonesArray &ts = *PhysicalTrack; |
866 |
int N = ntrk(); |
int N = ntrk(); |
867 |
vector<int> m(N); for(int i=0; i<N; i++)m[i]=1; |
vector<int> m(N); for(int i=0; i<N; i++)m[i]=1; |
868 |
// int m[50]; for(int i=0; i<N; i++)m[i]=1; |
// int m[50]; for(int i=0; i<N; i++)m[i]=1; |
869 |
|
|
870 |
int indo=0; |
int indo=0; |
871 |
int indi=0; |
int indi=0; |
872 |
while(N != 0){ |
while(N != 0){ |
873 |
int nfit =0; |
int nfit =0; |
874 |
float chi2ref = numeric_limits<float>::max(); |
float chi2ref = numeric_limits<float>::max(); |
875 |
|
|
876 |
// first loop to search maximum num. of fit points |
// first loop to search maximum num. of fit points |
877 |
for(int i=0; i < ntrk(); i++){ |
for(int i=0; i < ntrk(); i++){ |
878 |
if( ((TrkTrack *)t[i])->GetNtot() >= nfit && m[i]==1){ |
if( ((TrkTrack *)t[i])->GetNtot() >= nfit && m[i]==1){ |
879 |
nfit = ((TrkTrack *)t[i])->GetNtot(); |
nfit = ((TrkTrack *)t[i])->GetNtot(); |
880 |
} |
} |
881 |
} |
} |
882 |
//second loop to search minimum chi2 among selected |
//second loop to search minimum chi2 among selected |
883 |
for(int i=0; i<this->ntrk(); i++){ |
for(int i=0; i<this->ntrk(); i++){ |
884 |
Float_t chi2 = ((TrkTrack *)t[i])->chi2; |
Float_t chi2 = ((TrkTrack *)t[i])->chi2; |
885 |
if(chi2 < 0) chi2 = chi2*1000; |
if(chi2 < 0) chi2 = chi2*1000; |
886 |
if( chi2 < chi2ref |
if( chi2 < chi2ref |
887 |
&& ((TrkTrack *)t[i])->GetNtot() == nfit |
&& ((TrkTrack *)t[i])->GetNtot() == nfit |
888 |
&& m[i]==1){ |
&& m[i]==1){ |
889 |
chi2ref = ((TrkTrack *)t[i])->chi2; |
chi2ref = ((TrkTrack *)t[i])->chi2; |
890 |
indi = i; |
indi = i; |
891 |
}; |
}; |
892 |
}; |
}; |
893 |
if( ((TrkTrack *)t[indi])->HasImage() ){ |
if( ((TrkTrack *)t[indi])->HasImage() ){ |
894 |
m[((TrkTrack *)t[indi])->image] = 0; |
m[((TrkTrack *)t[indi])->image] = 0; |
895 |
N--; |
N--; |
896 |
|
|
897 |
// cout << "i** "<< ((TrkTrack *)t[indi])->image << " " << nfiti <<" "<<chi2i<<endl; |
// cout << "i** "<< ((TrkTrack *)t[indi])->image << " " << nfiti <<" "<<chi2i<<endl; |
898 |
}; |
}; |
899 |
sorted->Add( (TrkTrack*)t[indi] ); |
sorted->Add( (TrkTrack*)t[indi] ); |
900 |
|
|
901 |
m[indi] = 0; |
m[indi] = 0; |
902 |
// cout << "SORTED "<< indo << " "<< indi << " "<< N << endl; |
// cout << "SORTED "<< indo << " "<< indi << " "<< N << endl; |
903 |
N--; |
N--; |
904 |
indo++; |
indo++; |
905 |
} |
} |
906 |
m.clear(); |
m.clear(); |
907 |
// cout << "GetTracks_NFitSorted(it): Done"<< endl; |
// cout << "GetTracks_NFitSorted(it): Done"<< endl; |
908 |
|
|
909 |
return sorted; |
return sorted; |
910 |
// return PhysicalTrack; |
// return PhysicalTrack; |
911 |
} |
} |
912 |
//-------------------------------------- |
//-------------------------------------- |
925 |
cout << " Stored tracks ntrk() = "<< this->ntrk() << endl; |
cout << " Stored tracks ntrk() = "<< this->ntrk() << endl; |
926 |
return 0; |
return 0; |
927 |
} |
} |
928 |
|
if(!Track){ |
929 |
|
cout << "TrkTrack *TrkLevel2::GetStoredTrack(int is) >> (TClonesArray*) Track ==0 "<<endl; |
930 |
|
}; |
931 |
TClonesArray &t = *(Track); |
TClonesArray &t = *(Track); |
932 |
TrkTrack *track = (TrkTrack*)t[is]; |
TrkTrack *track = (TrkTrack*)t[is]; |
933 |
return track; |
return track; |
947 |
cout << " Stored x-singlets nclsx() = "<< this->nclsx() << endl; |
cout << " Stored x-singlets nclsx() = "<< this->nclsx() << endl; |
948 |
return 0; |
return 0; |
949 |
} |
} |
950 |
|
if(!SingletX)return 0; |
951 |
TClonesArray &t = *(SingletX); |
TClonesArray &t = *(SingletX); |
952 |
TrkSinglet *singlet = (TrkSinglet*)t[is]; |
TrkSinglet *singlet = (TrkSinglet*)t[is]; |
953 |
return singlet; |
return singlet; |
967 |
cout << " Stored y-singlets nclsy() = "<< this->nclsx() << endl; |
cout << " Stored y-singlets nclsy() = "<< this->nclsx() << endl; |
968 |
return 0; |
return 0; |
969 |
} |
} |
970 |
|
if(!SingletY)return 0; |
971 |
TClonesArray &t = *(SingletY); |
TClonesArray &t = *(SingletY); |
972 |
TrkSinglet *singlet = (TrkSinglet*)t[is]; |
TrkSinglet *singlet = (TrkSinglet*)t[is]; |
973 |
return singlet; |
return singlet; |
990 |
} |
} |
991 |
|
|
992 |
TRefArray *sorted = GetTracks(); //TEMPORANEO |
TRefArray *sorted = GetTracks(); //TEMPORANEO |
993 |
|
if(!sorted)return 0; |
994 |
TrkTrack *track = (TrkTrack*)sorted->At(it); |
TrkTrack *track = (TrkTrack*)sorted->At(it); |
995 |
sorted->Delete(); |
sorted->Clear(); |
996 |
|
delete sorted; |
997 |
return track; |
return track; |
998 |
} |
} |
999 |
/** |
/** |
1002 |
Int_t TrkLevel2::GetNTracks(){ |
Int_t TrkLevel2::GetNTracks(){ |
1003 |
|
|
1004 |
Float_t ntot=0; |
Float_t ntot=0; |
1005 |
|
if(!Track)return 0; |
1006 |
TClonesArray &t = *Track; |
TClonesArray &t = *Track; |
1007 |
for(int i=0; i<ntrk(); i++) { |
for(int i=0; i<ntrk(); i++) { |
1008 |
if( ((TrkTrack *)t[i])->GetImageSeqNo() == -1 ) ntot+=1.; |
if( ((TrkTrack *)t[i])->GetImageSeqNo() == -1 ) ntot+=1.; |
1021 |
*/ |
*/ |
1022 |
TrkTrack *TrkLevel2::GetTrackImage(int it){ |
TrkTrack *TrkLevel2::GetTrackImage(int it){ |
1023 |
|
|
1024 |
if(it >= this->GetNTracks()){ |
if(it >= this->GetNTracks()){ |
1025 |
cout << "** TrkLevel2 ** Track "<< it << "does not exits! " << endl; |
cout << "** TrkLevel2 ** Track "<< it << "does not exits! " << endl; |
1026 |
cout << " Physical tracks GetNTracks() = "<< this->ntrk() << endl; |
cout << " Physical tracks GetNTracks() = "<< this->ntrk() << endl; |
1027 |
return 0; |
return 0; |
1028 |
} |
} |
1029 |
|
|
1030 |
TRefArray* sorted = GetTracks(); //TEMPORANEO |
TRefArray* sorted = GetTracks(); //TEMPORANEO |
1031 |
TrkTrack *track = (TrkTrack*)sorted->At(it); |
if(!sorted)return 0; |
1032 |
|
TrkTrack *track = (TrkTrack*)sorted->At(it); |
1033 |
|
|
1034 |
if(!track->HasImage()){ |
if(!track->HasImage()){ |
1035 |
cout << "** TrkLevel2 ** Track "<< it << "does not have image! " << endl; |
cout << "** TrkLevel2 ** Track "<< it << "does not have image! " << endl; |
1036 |
return 0; |
return 0; |
1037 |
} |
} |
1038 |
TrkTrack *image = (TrkTrack*)(*Track)[track->image]; |
if(!Track)return 0; |
1039 |
|
TrkTrack *image = (TrkTrack*)(*Track)[track->image]; |
1040 |
|
|
1041 |
sorted->Delete(); |
sorted->Delete(); |
1042 |
|
delete sorted; |
1043 |
return image; |
|
1044 |
|
return image; |
1045 |
|
|
1046 |
} |
} |
1047 |
//-------------------------------------- |
//-------------------------------------- |
1156 |
tl = new float[npoint]; |
tl = new float[npoint]; |
1157 |
int i=0; |
int i=0; |
1158 |
do{ |
do{ |
1159 |
x[i] = 0; |
x[i] = 0; |
1160 |
y[i] = 0; |
y[i] = 0; |
1161 |
z[i] = zin[i]; |
z[i] = zin[i]; |
1162 |
thx[i] = 0; |
thx[i] = 0; |
1163 |
thy[i] = 0; |
thy[i] = 0; |
1164 |
tl[i] = 0; |
tl[i] = 0; |
1165 |
i++; |
i++; |
1166 |
}while(zin[i-1] > zin[i] && i < npoint); |
}while(zin[i-1] > zin[i] && i < npoint); |
1167 |
npoint=i; |
npoint=i; |
1168 |
if(npoint != n)cout << "NB! Trajectory created with "<<npoint<<" points"<<endl; |
if(npoint != n)cout << "NB! Trajectory created with "<<npoint<<" points"<<endl; |
1169 |
} |
} |
1170 |
|
void Trajectory::Delete(){ |
1171 |
|
|
1172 |
|
if(x) delete [] x; |
1173 |
|
if(y) delete [] y; |
1174 |
|
if(z) delete [] z; |
1175 |
|
if(thx) delete [] thx; |
1176 |
|
if(thy) delete [] thy; |
1177 |
|
if(tl) delete [] tl; |
1178 |
|
|
1179 |
|
} |
1180 |
//-------------------------------------- |
//-------------------------------------- |
1181 |
// |
// |
1182 |
// |
// |