--- DarthVader/TrackerLevel2/src/ExtTrack.cpp 2014/02/27 11:24:43 1.1 +++ DarthVader/TrackerLevel2/src/ExtTrack.cpp 2014/08/07 16:04:14 1.5 @@ -6,200 +6,591 @@ #include #include using namespace std; -//...................................... -// F77 routines -//...................................... -extern "C" { -// void dotrack_(int*, double*, double*, double*, double*, int*); -// void dotrack2_(int*, double*, double*, double*, double*,double*, double*, double*,int*); -// void dotrack3_(int*, double*, double*, double*, double*,double*, double*, double*,double*,int*); -// void mini2_(int*,int*,int*); -// void guess_(); -// void gufld_(float*, float*); -// float risxeta2_(float *); -// float risxeta3_(float *); -// float risxeta4_(float *); -// float risyeta2_(float *); -} +ExtTrack::ExtTrack(int dim){ + + //cout << " ExtTrack::ExtTrack("< 1 || ip < 0 || ippp > 5 || il < 0 || il > 2) && + true){ + cout << " void ExtTrack::FillMiniStruct(TrkTrack&) --- WARNING ---trk sensor not defined, cannot read alignment parameters "<=nplanes){ + cout << " ExtTrack::SetZ("< exceed vector dimension = "<=nplanes){ + cout << " ExtTrack::ResetXY("< exceed vector dimension = "<=nplanes){ + cout << " ExtTrack::SetXY("< exceed vector dimension = "<=nplanes){ + cout << " ExtTrack::SetX("< exceed vector dimension = "<=nplanes){ + cout << " ExtTrack::SetX("< exceed vector dimension = "<=nplanes){ + cout << " ExtTrack::SetXGood("< exceed vector dimension = "<=nplanes){ + cout << " ExtTrack::SetYGood("< exceed vector dimension = "<0){ + if(xgood) delete [] xgood; + if(ygood) delete [] ygood; + if(multmaxx) delete [] multmaxx; + if(multmaxy) delete [] multmaxy; + if(xm) delete [] xm; + if(ym) delete [] ym; + if(zm) delete [] zm; + if(xma) delete [] xma; + if(yma) delete [] yma; + if(zma) delete [] zma; + if(xmb) delete [] xmb; + if(ymb) delete [] ymb; + if(zmb) delete [] zmb; + if(resx) delete [] resx; + if(resy) delete [] resy; + if(xv) delete [] xv; + if(yv) delete [] yv; + if(zv) delete [] zv; + if(axv) delete [] axv; + if(ayv) delete [] ayv; + if(dedx_x)delete [] dedx_x; + if(dedx_y)delete [] dedx_y; + //} + + xgood = NULL; + ygood = NULL; + multmaxx = NULL; + multmaxy = NULL; + xm = NULL; + ym = NULL; + zm = NULL; + xma = NULL; + yma = NULL; + zma = NULL; + xmb = NULL; + ymb = NULL; + zmb = NULL; + resx = NULL; + resy = NULL; + xv = NULL; + yv = NULL; + zv = NULL; + axv = NULL; + ayv = NULL; + dedx_x = NULL; + dedx_y = NULL; + + nplanes = 0; + + // Reset(); + }; -/** - * Set the position measurements - */ -void ExtTrack::SetMeasure(Double_t *xmeas, Double_t *ymeas, Double_t *zmeas){ - for(Int_t i=0; i0. ? 1./sqrt(coval[4][4]) : 0. ) ; cout << endl << "dedx_x : "; for(int i=0; i>>> fit failed "<al[i]; - for(int j=0; j<5; j++) coval[i][j]=track->cov[i][j]; + al[i] = (float) (track->al[i]); + for(int j=0; j<5; j++) coval[i][j] = (float) (track->cov[i][j]); } - chi2 = track->chi2; - nstep = track->nstep; - for(int i=0; i<6; i++){ - xv[i] = track->xv[i]; - yv[i] = track->yv[i]; - zv[i] = track->zv[i]; - xm[i] = track->xm[i]; - ym[i] = track->ym[i]; - zm[i] = track->zm[i]; - axv[i] = track->axv[i]; - ayv[i] = track->ayv[i]; + chi2 = (float) (track->chi2); + nstep = (float) (track->nstep); + for(int i=0; ixv[i]); + yv[i] = (float) (track->yv[i]); + zv[i] = (float) (track->zv[i]); + xm[i] = (float) (track->xm[i]); + ym[i] = (float) (track->ym[i]); + zm[i] = (float) (track->zm[i]); + xma[i] = (float) (track->xm_a[i]); + yma[i] = (float) (track->ym_a[i]); + zma[i] = (float) (track->zm_a[i]); + xmb[i] = (float) (track->xm_b[i]); + ymb[i] = (float) (track->ym_b[i]); + zmb[i] = (float) (track->zm_b[i]); + axv[i] = (float) (track->axv[i]); + ayv[i] = (float) (track->ayv[i]); } - + zini = (float) (track->zini); +} +/** + * Method to retrieve ID (0,1,...) of x-cluster (if any) associated to this track. + * If no cluster is associated, ID=-1. + * + */ +int ExtTrack::GetClusterX_ID(int ip){ + return ((int)fabs(xgood[ip]))%10000000-1; +}; +/** + * Method to retrieve ID (0-xxx) of y-cluster (if any) associated to this track. + * + */ +int ExtTrack::GetClusterY_ID(int ip){ + return ((int)fabs(ygood[ip]))%10000000-1; +}; + +/** + * Method to retrieve the dE/dx measured on a tracker view. + * @param ip plane (0-5) + * @param iv view (0=x 1=y) + */ +Float_t ExtTrack::GetDEDX(int ip, int iv){ + if(iv==0 && ip>=0 && ip<6)return fabs(dedx_x[ip]); + else if(iv==1 && ip>=0 && ip<6)return fabs(dedx_y[ip]); + else { + cout << "TrkTrack::GetDEDX(int ip, int iv) -- wrong input parameters "<=nplanes){ + cout << " ExtTrack::GetClusterX_Multiplicity("< exceed vector dimension = "<=nplanes){ + cout << " ExtTrack::GetClusterY_Multiplicity("< exceed vector dimension = "<=nplanes){ + cout << " ExtTrack::GetClusterX_MaxStrip("< exceed vector dimension = "<=nplanes){ + cout << " ExtTrack::GetClusterY_MaxStrip("< exceed vector dimension = "<0)rig=1./al[4]; + if(rig<0) rig=-rig; + return rig; +}; +// +Float_t ExtTrack::GetDeflection(){ + Float_t def=0; + if(chi2>0)def=al[4]; + return def; +}; + + +// +// all that follows: EM porting from TrkLevel2 +// +Bool_t ExtTrack::IsInsideAcceptance(float toll){ + int ngf = TrkParams::nGF; + for(int i=0; i= TrkParams::xGF_max[i] - toll || + yGF[i] <= TrkParams::yGF_min[i] + toll || + yGF[i] >= TrkParams::yGF_max[i] - toll || + false){ + + return false; + } + } + return true; +} + +/** + * Returns the reduced chi-square of track x-projection + */ +Float_t ExtTrack::GetChi2X(){ + float chiq=0; + for(int ip=0; ip3)chiq=chiq/(GetNX()-3); + else chiq=0; + if(chiq==0)cout << " Float_t ExtTrack::GetChi2X() -- WARNING -- value not defined "<2)chiq=chiq/(GetNY()-2); + else chiq=0; + if(chiq==0)cout << " Float_t ExtTrack::GetChi2Y() -- WARNING -- value not defined "<