--- DarthVader/TrackerLevel2/src/TrkLevel2.cpp 2008/12/05 08:26:46 1.50 +++ DarthVader/TrackerLevel2/src/TrkLevel2.cpp 2014/01/16 15:29:47 1.55 @@ -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); @@ -627,7 +601,7 @@ 4.52043, 4.29926}; int index; - float fact; + float fact=0.; for(int i=0; i<6; i++) { index = int((fabs(axv[i])+1.)/2.); if(index>10) index=10; @@ -723,8 +697,8 @@ int il = (int)GetLadder(i); double omega = 0.; - double beta = 0.; - double gamma = 0.; + // double beta = 0.;// EM GCC 4.7 + // double gamma = 0.; if( (is < 0 || is > 1 || ip < 0 || ip > 5 || il < 0 || il > 2) && true){ @@ -734,8 +708,8 @@ cout << " is ip il = "<0 define an inner fiducial volume) */ -Bool_t TrkTrack::IsInsideAcceptance(){ +// Bool_t TrkTrack::IsInsideAcceptance(){ + +// int ngf = TrkParams::nGF; +// for(int i=0; i= TrkParams::xGF_max[i] || +// yGF[i] <= TrkParams::yGF_min[i] || +// yGF[i] >= TrkParams::yGF_max[i] || +// false)return false; +// } +// return true; + +// } +Bool_t TrkTrack::IsInsideAcceptance(float toll){ + int ngf = TrkParams::nGF; for(int i=0; i= TrkParams::xGF_max[i] || - yGF[i] <= TrkParams::yGF_min[i] || - yGF[i] >= TrkParams::yGF_max[i] || - false)return false; + TrkParams::GF_element[i].CompareTo("S11") && + TrkParams::GF_element[i].CompareTo("S12") && + TrkParams::GF_element[i].CompareTo("S21") && + TrkParams::GF_element[i].CompareTo("S22") && + TrkParams::GF_element[i].CompareTo("T1") && + TrkParams::GF_element[i].CompareTo("CUF") && + TrkParams::GF_element[i].CompareTo("T2") && + TrkParams::GF_element[i].CompareTo("T3") && + TrkParams::GF_element[i].CompareTo("T4") && + TrkParams::GF_element[i].CompareTo("T5") && + TrkParams::GF_element[i].CompareTo("CLF") && + TrkParams::GF_element[i].CompareTo("T6") && + TrkParams::GF_element[i].CompareTo("S31") && + TrkParams::GF_element[i].CompareTo("S32") && + true)continue; + // apply condition only within the cavity +// cout << " -- "<= 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 "<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]; @@ -1848,7 +1907,8 @@ if(!Track)return 0; - TRefArray *sorted = new TRefArray(); + // TRefArray *sorted = new TRefArray(); + TRefArray *sorted = NULL; TClonesArray &t = *Track; // TClonesArray &ts = *PhysicalTrack; @@ -1886,6 +1946,7 @@ // cout << "i** "<< ((TrkTrack *)t[indi])->image << " " << nfiti <<" "<Add( (TrkTrack*)t[indi] ); m[indi] = 0; @@ -2246,12 +2307,18 @@ /** * 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) ). + * It integrates the equations of motion in the magnetic field. + * @param al Track state-vector (X0,Y0,sin(theta),phi,deflection). + * @param zini z-coordinate of the reference plane (Z0). * @return error flag. + * + * This method is needed when you want to integrate the particle trajectory + * starting from a track state-vector relative to an arbitrary reference plane. + * The default reference plane, used by the tracker routines, is at zini=23.5. + * If you give as input the track state-vector from a TrkTrack object, + * you can use Trajectory::DoTrack(float* al) instead. */ -int Trajectory::DoTrack2(float* al){ +int Trajectory::DoTrack(float* al, float zini){ // double *dxout = new double[npoint]; // double *dyout = new double[npoint]; @@ -2260,33 +2327,36 @@ // double *dtlout = new double[npoint]; // double *dzin = new double[npoint]; - double *dxout; - double *dyout; - double *dthxout; - double *dthyout; - double *dtlout; - double *dzin; - - dxout = (double*) malloc(npoint*sizeof(double)); - dyout = (double*) malloc(npoint*sizeof(double)); - dthxout = (double*) malloc(npoint*sizeof(double)); - dthyout = (double*) malloc(npoint*sizeof(double)); - dtlout = (double*) malloc(npoint*sizeof(double)); - dzin = (double*) malloc(npoint*sizeof(double)); + double *dxout; + double *dyout; + double *dthxout; + double *dthyout; + double *dtlout; + double *dzin; + + dxout = (double*) malloc(npoint*sizeof(double)); + dyout = (double*) malloc(npoint*sizeof(double)); + dthxout = (double*) malloc(npoint*sizeof(double)); + dthyout = (double*) malloc(npoint*sizeof(double)); + dtlout = (double*) malloc(npoint*sizeof(double)); + dzin = (double*) malloc(npoint*sizeof(double)); + + double dal[5]; - double dal[5]; + double dzini = (double)zini; int ifail = 0; - + for (int i=0; i<5; i++) dal[i] = (double)al[i]; for (int i=0; i>> 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) <<<<"<