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; |
52 |
clx = new TRefArray(6,0); |
// clx = new TRefArray(6,0); |
53 |
cly = new TRefArray(6,0); |
// cly = new TRefArray(6,0); |
54 |
}; |
}; |
55 |
//-------------------------------------- |
//-------------------------------------- |
56 |
// |
// |
66 |
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]; |
67 |
}; |
}; |
68 |
for(int ip=0;ip<6;ip++){ |
for(int ip=0;ip<6;ip++){ |
69 |
xgood[ip] = t.xgood[ip]; |
xgood[ip] = t.xgood[ip]; |
70 |
ygood[ip] = t.ygood[ip]; |
ygood[ip] = t.ygood[ip]; |
71 |
xm[ip] = t.xm[ip]; |
xm[ip] = t.xm[ip]; |
72 |
ym[ip] = t.ym[ip]; |
ym[ip] = t.ym[ip]; |
73 |
zm[ip] = t.zm[ip]; |
zm[ip] = t.zm[ip]; |
74 |
resx[ip] = t.resx[ip]; |
resx[ip] = t.resx[ip]; |
75 |
resy[ip] = t.resy[ip]; |
resy[ip] = t.resy[ip]; |
76 |
xv[ip] = t.xv[ip]; |
xv[ip] = t.xv[ip]; |
77 |
yv[ip] = t.yv[ip]; |
yv[ip] = t.yv[ip]; |
78 |
zv[ip] = t.zv[ip]; |
zv[ip] = t.zv[ip]; |
79 |
axv[ip] = t.axv[ip]; |
axv[ip] = t.axv[ip]; |
80 |
ayv[ip] = t.ayv[ip]; |
ayv[ip] = t.ayv[ip]; |
81 |
dedx_x[ip] = t.dedx_x[ip]; |
dedx_x[ip] = t.dedx_x[ip]; |
82 |
dedx_y[ip] = t.dedx_y[ip]; |
dedx_y[ip] = t.dedx_y[ip]; |
83 |
// clx[ip] = 0;//<<<<pointer |
}; |
84 |
// cly[ip] = 0;//<<<<pointer |
clx = 0; |
85 |
}; |
cly = 0; |
86 |
clx = new TRefArray(*(t.clx)); |
if(t.clx)clx = new TRefArray(*(t.clx)); |
87 |
cly = new TRefArray(*(t.cly)); |
if(t.cly)cly = new TRefArray(*(t.cly)); |
88 |
|
|
89 |
}; |
}; |
90 |
//-------------------------------------- |
//-------------------------------------- |
91 |
// |
// |
92 |
// |
// |
93 |
//-------------------------------------- |
//-------------------------------------- |
94 |
|
void TrkTrack::Copy(TrkTrack& t){ |
95 |
|
|
96 |
|
t.seqno = seqno; |
97 |
|
t.image = image; |
98 |
|
t.chi2 = chi2; |
99 |
|
t.nstep = nstep; |
100 |
|
for(int it1=0;it1<5;it1++){ |
101 |
|
t.al[it1] = al[it1]; |
102 |
|
for(int it2=0;it2<5;it2++)t.coval[it1][it2] = coval[it1][it2]; |
103 |
|
}; |
104 |
|
for(int ip=0;ip<6;ip++){ |
105 |
|
t.xgood[ip] = xgood[ip]; |
106 |
|
t.ygood[ip] = ygood[ip]; |
107 |
|
t.xm[ip] = xm[ip]; |
108 |
|
t.ym[ip] = ym[ip]; |
109 |
|
t.zm[ip] = zm[ip]; |
110 |
|
t.resx[ip] = resx[ip]; |
111 |
|
t.resy[ip] = resy[ip]; |
112 |
|
t.xv[ip] = xv[ip]; |
113 |
|
t.yv[ip] = yv[ip]; |
114 |
|
t.zv[ip] = zv[ip]; |
115 |
|
t.axv[ip] = axv[ip]; |
116 |
|
t.ayv[ip] = ayv[ip]; |
117 |
|
t.dedx_x[ip] = dedx_x[ip]; |
118 |
|
t.dedx_y[ip] = dedx_y[ip]; |
119 |
|
|
120 |
|
}; |
121 |
|
|
122 |
|
}; |
123 |
|
//-------------------------------------- |
124 |
|
// |
125 |
|
// |
126 |
|
//-------------------------------------- |
127 |
/** |
/** |
128 |
* Evaluates the trajectory in the apparatus associated to the track. |
* Evaluates the trajectory in the apparatus associated to the track. |
129 |
* 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. |
437 |
// |
// |
438 |
//-------------------------------------- |
//-------------------------------------- |
439 |
void TrkTrack::Clear(){ |
void TrkTrack::Clear(){ |
440 |
seqno = -1; |
// cout << "TrkTrack::Clear()"<<endl; |
441 |
image = -1; |
seqno = -1; |
442 |
chi2 = 0; |
image = -1; |
443 |
nstep = 0; |
chi2 = 0; |
444 |
for(int it1=0;it1<5;it1++){ |
nstep = 0; |
445 |
al[it1] = 0; |
for(int it1=0;it1<5;it1++){ |
446 |
for(int it2=0;it2<5;it2++)coval[it1][it2] = 0; |
al[it1] = 0; |
447 |
}; |
for(int it2=0;it2<5;it2++)coval[it1][it2] = 0; |
448 |
for(int ip=0;ip<6;ip++){ |
}; |
449 |
xgood[ip] = 0; |
for(int ip=0;ip<6;ip++){ |
450 |
ygood[ip] = 0; |
xgood[ip] = 0; |
451 |
xm[ip] = 0; |
ygood[ip] = 0; |
452 |
ym[ip] = 0; |
xm[ip] = 0; |
453 |
zm[ip] = 0; |
ym[ip] = 0; |
454 |
resx[ip] = 0; |
zm[ip] = 0; |
455 |
resy[ip] = 0; |
resx[ip] = 0; |
456 |
xv[ip] = 0; |
resy[ip] = 0; |
457 |
yv[ip] = 0; |
xv[ip] = 0; |
458 |
zv[ip] = 0; |
yv[ip] = 0; |
459 |
axv[ip] = 0; |
zv[ip] = 0; |
460 |
ayv[ip] = 0; |
axv[ip] = 0; |
461 |
dedx_x[ip] = 0; |
ayv[ip] = 0; |
462 |
dedx_y[ip] = 0; |
dedx_x[ip] = 0; |
463 |
// clx[ip] = 0; |
dedx_y[ip] = 0; |
464 |
// cly[ip] = 0; |
|
465 |
}; |
}; |
466 |
clx->Clear(); |
if(clx)clx->Clear(); |
467 |
cly->Clear(); |
if(cly)cly->Clear(); |
468 |
}; |
}; |
469 |
//-------------------------------------- |
//-------------------------------------- |
470 |
// |
// |
471 |
// |
// |
472 |
//-------------------------------------- |
//-------------------------------------- |
473 |
void TrkTrack::Delete(){ |
void TrkTrack::Delete(){ |
474 |
Clear(); |
// cout << "TrkTrack::Delete()"<<endl; |
475 |
clx->Delete(); |
// Clear(); |
476 |
cly->Delete(); |
if(clx)delete clx; |
477 |
|
if(cly)delete cly; |
478 |
}; |
}; |
479 |
//-------------------------------------- |
//-------------------------------------- |
480 |
// |
// |
481 |
// |
// |
482 |
//-------------------------------------- |
//-------------------------------------- |
486 |
// |
// |
487 |
//-------------------------------------- |
//-------------------------------------- |
488 |
TrkSinglet::TrkSinglet(){ |
TrkSinglet::TrkSinglet(){ |
489 |
|
// cout << "TrkSinglet::TrkSinglet() " << GetUniqueID()<<endl; |
490 |
plane = 0; |
plane = 0; |
491 |
coord[0] = 0; |
coord[0] = 0; |
492 |
coord[1] = 0; |
coord[1] = 0; |
493 |
sgnl = 0; |
sgnl = 0; |
494 |
cls = 0; |
// cls = 0; |
495 |
}; |
}; |
496 |
//-------------------------------------- |
//-------------------------------------- |
497 |
// |
// |
498 |
// |
// |
499 |
//-------------------------------------- |
//-------------------------------------- |
500 |
TrkSinglet::TrkSinglet(const TrkSinglet& s){ |
TrkSinglet::TrkSinglet(const TrkSinglet& s){ |
501 |
|
// cout << "TrkSinglet::TrkSinglet(const TrkSinglet& s) " << GetUniqueID()<<endl; |
502 |
plane = s.plane; |
plane = s.plane; |
503 |
coord[0] = s.coord[0]; |
coord[0] = s.coord[0]; |
504 |
coord[1] = s.coord[1]; |
coord[1] = s.coord[1]; |
505 |
sgnl = s.sgnl; |
sgnl = s.sgnl; |
506 |
// cls = 0;//<<<<pointer |
// cls = 0;//<<<<pointer |
507 |
cls = TRef(s.cls); |
cls = TRef(s.cls); |
508 |
}; |
}; |
509 |
//-------------------------------------- |
//-------------------------------------- |
510 |
// |
// |
521 |
// |
// |
522 |
// |
// |
523 |
//-------------------------------------- |
//-------------------------------------- |
524 |
|
void TrkSinglet::Clear(){ |
525 |
|
// cout << "TrkSinglet::Clear() " << GetUniqueID()<<endl; |
526 |
|
// cls=0; |
527 |
|
plane=-1; |
528 |
|
coord[0]=-999; |
529 |
|
coord[1]=-999; |
530 |
|
sgnl=0; |
531 |
|
|
532 |
|
} |
533 |
|
//-------------------------------------- |
534 |
|
// |
535 |
|
// |
536 |
|
//-------------------------------------- |
537 |
TrkLevel2::TrkLevel2(){ |
TrkLevel2::TrkLevel2(){ |
538 |
// good2 = -1; |
cout <<"TrkLevel2::TrkLevel2()"<<endl; |
539 |
for(Int_t i=0; i<12 ; i++){ |
for(Int_t i=0; i<12 ; i++){ |
|
// crc[i] = -1; |
|
540 |
good[i] = -1; |
good[i] = -1; |
541 |
}; |
}; |
542 |
Track = new TClonesArray("TrkTrack"); |
// okkio!! memory-leak |
543 |
SingletX = new TClonesArray("TrkSinglet"); |
// Track = new TClonesArray("TrkTrack"); |
544 |
SingletY = new TClonesArray("TrkSinglet"); |
// SingletX = new TClonesArray("TrkSinglet"); |
545 |
|
// SingletY = new TClonesArray("TrkSinglet"); |
546 |
|
Track = 0; |
547 |
|
SingletX = 0; |
548 |
|
SingletY = 0; |
549 |
|
|
550 |
// PhysicalTrack = new TClonesArray("TrkTrack"); |
} |
551 |
//sostituire con TRefArray... appena ho capito come si usa |
//-------------------------------------- |
552 |
|
// |
553 |
|
// |
554 |
|
//-------------------------------------- |
555 |
|
void TrkLevel2::Set(){ |
556 |
|
if(!Track)Track = new TClonesArray("TrkTrack"); |
557 |
|
if(!SingletX)SingletX = new TClonesArray("TrkSinglet"); |
558 |
|
if(!SingletY)SingletY = new TClonesArray("TrkSinglet"); |
559 |
} |
} |
560 |
//-------------------------------------- |
//-------------------------------------- |
561 |
// |
// |
563 |
//-------------------------------------- |
//-------------------------------------- |
564 |
void TrkLevel2::Dump(){ |
void TrkLevel2::Dump(){ |
565 |
|
|
|
TClonesArray &t = *Track; |
|
|
TClonesArray &sx = *SingletX; |
|
|
TClonesArray &sy = *SingletY; |
|
566 |
// |
// |
567 |
cout << endl << endl << "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"; |
cout << endl << endl << "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"; |
568 |
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]<<" "; |
569 |
cout << endl << "ntrk() : " << this->ntrk() ; |
cout << endl << "ntrk() : " << this->ntrk() ; |
570 |
cout << endl << "nclsx() : " << this->nclsx(); |
cout << endl << "nclsx() : " << this->nclsx(); |
571 |
cout << endl << "nclsy() : " << this->nclsy(); |
cout << endl << "nclsy() : " << this->nclsy(); |
572 |
for(int i=0; i<this->ntrk(); i++) ((TrkTrack *)t[i])->Dump(); |
// TClonesArray &t = *Track; |
573 |
for(int i=0; i<this->nclsx(); i++) ((TrkSinglet *)sx[i])->Dump(); |
// TClonesArray &sx = *SingletX; |
574 |
for(int i=0; i<this->nclsy(); i++) ((TrkSinglet *)sy[i])->Dump(); |
// TClonesArray &sy = *SingletY; |
575 |
|
// for(int i=0; i<ntrk(); i++) ((TrkTrack *)t[i])->Dump(); |
576 |
|
// for(int i=0; i<nclsx(); i++) ((TrkSinglet *)sx[i])->Dump(); |
577 |
|
// for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump(); |
578 |
|
if(Track){ |
579 |
|
TClonesArray &t = *Track; |
580 |
|
for(int i=0; i<ntrk(); i++) ((TrkTrack *)t[i])->Dump(); |
581 |
|
} |
582 |
|
if(SingletX){ |
583 |
|
TClonesArray &sx = *SingletX; |
584 |
|
for(int i=0; i<nclsx(); i++) ((TrkSinglet *)sx[i])->Dump(); |
585 |
|
} |
586 |
|
if(SingletY){ |
587 |
|
TClonesArray &sy = *SingletY; |
588 |
|
for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump(); |
589 |
|
} |
590 |
} |
} |
591 |
//-------------------------------------- |
//-------------------------------------- |
592 |
// |
// |
608 |
good[i] = l2->good[i]; |
good[i] = l2->good[i]; |
609 |
}; |
}; |
610 |
// *** TRACKS *** |
// *** TRACKS *** |
611 |
|
if(!Track) Track = new TClonesArray("TrkTrack"); |
612 |
TClonesArray &t = *Track; |
TClonesArray &t = *Track; |
613 |
for(int i=0; i<l2->ntrk; i++){ |
for(int i=0; i<l2->ntrk; i++){ |
614 |
t_track->seqno = i;// NBNBNBNB deve sempre essere = i |
t_track->seqno = i;// NBNBNBNB deve sempre essere = i |
615 |
t_track->image = l2->image[i]-1; |
t_track->image = l2->image[i]-1; |
616 |
// cout << "track "<<i<<t_track->seqno << t_track->image<<endl; |
// cout << "track "<<i<<t_track->seqno << t_track->image<<endl; |
617 |
t_track->chi2 = l2->chi2_nt[i]; |
t_track->chi2 = l2->chi2_nt[i]; |
618 |
t_track->nstep = l2->nstep_nt[i]; |
t_track->nstep = l2->nstep_nt[i]; |
619 |
for(int it1=0;it1<5;it1++){ |
for(int it1=0;it1<5;it1++){ |
620 |
t_track->al[it1] = l2->al_nt[i][it1]; |
t_track->al[it1] = l2->al_nt[i][it1]; |
621 |
for(int it2=0;it2<5;it2++) |
for(int it2=0;it2<5;it2++) |
622 |
t_track->coval[it1][it2] = l2->coval[i][it2][it1]; |
t_track->coval[it1][it2] = l2->coval[i][it2][it1]; |
623 |
}; |
}; |
624 |
for(int ip=0;ip<6;ip++){ |
for(int ip=0;ip<6;ip++){ |
625 |
t_track->xgood[ip] = l2->xgood_nt[i][ip]; |
t_track->xgood[ip] = l2->xgood_nt[i][ip]; |
626 |
t_track->ygood[ip] = l2->ygood_nt[i][ip]; |
t_track->ygood[ip] = l2->ygood_nt[i][ip]; |
627 |
t_track->xm[ip] = l2->xm_nt[i][ip]; |
t_track->xm[ip] = l2->xm_nt[i][ip]; |
628 |
t_track->ym[ip] = l2->ym_nt[i][ip]; |
t_track->ym[ip] = l2->ym_nt[i][ip]; |
629 |
t_track->zm[ip] = l2->zm_nt[i][ip]; |
t_track->zm[ip] = l2->zm_nt[i][ip]; |
630 |
t_track->resx[ip] = l2->resx_nt[i][ip]; |
t_track->resx[ip] = l2->resx_nt[i][ip]; |
631 |
t_track->resy[ip] = l2->resy_nt[i][ip]; |
t_track->resy[ip] = l2->resy_nt[i][ip]; |
632 |
t_track->xv[ip] = l2->xv_nt[i][ip]; |
t_track->xv[ip] = l2->xv_nt[i][ip]; |
633 |
t_track->yv[ip] = l2->yv_nt[i][ip]; |
t_track->yv[ip] = l2->yv_nt[i][ip]; |
634 |
t_track->zv[ip] = l2->zv_nt[i][ip]; |
t_track->zv[ip] = l2->zv_nt[i][ip]; |
635 |
t_track->axv[ip] = l2->axv_nt[i][ip]; |
t_track->axv[ip] = l2->axv_nt[i][ip]; |
636 |
t_track->ayv[ip] = l2->ayv_nt[i][ip]; |
t_track->ayv[ip] = l2->ayv_nt[i][ip]; |
637 |
t_track->dedx_x[ip] = l2->dedx_x[i][ip]; |
t_track->dedx_x[ip] = l2->dedx_x[i][ip]; |
638 |
t_track->dedx_y[ip] = l2->dedx_y[i][ip]; |
t_track->dedx_y[ip] = l2->dedx_y[i][ip]; |
639 |
// t_track->clx[ip] = 0; |
// t_track->clx[ip] = 0; |
640 |
// t_track->cly[ip] = 0; |
// t_track->cly[ip] = 0; |
641 |
}; |
}; |
642 |
new(t[i]) TrkTrack(*t_track); |
new(t[i]) TrkTrack(*t_track); |
643 |
t_track->Clear(); |
t_track->Clear(); |
644 |
}; |
}; |
645 |
// *** SINGLETS *** |
// *** SINGLETS *** |
646 |
|
if(!SingletX)SingletX = new TClonesArray("TrkSinglet"); |
647 |
TClonesArray &sx = *SingletX; |
TClonesArray &sx = *SingletX; |
648 |
for(int i=0; i<l2->nclsx; i++){ |
for(int i=0; i<l2->nclsx; i++){ |
649 |
t_singlet->plane = l2->planex[i]; |
t_singlet->plane = l2->planex[i]; |
650 |
t_singlet->coord[0] = l2->xs[i][0]; |
t_singlet->coord[0] = l2->xs[i][0]; |
651 |
t_singlet->coord[1] = l2->xs[i][1]; |
t_singlet->coord[1] = l2->xs[i][1]; |
652 |
t_singlet->sgnl = l2->signlxs[i]; |
t_singlet->sgnl = l2->signlxs[i]; |
653 |
// t_singlet->cls = 0; |
// t_singlet->cls = 0; |
654 |
new(sx[i]) TrkSinglet(*t_singlet); |
new(sx[i]) TrkSinglet(*t_singlet); |
655 |
t_singlet->Clear(); |
t_singlet->Clear(); |
656 |
} |
} |
657 |
|
if(!SingletY)SingletY = new TClonesArray("TrkSinglet"); |
658 |
TClonesArray &sy = *SingletY; |
TClonesArray &sy = *SingletY; |
659 |
for(int i=0; i<l2->nclsy; i++){ |
for(int i=0; i<l2->nclsy; i++){ |
660 |
t_singlet->plane = l2->planey[i]; |
t_singlet->plane = l2->planey[i]; |
661 |
t_singlet->coord[0] = l2->ys[i][0]; |
t_singlet->coord[0] = l2->ys[i][0]; |
662 |
t_singlet->coord[1] = l2->ys[i][1]; |
t_singlet->coord[1] = l2->ys[i][1]; |
663 |
t_singlet->sgnl = l2->signlys[i]; |
t_singlet->sgnl = l2->signlys[i]; |
664 |
// t_singlet->cls = 0; |
// t_singlet->cls = 0; |
665 |
new(sy[i]) TrkSinglet(*t_singlet); |
new(sy[i]) TrkSinglet(*t_singlet); |
666 |
t_singlet->Clear(); |
t_singlet->Clear(); |
667 |
}; |
}; |
668 |
|
|
669 |
delete t_track; |
delete t_track; |
670 |
delete t_singlet; |
delete t_singlet; |
671 |
} |
} |
672 |
//-------------------------------------- |
//-------------------------------------- |
673 |
// |
// |
689 |
good[i] = l2->good[i]; |
good[i] = l2->good[i]; |
690 |
}; |
}; |
691 |
// *** TRACKS *** |
// *** TRACKS *** |
692 |
|
if(!Track) Track = new TClonesArray("TrkTrack"); |
693 |
TClonesArray &t = *Track; |
TClonesArray &t = *Track; |
694 |
|
if(!t_track->clx)t_track->clx = new TRefArray(6,0); |
695 |
|
if(!t_track->cly)t_track->cly = new TRefArray(6,0); |
696 |
for(int i=0; i<l2->ntrk; i++){ |
for(int i=0; i<l2->ntrk; i++){ |
697 |
t_track->seqno = i;// NBNBNBNB deve sempre essere = i |
t_track->seqno = i;// NBNBNBNB deve sempre essere = i |
698 |
t_track->image = l2->image[i]-1; |
t_track->image = l2->image[i]-1; |
721 |
t_track->dedx_y[ip] = l2->dedx_y[i][ip]; |
t_track->dedx_y[ip] = l2->dedx_y[i][ip]; |
722 |
// 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; |
723 |
//----------------------------------------------------- |
//----------------------------------------------------- |
724 |
// t_track->clx[ip] = l1->GetCluster(l2->cltrx[i][ip]-1); |
//----------------------------------------------------- |
|
// t_track->cly[ip] = l1->GetCluster(l2->cltry[i][ip]-1); |
|
725 |
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); |
726 |
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); |
727 |
// 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; |
728 |
// 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; |
729 |
//----------------------------------------------------- |
//----------------------------------------------------- |
730 |
|
//----------------------------------------------------- |
731 |
}; |
}; |
732 |
new(t[i]) TrkTrack(*t_track); |
new(t[i]) TrkTrack(*t_track); |
733 |
t_track->Clear(); |
t_track->Clear(); |
734 |
}; |
}; |
735 |
// *** SINGLETS *** |
// *** SINGLETS *** |
736 |
|
if(!SingletX)SingletX = new TClonesArray("TrkSinglet"); |
737 |
TClonesArray &sx = *SingletX; |
TClonesArray &sx = *SingletX; |
738 |
for(int i=0; i<l2->nclsx; i++){ |
for(int i=0; i<l2->nclsx; i++){ |
739 |
t_singlet->plane = l2->planex[i]; |
t_singlet->plane = l2->planex[i]; |
748 |
new(sx[i]) TrkSinglet(*t_singlet); |
new(sx[i]) TrkSinglet(*t_singlet); |
749 |
t_singlet->Clear(); |
t_singlet->Clear(); |
750 |
} |
} |
751 |
|
if(!SingletY)SingletY = new TClonesArray("TrkSinglet"); |
752 |
TClonesArray &sy = *SingletY; |
TClonesArray &sy = *SingletY; |
753 |
for(int i=0; i<l2->nclsy; i++){ |
for(int i=0; i<l2->nclsy; i++){ |
754 |
t_singlet->plane = l2->planey[i]; |
t_singlet->plane = l2->planey[i]; |
781 |
}; |
}; |
782 |
// *** TRACKS *** |
// *** TRACKS *** |
783 |
|
|
784 |
l2->ntrk = Track->GetEntries(); |
if(Track){ |
785 |
for(Int_t i=0;i<l2->ntrk;i++){ |
l2->ntrk = Track->GetEntries(); |
786 |
l2->image[i] = 1 + ((TrkTrack *)Track->At(i))->image; |
for(Int_t i=0;i<l2->ntrk;i++){ |
787 |
l2->chi2_nt[i] = ((TrkTrack *)Track->At(i))->chi2; |
l2->image[i] = 1 + ((TrkTrack *)Track->At(i))->image; |
788 |
l2->nstep_nt[i] = ((TrkTrack *)Track->At(i))->nstep; |
l2->chi2_nt[i] = ((TrkTrack *)Track->At(i))->chi2; |
789 |
for(int it1=0;it1<5;it1++){ |
l2->nstep_nt[i] = ((TrkTrack *)Track->At(i))->nstep; |
790 |
l2->al_nt[i][it1] = ((TrkTrack *)Track->At(i))->al[it1]; |
for(int it1=0;it1<5;it1++){ |
791 |
for(int it2=0;it2<5;it2++) |
l2->al_nt[i][it1] = ((TrkTrack *)Track->At(i))->al[it1]; |
792 |
l2->coval[i][it2][it1] = ((TrkTrack *)Track->At(i))->coval[it1][it2]; |
for(int it2=0;it2<5;it2++) |
793 |
}; |
l2->coval[i][it2][it1] = ((TrkTrack *)Track->At(i))->coval[it1][it2]; |
794 |
for(int ip=0;ip<6;ip++){ |
}; |
795 |
l2->xgood_nt[i][ip] = ((TrkTrack *)Track->At(i))->xgood[ip]; |
for(int ip=0;ip<6;ip++){ |
796 |
l2->ygood_nt[i][ip] = ((TrkTrack *)Track->At(i))->ygood[ip]; |
l2->xgood_nt[i][ip] = ((TrkTrack *)Track->At(i))->xgood[ip]; |
797 |
l2->xm_nt[i][ip] = ((TrkTrack *)Track->At(i))->xm[ip]; |
l2->ygood_nt[i][ip] = ((TrkTrack *)Track->At(i))->ygood[ip]; |
798 |
l2->ym_nt[i][ip] = ((TrkTrack *)Track->At(i))->ym[ip]; |
l2->xm_nt[i][ip] = ((TrkTrack *)Track->At(i))->xm[ip]; |
799 |
l2->zm_nt[i][ip] = ((TrkTrack *)Track->At(i))->zm[ip]; |
l2->ym_nt[i][ip] = ((TrkTrack *)Track->At(i))->ym[ip]; |
800 |
l2->resx_nt[i][ip] = ((TrkTrack *)Track->At(i))->resx[ip]; |
l2->zm_nt[i][ip] = ((TrkTrack *)Track->At(i))->zm[ip]; |
801 |
l2->resy_nt[i][ip] = ((TrkTrack *)Track->At(i))->resy[ip]; |
l2->resx_nt[i][ip] = ((TrkTrack *)Track->At(i))->resx[ip]; |
802 |
l2->xv_nt[i][ip] = ((TrkTrack *)Track->At(i))->xv[ip]; |
l2->resy_nt[i][ip] = ((TrkTrack *)Track->At(i))->resy[ip]; |
803 |
l2->yv_nt[i][ip] = ((TrkTrack *)Track->At(i))->yv[ip]; |
l2->xv_nt[i][ip] = ((TrkTrack *)Track->At(i))->xv[ip]; |
804 |
l2->zv_nt[i][ip] = ((TrkTrack *)Track->At(i))->zv[ip]; |
l2->yv_nt[i][ip] = ((TrkTrack *)Track->At(i))->yv[ip]; |
805 |
l2->axv_nt[i][ip] = ((TrkTrack *)Track->At(i))->axv[ip]; |
l2->zv_nt[i][ip] = ((TrkTrack *)Track->At(i))->zv[ip]; |
806 |
l2->ayv_nt[i][ip] = ((TrkTrack *)Track->At(i))->ayv[ip]; |
l2->axv_nt[i][ip] = ((TrkTrack *)Track->At(i))->axv[ip]; |
807 |
l2->dedx_x[i][ip] = ((TrkTrack *)Track->At(i))->dedx_x[ip]; |
l2->ayv_nt[i][ip] = ((TrkTrack *)Track->At(i))->ayv[ip]; |
808 |
l2->dedx_y[i][ip] = ((TrkTrack *)Track->At(i))->dedx_y[ip]; |
l2->dedx_x[i][ip] = ((TrkTrack *)Track->At(i))->dedx_x[ip]; |
809 |
}; |
l2->dedx_y[i][ip] = ((TrkTrack *)Track->At(i))->dedx_y[ip]; |
810 |
|
}; |
811 |
|
} |
812 |
} |
} |
|
|
|
813 |
// *** SINGLETS *** |
// *** SINGLETS *** |
814 |
l2->nclsx = SingletX->GetEntries(); |
if(SingletX){ |
815 |
for(Int_t i=0;i<l2->nclsx;i++){ |
l2->nclsx = SingletX->GetEntries(); |
816 |
l2->planex[i] = ((TrkSinglet *)SingletX->At(i))->plane; |
for(Int_t i=0;i<l2->nclsx;i++){ |
817 |
l2->xs[i][0] = ((TrkSinglet *)SingletX->At(i))->coord[0]; |
l2->planex[i] = ((TrkSinglet *)SingletX->At(i))->plane; |
818 |
l2->xs[i][1] = ((TrkSinglet *)SingletX->At(i))->coord[1]; |
l2->xs[i][0] = ((TrkSinglet *)SingletX->At(i))->coord[0]; |
819 |
l2->signlxs[i] = ((TrkSinglet *)SingletX->At(i))->sgnl; |
l2->xs[i][1] = ((TrkSinglet *)SingletX->At(i))->coord[1]; |
820 |
} |
l2->signlxs[i] = ((TrkSinglet *)SingletX->At(i))->sgnl; |
821 |
l2->nclsy = SingletY->GetEntries(); |
} |
822 |
for(Int_t i=0;i<l2->nclsy;i++){ |
} |
823 |
l2->planey[i] = ((TrkSinglet *)SingletY->At(i))->plane; |
|
824 |
l2->ys[i][0] = ((TrkSinglet *)SingletY->At(i))->coord[0]; |
if(SingletY){ |
825 |
l2->ys[i][1] = ((TrkSinglet *)SingletY->At(i))->coord[1]; |
l2->nclsy = SingletY->GetEntries(); |
826 |
l2->signlys[i] = ((TrkSinglet *)SingletY->At(i))->sgnl; |
for(Int_t i=0;i<l2->nclsy;i++){ |
827 |
|
l2->planey[i] = ((TrkSinglet *)SingletY->At(i))->plane; |
828 |
|
l2->ys[i][0] = ((TrkSinglet *)SingletY->At(i))->coord[0]; |
829 |
|
l2->ys[i][1] = ((TrkSinglet *)SingletY->At(i))->coord[1]; |
830 |
|
l2->signlys[i] = ((TrkSinglet *)SingletY->At(i))->sgnl; |
831 |
|
} |
832 |
} |
} |
833 |
} |
} |
834 |
//-------------------------------------- |
//-------------------------------------- |
836 |
// |
// |
837 |
//-------------------------------------- |
//-------------------------------------- |
838 |
void TrkLevel2::Clear(){ |
void TrkLevel2::Clear(){ |
|
// good2 = -1; |
|
839 |
for(Int_t i=0; i<12 ; i++){ |
for(Int_t i=0; i<12 ; i++){ |
840 |
// crc[i] = -1; |
good[i] = -1; |
841 |
good[i] = -1; |
}; |
842 |
}; |
// if(Track)Track->Clear("C"); |
843 |
/* Track->RemoveAll(); |
// if(SingletX)SingletX->Clear("C"); |
844 |
SingletX->RemoveAll(); |
// if(SingletY)SingletY->Clear("C"); |
845 |
SingletY->RemoveAll();*/ |
if(Track)Track->Delete(); |
846 |
// modify to avoid memory leakage |
if(SingletX)SingletX->Delete(); |
847 |
Track->Clear(); |
if(SingletY)SingletY->Delete(); |
848 |
SingletX->Clear(); |
} |
849 |
SingletY->Clear(); |
// //-------------------------------------- |
850 |
} |
// // |
851 |
//-------------------------------------- |
// // |
852 |
// |
// //-------------------------------------- |
|
// |
|
|
//-------------------------------------- |
|
853 |
void TrkLevel2::Delete(){ |
void TrkLevel2::Delete(){ |
854 |
|
|
855 |
Clear(); |
// cout << "void TrkLevel2::Delete()"<<endl; |
856 |
Track->Delete(); |
Clear(); |
857 |
SingletX->Delete(); |
if(Track)delete Track; |
858 |
SingletY->Delete(); |
if(SingletX)delete SingletX; |
859 |
|
if(SingletY)delete SingletY; |
860 |
|
|
861 |
} |
} |
862 |
//-------------------------------------- |
//-------------------------------------- |
863 |
// |
// |
869 |
*/ |
*/ |
870 |
TRefArray *TrkLevel2::GetTracks_NFitSorted(){ |
TRefArray *TrkLevel2::GetTracks_NFitSorted(){ |
871 |
|
|
872 |
TRefArray *sorted = new TRefArray(); |
if(!Track)return 0; |
873 |
|
|
874 |
|
TRefArray *sorted = new TRefArray(); |
875 |
|
|
876 |
TClonesArray &t = *Track; |
TClonesArray &t = *Track; |
877 |
// TClonesArray &ts = *PhysicalTrack; |
// TClonesArray &ts = *PhysicalTrack; |
878 |
int N = ntrk(); |
int N = ntrk(); |
879 |
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; |
880 |
// 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; |
881 |
|
|
882 |
int indo=0; |
int indo=0; |
883 |
int indi=0; |
int indi=0; |
884 |
while(N != 0){ |
while(N != 0){ |
885 |
int nfit =0; |
int nfit =0; |
886 |
float chi2ref = numeric_limits<float>::max(); |
float chi2ref = numeric_limits<float>::max(); |
887 |
|
|
888 |
// first loop to search maximum num. of fit points |
// first loop to search maximum num. of fit points |
889 |
for(int i=0; i < ntrk(); i++){ |
for(int i=0; i < ntrk(); i++){ |
890 |
if( ((TrkTrack *)t[i])->GetNtot() >= nfit && m[i]==1){ |
if( ((TrkTrack *)t[i])->GetNtot() >= nfit && m[i]==1){ |
891 |
nfit = ((TrkTrack *)t[i])->GetNtot(); |
nfit = ((TrkTrack *)t[i])->GetNtot(); |
892 |
} |
} |
893 |
} |
} |
894 |
//second loop to search minimum chi2 among selected |
//second loop to search minimum chi2 among selected |
895 |
for(int i=0; i<this->ntrk(); i++){ |
for(int i=0; i<this->ntrk(); i++){ |
896 |
Float_t chi2 = ((TrkTrack *)t[i])->chi2; |
Float_t chi2 = ((TrkTrack *)t[i])->chi2; |
897 |
if(chi2 < 0) chi2 = chi2*1000; |
if(chi2 < 0) chi2 = chi2*1000; |
898 |
if( chi2 < chi2ref |
if( chi2 < chi2ref |
899 |
&& ((TrkTrack *)t[i])->GetNtot() == nfit |
&& ((TrkTrack *)t[i])->GetNtot() == nfit |
900 |
&& m[i]==1){ |
&& m[i]==1){ |
901 |
chi2ref = ((TrkTrack *)t[i])->chi2; |
chi2ref = ((TrkTrack *)t[i])->chi2; |
902 |
indi = i; |
indi = i; |
903 |
}; |
}; |
904 |
}; |
}; |
905 |
if( ((TrkTrack *)t[indi])->HasImage() ){ |
if( ((TrkTrack *)t[indi])->HasImage() ){ |
906 |
m[((TrkTrack *)t[indi])->image] = 0; |
m[((TrkTrack *)t[indi])->image] = 0; |
907 |
N--; |
N--; |
908 |
|
|
909 |
// cout << "i** "<< ((TrkTrack *)t[indi])->image << " " << nfiti <<" "<<chi2i<<endl; |
// cout << "i** "<< ((TrkTrack *)t[indi])->image << " " << nfiti <<" "<<chi2i<<endl; |
910 |
}; |
}; |
911 |
sorted->Add( (TrkTrack*)t[indi] ); |
sorted->Add( (TrkTrack*)t[indi] ); |
912 |
|
|
913 |
m[indi] = 0; |
m[indi] = 0; |
914 |
// cout << "SORTED "<< indo << " "<< indi << " "<< N << endl; |
// cout << "SORTED "<< indo << " "<< indi << " "<< N << endl; |
915 |
N--; |
N--; |
916 |
indo++; |
indo++; |
917 |
} |
} |
918 |
m.clear(); |
m.clear(); |
919 |
// cout << "GetTracks_NFitSorted(it): Done"<< endl; |
// cout << "GetTracks_NFitSorted(it): Done"<< endl; |
920 |
|
|
921 |
return sorted; |
return sorted; |
922 |
// return PhysicalTrack; |
// return PhysicalTrack; |
923 |
} |
} |
924 |
//-------------------------------------- |
//-------------------------------------- |
937 |
cout << " Stored tracks ntrk() = "<< this->ntrk() << endl; |
cout << " Stored tracks ntrk() = "<< this->ntrk() << endl; |
938 |
return 0; |
return 0; |
939 |
} |
} |
940 |
|
if(!Track){ |
941 |
|
cout << "TrkTrack *TrkLevel2::GetStoredTrack(int is) >> (TClonesArray*) Track ==0 "<<endl; |
942 |
|
}; |
943 |
TClonesArray &t = *(Track); |
TClonesArray &t = *(Track); |
944 |
TrkTrack *track = (TrkTrack*)t[is]; |
TrkTrack *track = (TrkTrack*)t[is]; |
945 |
return track; |
return track; |
959 |
cout << " Stored x-singlets nclsx() = "<< this->nclsx() << endl; |
cout << " Stored x-singlets nclsx() = "<< this->nclsx() << endl; |
960 |
return 0; |
return 0; |
961 |
} |
} |
962 |
|
if(!SingletX)return 0; |
963 |
TClonesArray &t = *(SingletX); |
TClonesArray &t = *(SingletX); |
964 |
TrkSinglet *singlet = (TrkSinglet*)t[is]; |
TrkSinglet *singlet = (TrkSinglet*)t[is]; |
965 |
return singlet; |
return singlet; |
979 |
cout << " Stored y-singlets nclsy() = "<< this->nclsx() << endl; |
cout << " Stored y-singlets nclsy() = "<< this->nclsx() << endl; |
980 |
return 0; |
return 0; |
981 |
} |
} |
982 |
|
if(!SingletY)return 0; |
983 |
TClonesArray &t = *(SingletY); |
TClonesArray &t = *(SingletY); |
984 |
TrkSinglet *singlet = (TrkSinglet*)t[is]; |
TrkSinglet *singlet = (TrkSinglet*)t[is]; |
985 |
return singlet; |
return singlet; |
1002 |
} |
} |
1003 |
|
|
1004 |
TRefArray *sorted = GetTracks(); //TEMPORANEO |
TRefArray *sorted = GetTracks(); //TEMPORANEO |
1005 |
|
if(!sorted)return 0; |
1006 |
TrkTrack *track = (TrkTrack*)sorted->At(it); |
TrkTrack *track = (TrkTrack*)sorted->At(it); |
1007 |
sorted->Delete(); |
sorted->Clear(); |
1008 |
|
delete sorted; |
1009 |
return track; |
return track; |
1010 |
} |
} |
1011 |
/** |
/** |
1014 |
Int_t TrkLevel2::GetNTracks(){ |
Int_t TrkLevel2::GetNTracks(){ |
1015 |
|
|
1016 |
Float_t ntot=0; |
Float_t ntot=0; |
1017 |
|
if(!Track)return 0; |
1018 |
TClonesArray &t = *Track; |
TClonesArray &t = *Track; |
1019 |
for(int i=0; i<ntrk(); i++) { |
for(int i=0; i<ntrk(); i++) { |
1020 |
if( ((TrkTrack *)t[i])->GetImageSeqNo() == -1 ) ntot+=1.; |
if( ((TrkTrack *)t[i])->GetImageSeqNo() == -1 ) ntot+=1.; |
1033 |
*/ |
*/ |
1034 |
TrkTrack *TrkLevel2::GetTrackImage(int it){ |
TrkTrack *TrkLevel2::GetTrackImage(int it){ |
1035 |
|
|
1036 |
if(it >= this->GetNTracks()){ |
if(it >= this->GetNTracks()){ |
1037 |
cout << "** TrkLevel2 ** Track "<< it << "does not exits! " << endl; |
cout << "** TrkLevel2 ** Track "<< it << "does not exits! " << endl; |
1038 |
cout << " Physical tracks GetNTracks() = "<< this->ntrk() << endl; |
cout << " Physical tracks GetNTracks() = "<< this->ntrk() << endl; |
1039 |
return 0; |
return 0; |
1040 |
} |
} |
1041 |
|
|
1042 |
TRefArray* sorted = GetTracks(); //TEMPORANEO |
TRefArray* sorted = GetTracks(); //TEMPORANEO |
1043 |
TrkTrack *track = (TrkTrack*)sorted->At(it); |
if(!sorted)return 0; |
1044 |
|
TrkTrack *track = (TrkTrack*)sorted->At(it); |
1045 |
|
|
1046 |
if(!track->HasImage()){ |
if(!track->HasImage()){ |
1047 |
cout << "** TrkLevel2 ** Track "<< it << "does not have image! " << endl; |
cout << "** TrkLevel2 ** Track "<< it << "does not have image! " << endl; |
1048 |
return 0; |
return 0; |
1049 |
} |
} |
1050 |
TrkTrack *image = (TrkTrack*)(*Track)[track->image]; |
if(!Track)return 0; |
1051 |
|
TrkTrack *image = (TrkTrack*)(*Track)[track->image]; |
1052 |
|
|
1053 |
sorted->Delete(); |
sorted->Delete(); |
1054 |
|
delete sorted; |
1055 |
return image; |
|
1056 |
|
return image; |
1057 |
|
|
1058 |
} |
} |
1059 |
//-------------------------------------- |
//-------------------------------------- |
1168 |
tl = new float[npoint]; |
tl = new float[npoint]; |
1169 |
int i=0; |
int i=0; |
1170 |
do{ |
do{ |
1171 |
x[i] = 0; |
x[i] = 0; |
1172 |
y[i] = 0; |
y[i] = 0; |
1173 |
z[i] = zin[i]; |
z[i] = zin[i]; |
1174 |
thx[i] = 0; |
thx[i] = 0; |
1175 |
thy[i] = 0; |
thy[i] = 0; |
1176 |
tl[i] = 0; |
tl[i] = 0; |
1177 |
i++; |
i++; |
1178 |
}while(zin[i-1] > zin[i] && i < npoint); |
}while(zin[i-1] > zin[i] && i < npoint); |
1179 |
npoint=i; |
npoint=i; |
1180 |
if(npoint != n)cout << "NB! Trajectory created with "<<npoint<<" points"<<endl; |
if(npoint != n)cout << "NB! Trajectory created with "<<npoint<<" points"<<endl; |
1181 |
} |
} |
1182 |
|
void Trajectory::Delete(){ |
1183 |
|
|
1184 |
|
if(x) delete [] x; |
1185 |
|
if(y) delete [] y; |
1186 |
|
if(z) delete [] z; |
1187 |
|
if(thx) delete [] thx; |
1188 |
|
if(thy) delete [] thy; |
1189 |
|
if(tl) delete [] tl; |
1190 |
|
|
1191 |
|
} |
1192 |
//-------------------------------------- |
//-------------------------------------- |
1193 |
// |
// |
1194 |
// |
// |