Changeset 32 in TRACY3 for trunk/tracy/tracy/src/nsls-ii_lib.cc
- Timestamp:
- Apr 9, 2014, 3:50:11 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tracy/tracy/src/nsls-ii_lib.cc
r11 r32 763 763 1.5 sextupole 764 764 2.0 bpm 765 Fnum family index 765 Fnum family index of the BPM. 766 766 all true, print the cod at all elements 767 false, print the cod at the family elements767 false, print the cod at the BPM elements, the name of the BPM must be defined in the "*.prm" file. 768 768 Output: 769 769 none … … 784 784 void prt_cod(const char *file_name, const int Fnum, const bool all) 785 785 { 786 long i ;786 long i=0L; 787 787 double code = 0.0; 788 788 FILE *outf; 789 long FORLIM ;789 long FORLIM=0L; 790 790 struct tm *newtime; 791 791 … … 828 828 } 829 829 /* COD is in local coordinates */ 830 fprintf(outf, "%4ld %.*s %6.2f %4.1f %6. 3f %6.3f %6.3f %6.3f"831 " %6. 3f %6.3f %6.3f %6.3f %6.3f %6.3f\n",830 fprintf(outf, "%4ld %.*s %6.2f %4.1f %6.4f %6.4f %6.4f %6.4f" 831 " %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f\n", 832 832 i, SymbolLength, Cell[i].Elem.PName, Cell[i].S, code, 833 833 Cell[i].Beta[X_], Cell[i].Nu[X_], … … 842 842 } 843 843 844 /**************************************************************** 845 * void prt_beampos(const char *file_name) 846 * 847 * print the orbits at all lattice elements. 848 * 849 * Comments: 850 * To use this command, the BPM name should be defined in the 851 * "*.prm" file with the command 852 * bpm_name BPM_names 853 * 854 * 855 ****************************************************************/ 844 856 845 857 void prt_beampos(const char *file_name) 846 858 { 847 int k;859 int i=0; 848 860 ofstream outf; 849 861 850 862 file_wr(outf, file_name); 851 863 852 outf << "# k s name x px ypy delta ct" << endl;864 outf << "# i name s[m] x[mm] px y[mm] py delta ct" << endl; 853 865 outf << "#" << endl; 854 866 855 for (k = 0; k <= globval.Cell_nLoc; k++) 856 outf << scientific << setprecision(5) 857 << setw(5) << k << setw(11) << Cell[k].Elem.PName 858 << setw(13) << Cell[k].BeamPos << endl; 859 867 868 for (i = 0; i <= globval.Cell_nLoc; i++){ 869 if (Cell[i].Fnum == globval.bpm) 870 outf << scientific << setprecision(4) 871 << setw(5) << i << setw(20) << Cell[i].Elem.PName 872 << setw(5) << Cell[i].S 873 << setw(13) << Cell[i].BeamPos*1e3 << endl; 874 } 860 875 outf.close(); 861 876 } … … 874 889 // the dT and roll angle are all printed out 875 890 { 876 int i ,j;877 int n_girders ;878 int gs_Fnum , ge_Fnum;879 int gs_nKid , ge_nKid;880 int dip_Fnum ,dip_nKid;881 int loc , loc_gs, loc_ge;891 int i=0,j=0; 892 int n_girders=0; 893 int gs_Fnum=0, ge_Fnum=0; 894 int gs_nKid=0, ge_nKid=0; 895 int dip_Fnum=0,dip_nKid=0; 896 int loc=0, loc_gs=0, loc_ge=0; 882 897 char * name; 883 double s ;898 double s=0.0; 884 899 double PdSsys[2], PdSrms[2], PdSrnd[2], dS[2], dT[2]; 885 900 fstream fout; … … 5285 5300 Purpose: 5286 5301 Calculate momentum compact factor up to third order. 5287 5288 5289 5290 5291 5292 5293 5302 Method: 5303 track the orbit offset c*tau at the first element, 5304 at 11 different energy offset(-10-3 to 10-3), then 5305 use polynomal to fit the momentum compact faction factor 5306 up to 3rd order. 5307 The initial coorinates are (x_co,px_co,y_co,py_co,delta,0). 5308 5294 5309 Input: 5295 5310 none … … 5307 5322 change the initial coorinates from (0 0 0 0 delta 0) to 5308 5323 (x_co,px_co,y_co,py_co,delta,0). i.e., track 5309 5324 around the off-momentum close orbit but not zero orbit. 5310 5325 5311 5326 *******************************************************************/ … … 5320 5335 //const double d_delta = 1e-4; 5321 5336 5322 int i , n;5323 long int lastpos ; // last tracking position when the particle is stable5324 double delta[2*n_points+1], alphac[2*n_points+1], sigma ;5337 int i=0, n=0; 5338 long int lastpos=0L; // last tracking position when the particle is stable 5339 double delta[2*n_points+1], alphac[2*n_points+1], sigma=0.0; 5325 5340 Vector x, b; 5326 5341 CellType Cell; 5327 bool cod ;5342 bool cod=false; 5328 5343 5329 5344 globval.pathlength = false; 5330 5345 getelem(globval.Cell_nLoc, &Cell); 5331 n = 0;5332 5346 5333 5347 for (i = -n_points; i <= n_points; i++) { … … 5353 5367 5354 5368 5369 /********************************************************** 5370 * float f_bend(float b0L[]) 5371 * 5372 * 5373 * 5374 **********************************************************/ 5355 5375 float f_bend(float b0L[]) 5356 5376 {
Note: See TracChangeset
for help on using the changeset viewer.