--- DarthVader/TrackerLevel2/src/TrkLevel2.cpp 2006/11/07 15:55:11 1.15 +++ DarthVader/TrackerLevel2/src/TrkLevel2.cpp 2006/11/14 16:21:08 1.17 @@ -12,7 +12,8 @@ extern "C" { void dotrack_(int*, double*, double*, double*, double*, int*); void dotrack2_(int*, double*, double*, double*, double*,double*, double*, double*,int*); - int readb_(const char*); +// int readb_(const char*); + int readb_(); void mini2_(int*,int*,int*); void guess_(); } @@ -20,6 +21,42 @@ // // //-------------------------------------- +/** + * Evaluates the trajectory in the apparatus associated to the track. + * 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. + * @param t pointer to an object of the class Trajectory, + * which z coordinates should be previously initialized by calling the proper constructor ( Trajectory::Trajectory(int n, float* zin) ). + * @return error flag. + */ +int Trajectory::DoTrack2(float* al){ + + double *dxout = new double[t->npoint]; + double *dyout = new double[t->npoint]; + double *dthxout = new double[t->npoint]; + double *dthyout = new double[t->npoint]; + double *dtlout = new double[t->npoint]; + double *dzin = new double[t->npoint]; + double dal[5]; + + int ifail = 0; + + for (int i=0; i<5; i++) dal[i] = (double)al[i]; + for (int i=0; inpoint; i++) dzin[i] = (double)z[i]; + + dotrack2_(&(t->npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&ifail); + + for (int i=0; inpoint; i++){ + x[i] = (float)*dxout++; + y[i] = (float)*dyout++; + thx[i] = (float)*dthxout++; + thy[i] = (float)*dthyout++; + tl[i] = (float)*dtlout++; + } + + return ifail; +}; +//--------------------------------------------- +//--------------------------------------------- TrkTrack::TrkTrack(){ seqno = -1; image = -1; @@ -249,8 +286,13 @@ /** * Load the magnetic field */ -void TrkTrack::LoadField(TString s){ - readb_(s.Data()); +void TrkTrack::LoadField(TString path){ + + strcpy(path_.path,path.Data()); + path_.pathlen = path.Length(); + path_.error = 0; + readb_(); + }; /** * Tracking method. It calls F77 mini routine. @@ -261,11 +303,6 @@ extern cMini2track track_; fail = 0; -// extern cMini2fitinfo fit_info_; -// extern void mini_2_(int*,int*); -// track_.xm[0]=1.0; - - cout << "fitting routine "<