13 |
void dotrack_(int*, double*, double*, double*, double*, int*); |
void dotrack_(int*, double*, double*, double*, double*, int*); |
14 |
void dotrack2_(int*, double*, double*, double*, double*,double*, double*, double*,int*); |
void dotrack2_(int*, double*, double*, double*, double*,double*, double*, double*,int*); |
15 |
// int readb_(const char*); |
// int readb_(const char*); |
16 |
int readb_(); |
// int readb_(); |
17 |
void mini2_(int*,int*,int*); |
void mini2_(int*,int*,int*); |
18 |
void guess_(); |
void guess_(); |
19 |
void gufld_(float*, float*); |
void gufld_(float*, float*); |
20 |
} |
} |
21 |
|
|
22 |
//-------------------------------------- |
//-------------------------------------- |
23 |
// |
// |
24 |
// |
// |
145 |
for (int i=0; i<5; i++) dal[i] = (double)al[i]; |
for (int i=0; i<5; i++) dal[i] = (double)al[i]; |
146 |
for (int i=0; i<t->npoint; i++) dzin[i] = (double)t->z[i]; |
for (int i=0; i<t->npoint; i++) dzin[i] = (double)t->z[i]; |
147 |
|
|
148 |
|
TrkParams::Load(1); |
149 |
|
if( !TrkParams::IsLoaded(1) ){ |
150 |
|
cout << "int TrkTrack::DoTrack(Trajectory* t) --- ERROR --- m.field not loaded"<<endl; |
151 |
|
return 0; |
152 |
|
} |
153 |
dotrack_(&(t->npoint),dzin,dxout,dyout,dal,&ifail); |
dotrack_(&(t->npoint),dzin,dxout,dyout,dal,&ifail); |
154 |
|
|
155 |
for (int i=0; i<t->npoint; i++){ |
for (int i=0; i<t->npoint; i++){ |
189 |
for (int i=0; i<5; i++) dal[i] = (double)al[i]; |
for (int i=0; i<5; i++) dal[i] = (double)al[i]; |
190 |
for (int i=0; i<t->npoint; i++) dzin[i] = (double)t->z[i]; |
for (int i=0; i<t->npoint; i++) dzin[i] = (double)t->z[i]; |
191 |
|
|
192 |
|
TrkParams::Load(1); |
193 |
|
if( !TrkParams::IsLoaded(1) ){ |
194 |
|
cout << "int TrkTrack::DoTrack2(Trajectory* t) --- ERROR --- m.field not loaded"<<endl; |
195 |
|
return 0; |
196 |
|
} |
197 |
dotrack2_(&(t->npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&ifail); |
dotrack2_(&(t->npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&ifail); |
198 |
|
|
199 |
for (int i=0; i<t->npoint; i++){ |
for (int i=0; i<t->npoint; i++){ |
298 |
*/ |
*/ |
299 |
void TrkTrack::LoadField(TString path){ |
void TrkTrack::LoadField(TString path){ |
300 |
|
|
301 |
strcpy(path_.path,path.Data()); |
// strcpy(path_.path,path.Data()); |
302 |
path_.pathlen = path.Length(); |
// path_.pathlen = path.Length(); |
303 |
path_.error = 0; |
// path_.error = 0; |
304 |
readb_(); |
// readb_(); |
305 |
|
|
306 |
|
TrkParams::Set(path,1); |
307 |
|
|
308 |
}; |
}; |
309 |
|
|
368 |
axv[i] = track->axv[i]; |
axv[i] = track->axv[i]; |
369 |
ayv[i] = track->ayv[i]; |
ayv[i] = track->ayv[i]; |
370 |
} |
} |
|
|
|
371 |
|
|
372 |
} |
} |
373 |
/** |
/** |
399 |
|
|
400 |
// ------------------------------------------ |
// ------------------------------------------ |
401 |
// call mini routine |
// call mini routine |
402 |
|
TrkParams::Load(1); |
403 |
|
if( !TrkParams::IsLoaded(1) ){ |
404 |
|
cout << "void TrkTrack::Fit(double pfixed, int& fail, int iprint) --- ERROR --- m.field not loaded"<<endl; |
405 |
|
return; |
406 |
|
} |
407 |
int istep=0; |
int istep=0; |
408 |
int ifail=0; |
int ifail=0; |
409 |
mini2_(&istep,&ifail, &iprint); |
mini2_(&istep,&ifail, &iprint); |
614 |
/** |
/** |
615 |
* Fills a TrkLevel2 object with values from a struct cTrkLevel2 (to get data from F77 common). |
* Fills a TrkLevel2 object with values from a struct cTrkLevel2 (to get data from F77 common). |
616 |
*/ |
*/ |
617 |
void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2){ |
// void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2){ |
|
|
|
|
// temporary objects: |
|
|
TrkSinglet* t_singlet = new TrkSinglet(); |
|
|
TrkTrack* t_track = new TrkTrack(); |
|
618 |
|
|
619 |
// **** general variables **** |
// // temporary objects: |
620 |
// good2 = l2->good2; |
// TrkSinglet* t_singlet = new TrkSinglet(); |
621 |
for(Int_t i=0; i<12 ; i++){ |
// TrkTrack* t_track = new TrkTrack(); |
622 |
// crc[i] = l2->crc[i]; |
|
623 |
good[i] = l2->good[i]; |
// // **** general variables **** |
624 |
}; |
// // good2 = l2->good2; |
625 |
// *** TRACKS *** |
// for(Int_t i=0; i<12 ; i++){ |
626 |
if(!Track) Track = new TClonesArray("TrkTrack"); |
// // crc[i] = l2->crc[i]; |
627 |
TClonesArray &t = *Track; |
// good[i] = l2->good[i]; |
628 |
for(int i=0; i<l2->ntrk; i++){ |
// }; |
629 |
t_track->seqno = i;// NBNBNBNB deve sempre essere = i |
// // *** TRACKS *** |
630 |
t_track->image = l2->image[i]-1; |
// if(!Track) Track = new TClonesArray("TrkTrack"); |
631 |
// cout << "track "<<i<<t_track->seqno << t_track->image<<endl; |
// TClonesArray &t = *Track; |
632 |
t_track->chi2 = l2->chi2_nt[i]; |
// for(int i=0; i<l2->ntrk; i++){ |
633 |
t_track->nstep = l2->nstep_nt[i]; |
// t_track->seqno = i;// NBNBNBNB deve sempre essere = i |
634 |
for(int it1=0;it1<5;it1++){ |
// t_track->image = l2->image[i]-1; |
635 |
t_track->al[it1] = l2->al_nt[i][it1]; |
// // cout << "track "<<i<<t_track->seqno << t_track->image<<endl; |
636 |
for(int it2=0;it2<5;it2++) |
// t_track->chi2 = l2->chi2_nt[i]; |
637 |
t_track->coval[it1][it2] = l2->coval[i][it2][it1]; |
// t_track->nstep = l2->nstep_nt[i]; |
638 |
}; |
// for(int it1=0;it1<5;it1++){ |
639 |
for(int ip=0;ip<6;ip++){ |
// t_track->al[it1] = l2->al_nt[i][it1]; |
640 |
t_track->xgood[ip] = l2->xgood_nt[i][ip]; |
// for(int it2=0;it2<5;it2++) |
641 |
t_track->ygood[ip] = l2->ygood_nt[i][ip]; |
// t_track->coval[it1][it2] = l2->coval[i][it2][it1]; |
642 |
t_track->xm[ip] = l2->xm_nt[i][ip]; |
// }; |
643 |
t_track->ym[ip] = l2->ym_nt[i][ip]; |
// for(int ip=0;ip<6;ip++){ |
644 |
t_track->zm[ip] = l2->zm_nt[i][ip]; |
// t_track->xgood[ip] = l2->xgood_nt[i][ip]; |
645 |
t_track->resx[ip] = l2->resx_nt[i][ip]; |
// t_track->ygood[ip] = l2->ygood_nt[i][ip]; |
646 |
t_track->resy[ip] = l2->resy_nt[i][ip]; |
// t_track->xm[ip] = l2->xm_nt[i][ip]; |
647 |
t_track->xv[ip] = l2->xv_nt[i][ip]; |
// t_track->ym[ip] = l2->ym_nt[i][ip]; |
648 |
t_track->yv[ip] = l2->yv_nt[i][ip]; |
// t_track->zm[ip] = l2->zm_nt[i][ip]; |
649 |
t_track->zv[ip] = l2->zv_nt[i][ip]; |
// t_track->resx[ip] = l2->resx_nt[i][ip]; |
650 |
t_track->axv[ip] = l2->axv_nt[i][ip]; |
// t_track->resy[ip] = l2->resy_nt[i][ip]; |
651 |
t_track->ayv[ip] = l2->ayv_nt[i][ip]; |
// t_track->xv[ip] = l2->xv_nt[i][ip]; |
652 |
t_track->dedx_x[ip] = l2->dedx_x[i][ip]; |
// t_track->yv[ip] = l2->yv_nt[i][ip]; |
653 |
t_track->dedx_y[ip] = l2->dedx_y[i][ip]; |
// t_track->zv[ip] = l2->zv_nt[i][ip]; |
654 |
// t_track->clx[ip] = 0; |
// t_track->axv[ip] = l2->axv_nt[i][ip]; |
655 |
// t_track->cly[ip] = 0; |
// t_track->ayv[ip] = l2->ayv_nt[i][ip]; |
656 |
}; |
// t_track->dedx_x[ip] = l2->dedx_x[i][ip]; |
657 |
new(t[i]) TrkTrack(*t_track); |
// t_track->dedx_y[ip] = l2->dedx_y[i][ip]; |
658 |
t_track->Clear(); |
// // t_track->clx[ip] = 0; |
659 |
}; |
// // t_track->cly[ip] = 0; |
660 |
// *** SINGLETS *** |
// }; |
661 |
if(!SingletX)SingletX = new TClonesArray("TrkSinglet"); |
// new(t[i]) TrkTrack(*t_track); |
662 |
TClonesArray &sx = *SingletX; |
// t_track->Clear(); |
663 |
for(int i=0; i<l2->nclsx; i++){ |
// }; |
664 |
t_singlet->plane = l2->planex[i]; |
// // *** SINGLETS *** |
665 |
t_singlet->coord[0] = l2->xs[i][0]; |
// if(!SingletX)SingletX = new TClonesArray("TrkSinglet"); |
666 |
t_singlet->coord[1] = l2->xs[i][1]; |
// TClonesArray &sx = *SingletX; |
667 |
t_singlet->sgnl = l2->signlxs[i]; |
// for(int i=0; i<l2->nclsx; i++){ |
668 |
// t_singlet->cls = 0; |
// t_singlet->plane = l2->planex[i]; |
669 |
new(sx[i]) TrkSinglet(*t_singlet); |
// t_singlet->coord[0] = l2->xs[i][0]; |
670 |
t_singlet->Clear(); |
// t_singlet->coord[1] = l2->xs[i][1]; |
671 |
} |
// t_singlet->sgnl = l2->signlxs[i]; |
672 |
if(!SingletY)SingletY = new TClonesArray("TrkSinglet"); |
// // t_singlet->cls = 0; |
673 |
TClonesArray &sy = *SingletY; |
// new(sx[i]) TrkSinglet(*t_singlet); |
674 |
for(int i=0; i<l2->nclsy; i++){ |
// t_singlet->Clear(); |
675 |
t_singlet->plane = l2->planey[i]; |
// } |
676 |
t_singlet->coord[0] = l2->ys[i][0]; |
// if(!SingletY)SingletY = new TClonesArray("TrkSinglet"); |
677 |
t_singlet->coord[1] = l2->ys[i][1]; |
// TClonesArray &sy = *SingletY; |
678 |
t_singlet->sgnl = l2->signlys[i]; |
// for(int i=0; i<l2->nclsy; i++){ |
679 |
// t_singlet->cls = 0; |
// t_singlet->plane = l2->planey[i]; |
680 |
new(sy[i]) TrkSinglet(*t_singlet); |
// t_singlet->coord[0] = l2->ys[i][0]; |
681 |
t_singlet->Clear(); |
// t_singlet->coord[1] = l2->ys[i][1]; |
682 |
}; |
// t_singlet->sgnl = l2->signlys[i]; |
683 |
|
// // t_singlet->cls = 0; |
684 |
|
// new(sy[i]) TrkSinglet(*t_singlet); |
685 |
|
// t_singlet->Clear(); |
686 |
|
// }; |
687 |
|
|
688 |
delete t_track; |
// delete t_track; |
689 |
delete t_singlet; |
// delete t_singlet; |
690 |
} |
// } |
691 |
//-------------------------------------- |
//-------------------------------------- |
692 |
// |
// |
693 |
// |
// |
710 |
// *** TRACKS *** |
// *** TRACKS *** |
711 |
if(!Track) Track = new TClonesArray("TrkTrack"); |
if(!Track) Track = new TClonesArray("TrkTrack"); |
712 |
TClonesArray &t = *Track; |
TClonesArray &t = *Track; |
713 |
if(!t_track->clx)t_track->clx = new TRefArray(6,0); |
//----------------------------------------------------- |
714 |
if(!t_track->cly)t_track->cly = new TRefArray(6,0); |
if(l1 && !t_track->clx)t_track->clx = new TRefArray(6,0); |
715 |
|
if(l1 && !t_track->cly)t_track->cly = new TRefArray(6,0); |
716 |
|
//----------------------------------------------------- |
717 |
for(int i=0; i<l2->ntrk; i++){ |
for(int i=0; i<l2->ntrk; i++){ |
718 |
t_track->seqno = i;// NBNBNBNB deve sempre essere = i |
t_track->seqno = i;// NBNBNBNB deve sempre essere = i |
719 |
t_track->image = l2->image[i]-1; |
t_track->image = l2->image[i]-1; |
740 |
t_track->ayv[ip] = l2->ayv_nt[i][ip]; |
t_track->ayv[ip] = l2->ayv_nt[i][ip]; |
741 |
t_track->dedx_x[ip] = l2->dedx_x[i][ip]; |
t_track->dedx_x[ip] = l2->dedx_x[i][ip]; |
742 |
t_track->dedx_y[ip] = l2->dedx_y[i][ip]; |
t_track->dedx_y[ip] = l2->dedx_y[i][ip]; |
|
// cout << "traccia "<<i<<" -- "<< ip << " "<< l2->cltrx[i][ip] <<" "<< l2->cltry[i][ip] <<" "<< t_track->xgood[ip] << t_track->ygood[ip]<<endl; |
|
743 |
//----------------------------------------------------- |
//----------------------------------------------------- |
744 |
//----------------------------------------------------- |
//----------------------------------------------------- |
745 |
if(t_track->xgood[ip])t_track->clx->AddAt(l1->GetCluster(l2->cltrx[i][ip]-1),ip); |
if(l1 && t_track->xgood[ip])t_track->clx->AddAt(l1->GetCluster(l2->cltrx[i][ip]-1),ip); |
746 |
if(t_track->ygood[ip])t_track->cly->AddAt(l1->GetCluster(l2->cltry[i][ip]-1),ip); |
if(l1 && t_track->ygood[ip])t_track->cly->AddAt(l1->GetCluster(l2->cltry[i][ip]-1),ip); |
|
// 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->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; |
|
747 |
//----------------------------------------------------- |
//----------------------------------------------------- |
748 |
//----------------------------------------------------- |
//----------------------------------------------------- |
749 |
}; |
}; |
759 |
t_singlet->coord[1] = l2->xs[i][1]; |
t_singlet->coord[1] = l2->xs[i][1]; |
760 |
t_singlet->sgnl = l2->signlxs[i]; |
t_singlet->sgnl = l2->signlxs[i]; |
761 |
//----------------------------------------------------- |
//----------------------------------------------------- |
762 |
// cout << "singolo x "<<i<<" -- "<< l2->clsx[i] <<endl; |
if(l1) t_singlet->cls = l1->GetCluster(l2->clsx[i]-1); |
|
t_singlet->cls = l1->GetCluster(l2->clsx[i]-1); |
|
|
// cout<<" i "<<i<<" l2->clsx[i] "<<l2->clsx[i]<< " l1->GetCluster(l2->clsx[i]-1) "<<l1->GetCluster(l2->clsx[i]-1)<<endl; |
|
763 |
//----------------------------------------------------- |
//----------------------------------------------------- |
764 |
new(sx[i]) TrkSinglet(*t_singlet); |
new(sx[i]) TrkSinglet(*t_singlet); |
765 |
t_singlet->Clear(); |
t_singlet->Clear(); |
772 |
t_singlet->coord[1] = l2->ys[i][1]; |
t_singlet->coord[1] = l2->ys[i][1]; |
773 |
t_singlet->sgnl = l2->signlys[i]; |
t_singlet->sgnl = l2->signlys[i]; |
774 |
//----------------------------------------------------- |
//----------------------------------------------------- |
775 |
// cout << "singolo y "<<i<<" -- "<< l2->clsy[i] <<endl; |
if(l1) t_singlet->cls = l1->GetCluster(l2->clsy[i]-1); |
|
t_singlet->cls = l1->GetCluster(l2->clsy[i]-1); |
|
|
// cout<<" i "<<i<<" l2->clsy[i] "<<l2->clsy[i]<< " l1->GetCluster(l2->clsy[i]-1) "<<l1->GetCluster(l2->clsy[i]-1)<<endl; |
|
776 |
//----------------------------------------------------- |
//----------------------------------------------------- |
777 |
new(sy[i]) TrkSinglet(*t_singlet); |
new(sy[i]) TrkSinglet(*t_singlet); |
778 |
t_singlet->Clear(); |
t_singlet->Clear(); |
895 |
|
|
896 |
int indo=0; |
int indo=0; |
897 |
int indi=0; |
int indi=0; |
898 |
while(N != 0){ |
while(N > 0){ |
899 |
|
// while(N != 0){ |
900 |
int nfit =0; |
int nfit =0; |
901 |
float chi2ref = numeric_limits<float>::max(); |
float chi2ref = numeric_limits<float>::max(); |
902 |
|
|
907 |
} |
} |
908 |
} |
} |
909 |
//second loop to search minimum chi2 among selected |
//second loop to search minimum chi2 among selected |
910 |
for(int i=0; i<this->ntrk(); i++){ |
for(int i=0; i<ntrk(); i++){ |
911 |
Float_t chi2 = ((TrkTrack *)t[i])->chi2; |
Float_t chi2 = ((TrkTrack *)t[i])->chi2; |
912 |
if(chi2 < 0) chi2 = chi2*1000; |
if(chi2 < 0) chi2 = -chi2*1000; |
913 |
if( chi2 < chi2ref |
if( chi2 < chi2ref |
914 |
&& ((TrkTrack *)t[i])->GetNtot() == nfit |
&& ((TrkTrack *)t[i])->GetNtot() == nfit |
915 |
&& m[i]==1){ |
&& m[i]==1){ |
921 |
m[((TrkTrack *)t[indi])->image] = 0; |
m[((TrkTrack *)t[indi])->image] = 0; |
922 |
N--; |
N--; |
923 |
|
|
924 |
// cout << "i** "<< ((TrkTrack *)t[indi])->image << " " << nfiti <<" "<<chi2i<<endl; |
// cout << "i** "<< ((TrkTrack *)t[indi])->image << " " << nfiti <<" "<<chi2i<<endl; |
925 |
}; |
}; |
926 |
sorted->Add( (TrkTrack*)t[indi] ); |
sorted->Add( (TrkTrack*)t[indi] ); |
927 |
|
|
928 |
m[indi] = 0; |
m[indi] = 0; |
929 |
// cout << "SORTED "<< indo << " "<< indi << " "<< N << endl; |
// cout << "SORTED "<< indo << " "<< indi << " "<< N << " "<<((TrkTrack *)t[indi])->image<<" "<<chi2ref<<endl; |
930 |
N--; |
N--; |
931 |
indo++; |
indo++; |
932 |
} |
} |
933 |
m.clear(); |
m.clear(); |
934 |
// cout << "GetTracks_NFitSorted(it): Done"<< endl; |
// cout << "GetTracks_NFitSorted(it): Done"<< endl; |
935 |
|
|
936 |
return sorted; |
return sorted; |
937 |
// return PhysicalTrack; |
// return PhysicalTrack; |
1081 |
*/ |
*/ |
1082 |
void TrkLevel2::LoadField(TString path){ |
void TrkLevel2::LoadField(TString path){ |
1083 |
// |
// |
1084 |
strcpy(path_.path,path.Data()); |
// strcpy(path_.path,path.Data()); |
1085 |
path_.pathlen = path.Length(); |
// path_.pathlen = path.Length(); |
1086 |
path_.error = 0; |
// path_.error = 0; |
1087 |
readb_(); |
// readb_(); |
1088 |
|
|
1089 |
|
TrkParams::Set(path,1); |
1090 |
|
|
1091 |
// |
// |
1092 |
}; |
}; |
1093 |
/** |
/** |
1294 |
for (int i=0; i<5; i++) dal[i] = (double)al[i]; |
for (int i=0; i<5; i++) dal[i] = (double)al[i]; |
1295 |
for (int i=0; i<npoint; i++) dzin[i] = (double)z[i]; |
for (int i=0; i<npoint; i++) dzin[i] = (double)z[i]; |
1296 |
|
|
1297 |
|
TrkParams::Load(1); |
1298 |
|
if( !TrkParams::IsLoaded(1) ){ |
1299 |
|
cout << "int Trajectory::DoTrack2(float* al) --- ERROR --- m.field not loaded"<<endl; |
1300 |
|
return 0; |
1301 |
|
} |
1302 |
dotrack2_(&(npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&ifail); |
dotrack2_(&(npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&ifail); |
1303 |
|
|
1304 |
for (int i=0; i<npoint; i++){ |
for (int i=0; i<npoint; i++){ |