From 84d6cf6fac8c37a82cd5c2617147d56e14070d08 Mon Sep 17 00:00:00 2001 From: zhang <zhang@9a6e40ed-f3a0-4838-9b4a-bf418f78e88d> Date: Tue, 19 Jul 2011 15:04:00 +0000 Subject: [PATCH] 19/07/11 Add user interface to define the file name which is used to save printtwiss,printcod, printtrack --- tracy/tools/soltracy.cc | 22 ++++++++++++++-------- tracy/tracy/inc/soleillib.h | 2 +- tracy/tracy/src/soleillib.cc | 12 ++++++------ 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/tracy/tools/soltracy.cc b/tracy/tools/soltracy.cc index 956e153..f4d5db3 100644 --- a/tracy/tools/soltracy.cc +++ b/tracy/tools/soltracy.cc @@ -272,24 +272,30 @@ int main(int argc, char *argv[]) { //print the twiss paramaters in a file defined by the name else if(strcmp(CommandStr,"PrintTwissFlag") == 0) { cout << "\n"; - cout << "print the twiss parameters to file: "<< twiss_file << "\n"; - printlatt(twiss_file); + cout << "print the twiss parameters to file: " + << UserCommandFlag[i]._PrintTwiss_twiss_file << "\n"; + + printlatt(UserCommandFlag[i]._PrintTwiss_twiss_file); } //print the close orbit else if(strcmp(CommandStr,"PrintCODFlag") == 0) { cout << "\n"; - cout << "print the close orbit to file: "<< cod_file << "\n"; + cout << "print the close orbit to file: " + << UserCommandFlag[i]._PrintCOD_cod_file << "\n"; getcod(dP, lastpos); - prt_cod(cod_file, globval.bpm, true); + prt_cod(UserCommandFlag[i]._PrintCOD_cod_file, globval.bpm, true); } //print coordinates at lattice elements obtained by tracking else if(strcmp(CommandStr,"PrintTrackFlag") == 0) { cout << "\n"; - cout << "print the coordinates to file: "<< track_file << "\n"; + cout << "print the tracked coordinates to file: " + << UserCommandFlag[i]._PrintTrack_track_file << "\n"; - PrintTrack(track_file,UserCommandFlag[i]._x,UserCommandFlag[i]._px, - UserCommandFlag[i]._y,UserCommandFlag[i]._py, - UserCommandFlag[i]._delta,UserCommandFlag[i]._ctau,UserCommandFlag[i]._nmax); + PrintTrack(UserCommandFlag[i]._PrintTrack_track_file, + UserCommandFlag[i]._PrintTrack_x, UserCommandFlag[i]._PrintTrack_px, + UserCommandFlag[i]._PrintTrack_y, UserCommandFlag[i]._PrintTrack_py, + UserCommandFlag[i]._PrintTrack_delta,UserCommandFlag[i]._PrintTrack_ctau, + UserCommandFlag[i]._PrintTrack_nmax); } //print the girder diff --git a/tracy/tracy/inc/soleillib.h b/tracy/tracy/inc/soleillib.h index 79629a6..28b28aa 100644 --- a/tracy/tracy/inc/soleillib.h +++ b/tracy/tracy/inc/soleillib.h @@ -115,7 +115,7 @@ void AddCorrQtErr_fam(char const *fic, const int Fnum, const double conv, const /* fit tunes for soleil lattice, in which each quadrupole is cut into two parts*/ void FitTune4(long qf1,long qf2, long qd1, long qd2, double nux, double nuy); //print the coordinates at lattice elements -void PrintTrack(const char *file_name, double x, double px,double y,double py, +void PrintTrack(const char *TrackFile, double x, double px,double y,double py, double delta, double ctau, long int nmax); diff --git a/tracy/tracy/src/soleillib.cc b/tracy/tracy/src/soleillib.cc index 218e714..bc39b53 100644 --- a/tracy/tracy/src/soleillib.cc +++ b/tracy/tracy/src/soleillib.cc @@ -5620,14 +5620,14 @@ void FitTune4(long qf1,long qf2, long qd1, long qd2, double nux, double nuy) } /********************************************************************** -void PrintTrack(const char *file_name, double x, double px, double y,double py, +void PrintTrack(const char *TrackFile, double x, double px, double y,double py, double delta, double ctau, long int nmax) Purpose: - Print the coordinates at each lattice element using tracking + Print the coordinates at each lattice element by tracking around COD Input: - file_name file to be print + TrackFile file to be print x initial x relative to closed orbit px initial px relative to closed orbit y initial y relative to closed orbit @@ -5642,7 +5642,7 @@ void PrintTrack(const char *file_name, double x, double px, double y,double py, Comments: Written by Jianfeng Zhang @ synchro. soleil 05/2011 **********************************************************************/ -void PrintTrack(const char *file_name, double x, double px, double y,double py, +void PrintTrack(const char *TrackFile, double x, double px, double y,double py, double delta, double ctau, long int nmax) { @@ -5654,11 +5654,11 @@ void PrintTrack(const char *file_name, double x, double px, double y,double py, bool prt = false; - outf = file_write(file_name); + outf = file_write(TrackFile); /* Get time and date */ newtime = GetTime(); - fprintf(outf, "# Tracking with TRACY III-- %s -- %s\n",file_name, asctime2(newtime)); + fprintf(outf, "# Tracking using TRACY III-- %s -- %s\n",TrackFile, asctime2(newtime)); fprintf(outf, "#\n"); // fprintf(outf, "# work tunes: %7.5f %7.5f\n",globval.TotalTune[0], globval.TotalTune[1]); fprintf(outf, "# i ElemName S x p_x y p_y"); -- GitLab