--- DarthVader/TrackerLevel2/src/TrkLevel2.cpp 2008/03/22 08:32:50 1.45 +++ DarthVader/TrackerLevel2/src/TrkLevel2.cpp 2014/06/04 07:57:04 1.57 @@ -12,6 +12,7 @@ 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*); @@ -177,60 +178,33 @@ // //-------------------------------------- /** - * 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. * - * >>> OBSOLETE !!! use TrkTrack::DoTrack2(Trajectory* t) instead + * >>> OBSOLETE !!! use TrkTrack::DoTrack(Trajectory* t) instead * */ -int TrkTrack::DoTrack(Trajectory* t){ - - cout << " int TrkTrack::DoTrack(Trajectory* t) --->> OBSOLETE !!! "<npoint]; - double *dyout = 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)t->z[i]; +int TrkTrack::DoTrack2(Trajectory* t){ - TrkParams::Load(1); - if( !TrkParams::IsLoaded(1) ){ - cout << "int TrkTrack::DoTrack(Trajectory* t) --- ERROR --- m.field not loaded"<npoint),dzin,dxout,dyout,dal,&ifail); - - for (int i=0; inpoint; i++){ - t->x[i] = (float)*(dxout+i); - t->y[i] = (float)*(dyout+i); - } + cout << endl; + cout << " int TrkTrack::DoTrack2(Trajectory* t) --->> NB NB !! this method is going to be eliminated !!! "<>>> replace it with TrkTrack::DoTrack(Trajectory* t) <<<<"<npoint]; double *dyout = new double[t->npoint]; @@ -247,7 +221,7 @@ TrkParams::Load(1); if( !TrkParams::IsLoaded(1) ){ - cout << "int TrkTrack::DoTrack2(Trajectory* t) --- ERROR --- m.field not loaded"<npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&ifail); @@ -400,6 +374,31 @@ return (last_plane-first_plane+1); } /** + * Returns the track "lever-arm" on the x+y view, defined as the distance (in planes) between + * the upper and lower x,y (couple) measurements (the maximum value of lever-arm is 6). + */ +Int_t TrkTrack::GetLeverArmXY(){ + int first_plane = -1; + int last_plane = -1; + for(Int_t ip=0; ip<6; ip++){ + if( XGood(ip)*YGood(ip) && first_plane == -1 )first_plane = ip; + if( XGood(ip)*YGood(ip) && first_plane != -1 )last_plane = ip; + } + if( first_plane == -1 || last_plane == -1){ + cout<< "Int_t TrkTrack::GetLeverArmXY() -- XGood(ip)*YGood(ip) always false ??? "<10) index=10; @@ -657,6 +656,9 @@ TrkParams::Set(path,1); TrkParams::Load(1); + if( !TrkParams::IsLoaded(1) ){ + cout << "void TrkTrack::LoadField(TString path) --- ERROR --- m.field not loaded"< 1 || ip < 0 || ip > 5 || il < 0 || il > 2) && + true){ + // se il piano risulta colpito, ladder e sensore devono essere + // assegnati correttamente + cout << " void TrkTrack::FillMiniStruct(cMini2track&) --- WARNING --- sensor not defined, cannot read alignment parameters "<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; + chi2 = (float) (track->chi2); + nstep = (float) (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]; + xv[i] = (float) (track->xv[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]); + axv[i] = (float) (track->axv[i]); + ayv[i] = (float) (track->ayv[i]); + resx[i] = (float) (track->resx[i]); //Elena 10th + resy[i] = (float) (track->resy[i]); } } @@ -756,13 +803,26 @@ // cout << "void TrkTrack::GetClusterositions() "<= TrkParams::xGF_max[i] || - yGF[i] <= TrkParams::yGF_min[i] || - yGF[i] >= TrkParams::yGF_max[i] || - false)return false; + xGF[i] <= TrkParams::xGF_min[i] + toll || + xGF[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 true if the track is inside one of the surfaces which define the + * geometrical acceptance. + * @param surf tag of the surface (possible values are: S11 S12 S21 S22 T1 + * CUF T2 T3 T4 T5 CLF T6 S31 S32). + * @param toll Tolerance around the nominal surface (toll>0 define an inner + * fiducial surface) +*/ +Bool_t TrkTrack::IsInsideGFSurface(const char* surf, float toll){ + + + int ngf = TrkParams::nGF; + bool SURFOK = false; + for(int i=0; i TrkParams::xGF_min[i] + toll && + xGF[i] < TrkParams::xGF_max[i] - toll && + yGF[i] > TrkParams::yGF_min[i] + toll && + yGF[i] < TrkParams::yGF_max[i] - toll && + true)return true; + } + } + if( !SURFOK )cout << " Bool_t TrkTrack::IsInsideGFSurface(char* surf, float toll) --> suface "<5||clid<1||il<-1||il>2||is<-1||is>1) + cout << " void TrkTrack::SetXGood(int,int,int,int,bool) --> MA SEI DI COCCIO?!?!"<5||clid<1||il<-1||il>2||is<-1||is>1) + cout << " void TrkTrack::SetYGood(int,int,int,int,bool) --> MA SEI DI COCCIO?!?!"<max)max=GetDEDX(i,j); - + for(int j=vfrom; jmax)max=GetDEDX(i,j); + if(j==1 && YGood(i) && GetDEDX(i,j)>max)max=GetDEDX(i,j); + } return max; }; @@ -1170,15 +1316,16 @@ vto = iv+1; } for(int i=pfrom; ifabs(max))max=xv[i]-xm[i]; - if(j==1 && YGood(i) && fabs(ym[i]-yv[i])>fabs(max))max=yv[i]-ym[i]; + for(int j=vfrom; jfabs(max))max=xm[i]-xv[i]; + if(j==1 && YGood(i) && fabs(ym[i]-yv[i])>fabs(max))max=ym[i]-yv[i]; } } return max; }; +/** + * \brief Give the anerage spatial residual + */ +Float_t TrkTrack::GetResidual_av(int ip, int iv){ + // +//Sum$((xm>-50)*(xm-xv)/resx)/sqrt(TrkTrack.GetNX()*TrkTrack.GetChi2X())<0.3 + + Float_t av = 0.; + int nav = 0; + // + int pfrom = 0; + int pto = 6; + int vfrom = 0; + int vto = 2; + if(ip>=0&&ip<6){ + pfrom = ip; + pto = ip+1; + } + if(iv>=0&&iv<2){ + vfrom = iv; + vto = iv+1; + } + for(int i=pfrom; ial);//<<<< integrate the trajectory + tgf.DoTrack(t_track->al);//<<<< integrate the trajectory for(int ip=0; ipxGF[ip] = tgf.x[ip]; t_track->yGF[ip] = tgf.y[ip]; @@ -1743,7 +1923,8 @@ if(!Track)return 0; - TRefArray *sorted = new TRefArray(); + // TRefArray *sorted = new TRefArray(); + TRefArray *sorted = NULL; TClonesArray &t = *Track; // TClonesArray &ts = *PhysicalTrack; @@ -1781,6 +1962,7 @@ // cout << "i** "<< ((TrkTrack *)t[indi])->image << " " << nfiti <<" "<Add( (TrkTrack*)t[indi] ); m[indi] = 0; @@ -1951,6 +2133,9 @@ TrkParams::Set(path,1); TrkParams::Load(1); + if( !TrkParams::IsLoaded(1) ){ + cout << "void TrkLevel2::LoadField(TString path) --- ERROR --- m.field not loaded"< zin[i] && i < npoint); npoint=i; - if(npoint != n)cout << "NB! Trajectory created with "<>> OBSOLETE !!! use Trajectory::DoTrack(float* al, float zini) instead + * + */ +int Trajectory::DoTrack2(float* al, float zini){ + + cout << endl; + cout << " int Trajectory::DoTrack2(float* al, float zini) --->> NB NB !! this method is going to be eliminated !!! "<>>> replace it with TrkTrack::DoTrack(Trajectory* t) <<<<"<