--- DarthVader/TrackerLevel2/src/TrkLevel2.cpp 2008/11/20 15:06:26 1.48 +++ DarthVader/TrackerLevel2/src/TrkLevel2.cpp 2014/10/15 08:45:51 1.59 @@ -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 ??? "<3)chiq=chiq/(GetNX()-3); else chiq=0; - if(chiq==0)cout << " Float_t TrkTrack::GetChi2X() -- WARNING -- value not defined "<2)chiq=chiq/(GetNY()-2); else chiq=0; - if(chiq==0)cout << " Float_t TrkTrack::GetChi2Y() -- WARNING -- value not defined "<10) index=10; @@ -673,12 +672,12 @@ // cout << i<<" - "< 1 || ip < 0 || ip > 5 || il < 0 || il > 2) && true){ @@ -717,34 +717,34 @@ cout << " is ip il = "<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]); } } @@ -801,16 +803,26 @@ // cout << "void TrkTrack::GetClusterositions() "<= 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<0||il<-1||il>2||is<-1||is>1) + if(ip<0||ip>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<0||il<-1||il>2||is<-1||is>1) + if(ip<0||ip>5||clid<1||il<-1||il>2||is<-1||is>1) cout << " void TrkTrack::SetYGood(int,int,int,int,bool) --> MA SEI DI COCCIO?!?!"<GetClass()->GetName(),"TrkTrack")==0){ + if(Track)Track->Clear("C"); + Track = track; + } +} +//-------------------------------------- +// +// +//-------------------------------------- void TrkLevel2::Dump(){ // @@ -1673,7 +1775,7 @@ int ngf = TrkParams::nGF; float *zgf = TrkParams::zGF; Trajectory tgf = Trajectory(ngf,zgf); - tgf.DoTrack2(t_track->al);//<<<< 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]; @@ -1831,7 +1933,8 @@ if(!Track)return 0; - TRefArray *sorted = new TRefArray(); + // TRefArray *sorted = new TRefArray(); + TRefArray *sorted = NULL; TClonesArray &t = *Track; // TClonesArray &ts = *PhysicalTrack; @@ -1869,6 +1972,7 @@ // cout << "i** "<< ((TrkTrack *)t[indi])->image << " " << nfiti <<" "<Add( (TrkTrack*)t[indi] ); m[indi] = 0; @@ -2100,7 +2204,7 @@ * (By default is created with z-coordinates inside the tracking volume) */ Trajectory::Trajectory(){ - npoint = 10; + npoint = 6; x = new float[npoint]; y = new float[npoint]; z = new float[npoint]; @@ -2167,17 +2271,18 @@ thy = new float[npoint]; tl = new float[npoint]; int i=0; - do{ - x[i] = 0; - y[i] = 0; + do{ + x[i] = 0.; + y[i] = 0.; z[i] = zin[i]; - thx[i] = 0; - thy[i] = 0; - tl[i] = 0; + thx[i] = 0.; + thy[i] = 0.; + tl[i] = 0.; i++; }while(zin[i-1] > 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) <<<<"<