Changeset 32 in TRACY3
- Timestamp:
- Apr 9, 2014, 3:50:11 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/make_for_gcc.sh
r25 r32 27 27 ./bootstrap 28 28 29 FFLAGS="-g -O2 -Wall -fbounds-check" CXXFLAGS="-g -O2 -Wall-fno-implicit-templates" CC=gcc F77=gfortran CXX=g++ ./configure --prefix=$dir/$TRACY/tracy29 FFLAGS="-g -O2 -Wall -fbounds-check" CXXFLAGS="-g -O2 -Wall -fno-implicit-templates" CC=gcc F77=gfortran CXX=g++ ./configure --prefix=$dir/$TRACY/tracy 30 30 31 31 -
trunk/tracy/autom4te.cache/requests
r17 r32 70 70 'AM_PROG_CC_C_O' => 1, 71 71 '_AM_MANGLE_OPTION' => 1, 72 'AM_SET_LEADING_DOT' => 1, 72 73 'AM_CONDITIONAL' => 1, 73 'AM_SET_LEADING_DOT' => 1,74 74 'AM_SET_DEPDIR' => 1, 75 75 '_AM_DEPENDENCIES' => 1, 76 'm4_include' => 1, 76 77 'AM_PROG_INSTALL_SH' => 1, 77 'm4_include' => 1,78 78 '_AC_AM_CONFIG_HEADER_HOOK' => 1, 79 79 'AU_DEFUN' => 1, … … 93 93 ], 94 94 { 95 '_LT_AC_TAGCONFIG' => 1, 95 96 'AM_PROG_F77_C_O' => 1, 96 ' _LT_AC_TAGCONFIG' => 1,97 'AC_INIT' => 1, 97 98 'm4_pattern_forbid' => 1, 98 'AC_ INIT' => 1,99 'AC_CANONICAL_TARGET' => 1, 99 100 '_AM_COND_IF' => 1, 100 'AC_C ANONICAL_TARGET' => 1,101 'AC_CONFIG_LIBOBJ_DIR' => 1, 101 102 'AC_SUBST' => 1, 102 'AC_C ONFIG_LIBOBJ_DIR' => 1,103 'AC_CANONICAL_HOST' => 1, 103 104 'AC_FC_SRCEXT' => 1, 104 'AC_CANONICAL_HOST' => 1,105 105 'AC_PROG_LIBTOOL' => 1, 106 106 'AM_INIT_AUTOMAKE' => 1, 107 'AC_CONFIG_SUBDIRS' => 1, 107 108 'AM_PATH_GUILE' => 1, 108 'AC_CONFIG_SUBDIRS' => 1,109 109 'AM_AUTOMAKE_VERSION' => 1, 110 110 'LT_CONFIG_LTDL_DIR' => 1, 111 'AC_REQUIRE_AUX_FILE' => 1, 111 112 'AC_CONFIG_LINKS' => 1, 112 ' AC_REQUIRE_AUX_FILE' => 1,113 'LT_SUPPORTED_TAG' => 1, 113 114 'm4_sinclude' => 1, 114 'LT_SUPPORTED_TAG' => 1,115 115 'AM_MAINTAINER_MODE' => 1, 116 116 'AM_NLS' => 1, 117 117 'AM_GNU_GETTEXT_INTL_SUBDIR' => 1, 118 '_m4_warn' => 1, 118 119 'AM_MAKEFILE_INCLUDE' => 1, 119 '_m4_warn' => 1,120 120 'AM_PROG_CXX_C_O' => 1, 121 '_AM_COND_ENDIF' => 1, 121 122 '_AM_MAKEFILE_INCLUDE' => 1, 122 '_AM_COND_ENDIF' => 1,123 123 'AM_ENABLE_MULTILIB' => 1, 124 124 'AM_PROG_MOC' => 1, 125 125 'AM_SILENT_RULES' => 1, 126 126 'AC_CONFIG_FILES' => 1, 127 'include' => 1, 127 128 'LT_INIT' => 1, 128 ' include' => 1,129 'AM_PROG_AR' => 1, 129 130 'AM_GNU_GETTEXT' => 1, 130 'AM_PROG_AR' => 1,131 131 'AC_LIBSOURCE' => 1, 132 'AC_CANONICAL_BUILD' => 1, 132 133 'AM_PROG_FC_C_O' => 1, 133 'AC_CANONICAL_BUILD' => 1,134 134 'AC_FC_FREEFORM' => 1, 135 135 'AH_OUTPUT' => 1, 136 '_AM_SUBST_NOTMAKE' => 1, 136 137 'AC_CONFIG_AUX_DIR' => 1, 137 '_AM_SUBST_NOTMAKE' => 1, 138 'AM_PROG_CC_C_O' => 1, 139 'sinclude' => 1, 138 140 'm4_pattern_allow' => 1, 139 ' sinclude' => 1,140 'A M_PROG_CC_C_O' => 1,141 'AM_CONDITIONAL' => 1, 142 'AC_CANONICAL_SYSTEM' => 1, 141 143 'AM_XGETTEXT_OPTION' => 1, 142 'AC_CANONICAL_SYSTEM' => 1,143 'AM_CONDITIONAL' => 1,144 144 'AC_CONFIG_HEADERS' => 1, 145 145 'AC_DEFINE_TRACE_LITERAL' => 1, -
trunk/tracy/tools/soltracy.cc
r11 r32 127 127 //print flat file with all the design values of the lattice, 128 128 prtmfile("flat_file.dat"); 129 // print location, twiss parameters and close orbit at all elements position to a file 130 getcod(dP, lastpos); 131 prt_cod("cod.out", globval.bpm, true); 132 129 130 //find the closed orbit of a ring 131 if(globval.RingType == 1){ 132 getcod(dP, lastpos); 133 134 // compute up to 3rd order momentum compact factor 135 get_alphac2(); 136 } 137 138 139 // print location, twiss parameters and close orbit/orbit at the BPM positions to a file 140 if(globval.bpm !=0){ 141 prt_beampos("6Dcod.out"); 142 } 143 144 145 146 147 148 149 150 133 151 //get_matching_params_scl(); // get tunes and beta functions at entrance 134 // compute up to 3rd order momentum compact factor 135 get_alphac2(); 152 136 153 //cout << endl << "computing tune shifts" << endl; 137 154 //dnu_dA(10e-3, 5e-3, 0.002); -
trunk/tracy/tracy/doc/soltracy3_userManual_developer.tex
r11 r32 1 \documentclass {article}2 \author{Jianfeng Nadolski\footnote{LAL, Orsay, France.Email: \href{mailto:zhangj@lal.in2p3.fr}{zhangj@lal.in2p3.fr}}}1 \documentclass[fleqn]{article} 2 \author{Jianfeng Zhang \footnote{LAL, Orsay, France.Email: \href{mailto:zhangj@lal.in2p3.fr}{zhangj@lal.in2p3.fr}}} 3 3 \title{Soltracy3 mannual for developpers} 4 4 5 \usepackage{amsmath} 5 %% left align the long equations in the 'aligned' enviroment 6 \usepackage[fleqn]{amsmath} 6 7 \usepackage{amssymb} 7 8 \usepackage{graphicx} … … 52 53 \tableofcontents 53 54 54 %\onehalfspacing55 56 \section{ Log}55 \onehalfspacing 56 57 \section{Change Log} 57 58 58 59 \begin{itemize} … … 65 66 66 67 \section{Introduction} 67 Tracy is a code to do long term tracking, and is written in the mixture of c and c++. 68 Tracy is a code to do long term tracking, and is written in the mixture of c and c++ by Johann Bengsston 69 and other scientists (???). 70 71 This manual is for SOLEIL version Tracy which is maintained and developped by 72 L. Nadolski and J. Zhang in Synchrotron SOLEIL. The former manuals of Tracy are in the file folder 73 ``tracy/tracy/doc'' of the Tracy3 code. 74 75 76 77 \begin{description} 78 \item[Rotation angle] 79 The user can define the design rotation angle 80 of the magnetic lattice element in the lattice file. 81 \item{parameters of the lattice element: rotation, field, misalignment errors?} 82 The user can define systematic 83 and random rotation errors, the systematic and random displacement error, and systematic and random multipole field error 84 of the lattice element in an external file (see section.~\ref{}), these 85 variables can't be defined in the lattice file as an element parameters. 86 87 \item{Simulation method: matrix or tracking?} 88 There are two types of simulation in Tracy, Matrix method (Taylor's nonsymplectic map) and symplectic tracking. The default mode is the symplectic tracking. User can active the matrix mode by setting globval.MatMeth in the source code...(Need to update in the input script to active this mode. Be careful, during the 89 lattice reading, the t2init() will active the tracking mode...) 90 91 \item{Define RING or transfer line type in the lattice file} 92 in Lattice\_Read() of t2lat.cc, it seems like we can define a transfer line 93 in Tracy, using the variable V.Symmetry != 0, how to define a transfer line 94 in the lattice? ANSWER: RingType = 1; {define the ring}, or RingType = 0; 95 {define the transfer line}. 96 97 98 The variable is: globval.RingType = 1/0, 1: ring, 0: transfer line. 99 100 \end{description} 101 102 68 103 This code is kept on developing. Soleil version of Tracy 3 is a code with more flexibility and easy to use. User does not need to know the structure of the code, what they need to do is to write an input script, and then run the code. 104 69 105 Based on the need, user can write the files to define multipole field errors, misalignment errors of the lattice elements, and vacuum chamber, and then provide the file name in the user input script, in order to set the field errors of the lattice elements and the vacuum limit for the different region of the lattice. 70 106 Attention: … … 76 112 \section{ Non-parallel version Tracy} 77 113 \subsection {Compile} 78 The make file of Tracy is generated by âautomakeâ. Based on the compilers used,114 The make file of Tracy is generated by ``automake''. Based on the compilers used, 79 115 user needs to update â\textsf{\wrapletters{make\_for\_gcc.sh}}â under 80 116 path ``\pathfont{\$HOME/TracyIII/}'' … … 279 315 the vertical correctors on which the multipole field errors are added in SOLEIL lattice; 280 316 \tracypara{GS} is the name of the start girder; \tracypara{GE} is the name of the end girder; 281 \tracypara{BPM} is the name of beam position monitors defined in the lattice file; 317 \tracypara{BPM} is the name of beam position monitors defined in the lattice file; the 318 BPM acts as both horizontal BPM and vertical BPM. 282 319 \tracypara{QT} is the name of the skew quadrupoles defined in the lattice. Generally, 283 320 user needs to define horizontal, vertical correctors and BPMs when reading the misalignment … … 345 382 346 383 \section{Physics: Hamiltionian} 347 The dynamic motion of a conserved system can be described by a Hamiltonian. For an accelerator system without radiation 384 The lattice elements in Tracy can be classified into two types: drift and multipoles (thick or thin). 385 386 The dynamic motion of a conserved system can be described by a Hamiltonian. For an accelerator system 387 without radiation 348 388 damping (energy loss) and RF cavities (energy gain), the motion of a single electron in the magnetic field can be described using the 349 389 following Hamitonian in the curvilinear coordinate system (Merz...) … … 587 627 588 628 589 \section{ Lattice file} 629 \section{Machine mode} 630 \subsection{Transfer line} 631 Tracy can simulate the transfer line (TL), to calculate some features 632 of this type of the machine, for example, to transfer the twiss functions 633 and the orbits. User can define the TL type in the lattice file 634 using the command: 635 \tracycommand{RingType = 0}{} 636 637 Since the symplecticity is not important to the transfer map of a 638 TL, the twiss functions and orbits of a TL is calculated using 639 a 6-dimensional (6D) linear Taylor transfer matrix. 640 641 \begin{itemize} 642 \item The initial phase of the TL is 0. 643 \item The initial parameters of the TL (alpha, beta, mu, and orbit) are 644 defined in the file ``soleilcommon.cc''. 645 Maybe these parameters can be defined in the lattice file or ``*.prm'' 646 in the future. 647 \item The calculated optical functions at i-th lattice element can be called 648 using: Cell[i] $\rightarrow$ Alpha, Cell[i] $\rightarrow$ Beta, 649 Cell[i]$\rightarrow$ Nu,Cell[i] $\rightarrow$ Eta, 650 Cell[i] $\rightarrow$ Etap. 651 \item The optical functions (alpha, beta, mu), orbits will be automatically 652 calculated and saved in the file ``cod.out''. 653 \item 654 If the BPMs are defined in the lattice file, and the BPMs names are declared 655 in the ``*.prm'' file with the command: 656 \tracycommand{bpm\_name}{BPMs names} 657 then the 6D orbits at the BPM positions will be saved in the 658 file ``6Dcod.out''. 659 \item See also section \ref{sec:general:files}. 660 \end{itemize} 661 662 Called functions: Cell\_Twiss\_M() in t2ring.cc. 663 664 The functions with ``...M()'' are for the transfer line. 665 666 \subsection{Ring} 667 User can define the ring type in the lattice file using the command: 668 \tracycommand{RingType = 1}{} 669 670 If this machine type is not defined, then the default machine type 671 is ring. 672 673 \begin{itemize} 674 \item 675 The momentum compaction factor is calculated and printed to the terminal. 676 \item 677 The twiss functions, and COD files will be automatically printed to 678 a file ``cod.out''. 679 \item 680 If the BPMs are defined in the lattice, and the BPMs names are declared 681 in the ``*.prm'' file using the command: 682 \tracycommand{bpm\_name}{BPM names} 683 684 then the 6D closed orbit at the position of the BPMs will be saved in 685 a file ``6Dcod.out''. 686 \item 687 See also section \ref{sec:general:files}. 688 \end{itemize} 689 690 \section{General print files} 691 \label{sec:general:files} 692 693 After reading the lattice file, Tracy will print several files with the general informations of 694 the lattice. 695 \subsection{*.sum} 696 This file is with the same name as the lattice file but with the file extertion ``*.sum''. 697 This file is with the information: 698 699 700 \begin{flushleft} 701 \textbf{general inforamtion} \\ 702 \end{flushleft} 703 704 \begin{tabular}{l l l} 705 dPcommon = 1.000e-10 &dPparticle = 0.000e+00 &Energy [GeV] = 0.050\\ 706 MaxAmplx [m] = 0.000e+00 &MaxAmply [m] = 0.000e+00 &RFAccept [\%] = +/- 100.00 \\ 707 MatMeth = FALSE& Cavity\_On = FALSE&Radiation\_On = FALSE\\ 708 bpm = 0 & qt = 0 & \\ 709 hcorr = 0 & vcorr = 0 & \\ 710 Chambre\_On = FALSE& & \\ 711 alphac = 0.0000e+00 & & \\ 712 nux = 1.382583 & nuy = 0.859382 & \\ 713 ksix = 0.000000& ksiy = 0.000000 & \\ 714 \end{tabular} 715 716 717 \begin{description} 718 \item[dPcommon]: relative energy spread. 719 \item[dPparticle]: 720 \item[Energy]: beam energy [GeV]. 721 \item[MaxAmplx]: maximum horizontal aperture size. 722 \item[MaxAmply]: maximum vertical aperture size. 723 \item[RFAccept [\%]]: RF acceptance. 724 \item[MatMeth]: use linear transfer matrix or tracking? True/false. 725 \item[Cavity\_On]: with RF cavity or not? 726 \item[Radiation\_On]: synchrotron radiation is on or off? 727 \item[bpm]: number of BPMs. If the user doesn't specify the name of the BPM 728 in the ``*.prm'' file, then this value is 0, it means that Tracy think 729 there is no BPMs defined in the lattice? (need to check...) 730 \item[qt]: number of skew quadrupoles. If the user doesn't specify the name 731 of the qt in the ``*.prm'' file, then this value is 0, it means that 732 Tracy think there is no skew quadrupoles defined in the lattice? (need to 733 check...) 734 \item[hcorr]: number of horizontal correctors. If the user doesn't specify the name of the hcorr in the 735 ``*.prm'' file, then this value is 0, it means that Tracy think there 736 is no horizontal correctors defined in the lattice? (need to check...) 737 \item[vcorr]: number of vertical correctors. If the user doesn't specify the name of the vcorr in the 738 ``*.prm'' file, then this value is 0, it means that Tracy think there 739 is no vertical correctors defined in the lattice? (need to check...) 740 \item[Chambre\_On]: read the vacuum chamber definition from an external file? If it is true, then 741 an external file with the definition of the vacuum chamber aperture must 742 be defined in the ``*.prm'' file. 743 \item[alphac]: first order momentum compaction factor. For a transfer line, this variable is 0. 744 \item[nux]: horizontal phase advance for a transfer line; horizontal tune for the ring. This 745 variable is normalized by 2$\pi$. 746 \item[nuy]: vertical phase advance for a transfer line; vertical tune for the ring. This 747 variable is normalized by 2$\pi$. 748 \item[ksix]: horizontal chromaticity. This variable is only valid for a ring; it is 0 for a transfer line. 749 \item[ksiy]: vertical chromaticity. This variable is only valid for a ring; it is 0 for a transfer line. 750 \end{description} 751 752 This file also has the 6$\times$6 transfer matrix (one turn map for a ring): 753 754 \begin{flushleft} 755 \textbf{OneTurn matrix}: \\ 756 matrix: 757 \end{flushleft} 758 759 \begin{tabular}{l l l l l l} 760 -1.397484e+00& 1.028931e+01& 0.000000e+00& 0.000000e+00& -1.089759e-02& 0.000000e+00\\ 761 1.025593e-01& -1.470689e+00& 0.000000e+00& 0.000000e+00& 1.695979e-01& 0.000000e+00\\ 762 0.000000e+00& 0.000000e+00& 5.943899e-01& -5.866019e+00& 0.000000e+00& 0.000000e+00\\ 763 0.000000e+00& 0.000000e+00& 5.043746e-01& -3.295264e+00& 0.000000e+00& 0.000000e+00\\ 764 0.000000e+00& 0.000000e+00& 0.000000e+00& 0.000000e+00& 1.000000e+00& 0.000000e+00\\ 765 0.000000e+00& 0.000000e+00& 0.000000e+00& 0.000000e+00& 0.000000e+00& 0.000000e+00\\ 766 & & & & & \\ 767 \end{tabular} 768 \\ 769 770 Finally, the twiss parameters at the entrance of the first element is saved: 771 \begin{flushleft} 772 \textbf{Twiss parameters at entrance}:\\ 773 \end{flushleft} 774 775 \begin{tabular}{l l l l} 776 Betax [m] = 8.100e+00& Alphax = -0.000e+00& Etax [m] = 0.000e+00& Etaxp = 0.000e+00\\ 777 Betay [m] = 8.100e+00& Alphay = -0.000e+00& Etay [m] = 0.000e+00& Etayp = 0.000e+00\\ 778 \end{tabular} 779 780 \subsection{Twiss file} 781 This file is with the twiss functions at the end of all lattice elements, 782 the file name is the same as the lattice file name, but with the file extension 783 ``*.twi''. 784 785 \begin{tabular}{l l l l l l l l l l l l} 786 name & s & alphax & betax & nux & etax & etapx & alphay & betay & nuy & etay & etapy \\ 787 &[m]& & [m] & & [m] & & & [m] & & [m] & \\ 788 & & & & & & & & & & & \\ 789 \end{tabular} 790 where 791 \begin{description} 792 \item[name]: name of the lattice element. 793 \item[$s$ [m]]: longitudinal position of the element. 794 \item[alphax $\alpha_x$]: horizontal alpha. 795 \item[betax $\beta_x$ [m]]: horizontal beta functions. 796 \item[betay $\beta_y$ [m]]: vertical beta functions. 797 \item[etax $\eta_x$ [m]]: horizontal linear dispersion funciton. 798 \item[etay $\eta_y$[m]]: vertical linear dispersion funciton. 799 \item[etapx $\mathrm{d} \eta_x /mathrm{d}s$]: horizontal linear dispersion 800 funciton $\eta_x$ with respective to longitudinal coordinate $s$. 801 \item[etapy $\mathrm{d} \eta_y /mathrm{d}s$]: vertical linear dispersion 802 funciton $\eta_y$ with respective to longitudinal coordinate $s$. 803 \item[nux $\nu_x$]: horizontal phase advance of the transfer line, or 804 horizontal tune of the ring. 805 This value is normalized by $2 \pi$. 806 \item[nuy $\nu_y$]: vertical phase advance of the transfer line, or 807 vertical tune of the ring. 808 This value is normalized by $2 \pi$. 809 \end{description} 810 811 \subsection{Lattice elements property file} 812 Each time when running Tracy, the design values of lattice 813 elements will be printed to the file ``flat\_file.dat''. 814 This file is a very important file to check the Tracy is 815 correctly running. 816 817 The printed properties of one lattice element are (also see MML) 818 different for the elment type: drift and multipoles (thick or thin). 819 820 821 822 823 \begin{flushleft} 824 \textbf{\color{blue}{drift}}: 825 \end{flushleft} 826 827 828 \begin{flushleft} 829 \textbf{1st line:} \\ 830 Name; familylist number; \\ 831 kid number; \\ 832 index number in the lattice, for example, ``1'' means the first element; \\ 833 834 \textbf{2nd line}: 835 type; method, N \\ 836 837 838 \textbf{type:} type of the lattice element defined in Tracy: \\ 839 840 \begin{tabular}{l l} 841 marker & -1 \\ 842 drift & 0\\ 843 multipole & 1\\ 844 cavity & 2\\ 845 thin kick & 3\\ 846 wiggler & 4\\ 847 kick\_map & 6\\ 848 \end{tabular} 849 850 851 \textbf{method:} symplectic integration method. 852 For drift, method = 0. \\ 853 854 855 \textbf{N:} number of pieces of the elements to be cut. 856 For drift, N = 0. \\ 857 858 859 860 \textbf{3rd line:} 861 MaxamplX0, MaxamplX1, MaxamplY0, MaxamplY1. \\ 862 \begin{tabular}{r l} 863 MaxamplX0: & minimum horizontal aperture size;\\ 864 MaxamplX1: & maximum horizontal aperture size;\\ 865 MaxamplY0: & minimum vertical aperture size;\\ 866 MaxamplY1: & maximum vertical aperture size;\\ 867 \end{tabular} 868 869 \textbf{4th line:} 870 Element length. \\ 871 872 873 874 875 \textit{For example:} \\ 876 877 \begin{tabular}{l l l l} 878 sd1l & 1 & 1 & 2 \\ 879 0 & 0 & 0 & \\ 880 0.000e+00 & 0.000e+00 & 0.000e+00 & 0.000e+00 \\ 881 2.000e-01 & & & \\ 882 \end{tabular} 883 \end{flushleft} 884 885 886 \begin{flushleft} 887 \textbf{\color{blue}{multipoles:}} 888 889 Depending on the elements length, the printed information of thick 890 and thin multipoles are different. But both types of multipoles have 891 the following general informations as the drift: \\ 892 893 \textbf{1st line:} \\ 894 Name; familylist number; kid number; index number in the 895 lattice, for example, ``1'' means the first element;\\ 896 897 Name: element name. \\ 898 899 900 901 \textbf{2nd line:} 902 type; method, N 903 904 \textbf{type:} type of the lattice element defined in Tracy: \\ 905 \begin{tabular}{l l} 906 marker & -1\\ 907 drift & 0\\ 908 thick multipole & 1\\ 909 cavity & 2\\ 910 thin multipole & 3\\ 911 wiggler & 4\\ 912 kick\_map & 6\\ 913 \end{tabular} 914 915 \textbf{method:} symplectic integration method defined in the lattice, or 916 the default method for this element.\\ 917 918 \textbf{N:} number of pieces of the elements to be cut defined in the 919 lattice or the default value ``1''.\\ 920 921 \textbf{3rd line:} 922 MaxamplX0, MaxamplX1, MaxamplY0, MaxamplY1.\\ 923 924 \begin{tabular}{r l} 925 MaxamplX0:& minimum horizontal aperture size;\\ 926 MaxamplX1:& maximum horizontal aperture size;\\ 927 MaxamplY0:& minimum vertical aperture size;\\ 928 MaxamplY1:& maximum vertical aperture size;\\ 929 \end{tabular} 930 931 \textbf{For a thick multipoles,} \\ 932 \textbf{4th line:} 933 DsX, DsY, PdTpar, PdTsys, PdTrms*PdTrnd. \\ 934 935 936 \textbf{DsX:} horizontal displacement error of the element. \\ 937 \textbf{DsY:} vertical displacement error of the element. \\ 938 \textbf{PdTpar:} total designed rotation angle [degree]. \\ 939 \textbf{PdTsys:} systematic designed rotation angle \\ 940 defined in the lattice.[degree]. \\ 941 \textbf{PdTrms*PdTrnd:} random rotation errors of the element multiplied 942 by a scale factor PdTrnd. The default value of 943 PdTrnd is 0. \\ 944 945 \textbf{For a thin multipole:} \\ 946 \textbf{4th line:} 947 DsX, DsY, PdTsys+ PdTrms*PdTrnd.\\ 948 949 \textbf{DsX:} horizontal displacement error of the element. \\ 950 \textbf{DsY:} vertical displacement error of the element.\\ 951 \textbf{PdTsys + pdTrm*PdTrnd:} 952 The sum of the systematic field components and random multipole field 953 components, field components of the same order are added.\\ 954 \textbf{PdTsys:} systematic designed rotation angle 955 defined in the lattice.[degree].\\ 956 \textbf{PdTrms*PdTrnd:} random rotation errors of the element multiplied 957 by a scale factor PdTrnd. The default value of 958 PdTrnd is 0. \\ 959 960 961 962 \textbf{5th line:} PL, Pirho, PTx1, PTx2, PH1, PH2, Pgap \\ 963 964 \begin{tabular}{l p{10cm}} 965 PL: & length of the element [m]. \\ 966 Pirho: & curvature of the radius of the dipole,1/rho [1/m]. Pirho 967 denotes the 968 bending angle of the dipole, since Pirho = $\frac{\theta}{180}*\pi/L$\\ 969 PTx1: & entrance angle of the dipole, [degree].\\ 970 PTx2: & exit angle of the dipole, [degree].\\ 971 PH1: & bending curvature of the entrance pole face of dipole, [degree].\\ 972 PH2: & bending curvature of the exit pole face of dipole, [degree].\\ 973 Pgap: & full dipole gap, [m]. \\ 974 \end{tabular} 975 976 The definitions of PTx1, PTx2, PH1, PH2, Pgap can be found on P116 SAC-75. 977 978 \textbf{6th line:} 979 nmpole, n\_design \\ 980 981 \begin{tabular}{l p{10cm}} 982 nmpole: & multipole field order of the element. The value is 0 for dipole. \\ 983 n\_design:& design order of the multipole field of the element. \\ 984 \end{tabular} 985 986 The value of n\_design is: \\ 987 \begin{tabular}{l l} 988 0: & All \\ 989 1: & dipole (n = 1).\\ 990 2: & quadrupole (n = 2).\\ 991 3: & sextupole (n = 3).\\ 992 4: & octupole (n = 4).\\ 993 5: & decuple (n = 5). \\ 994 6: & dodecapule (n = 6).\\ 995 \end{tabular} 996 997 \textbf{ 998 7th line and then:} 999 i, HOMmax+i, HOMmax-i \\ 1000 1001 \begin{tabular}{l l } 1002 i: & multipole field order of the element. \\ 1003 HOMmax+i: & normal multipole field components, normalized by $B\rho$.\\ 1004 HOMmax-i: & skew multipole field components, normalized by $B\rho$.\\ 1005 \end{tabular} 1006 \textbf{Notes}:\\ 1007 \begin{itemize} 1008 \item For a dipole element, there is no multipole field components. 1009 This is due to the kick map from the expanded Hamiltonian, 1010 the vector component of the dipole is treated separated from 1011 other multipoles, and the contribution of the dipoles are 1012 included in the curvature of radius of the dipole $1/rho$. 1013 1014 \item The non-zero multipole field components will be printed from 1-th order to 1015 the maximum order Porder. 1016 \end{itemize} 1017 1018 1019 \textit{For example:} \\ 1020 1021 \begin{tabular}{ l l l l l l l} 1022 bend1 & 17 & 1 & 15 & & & \\ 1023 1 & 4 & 4 & & & &\\ 1024 0.0000e+00 & 0.0000e+00 & 0.0000e+00 & 0.0000e+00 & & & \\ 1025 0.0000e+00 & 0.0000e+00 & 0.0000e+00 & 0.0000e+00 & & & \\ 1026 2.7645e-01 & 2.8409e+00 & 0.0000e+00 & 0.0000e+00 & 0.0000e+00 & 0.0000e+00 & 0.0000e+00 \\ 1027 0 & 1 & & & & & \\ 1028 & & & & & & \\ 1029 \end{tabular} 1030 1031 1032 \begin{tabular}{ l l l l l l l} 1033 sx1 & 22 & 1 & 13 \\ 1034 1 & 4 & 4 & \\ 1035 0.0000e+00 & 0.0000e+00 & 0.0000e+00 & 0.0000e+00& & & \\ 1036 0.0000e+00 & 0.0000e+00 & 0.0000e+00 & 0.0000e+00& & & \\ 1037 9.9999e-07 & 0.0000e+00 & 0.0000e+00 & 0.0000e+00 & 0.0000e+00 & 0.0000e+00 & 0.0000e+00 \\ 1038 1 & 3 & & & & & \\ 1039 3 & -8.9672e+06& 0.0000e+00& & & & \\ 1040 \end{tabular} 1041 1042 \end{flushleft} 1043 1044 \begin{flushleft} 1045 \textbf{Cavity} \\ 1046 RF cavity. 1047 \end{flushleft} 1048 1049 1050 \textbf{1st line:} 1051 Name; familylist number; kid number; index number in the 1052 lattice, for example, ``1'' means the first element; \\ 1053 1054 \textbf{2nd line:} type; method, N \\ 1055 1056 \textbf{type:} type of the lattice element defined in Tracy: \\ 1057 cavity 2 1058 1059 \textbf{method:} symplectic integration method defined in the lattice, or 1060 the default method for this element.\\ 1061 1062 \textbf{N:} number of pieces of the elements to be cut defined in the 1063 lattice or the default value ``1''.\\ 1064 1065 \textbf{3rd line:} 1066 MaxamplX0, MaxamplX1, MaxamplY0, MaxamplY1.\\ 1067 1068 \begin{tabular}{l l} 1069 MaxamplX0:& minimum horizontal aperture size;\\ 1070 MaxamplX1:& maximum horizontal aperture size;\\ 1071 MaxamplY0:& minimum vertical aperture size;\\ 1072 MaxamplY1:& maximum vertical aperture size;\\ 1073 & \\ 1074 \end{tabular} 1075 1076 \textbf{4th line:} 1077 Pvolt/energy, 2*pi*Pfreq/co, phase, energy. \\ 1078 1079 \begin{tabular}{l l} 1080 Pvolt/energy:& RF voltage normalized by beam energy [eV]. \\ 1081 2*pi*pfreq/c0:& RF frequency normalized by the speed of light. \\ 1082 phase:& RF phase [degree]. \\ 1083 energy:& beam energy [eV].\\ 1084 & \\ 1085 \end{tabular} 1086 1087 \begin{flushleft} 1088 \textbf{marker} \\ 1089 \end{flushleft} 1090 1091 \textbf{1st line:} 1092 Name; familylist number; kid number; index number in the 1093 lattice, for example, ``1'' means the first element;\\ 1094 1095 \textbf{2nd line: } 1096 type; method, N \\ 1097 1098 1099 type: type of the lattice element defined in Tracy: 1100 marker -1 1101 1102 \textbf{3rd line:} 1103 MaxamplX0, MaxamplX1, MaxamplY0, MaxamplY1.\\ 1104 1105 \begin{tabular}{l l} 1106 MaxamplX0:& minimum horizontal aperture size;\\ 1107 MaxamplX1:& maximum horizontal aperture size;\\ 1108 MaxamplY0:& minimum vertical aperture size;\\ 1109 MaxamplY1:& maximum vertical aperture size;\\ 1110 & \\ 1111 \end{tabular} 1112 1113 1114 \textit{For example:}\\ 1115 \begin{tabular}{l l l l} 1116 debut & 56 & 1 & 1\\ 1117 -1 & 0 & 0 & \\ 1118 0.0000e+00 & 0.0000e+00 & 0.0000e+00 & 0.0000e+00 \\ 1119 \end{tabular} 1120 1121 \begin{flushleft} 1122 \textbf{wiggler}: \\ 1123 \textbf{insertion device}: 1124 \end{flushleft} 1125 1126 1127 1128 1129 \subsection{File of the ring closed orbit or orbit of the transfer line} 1130 The horizontal and vertical closed orbits of the ring lattice or the orbits 1131 of the transfer line 1132 at all lattice elements are be printed to the file ``cod.out''. 1133 1134 The user can also choose to print the orbit at the position of BPM, but 1135 the name of the BPM must be defined at the beginning of the ``*.prm'' file, 1136 since both the horizontal and vertical orbits will be printed at the BPM position, 1137 it is only needed to define a general BPM in the lattice file. 1138 1139 \begin{tabular}{ l l l l l l l l l l l l l l} 1140 i &name &s& code & betax & nux & betay & nuy & xcod & ycod & dSx & dSy & dipx & dipy\\ 1141 \end{tabular} 1142 1143 \begin{tabular}{l p{10cm}} 1144 i: & lattice element index. \\ 1145 name: & name of the lattice element.\\ 1146 s: & longitudinal position of the element [m].\\ 1147 code:& code type of the element. \\ 1148 & drift: 0.0 \\ 1149 & dipole: 0.5 \\ 1150 & focusing quadrupole: 1 \\ 1151 & defocusing quadrupole: -1 \\ 1152 &focusing sextupole: 1.5 \\ 1153 & defocusing sextupole: -1.5 \\ 1154 & bpm: 2.0; \\ 1155 & only when the name of the bpms are defined in 1156 the ``*.prm'' file, this value is 2.0, otherwise 1157 Tracy will not find them. \\ 1158 others: & 0.0 \\ 1159 betax:& horizontal beta function [m].\\ 1160 nux: & horizontal tune (normalized by $2 \pi$).\\ 1161 betay:& vertical beta function [m].\\ 1162 nuy: & vertical tune (normalized by $2 \pi$).\\ 1163 xcod:& horizontal closed orbit, [mm]. \\ 1164 ycod:& vertical closed orbit, [mm].\\ 1165 dSx:& horizontal displacement error, [mm].\\ 1166 dSy:& vertical displacement error, [mm].\\ 1167 dipx:& horizontal kick angle, only valid for horizontal correctors, [mrad].\\ 1168 dipy:& vertical kick angle, only valid for vertical correctors, [mrad].\\ 1169 & \\ 1170 \end{tabular} 1171 1172 \textit{For example:} \\ 1173 \begin{tabular}{l l l l l l l l l l l l l l } 1174 \multicolumn{14}{l}{drift:} \\ 1175 2& sd5& 0.78& 0.0& 3.873& 0.033& 2.137& 0.065& -0.002& 0.000& 0.000& 0.000& -0.000& 0.000\\ 1176 \hline 1177 \multicolumn{14}{l}{quadrupole:} \\ 1178 5& qp1& 0.93& -1.0& 4.403& 0.039& 2.035& 0.076& -0.002& 0.000& 0.000& 0.000& -0.000& 0.000\\ 1179 \hline 1180 \multicolumn{14}{l}{dipole:} \\ 1181 10& dip& 2.16& 0.5& 0.126& 0.196& 7.446& 0.148& 0.001& 0.000& 0.000& 0.000& -0.000& 0.000\\ 1182 \hline 1183 \multicolumn{14}{l}{corrector:} \\ 1184 14 & ch01& 2.29& 0.0& 0.127& 0.420& 8.950& 0.150& 0.001& 0.000& 0.000& 0.000& 0.010& 0.000\\ 1185 \hline 1186 \multicolumn{14}{l}{defocusing sextupole:} \\ 1187 19& sx3& 2.59& -1.5& 2.566& 0.523& 7.225& 0.155& 0.005& 0.000& 0.000& 0.000& -0.000& 0.000 \\ 1188 \hline 1189 \multicolumn{14}{l}{focusing sextupole:} \\ 1190 27& sx2& 3.06& 1.5& 9.603& 0.535& 2.375& 0.176& 0.010& 0.000& 0.000& 0.000& -0.000& 0.000\\ 1191 \end{tabular} 1192 1193 1194 1195 1196 \subsection{6-Dimensional (6D) closed orbit or 6D orbit of the transfer line} 1197 If the BPMs are defined in the lattice, and the BPM names are defined 1198 in the user input file ``*.prm'' using the command: 1199 \tracycommand{bpm\_names}{BPMx} 1200 1201 then Tracy will print out the 6D closed orbit of the ring or the 6D orbit 1202 of the transfer line at the locations of the BPMs to a file ``6Dcod.out''. 1203 The printed parameters are: 1204 1205 i name s x px y py delta ct 1206 1207 \begin{description} 1208 \item[i]: index of the lattice element. 1209 \item[name]: name of the lattice element. 1210 \item[s]: longitudinal position of the element, [m]. 1211 \item[x]: horizontal orbit at the end of the element, [mm]. 1212 \item[px]: derivative of the horizontal orbit $x$ with respective to $s$ at the end of the element. 1213 \item[y]: vertical orbit at the end of the element, [mm]. 1214 \item[py]: derivative of the vertical orbit $y$ with respective to $s$ at the end of the element. 1215 \item[delta]: energy spread. 1216 \item[ct]: longitudinal displacement with respective to the reference particle. 1217 \end{description} 1218 1219 \textit{For example:}\\ 1220 \begin{tabular}{l l l l l l l l l} 1221 3& bpmx& 7.75e-01& -2.09e-03& 1.53e-03& 0.00e+00& 0.00e+00& 0.00e+00& 9.16e-13 \\ 1222 \end{tabular} 1223 1224 1225 \section{Lattice file} 590 1226 In the lattice, RF cavity with the correct harmonic number must be defined!!! 591 1227 Otherwise Tracy will give the error message: … … 650 1286 651 1287 \subsection{Variables} 652 User can define thevariables in the lattice file. For example:1288 User can define variables in the lattice file. For example: 653 1289 \begin{tightcenter} 654 1290 \textsf{Intmeth = 4}; … … 668 1304 669 1305 \subsection{Global variables} 670 After define the ring, user needs to define the system parameters of the lattice: 671 Energy, the beam energy with unit [GeV]. 672 dP, the relative momentum offset of the particle. 673 CODeps, the convergence for the algorism to find the closed orbit. 674 For example: 675 Energy = 2.739; 676 dP = 1.0d-10; 677 CODeps= 1.0d-15; 678 These definitions are mandatory. 1306 After define the ring, user needs to define the system parameters of the lattice: 1307 \begin{tabular}{l p{10cm}} 1308 \textbf{RingType = 1/0;} & define the machine type: ring or transfer line. 1 defines the ring, 0 defines the transfer line. This variable definition is optional, the default machine type is ring. \\ 1309 \textbf{Energy = ;} & the beam energy with unit [GeV]. This variable definition is 1310 mandatory. \\ 1311 \textbf{dP = ;} & the relative momentum offset of the particle. This variable defintion is mandatory. \\ 1312 \textbf{CODeps = ;} & the convergence for the algorism to find the closed orbit. This variable definition is mandatory. \\ 1313 \end{tabular} 1314 1315 \vspace{0.05in} 1316 \begin{flushleft} 1317 \textit{Example:} \\ 1318 \end{flushleft} 1319 \begin{tabular}{r c l} 1320 Energy &= & 2.739; \\ 1321 dP & = & 1.0d-10; \\ 1322 CODeps & = & 1.0d-15; \\ 1323 \end{tabular} 679 1324 680 1325 \subsection{DRIFT} … … 704 1349 705 1350 \latticedef{Element\_name:}{bending,}{L = $\langle \dots \rangle$, T = $\langle \dots \rangle$, 706 \textbf{T1} = $\langle \dots \rangle$, \textbf{T2}=$\langle \dots \rangle$,707 \textbf{H1} = $\lbrack \dots \rbrack$, \textbf{H2}= $\lbrack \dots \rbrack$,708 \textbf{gap} = $\lbrack \dots \rbrack$, \textbf{edge\_effect1}= $\lbrack \dots \rbrack$,709 \textbf{edge\_effect2} = $\lbrack \dots \rbrack$, \textbf{K}=$\lbrack \dots \rbrack$,710 \textbf{method} = $\langle \dots \rangle$, \textbf{N}= $\langle \dots \rangle$;}1351 T1 = $\langle \dots \rangle$, T2=$\langle \dots \rangle$, 1352 H1 = $\lbrack \dots \rbrack$, H2= $\lbrack \dots \rbrack$, 1353 gap = $\lbrack \dots \rbrack$, edge\_effect1 = $\lbrack \dots \rbrack$, 1354 edge\_effect2 = $\lbrack \dots \rbrack$, K =$\lbrack \dots \rbrack$, 1355 method = $\langle \dots \rangle$, N = $\langle \dots \rangle$;} 711 1356 712 1357 … … 755 1400 756 1401 \vspace{0.05in} 757 For example:\\1402 \textit{Example}:\\ 758 1403 \vspace{0.05in} 759 1404 \textsf{beta\_gap=37e-3; tracy\_gap=beta\_gap*2*0.724;} 760 \latticedef{BEND1 :}{ \textbf{bending},}{ \textbf{L} = 1.05243, \textbf{T} = 11.25, \textbf{T1} = 5.5906, 761 \textbf{T2} = 5.67658, \textbf{K} = 0.00204,gap=tracy\_gap, 762 \textbf{edge\_effect1} = 1, \textbf{edge\_effect2} = 1, \textbf{N} = 4, 763 \textbf{method} = intmeth;} 764 765 The parameters of ``bending'' are optional, the default values for the missing parameters are 0, 766 and the default value for ``method'' is also 0. 1405 \latticedef{BEND1 :}{ bending,}{L = 1.05243, T = 11.25, T1 = 5.5906, 1406 T2 = 5.67658, K = 0.00204, gap=tracy\_gap, 1407 edge\_effect1 = 1, edge\_effect2 = 1, N = 4, 1408 method = intmeth;} 1409 1410 1411 \begin{figure} 1412 \includegraphics[width=0.8\linewidth]{bend_curve} 1413 \caption{Field boundaries of the dipoles. $T1$ 1414 is the entrance angle; $T2$ is the exit angle; $H1$ is 1415 the radius of curvature of the entrance pole face; $H2$ is 1416 for the exit pole face; $\rho$ is the local radius of the 1417 design 1418 orbit in the dipole.} 1419 \label{fig:bend_curve} 1420 \end{figure} 767 1421 768 1422 … … 791 1445 tracy\_gap = beta\_gap*2*0.348;} 792 1446 793 794 \latticedef{DIP:}{bending,}{L=0.27646,T= 45, T1=0, T2=0,gap=tracy\_gap,edge\_effect1=1,edge\_effect2=1,method=intmeth,N=4;} 795 796 Elegant definition of dipole with dipole fringe field: \\ 797 \textsf{DIP: csbend,N\_KICKS=100,INTEGRATION\_ORDER=4,L=0.27646,angle= 0.785398, E1=0, E2=0,hgap=0.02,Fint=0.348,nonlinear=1,edge1\_effects=2,edge2\_effects=2,edge\_order=2;} 1447 \begin{tabular}{l l l l l l l} 1448 DIP: & bending, & L=0.27646, &T= 45,& T1=0,& T2=0, gap=tracy\_gap, \\ 1449 & edge\_effect1=1, &edge\_effect2=1,&method=intmeth,& N=4; & & \\ 1450 & & & & & & \\ 1451 \end{tabular} 1452 1453 \textbf{Elegant} definition of dipole with dipole fringe field: \\ 1454 \textsf{DIP: csbend, N\_KICKS=100, INTEGRATION\_ORDER=4, L=0.27646, angle= 0.785398, E1=0, E2=0, hgap=0.02, Fint=0.348, nonlinear=1, edge1\_effects=2, edge2\_effects=2, edge\_order=2;} 798 1455 \end{itemize} 799 1456 … … 977 1634 The multipole field components $a_n$ and $b_n$ are defined as 978 1635 \begin{eqnarray} 1636 \begin{aligned} 979 1637 b_n & = & \frac{1}{B \rho} \frac{1}{(n-1)!} \frac{\partial^{n-1} B_y }{\partial x ^{n-1}}|_{x=0,y=0} \\ 980 1638 a_n & = & \frac{1}{B \rho} \frac{1}{(n-1)!} \frac{\partial^{n-1} B_x }{\partial x ^{n-1}}|_{x=0,y=0} \\ 981 1639 B \rho & = & \frac{p_0}{e} 1640 \end{aligned} 982 1641 \end{eqnarray} 983 1642 $B \rho$ is the magnetic rigidity, $p_0$ is the design beam momentum, $e$ is the electric charge. … … 996 1655 \end{equation} 997 1656 The total magnetic field with $1^{st}$ to $n^{th}$ order field components can be calculated using 998 \begin{eq narray}1657 \begin{equation} 999 1658 \label{eqn:total:field} 1000 B_y + i * B_x & = & (b_n + i*a_n) * (x+i*y)*(x + i*y)^{n-1} + O(n-1) \\ 1001 & = & [(b_n*x - a_n*y) + b_{n-1} + i*(a_n*x + b_n*y + a_{n-1})]*(x+i*y)^{n-1} + O(n-2) \\ 1002 & ...& 1003 \end{eqnarray} 1659 \begin{aligned} 1660 B_y + i * B_x &= (b_n + i*a_n) * (x+i*y)*(x + i*y)^{n-1} + O(n-1) \\ 1661 &= [(b_n*x - a_n*y) + b_{n-1} + i*(a_n*x + b_n*y + a_{n-1})]*(x+i*y)^{n-1} \\ 1662 +& O(n-2) \\ 1663 +&... 1664 \end{aligned} 1665 \end{equation} 1666 1667 1668 1004 1669 1005 1670 The eqn.~\ref{eqn:total:field} is used in Tracy3 to calculate the effective fields of the … … 1042 1707 \end{eqnarray*} 1043 1708 1044 \subsection{ wiggler (To be updated.)} 1709 \subsection{SOLENOID (to be updated)} 1710 1711 \subsection{WIGGLER (To be updated.)} 1045 1712 1046 1713 \latticedef{Element\_Name:}{Wiggler,}{L = $\langle$ length $\rangle$,BoBrhoV = $\langle$ B/Brho $\rangle$, … … 1109 1776 1110 1777 1111 \subsection{INSERTION DEVICE }1778 \subsection{INSERTION DEVICE (to be updated)} 1112 1779 1113 1780 \latticedef{Element\_Name:}{insertion,}{scaling1 = 1/0, scaling2=1/0,method = interpolation\_method, … … 1183 1850 \latticedef{CAV:}{Cavity,}{Frequency = 499.95e6, Voltage=1.22e6, phase = 30, harnum=328;} 1184 1851 1185 The harmonic number of the RF cavity is mandatory, and the other parameters of âcavityâ are 1186 optional, the default values are 0. 1852 To calculate the stable phase for the lattice with positive or negative 1853 momentum compaction factor, the definition of the harmonic number of the 1854 RF cavity is mandatory. The other parameters of RF cavity are 1855 optional, and their default values are 0. 1187 1856 1188 1857 \subsection{CORRECTOR} 1189 1858 1190 \latticedef{Element\_Name:}{corrector,}{horizontal/vertical, method = integrated method;} 1859 \latticedef{Element\_Name:}{corrector,}{horizontal/vertical, L = , kick = , roll = , 1860 N = , method = integrated method;} 1191 1861 1192 1862 \begin{table}[htbp] … … 1194 1864 \caption{Parameters of correctors.} 1195 1865 \label{tab:corrector-para} 1196 \begin{tabular}{| p{0.2\linewidth} | p{0.2\linewidth} | p{0.1\linewidth} | p{0.4\linewidth} |} 1197 \hline 1198 \textbf{Horizontal / vertical} & - & ??? & âhorizontalâ: horizontal corrector; âverticalâ: vertical 1866 \begin{tabular}{| p{0.2\linewidth} | p{0.1\linewidth} | p{0.2\linewidth} | p{0.4\linewidth} |} 1867 \hline 1868 \textbf{Parameter Name} & \textbf{Units} &\textbf{Default} & \textbf{Description} \\ 1869 \hline 1870 \textbf{Horizontal / vertical} & - & horizontal & âhorizontalâ: horizontal corrector; âverticalâ: vertical 1199 1871 corrector \\ 1200 1872 \hline 1201 \textbf{method} & - & ??? & 1, 2, 4. Order of symplectic integration method. 1873 \textbf{L} & [m] & 0.0 & length of the corrector \\ 1874 \hline 1875 \textbf{kick} & [rad] & 0.0 & kick angle \\ 1876 \hline 1877 \textbf{roll} & - & 0.0 & designed rotation angle \\ 1878 \hline 1879 \textbf{N} & - & 1 & cut piece of the element \\ 1880 \hline 1881 \textbf{method} & - & 1, first order & 1, 2, 4. Order of symplectic integration method. 1202 1882 Value â1â means 1st order, â2â means 2nd order, and â4â means 4th order \\ 1203 1883 \hline … … 1216 1896 It defines a vertical corrector. 1217 1897 1218 The parameters of âcorrectorâ are optional, the default value for âmethodâ is 0.1219 1220 1898 \notespace{NOTES:} 1899 \begin{itemize} 1900 \item 1901 The corrector type can be used as a corrector to do both orbit correction or as a 1902 kicker to kick the beam. 1903 \item 1904 The corrector is treated as a multipole in TRACY, that is, if the length 1905 of the corrector \textbf{L} is non-zero, then the element is treated as a thick 1906 multipole, if \textbf{L} is zero, then the corrector is treated as a 1907 thin multipole. 1908 \item 1221 1909 For a lattice with correctors, user must specify the name of corrector in the Tracy 1222 1910 input file with the commands: … … 1227 1915 orbit correction (????); \tracypara{VCM} is the name of the corrector defined in the 1228 1916 lattice for vertical orbit correction. 1229 1230 1231 \subsection{MARKER} 1232 1233 \latticedef{Element\_Name:}{marker;}{} 1917 \end{itemize} 1918 1234 1919 1235 1920 \subsection{BEAM POSITION MONITOR (To be updated)} … … 1238 1923 \latticedef{BPM:}{type;}{} 1239 1924 1240 Normally Its type is defined as âMarkerâtype, but in order to include the misalignment1925 Normally Its type is defined as ``Marker'' type, but in order to include the misalignment 1241 1926 error of BPM into the lattice, it must be defined as âBeam Position Monitorâ type 1242 1927 which is in fact multipole type, since only the element with multipole type is saved … … 1246 1931 For lattice with BPMs, user must specify the name of BPM in the Tracy input file 1247 1932 with the command: 1248 \latticedef{bpm }{beaPosMonitor}1249 Here âbeaPosMonitorâis the name of the BPMs defined in the lattice.1933 \latticedef{bpm\_name }{beaPosMonitor}{} 1934 Here ``beaPosMonitor'' is the name of the BPMs defined in the lattice. 1250 1935 1251 1936 \subsection{GIRDER} 1252 Girder is a special element, itâs the girder used in the real machine to support the magnetic elements and other elements. It is defined as: 1253 Symbol: type; 1254 1255 Normally Its type is defined as âMarkerâ type, but in order to include the misalignment error of girder into the lattice, it must be defined as âmultipoleâ type, since only the element with multipole type is saved with displacement error, field error, etc. 1256 For convenience, itâs better to define the beginning of the girder and also the end of the girder, and the elements between the beginning and end of the girders are the elements who are put on the girder in the real machine. 1257 1258 Notice: 1259 For lattice with girders, 1260 User must specify the name of girder in the input file â*.prmâ with the commands: 1261 gs Girder\_Start 1262 ge Girder\_End 1263 1264 Here âGirder\_Startâ is the name of the start of girder defined in the lattice; âGirder\_Endâ is the name of the end of girder defined in the lattice. 1265 1266 \subsection{SOLENOID...TO BE UPDATED...} 1267 1937 Girder is a special element, itâs the girder used in the real machine to support the 1938 magnetic elements and other elements. It is defined as: 1939 \latticedef{Symbol:}{ type;}{} 1940 1941 Normally Its type is defined as ``Marker'' type, but in order to include the misalignment 1942 error of girder into the lattice, it must be defined as ``multipole'' type, since only 1943 the element with multipole type is saved with displacement error, field error, etc. 1944 1945 For convenience, itâs better to define the beginning of the girder and also the end of 1946 the girder, and the elements between the beginning and end of the girders are the 1947 elements who are put on the girder in the real machine. 1948 1949 \begin{flushleft} 1950 \textbf{Notice:}\\ 1951 For lattice with girders, User must specify the name of girder in the 1952 input file ``*.prm'' with the commands: \\ 1953 1954 \begin{tabular}{l l} 1955 gs & Girder\_Start \\ 1956 ge & Girder\_End \\ 1957 & \\ 1958 \end{tabular} 1959 1960 Here ``Girder\_Start'' is the name of the start of girder defined in the lattice; 1961 ``Girder\_End'' is the name of the end of girder defined in the lattice. 1962 \end{flushleft} 1963 1964 \subsection{MARKER} 1965 1966 \latticedef{Element\_Name:}{marker;}{} 1268 1967 1269 1968 \subsection{ELEMENT BLOCK} 1270 To construct the element block, use the following format: 1271 Symbol: elem1, elem2,âŠ., block1,block2; 1272 Here âSymbolâ is the name of the element block, and âelem1â, âelem2â, âblock1â, âblock2â are the element or sub element blocks in this element block. 1273 If there are N the same element/block subsequently, user can use âN*element/blockâ to simply the definition. For example: 1274 SINJ: SD1a, ssep, 3*SEP,esep,SD1c,eHU600,SD1d; 1275 In this example element block, there are 9 elements/blocks, and 3 elements/blocks âSEPâ subsequently. 1969 \begin{flushleft} 1970 To construct the element block, use the following format: \\ 1971 \latticedef{Symbol:}{ elem1, elem2,âŠ., block1,block2;}{} 1972 Here ``Symbol'' is the name of the element block, and ``elem1'', 1973 ``elem2'', ``block1'', ``block2'' are the element or sub element 1974 blocks in this element block. \\ 1975 1976 If there are $N$ the same element/block subsequently, user can use 1977 ``$N$*element/block'' to simply the definition. \\ 1978 \textbf{For example:} \\ 1979 \latticedef{SINJ:}{ SD1a, ssep, 3*SEP,esep,SD1c,eHU600,SD1d;}{} 1980 In this example element block, there are 9 elements/blocks, and 3 elements/blocks ``SEP'' subsequently. 1276 1981 1277 1982 \subsection{LINE} 1278 1983 User can define the cell structure using the command: 1279 1984 1280 CELL : $\langle$ block name $\rangle$, SYMMETRY=$\langle$ symmetry $\rangle$; 1281 1282 $\langle$ block name $\rangle$ is the name of a block; $\langle$ symmetry $\rangle$ is the number of super symmetry or the number of the block in the ring. 1283 1284 Example: 1285 1286 CELL: BL1, Symmetry=12; 1287 1288 This example defines the cell with block âBL1â, and the number of super symmetry is 12. The output of the Tracy3 with symmetry large than 1 will give the 1985 \latticedef{CELL :} {$\langle$ block name $\rangle$, SYMMETRY=$\langle$ symmetry $\rangle$;}{} 1986 1987 \begin{tabular}{l l} 1988 $\langle$block name $\rangle$: & the name of a block; \\ 1989 $\langle$symmetry $\rangle$: & the number of super symmetry or the number of the block in the ring. \\ 1990 & \\ 1991 \end{tabular} 1992 1993 \textit{Example:} \\ 1994 1995 CELL: BL1, Symmetry = 12; \\ 1996 1997 This example defines the cell with block ``BL1'', and the number of super 1998 symmetry is 12. The output of the Tracy3 with symmetry large than 1 will give the 1289 1999 tunes and chromaticities in one symmetric period. 2000 2001 \end{flushleft} 1290 2002 1291 2003 \subsection{RING} 1292 2004 To define the ring, use the command: 1293 RING: elem, blockâŠ. 1294 Itâs similar to define an element block, but must with the fixed symbol name âRINGâ. For example: 1295 RING: DEBUT,SUP1,SUP2,SUP3,SUP4,CAV,FIN; 1296 5.1.23 End line 2005 \latticedef{RING:}{ elem, blockâŠ.} 2006 Itâs similar to define an element block, but must with the fixed symbol 2007 name ``RING''. \\ 2008 2009 \textbf{For example:} \\ 2010 \latticedef{RING:}{ DEBUT,SUP1,SUP2,SUP3,SUP4,CAV,FIN;}{} 2011 2012 \subsection{End line} 1297 2013 To end the lattice file, user needs to use the following command at the end of the lattice file: 1298 2014 End; … … 1301 2017 1302 2018 \section{Commands} 1303 The following commands turn on the boolean flags in the code to set the machine parameters and carry on different calculations. All these commands are optional; user can choose whichever they need. If user wants to use the flag, they can write the flag in the script, if they do not want to use it, they can delete or comment out (add â\#â at the beginning of command line) the flag. The Boolean flags in the user input script have the following features: 1304 If the flags are not active, then the default values for all the boolean commands are false. 1305 The code will execute the command according to the sequence defined in the input script â*.prmâ. For example, 1306 FitTune4Flag    qp7a qp7b qp9a qp9b 18.18 10.28 1307 ReadMultipoleFlag 1308 FitTune4Flag    qp7a qp7b qp9a qp9b 18.202 10.317 1309 The code will fit tunes to the target tunes (18.18 10.28), and then read multipole field errors into the lattice, then fit the tunes to a new set of values (18.202 10.317). 1310 User can define the same Boolean commands as often as they want in the same input script; but user can only define maximum 500 commands in one input script. 1311 The user defined script can be used both for the non-parallel and parallel version Tracy; the output files are the same for both versions. 2019 The following commands turn on the boolean flags in the code to set the 2020 machine parameters and carry on different calculations. All these commands 2021 are optional; user can choose whichever they need. If user wants to use 2022 the flag, they can write the flag in the script, if they do not want to 2023 use it, they can delete or comment out (add ``\#'' at the beginning of command line) 2024 the flag. The Boolean flags in the user input script have the following features: 2025 \begin{flushleft} 2026 \begin{itemize} 2027 \item 2028 If the flags are not active, then the default values for all the boolean 2029 commands are false. 2030 \item 2031 The code will execute the command according to the sequence defined in the 2032 input script ``*.prm''. For example, \\ 2033 \begin{tabular}{l l} 2034 (1) & \\ 2035 \hline 2036 FitTune4Flag & qp7a qp7b qp9a qp9b 18.18 10.28 \\ 2037 \hline 2038 (2) & \\ 2039 ReadMultipoleFlag & \\ 2040 \hline 2041 (3) & \\ 2042 FitTune4Flag & qp7a qp7b qp9a qp9b 18.202 10.317 \\ 2043 & \\ 2044 \end{tabular} 2045 2046 With the command (1), 2047 the code will fit tunes to the target tunes (18.18 10.28); \\ 2048 with the command (2), the code 2049 then read multipole field errors into the lattice; \\ 2050 with the command (3), the code 2051 then fit the tunes to a new set of values (18.202 10.317). 2052 2053 \item 2054 User can define the same Boolean commands as often as they want 2055 in the same input script; but user can only define maximum 500 2056 commands in one input script. 2057 \item 2058 The user defined script can be used both for both the non-parallel 2059 and parallel version Tracy; the output files are the same 2060 for both versions. 2061 \item 2062 The key words in the user defined input file ``*.prm'' is 2063 case sensitive, that is, the key word with captical letters 2064 is different from the one with small letters. 2065 \item 2066 The variables and lattice element names in Tracy lattice file 2067 are not case sensitive, user can define the variables and 2068 lattice elements names with small or captical letters. 2069 2070 \end{itemize} 2071 \end{flushleft} 1312 2072 1313 2073 \subsection{QuadFringeOnFlag } 1314 To activate quadrupole fringe field, use the command:\\ 1315 QuadFringeOnFlag\\ 1316 in the â*.prmâ script. With this command, user can define the fringe field at the entrance or exit of the quadrupole together with the command FF1 = 1 or FF2 = 1 of the quadrupoles which are defined in the lattice file; if FF1 or FF2 not equals to 1, then there is no fringe field at the entrance or exit of the quadrupoles even if QuadFringeOnFlag is active in the â*.prmâ file. 1317 This flag is a global flag, if user set this flag in the input script, it will always have effects until this flag is reset. 2074 To activate quadrupole fringe field, use the command: 2075 \tracycommand{QuadFringeOnFlag}{} 2076 in the ``*.prm'' script. With this command, user can define 2077 the fringe field at the entrance or exit of the quadrupole together 2078 with the command ``FF1 = 1'' or ``FF2 = 1'' of the quadrupoles 2079 which are defined in the lattice file; if FF1 or FF2 not equals to 1, 2080 then there is no fringe field at the entrance or exit of the quadrupoles 2081 even if QuadFringeOnFlag is active in the ``*.prm'' file. 2082 2083 This flag is a global flag, if user set this flag in the input script, 2084 it will always have effects until this flag is reset. 1318 2085 1319 2086 \subsection{QuadFringeOffFlag } 1320 2087 To deactivate quadrupole fringe field, use the command: 1321 QuadFringeOffFlag 1322 With this command, user can deactivate the fringe field at the entrance and exit of the quadrupole, even if FF1 = 1 or FF2 = 1 for the quadrupole in the lattice file. 1323 This flag is a global flag, if user set this flag in the input script, it will always have effects until this flag is reset. 2088 \tracycommand{QuadFringeOffFlag}{} 2089 2090 With this command, user can deactivate the fringe field at the entrance 2091 and exit of the quadrupole, even if ``FF1 = 1'' or ``FF2 = 1'' for the 2092 quadrupole in the lattice file. 2093 2094 This flag is a global flag, if user set this flag in the input script, 2095 it will always have effects until this flag is reset. 1324 2096 1325 2097 \subsection{RFvoltageFlag} 1326 User can reset the RF voltage by setting âRFvoltageFlagâ to replace the value of RF voltage which is defined in the lattice. For example: 1327 RFvoltageFlag 3000000 1328 Here âRFvoltageFlagâ is the name of the keyword command, â3000000â is the value of RF voltage with the unit [volt]. 1329 If the ring has more than one RF cavities, the related parameters are defined as the total values for one RF cavity. 2098 User can reset the RF voltage by setting ``RFvoltageFlag'' to replace 2099 the value of RF voltage which is defined in the lattice. For example: 2100 \tracycommand{RFvoltageFlag}{ 3000000} 2101 2102 Here ``RFvoltageFlag'' is the name of the keyword command, ``3000000'' is 2103 the value of RF voltage with the unit [volt]. 2104 2105 If the ring has more than one RF cavities, the related parameters 2106 are defined as the total values for one RF cavity. 1330 2107 1331 2108 \subsection{PrintTrackFlag} 1332 2109 To print the coordinates tracked around COD at each element to a file, use the command: 1333 PrintTrackFlag track\_file x px y py delta ctau nturn 2110 \tracycommand{PrintTrackFlag}{ track\_file x px y py delta ctau nturn} 1334 2111 1335 2112 For example: 1336 PrintTrackFlag track.out 0.001 0.0 0.0 0.0 0.0 0.0 50 1337 1338 The parameters and the default values of âPrintTrackFlagâ are shown in Table.2113 \tracycommand{PrintTrackFlag}{ track.out 0.001 0.0 0.0 0.0 0.0 0.0 50} 2114 2115 The parameters and the default values of ``PrintTrackFlag'' are shown in Table \cite{tab:prnttrackflag:para}. 1339 2116 1340 2117 \begin{table}[h] 1341 2118 \centering 1342 \caption{} 1343 \label{} 1344 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.2\linewidth} |p{0.5\linewidth} | p{0.15\linewidth} |} 1345 \hline 2119 \label{tab:prnttrackflag:para} 2120 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.1\linewidth}|p{0.5\linewidth} |p{0.1\linewidth} | p{0.1\linewidth} |} 2121 \hline 2122 Name & Description & Default value & Unit \\ 2123 \hline 2124 track\_file & File to save the tracked coordinates around each lattice element & track.out & - \\ 2125 \hline 2126 x & Start tracking horizontal coordinate & 0.001 & [m] \\ 2127 \hline 2128 px & Start tracking horizontal canonical momentum px normalized by 2129 reference momentum p0, that is: px = px/p0. Normally px is approximate 2130 as horizontal deviation with unit [rad]. & 0.0 & - \\ 2131 \hline 2132 y & Start tracking vertical coordinate & 0.0 & [m] \\ 2133 \hline 2134 py & Start tracking vertical canonical momentum py normalized by reference 2135 momentum p0, that is: py = py/p0. Normally px is approximate as vertical 2136 deviation with unit [rad]. & 0.0 & - \\ 2137 \hline 2138 delta & Start tracking relative energy offset & 0.0 & - \\ 2139 \hline 2140 ctau & Start tracking longitudinal coordinate & 0.0 & [m] \\ 2141 \hline 2142 nturn & Number of turn for tracking & 50 & - \\ 2143 \hline 2144 \end{tabular*} 2145 \caption{Parameters of command ``PrintTrackFlag''.} 2146 \end{table} 2147 2148 2149 2150 \subsection{PrintTrackElemFlag} 2151 To print the coordinates tracked (NOT around COD) at a certain element to a file, use the command: 2152 \tracycommand{PrintTrackFlag}{track\_file x px y py delta ctau nelem1 nelem2} 2153 2154 For example: 2155 \tracycommand{PrintTrackFlag}{track.out 0.001 0.0 0.0 0.0 0.0 0.0 50 1 2} 2156 2157 The parameters and the default values of ``PrintTrackElemFlag'' are shown in Table \cite{tab:printtrackelemflag:para}. 2158 2159 \begin{table}[h] 2160 \centering 2161 \label{tab:printtrackelemflag:para} 2162 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.1\linewidth}|p{0.5\linewidth} |p{0.1\linewidth} | p{0.1\linewidth} |} 2163 \hline 2164 Name & Description & Default value & Unit \\ 2165 \hline 2166 track\_file & File to save the tracked coordinates around 2167 each lattice element. & track.out & - \\ 2168 \hline 2169 x & Start tracking horizontal coordinate & 0.001 & [m] \\ 2170 \hline 2171 px & Start tracking horizontal canonical momentum px normalized 2172 by reference momentum p0, that is: px = px/p0. Normally 2173 px is approximate as horizontal deviation with unit [rad]. & 2174 0.0 & - \\ 2175 y & Start tracking vertical coordinate & 0.0 & [m] \\ 2176 \hline 2177 py & Start tracking vertical canonical momentum py normalized by 2178 reference momentum p0, that is: py = py/p0. Normally px is 2179 approximate as vertical deviation with unit [rad]. & 2180 0.0 & - \\ 2181 \hline 2182 delta & Start tracking relative energy offset & 0.0 & - \\ 2183 \hline 2184 ctau &Start tracking longitudinal coordinate &0.0 & [m] \\ 2185 nelem1 &index of start lattice element for tracking & - & - \\ 2186 \hline 2187 nelem2 & index of end lattice element for tracking & - & - \\ 2188 \hline 2189 \end{tabular*} 2190 \caption{Parameters of command ``PrintTrackElemFlag''.} 2191 \end{table} 2192 2193 2194 2195 \subsection{PrintTwissFlag} 2196 2197 Print Twiss parameters to a user defined file \\ 2198 2199 With the command ``PrintTwissFlag'', Tracy 3 will print the Twiss 2200 parameters to a user defined file. The format is: 2201 \tracycommand{ PrintTwissFlag}{ user\_defined\_file} 2202 2203 If user use the command PrintTwissFlag but without define the file name, 2204 then the code will print the Twiss parameters to a default file ``twiss.out''. 2205 2206 \subsection{PrintCODFlag} 2207 Print COD (Close Orbit Distortion) to a user defined file\\ 2208 2209 With the command ``PrintCODFlag'', the code will print the close orbit 2210 distortion to a user defined file. The format is: 2211 \tracycommand{PrintCODFlag}{ user\_defined\_file} 2212 If user use the command PrintCODFlag but without defining the file name, 2213 then the closed orbit will be printed to the default file ``printcod.out''. 2214 2215 In Tracy 3, close orbit file ``cod.out'' is automatically generated after 2216 reading the lattice. 2217 2218 See the details in seciton {}...?????????? 2219 2220 \subsection{ReadChamberFlag} 2221 Read vacuum chamber setting from an external file \\ 2222 2223 To read the vacuum chamber from the user defined chamber file, use the command: 2224 \tracycommand{ReadChamberFlag}{ Chamber\_example.dat} 2225 In the file ``Chamber\_example.dat'', user can specify the vacuum limit at the 2226 different region of the lattice; the format of the chamber file is given in section {}.....?????. 2227 2228 \subsection{ReadfefileFlag} 2229 Read lattice element multipole field errors from an external file \\ 2230 2231 To read the multipole field errors of the lattice elements from the user defined file, use the command: 2232 \tracycommand{ReadfefileFlag}{ dip.fe} 2233 2234 Tracy will read the systematic and random multipole field errors of the 2235 lattice elements defined in the file ``dip.fe'', and then replace the 2236 corresponding field components of the elements with the new field errors. 2237 The formats to specify the systematic and random multipole field errors in 2238 a file are given in section Error: Reference source not found. 2239 2240 \subsection{ReadaefileFlag} 2241 Read lattice element misalignment errors from a file \\ 2242 2243 To read the misalignment error of the lattice elements from the user defined file, use the command: 2244 \tracycommand{ReadaefileFlag}{ dip.ae} 2245 2246 Tracy will read the systematic and random misalignment errors of the 2247 lattice elements from the file ``dip.fe'', and replace the misalignment 2248 errors of the corresponding components of the elements. The formats to 2249 define the systematic and random misalignment errors of the lattice 2250 elements in a file are given in section ....??????. 2251 2252 \subsection{CODCorrectFlag} 2253 \begin{flushleft} 2254 Closed orbit (COD) correction \\ 2255 2256 The orbit distortion is corrected using SVD (Singular Value Decomposition) 2257 method in Tracy 3. In order to do orbit correction, user needs to call the command 2258 \tracycommand{CODCorrectFlag}{} 2259 and then specify the following parameters in the user defined ``*.prm'' file. 2260 2261 Specify the element names of horizontal, vertical correctors, and beam position 2262 monitors used in the orbit correction as the following examples: 2263 \begin{tabular}{l l} 2264 h\_corr & HC \\ 2265 v\_corr & VC \\ 2266 BPM & bpm \\ 2267 & \\ 2268 \end{tabular} 2269 2270 User also need to specify the states of the correctors to trigger 2271 on/off the correction using the following parameters: \\ 2272 \begin{tabular}{l l} 2273 hcorr\_file & hcorr\_56nom.state \\ 2274 vcorr\_file & vcorr\_56nom.state \\ 2275 & \\ 2276 \end{tabular} 2277 2278 In the file ``hcorr\_56nom.state'', 2279 \begin{itemize} 2280 \item 2281 a list of numbers (1 or 0) are 2282 given to the horizontal correctors, according to the sequence in the lattice; 2283 ``1'' means the corresponding corrector is used for horizontal orbit correction, 2284 ``0'' means this corrector is not used in the horizontal orbit correction. 2285 The definition rules of vertical corrector states in ``vcorr\_56nom.state'' are 2286 the same as ``vcorr\_56nom.state''. 2287 \item 2288 This parameter defines number of iterations to correct the orbit distortion, 2289 this value should be an integer number not smaller than 1. \\ 2290 n\_orbit 3 2291 \item 2292 This parameter defines number of singular values in H-plane, must be not larger than the number of correctors used for orbit correction \\ 2293 nwh 60 2294 \item 2295 This defines number of singular values in V-plane, must be not larger than the number of correctors used for orbit correction \\ 2296 nwv 60 2297 \end{itemize} 2298 2299 In Tracy 3, during the closed orbit correction: 2300 \begin{itemize} 2301 \item 2302 Beam response matrices between beam position monitors and 2303 horizontal/vertical correctors are calculated and written to the 2304 files ``svdh.out''/ ``svdv.out'', respectively. The maximum number of 2305 horizontal/vertical correctors used for orbit correction is 250. 2306 \item 2307 The code corrects the closed orbit distortion. 2308 \item 2309 Horizontal and vertical orbits at the locations of all beam position monitors 2310 during the correction are saved to the files ``horbit.out'' and 2311 ``vorbit.out'', respectively. 2312 \item 2313 A file ``OrScanFile.out'' will be saved with the summaries of the mean 2314 and RMS values of the orbits before and after correction. 2315 \item 2316 Finally, Twiss parameters, closed orbit distortion at the lattice elements 2317 are saved to a summary file ``summary\_miserr\_codcorr.out'', the format of 2318 this file is explained in Table ....????. 2319 \end{itemize} 2320 2321 \end{flushleft} 2322 2323 \subsection{TuneTracFlag} 2324 2325 Get tunes by tracking \\ 2326 2327 To get tunes by tracking, use command: 2328 \tracycommand{TuneTracFlag} 2329 The tunes obtained by tracking are printed on the screen. 2330 2331 \subsection{ChromTracFlag} 2332 Get chromaticities by tracking \\ 2333 2334 To get chromaticity by tracking, use command: 2335 \tracycommand{ChromTracFlag}{} 2336 The chromaticities obtained by tracking are printed on the screen. 2337 2338 \subsection{AmplitudeTuneShiftFlag} 2339 2340 Tune shift with amplitude \\ 2341 2342 2343 To calculate tune shift with amplitude, one needs to use the following command: 2344 \tracycommand{AmplitudeTuneShiftFlag}{ nudx\_file nudz\_file nxpoint nypoint nturn xmax ymax delta} 2345 2346 For example: 2347 \tracycommand{AmplitudeTuneShiftFlag}{ nudx.out nudz.out 50 30 516 0.035 0.02 0.0} 2348 2349 The meanings of parameters and default values of command ``AmplitudeTuneShiftFlag'' 2350 are shown in Table \cite{tab:amplitudetuneshiftflag:para}. If user uses the command 2351 AmplitudeTuneShiftFlag without parameters, then the code will use all the default values. 2352 2353 \begin{table}[h] 2354 \centering 2355 \caption{Parameters of the command to calculate tune shift with amplitude.} 2356 \label{tab:amplitudetuneshiftflag:para} 2357 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.15\linewidth}|p{0.5\linewidth} |p{0.1\linewidth} | p{0.1\linewidth} |} 2358 \hline 2359 Parameters & Meaning & Default & units \\ 2360 \hline 2361 nudx\_file & File to save the calculated tune shift with horizontal amplitude & nudx.out & - \\ 2362 \hline 2363 nudz\_file & File to save the calculated tune shift with vertical amplitude & nudz.out & - \\ 2364 \hline 2365 nxpoint &Number of points in horizontal direction & 31 & - \\ 2366 \hline 2367 nypoint& Number of points in vertical direction & 21 & - \\ 2368 \hline 2369 nturn& Number of turns to track tune & 516 & - \\ 2370 \hline 2371 xmax & Maximum amplitude of x & 0.025 & [m] \\ 2372 \hline 2373 ymax & Maximum amplitude of y & 0.005 & [m] \\ 2374 \hline 2375 delta& Energy offset of the particle 0.0 & - \\ 1346 2376 \hline 1347 2377 \end{tabular*} 1348 2378 \end{table} 1349 2379 1350 Table Parameters of command "PrintTrackFlag". 1351 Name 1352 Description 1353 Default value 1354 Unit 1355 track\_file 1356 File to save the tracked coordinates around each lattice element 1357 track.out 1358 - 1359 x 1360 Start tracking horizontal coordinate 1361 0.001 1362 [m] 1363 px 1364 Start tracking horizontal canonical momentum px normalized by reference momentum p0, that is: px = px/p0. Normally px is approximate as horizontal deviation with unit [rad]. 1365 0.0 1366 1367 - 1368 y 1369 Start tracking vertical coordinate 1370 0.0 1371 [m] 1372 py 1373 Start tracking vertical canonical momentum py normalized by reference momentum p0, that is: py = py/p0. Normally px is approximate as vertical deviation with unit [rad]. 1374 0.0 1375 1376 - 1377 delta 1378 Start tracking relative energy offset 1379 0.0 1380 - 1381 ctau 1382 Start tracking longitudinal coordinate 1383 0.0 1384 [m] 1385 nturn 1386 Number of turn for tracking 1387 50 1388 - 1389 1390 \subsection{PrintTrackElemFlag} 1391 To print the coordinates tracked (NOT around COD) at a certain element to a file, use the command: 1392 PrintTrackFlag track\_file x px y py delta ctau nelem1 nelem2 1393 1394 For example: 1395 PrintTrackFlag track.out 0.001 0.0 0.0 0.0 0.0 0.0 50 1 2 1396 1397 The parameters and the default values of âPrintTrackElemFlagâ are shown in Table . 1398 1399 \begin{table}[h] 1400 \centering 1401 \caption{} 1402 \label{} 1403 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.2\linewidth} |p{0.5\linewidth} | p{0.15\linewidth} |} 1404 \hline 1405 \hline 1406 \end{tabular*} 1407 \end{table} 1408 1409 Table Parameters of command "PrintTrackElemFlag". 1410 Name 1411 Description 1412 Default value 1413 Unit 1414 track\_file 1415 File to save the tracked coordinates around each lattice element 1416 track.out 1417 - 1418 x 1419 Start tracking horizontal coordinate 1420 0.001 1421 [m] 1422 px 1423 Start tracking horizontal canonical momentum px normalized by reference momentum p0, that is: px = px/p0. Normally px is approximate as horizontal deviation with unit [rad]. 1424 0.0 1425 1426 - 1427 y 1428 Start tracking vertical coordinate 1429 0.0 1430 [m] 1431 py 1432 Start tracking vertical canonical momentum py normalized by reference momentum p0, that is: py = py/p0. Normally px is approximate as vertical deviation with unit [rad]. 1433 0.0 1434 1435 - 1436 delta 1437 Start tracking relative energy offset 1438 0.0 1439 - 1440 ctau 1441 Start tracking longitudinal coordinate 1442 0.0 1443 [m] 1444 nelem1 1445 index of start lattice element for tracking 1446 1447 nelem2 1448 index of end lattice element for tracking 1449 1450 \subsection{PrintTwissFlag} 1451 1452 Print Twiss parameters to a user defined file \\ 1453 1454 With the command âPrintTwissFlagâ, Tracy 3 will print the Twiss parameters to a user defined file. The format is: 1455 PrintTwissFlag user\_defined\_file 1456 1457 If user use the command PrintTwissFlag but without define the file name, then the code will print the Twiss parameters to a default file âtwiss.outâ. 1458 1459 \subsection{PrintCODFlag} 1460 Print COD (Close Orbit Distortion) to a user defined file\\ 1461 1462 With the command âPrintCODFlagâ, the code will print the close orbit distortion to a user defined file. The format is: 1463 PrintCODFlag user\_defined\_file 1464 If user use the command PrintCODFlag but without defining the file name, then the closed orbit will be printed to the default file âprintcod.outâ. 1465 In Tracy 3, close orbit file âcod.outâ is automatically generated after reading the lattice. 1466 In the outuput file of the command PrintCODFlag, the data is saved in the following format: 1467 \# i name s code betax nux betay nuy xcod ycod dSx dSy dipx dipy 1468 \# [m] [m] [m] [mm] [mm] [mm] [mm] [mrad] [mrad] 1469 \# 1470 Where â\#â denotes the command line, the meanings of the above parameters are shown in Table . 1471 1472 \begin{table}[h] 1473 \centering 1474 \caption{} 1475 \label{} 1476 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.2\linewidth} |p{0.5\linewidth} | p{0.15\linewidth} |} 1477 \hline 1478 \hline 1479 \end{tabular*} 1480 \end{table} 1481 1482 Table Parameters in the output file of close orbit. 1483 Name 1484 Description 1485 Unit 1486 i 1487 Number of the element 1488 - 1489 name 1490 Element name defined in lattice 1491 - 1492 s 1493 Longitudinal length 1494 [m] 1495 code 1496 Symbol for the element: 1497 0.5 dipole 1498 -1.0 defocusing quadrupole 1499 1.0 focusing quadrupole 1500 -1.5 defocusing sextupole 1501 1.5 focusing sextupole 1502 0 other element 1503 1504 1505 1506 - 1507 betax 1508 Horizontal beta function 1509 [m] 1510 nux 1511 Horizontal tune 1512 - 1513 betay 1514 Vertical beta function 1515 [m] 1516 nuy 1517 Vertical tune 1518 - 1519 xcod 1520 Horizontal closed orbit distortion 1521 [mm] 1522 ycod 1523 Vertical closed orbit distortion 1524 [mm] 1525 dSx 1526 Horizontal displacement of the element 1527 [mm] 1528 dSy 1529 vertical displacement of the element 1530 [mm[ 1531 dipx 1532 Horizontal dipole strength of the element 1533 [mrad] 1534 dipy 1535 vertical dipole strength of the element 1536 [mrad] 1537 1538 \subsection{ReadChamberFlag} 1539 Read vacuum chamber setting from an external file \\ 1540 1541 To read the vacuum chamber from the user defined chamber file, use the command: 1542 ReadChamberFlag Chamber\_example.dat 1543 In the file âChamber\_example.datâ, user can specify the vacuum limit at the different region of the lattice; the format of the chamber file is given in section . 1544 1545 \subsection{ReadfefileFlag} 1546 Read lattice element multipole field errors from an external file \\ 1547 1548 To read the multipole field errors of the lattice elements from the user defined file, use the command: 1549 ReadfefileFlag dip.fe 1550 Tracy will read the systematic and random multipole field errors of the lattice elements defined in the file âdip.feâ, and then replace the corresponding field components of the elements with the new field errors. The formats to specify the systematic and random multipole field errors in a file are given in section Error: Reference source not found. 1551 1552 \subsection{ReadaefileFlag} 1553 Read lattice element misalignment errors from a file \\ 1554 1555 To read the misalignment error of the lattice elements from the user defined file, use the command: 1556 ReadaefileFlag dip.ae 1557 Tracy will read the systematic and random misalignment errors of the lattice elements from the file âdip.feâ, and replace the misalignment errors of the corresponding components of the elements. The formats to define the systematic and random misalignment errors of the lattice elements in a file are given in section . 1558 1559 \subsection{CODCorrectFlag} 1560 Closed orbit (COD) correction \\ 1561 1562 The orbit distortion is corrected using SVD (Singular Value Decomposition) method in Tracy 3. In order to do orbit correction, user needs to call the command 1563 CODCorrectFlag 1564 and then specify the following parameters in the user defined â*.prmâ file. 1565 Specify the element names of horizontal, vertical correctors, and beam position monitors used in the orbit correction as the following examples: 1566 h\_corr HC 1567 v\_corr VC 1568 BPM bpm 1569 User also need to specify the states of the correctors to trigger on/off the correction using the following parameters: 1570 hcorr\_file hcorr\_56nom.state 1571 vcorr\_file vcorr\_56nom.state 1572 In the file âhcorr\_56nom.stateâ, a list of numbers (1 or 0) are given to the horizontal correctors, according to the sequence in the lattice; â1â means the corresponding corrector is used for horizontal orbit correction, â0â means this corrector is not used in the horizontal orbit correction. The definition rules of vertical corrector states in âvcorr\_56nom.stateâ are the same as âvcorr\_56nom.stateâ. 1573 1574 This parameter defines number of iterations to correct the orbit distortion, this value should be an integer number not smaller than 1. 1575 n\_orbit 3 1576 This parameter defines number of singular values in H-plane, must be not larger than the number of correctors used for orbit correction 1577 nwh 60 1578 This defines number of singular values in V-plane, must be not larger than the number of correctors used for orbit correction 1579 nwv 60 1580 1581 In Tracy 3, during the closed orbit correction: 1582 1) Beam response matrices between beam position monitors and horizontal/vertical correctors are calculated and written to the files âsvdh.outâ/ âsvdv.outâ, respectively. The maximum number of horizontal/vertical correctors used for orbit correction is 250. 1583 2) The code corrects the closed orbit distortion. 1584 3) Horizontal and vertical orbits at the locations of all beam position monitors during the correction are saved to the files âhorbit.outâ and âvorbit.outâ, respectively. 1585 4) A file âOrScanFile.outâ will be saved with the summaries of the mean and RMS values of the orbits before and after correction. 1586 5) Finally, Twiss parameters, closed orbit distortion at the lattice elements are saved to a summary file âsummary\_miserr\_codcorr.outâ, the format of this file is explained in Table . 1587 1588 \subsection{TuneTracFlag} 1589 1590 Get tunes by tracking \\ 1591 1592 To get tunes by tracking, use command: 1593 TuneTracFlag 1594 The tunes obtained by tracking are printed on the screen. 1595 1596 \subsection{ChromTracFlag} 1597 Get chromaticities by tracking \\ 1598 1599 To get chromaticity by tracking, use command: 1600 ChromTracFlag 1601 The chromaticities obtained by tracking are printed on the screen. 1602 1603 \subsection{AmplitudeTuneShiftFlag} 1604 1605 Tune shift with amplitude \\ 1606 1607 1608 To calculate tune shift with amplitude, one needs to use the following command: 1609 AmplitudeTuneShiftFlag nudx\_file nudz\_file nxpoint nypoint nturn xmax ymax delta 1610 For example: 1611 AmplitudeTuneShiftFlag nudx.out nudz.out 50 30 516 0.035 0.02 0.0 1612 1613 The meanings of parameters and default values of command âAmplitudeTuneShiftFlagâ are shown in Table . If user uses the command AmplitudeTuneShiftFlag without parameters, then the code will use all the default values. 1614 1615 \begin{table}[h] 1616 \centering 1617 \caption{} 1618 \label{} 1619 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.2\linewidth} |p{0.5\linewidth} | p{0.15\linewidth} |} 1620 \hline 1621 \hline 1622 \end{tabular*} 1623 \end{table} 1624 1625 Table Parameters of the command to calculate tune shift with amplitude 1626 Parameters 1627 Meaning 1628 Default values 1629 nudx\_file 1630 File to save the calculated tune shift with horizontal amplitude 1631 nudx.out 1632 nudz\_file 1633 File to save the calculated tune shift with vertical amplitude 1634 nudz.out 1635 nxpoint 1636 Number of points in horizontal direction 1637 31 1638 nypoint 1639 Number of points in vertical direction 1640 21 1641 nturn 1642 Number of turns to track tune 1643 516 1644 xmax 1645 Maximum amplitude of x with the unit [m] 1646 0.025 1647 ymax 1648 Maximum amplitude of y with the unit [m] 1649 0.005 1650 delta 1651 Energy offset of the particle 1652 0.0 2380 1653 2381 1654 2382 \subsection{EnergyTuneShiftFlag} 1655 2383 Tune shift with energy \\ 1656 2384 1657 1658 2385 To calculate tune shift with energy, one needs to use the command: 1659 EnergyTuneShiftFlag nudp\_file npoint nturn deltamax 2386 \tracycommand{EnergyTuneShiftFlag}{ nudp\_file npoint nturn deltamax} 2387 1660 2388 For example: 1661 EnergyTuneShiftFlag nudptest.out 31 1026 0.06 1662 The meaning of parameters and default values of this command are shown in Table . 2389 \tracycommand{EnergyTuneShiftFlag}{ nudptest.out 31 1026 0.06} 2390 2391 The meaning of parameters and default values of this command are shown in Table \cite{tab:energytuneshiftflag:para}. 1663 2392 If user uses command EnergyTuneShiftFlag without parameters, then the code will use all the default values. 1664 2393 1665 2394 \begin{table}[h] 1666 2395 \centering 1667 \caption{} 1668 \label{} 1669 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.2\linewidth} |p{0.5\linewidth} | p{0.15\linewidth} |} 1670 \hline 2396 \caption{Parameters of the command to calculate tune shift with energy.} 2397 \label{tab:energytuneshiftflag:para}. 2398 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.15\linewidth}|p{0.5\linewidth} |p{0.1\linewidth} | p{0.1\linewidth} |} 2399 \hline 2400 parameter & meaning & default & units \\ 2401 \hline 2402 nudp\_file & File to save the calculated tune shift with energy & 2403 nudp.out & - \\ 2404 \hline 2405 npoint & Number of points & 31 & - \\ 2406 \hline 2407 nturn & Number of turns for tracking & 516 & - \\ 2408 \hline 2409 deltamax & Maximum energy offset of the particle & 0.06 - \\ 1671 2410 \hline 1672 2411 \end{tabular*} 1673 2412 \end{table} 1674 2413 1675 Table Parameters of the command to calculate tune shift with energy 1676 parameter 1677 meaning 1678 default value 1679 nudp\_file 1680 File to save the calculated tune shift with energy 1681 nudp.out 1682 npoint 1683 Number of points 1684 31 1685 nturn 1686 Number of turns for tracking 1687 516 1688 deltamax 1689 Maximum energy offset of the particle 1690 0.06 2414 1691 2415 1692 2416 \subsection{FmapFlag} 1693 Frequency map analysis for on momentum particle. 2417 Frequency map analysis for on momentum particle. \\ 2418 1694 2419 Track the coordinates (x, px, y, py, delta, ctau) of the particle, 1695 2420 the coordinates (x, px, y, py) are tracked around the closed orbit; … … 1703 2428 1704 2429 To do frequency map analysis for the on momentum particle, use the command: 1705 FmapFlag fmap\_file nxpoint nypoint nturn xmax ymax delta diffusion \\ 2430 \tracycommand{FmapFlag}{ fmap\_file nxpoint nypoint nturn xmax ymax delta diffusion} 1706 2431 or 1707 FmapFlag fmap\_file nxpoint nypoint nturn xmax ymax delta diffusion printloss \\ 2432 \tracycommand{FmapFlag}{ fmap\_file nxpoint nypoint nturn xmax ymax delta diffusion printloss } 1708 2433 1709 2434 For example: 1710 FmapFlag fmap.out 31 21 516 0.025 0.005 0.0 true 2435 \tracycommand{FmapFlag}{ fmap.out 31 21 516 0.025 0.005 0.0 true } 1711 2436 or 1712 FmapFlag fmap.out 31 21 516 0.025 0.005 0.0 true true 1713 1714 1715 The meaning of parameters and default values of this command are shown in Table . If user uses command FmapFlag without parameters, then the code will use all the default values. 2437 \tracycommand{FmapFlag}{ fmap.out 31 21 516 0.025 0.005 0.0 true true} 2438 2439 2440 The meaning of parameters and default values of this command are shown in Table \cite{tab:fmapdpflag:para}. 2441 If user uses command FmapFlag without parameters, then the code will use all the default values. 1716 2442 1717 2443 \begin{table}[h] 1718 2444 \centering 1719 \caption{} 1720 \label{} 1721 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.2\linewidth} |p{0.5\linewidth} | p{0.15\linewidth} |} 1722 \hline 2445 \caption{Parameters of the command to do frequency map analysis for on momentum particle.} 2446 \label{tab:fmapdpflag:para} 2447 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.15\linewidth}|p{0.5\linewidth} |p{0.1\linewidth} | p{0.1\linewidth} |} 2448 \hline 2449 Parameters & meaning & Default & units \\ 2450 \hline 2451 fmap\_file & File to save the calculated frequency map analysis & 2452 fmap.out & - \\ 2453 \hline 2454 nxpoint & Number of points in the horizontal direction &31 & - \\ 2455 \hline 2456 nypoint &Number of points in the vertical direction & 21 & - \\ 2457 \hline 2458 nturn&Number of turns for tracking; if ``diffusion'' is 2459 true, then the tunes will calculated in the first Nturn 2460 and then the second Nturn, and the tune difference 2461 between these two tunes is the tune diffusion. & 516 & - \\ 2462 \hline 2463 xmax & Maximum amplitude in the horizontal direction & 0.025& [m] \\ 2464 \hline 2465 ymax & Maximum amplitude in the vertical direction & 0.005 & [m] \\ 2466 \hline 2467 delta &Energy offset of the particle & 0.0 & - \\ 2468 \hline 2469 diffusion & Boolean flag, true/false; to compute tune diffusion at 2470 the first N turns and second N turns. & true & - \\ 2471 \hline 2472 printloss (optional) & 2473 Boolean flag, true/flase; print out the last information of the tracked 2474 particleto and external file? If true, the output file is ``fmap\_file.loss''. & - &- \\ 1723 2475 \hline 1724 2476 \end{tabular*} 1725 2477 \end{table} 1726 2478 1727 Table Parameters of the command to do frequency map analysis for on momentum particle. 1728 Parameters 1729 meaning 1730 Default values 1731 fmap\_file 1732 File to save the calculated frequency map analysis 1733 fmap.out 1734 nxpoint 1735 Number of points in the horizontal direction 1736 31 1737 nypoint 1738 Number of points in the vertical direction 1739 21 1740 nturn 1741 Number of turns for tracking; if ``diffusion'' is 1742 true, then the tunes will calculated in the first Nturn 1743 and then the second Nturn, and the tune difference 1744 between these two tunes is the tune diffusion. 1745 516 1746 xmax 1747 Maximum amplitude in the horizontal direction with the unit [m] 1748 0.025 1749 ymax 1750 Maximum amplitude in the vertical direction with the unit [m] 1751 0.005 1752 delta 1753 Energy offset of the particle 1754 0.0 1755 diffusion 1756 Boolean flag, true/false; to compute tune diffusion at the first N turns and second N turns. 1757 true 1758 1759 printloss (optional) 1760 Boolean flag, true/flase; print out the last information of the tracked particleto and external file? If true, the output file is ``fmap\_file.loss''. 2479 2480 1761 2481 \subsection{FmapdpFlag} 1762 2482 Frequency map analysis for off momentum particle \\ … … 1767 2487 FmapdpFlag fmapdp\_file nxpoint nepoint nturn xmax emax y diffusion printloss 1768 2488 1769 The meaning of parameters and default values are shown in Table . If user only uses the command FmapdpFlag but without defining all the parameters, then the code uses the default values. 2489 The meaning of parameters and default values are shown in Table \cite{tab:fmapdpflag:para}. 2490 If user only uses the command ``FmapdpFlag'' but without defining all the parameters, 2491 then the code uses the default values. 1770 2492 1771 2493 \begin{table}[h] 1772 2494 \centering 1773 \caption{} 1774 \label{} 1775 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.2\linewidth} |p{0.5\linewidth} | p{0.15\linewidth} |} 1776 \hline 2495 \label{tab:fmapdpflag:para} 2496 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.15\linewidth}|p{0.45\linewidth} |p{0.15\linewidth} | p{0.1\linewidth} |} 2497 \hline 2498 parameters & meaning & default & units \\ 2499 \hline 2500 fmapdp\_file & File to save the calculated frequency map analysis & 2501 fmapdp.out & - \\ 2502 \hline 2503 nxpoint & Number of points in the horizontal direction &31 & - \\ 2504 \hline 2505 nepoint &Number of points for the energy & 21 & - \\ 2506 \hline 2507 nturn &Number of turns for tracking&516&-\\ 2508 \hline 2509 xmax &Maximum amplitude in the horizontal direction &0.025 & [m]\\ 2510 \hline 2511 emax &Maximum energy offset of the particle&0.005 & -\\ 2512 \hline 2513 y &Amplitude in the vertical direction& 0.0& [m] \\ 2514 \hline 2515 diffusion & Boolean flag to compute tune diffusion & true & - \\ 2516 \hline 2517 printloss (optional) & 2518 Boolean flag, true/flase; print out the last information of the tracked 2519 particle to and external file? If true, the output file 2520 is ``fmapdp\_file.loss''. & - & \\ 1777 2521 \hline 1778 2522 \end{tabular*} 2523 \caption{Parameters of the command ``FmapdpFlag''.} 1779 2524 \end{table} 1780 2525 1781 Table Parameters of the command âFmapdpFlagâ.1782 parameters1783 meaning1784 default value1785 fmapdp\_file1786 File to save the calculated frequency map analysis1787 fmapdp.out1788 nxpoint1789 Number of points in the horizontal direction1790 311791 nepoint1792 Number of points for the energy1793 211794 nturn1795 Number of turns for tracking1796 5161797 xmax1798 Maximum amplitude in the horizontal direction with the unit [m]1799 0.0251800 emax1801 Maximum energy offset of the particle1802 0.0051803 y1804 Amplitude in the vertical direction with the unit [m]1805 0.01806 diffusion1807 Boolean flag to compute tune diffusion1808 true1809 1810 printloss (optional)1811 Boolean flag, true/flase; print out the last information of the tracked particleto and external file? If true, the output file is ``fmapdp\_file.loss''.1812 2526 1813 2527 … … 1815 2529 Add coupling by the random rotation of the full quadrupoles \\ 1816 2530 1817 To simulate coupling in the lattice, use can add the random rotation error to all the full quadrupole, using the command as the following example: 1818 ErrorCouplingFlag 0 0.0007 1819 In this example, â0â is the random seed number; â0.0007â is the RMS value of the rotation angles of all the quadrupoles with the unit [rad]. 1820 After setting the rotation error in the lattice, the code will generate a file with the file name âflat\_file\_errcoupling\_full.datâ at the current working directory, user can check the error setting of quadrupoles in this file; then the coupling will be calculated and Twiss parameters after adding the random rotation errors will be saved to the file âlinlat\_errcoupling.outâ. 2531 To simulate coupling in the lattice, use can add the random rotation 2532 error to all the full quadrupole, using the command as the following example: 2533 \tracycommand{ErrorCouplingFlag}{ 0 0.0007} 2534 2535 In this example, ``0'' is the random seed number; ``0.0007'' is the RMS value 2536 of the rotation angles of all the quadrupoles with the unit [rad]. 2537 2538 After setting the rotation error in the lattice, the code will generate a file 2539 with the file name ``flat\_file\_errcoupling\_full.dat'' at the current working 2540 directory, user can check the error setting of quadrupoles in this file; then 2541 the coupling will be calculated and Twiss parameters after adding the random 2542 rotation errors will be saved to the file ``linlat\_errcoupling.out''. 1821 2543 1822 2544 \subsection{ErrorCoupling2Flag} 1823 2545 Add coupling by random rotation of the half quadrupoles \\ 1824 2546 1825 In order to get the beam parameters in the middle of the quadrupoles, each quadrupole in the lattice can be cut into two parts. In such case, the coupling of the lattice can be generated by random rotation of all the half quadrupoles in the lattice, using the command as the following example: 1826 ErrorCoupling2Flag 0 0.0007 1827 In this example, â0â is the random seed number; â0.0007â is the RMS value of the rotation angle of the quadrupole with the unit [rad]. 1828 After setting the errors in the lattice, the code will generate a file at the current working directory with the file name âflat\_file\_errcoupling\_half.datâ, user can check the error setting of quadrupoles in this file. After adding the random rotation errors, the coupling will be calculated and Twiss parameters will be saved to the file âlinlat\_errcoupling2.outâ. 1829 This command is dedicated for Soleil lattice in which each quadrupole is cut into two half quadrupoles. 2547 In order to get the beam parameters in the middle of the quadrupoles, each 2548 quadrupole in the lattice can be cut into two parts. In such case, 2549 the coupling of the lattice can be generated by random rotation of all the 2550 half quadrupoles in the lattice, using the command as the following example: 2551 \tracycommand{ErrorCoupling2Flag}{ 0 0.0007} 2552 2553 In this example, ``0'' is the random seed number; ``0.0007'' is the RMS value 2554 of the rotation angle of the quadrupole with the unit [rad]. 2555 2556 After setting the errors in the lattice, the code will generate a file at 2557 the current working directory with the file name ``flat\_file\_errcoupling\_half.dat'', 2558 user can check the error setting of quadrupoles in this file. After adding 2559 the random rotation errors, the coupling will be calculated and Twiss parameters 2560 will be saved to the file ``linlat\_errcoupling2.out''. 2561 2562 This command is dedicated for Soleil lattice in which each quadrupole 2563 is cut into two half quadrupoles. 1830 2564 1831 2565 \subsection{CouplingFlag} 1832 2566 Calculate coupling and emittance \\ 1833 2567 1834 To calculate coupling and emittance, use command: 1835 CouplingFlag 1836 After calculation, the coupling and the emittance will be printed on the screen, and the Twiss parameters will be automatically saved to the file âlinlat\_coupling.outâ. 2568 To calculate coupling and emittance, use command: 2569 \tracycommand{CouplingFlag}{} 2570 2571 After calculation, the coupling and the emittance will be printed on the 2572 screen, and the Twiss parameters will be automatically saved to the 2573 file ``linlat\_coupling.out''. 1837 2574 1838 2575 \subsection{MomentumAccFlag} 1839 2576 Calculate momentum acceptance by tracking \\ 1840 2577 1841 The following command calculate momentum acceptance at a predefined lattice region by tracking: 1842 MomentumAccFlag MomAccFile TrackDim istart istop deltaminp 1843 Deltamaxp nstepp deltaminn deltamaxn nstepn turns zinitial 1844 For example: 1845 MomentumAccFlag momacc.out 4D 1 209 0.01 0.05 100 -0.01 1846 -0.05 100 1026 0.0001 1847 The meaning of parameters and default values are shown in Table . If user uses MomentumAccFlag without parameters, then the code will use the default values. 2578 The following command calculate momentum acceptance at a predefined 2579 lattice region by tracking: 2580 \tracycommand{MomentumAccFlag}{ MomAccFile TrackDim istart istop deltaminp 2581 Deltamaxp nstepp deltaminn deltamaxn nstepn turns zinitial} 2582 2583 \textit{For example:} 2584 \tracycommand{MomentumAccFlag}{ momacc.out 4D 1 209 0.01 0.05 100 -0.01 2585 -0.05 100 1026 0.0001} 2586 2587 The meaning of parameters and default values are shown in Table \cite{tab:momentumaccflag:para}. 2588 If user uses MomentumAccFlag without parameters, then the code will use 2589 the default values. 1848 2590 1849 2591 \begin{table}[h] 1850 2592 \centering 1851 \caption{} 1852 \label{} 1853 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.2\linewidth} |p{0.5\linewidth} | p{0.15\linewidth} |} 1854 \hline 2593 \label{tab:momentumaccflag:para} 2594 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.15\linewidth}|p{0.5\linewidth} |p{0.1\linewidth} | p{0.1\linewidth} |} 2595 \hline 2596 parameter & meaning & Default & units \\ 2597 \hline 2598 MomAccFile & File to save the tracked momentum acceptance at each 2599 element; saved in the current directory.& momentumacceptance.out & - \\ 2600 \hline 2601 TrackDim & 4D/6D tracking to get the momentum acceptance & 6D & - \\ 2602 \hline 2603 istart &Start element in the lattice for the tracking & 1 & - \\ 2604 \hline 2605 istop &End element in the lattice for tracking &108 & - \\ 2606 \hline 2607 nstepp &Number of steps to do tracking in the positive energy range & 2608 100 & - \\ 2609 \hline 2610 nstepn&Number of steps to do tracking in the negative energy range &100 & - \\ 2611 \hline 2612 Deltaminp&Positive start energy of the tracking & 0.01 & - \\ 2613 \hline 2614 Deltamaxp & Positive end energy of the tracking & 0.05 & - \\ 2615 \hline 2616 Deltaminn & Negative start energy of the tracking & -0.01 & - \\ 2617 \hline 2618 Deltamaxn & Negative end energy of the tracking & -0.05 & - \\ 2619 \hline 2620 nturns &Number of turn & 1026 & - \\ 2621 \hline 2622 zinitial & The initial vertical coordinate which is used to search for 2623 6D closed orbit. This value should be a small value. & 0.0003 & [m] \\ 1855 2624 \hline 1856 2625 \end{tabular*} 2626 \caption{Parameters of the command to calculate momentum acceptance.} 1857 2627 \end{table} 1858 2628 1859 Table Parameters of the command to calculate momentum acceptance1860 parameter1861 meaning1862 Default value1863 MomAccFile1864 File to save the tracked momentum acceptance at each element; saved in the current directory.1865 momentumacceptance.out1866 TrackDim1867 4D/6D tracking to get the momentum acceptance1868 6D1869 istart1870 Start element in the lattice for the tracking1871 11872 istop1873 End element in the lattice for tracking1874 1081875 nstepp1876 Number of steps to do tracking in the positive energy range1877 1001878 nstepn1879 Number of steps to do tracking in the negative energy range1880 1001881 Deltaminp1882 Positive start energy of the tracking1883 0.011884 Deltamaxp1885 Positive end energy of the tracking1886 0.051887 Deltaminn1888 Negative start energy of the tracking1889 -0.011890 Deltamaxn1891 Negative end energy of the tracking1892 -0.051893 nturns1894 Number of turn1895 10261896 zinitial1897 The initial vertical coordinate which is used to search for 6D closed orbit. This value should be a small value.1898 0.0003 [m]1899 2629 1900 2630 … … 1902 2632 Read multipole field error from a file (SOLEIL lattice) \\ 1903 2633 1904 1905 After defining the file names of multipole field errors on SOLEIL storage ring (section and ), use the command: 1906 ReadMultipoleFlag 1907 to read multipole field errors and set the corresponding values to SOLEIL lattice. The multipole field errors of correctors and skew quadrupoles are added on the thick sextupoles which are integrated at the same magnets. The format of multipole errors file is given in section . 1908 1909 After setting the multipole field errors in the lattice, the code will generate a file at the current working directory, and the file name is âflat\_file\_errmultipole.datâ, user can check the field components of the lattice elements in this file to verify the multipole field errors. 2634 After defining the file names of multipole field errors on SOLEIL storage 2635 ring (see section \cite{} and \cite{}), use the command: 2636 \tracycommand{ReadMultipoleFlag}{} 2637 to read multipole field errors and set the corresponding values to SOLEIL 2638 lattice. The multipole field errors of correctors and skew quadrupoles 2639 are added on the thick sextupoles which are integrated at the same magnets. 2640 The format of multipole errors file is given in section \cite{}. 2641 2642 After setting the multipole field errors in the lattice, the code will 2643 generate a file at the current working directory, and the file name is 2644 ``flat\_file\_errmultipole.dat'', user can check the field components of 2645 the lattice elements in this file to verify the multipole field errors. 1910 2646 1911 2647 \subsection{ReadVirtualSkewquadFlag} 1912 2648 Read the sources of coupling from a file (SOLEIL lattice) \\ 1913 2649 1914 The sources of coupling on SOLEIL storage ring can be read from an external file. Use the command: 1915 ReadVirtualSkewquadFlag 1916 to read and set the field strength to the virtual skew quadrupoles. Currently this command only works for Soleil lattice. 1917 The coupling sources MUST be defined as the skew quadrupoles with the name âSQâ, the rules and related information are explained in section. 2650 The sources of coupling on SOLEIL storage ring can be read from an external 2651 file. Use the command: 2652 \tracycommand{ReadVirtualSkewquadFlag}{} 2653 to read and set the field strength to the virtual skew quadrupoles. Currently 2654 this command only works for Soleil lattice. 2655 2656 The coupling sources MUST be defined as the skew quadrupoles with the name 2657 ``SQ'', the rules and related information are explained in section \cite{}. 1918 2658 1919 2659 \subsection{FitTuneFlag} … … 1921 2661 1922 2662 Betatron tunes can be fit using two families of quadrupoles. The command is: 1923 FitTuneFlag Quad1 Quad2 nux nuz 1924 For example: 1925 FitTuneFlag q7 q9 18.202 10.317 1926 The parameters of this command are shown in Table . 1927 Table Parameters of the command âFitTuneFlagâ. 1928 Parameters 1929 Meaning 1930 Default values 1931 Quad1 1932 Quadrupole family used to fit the tunes 1933 - 1934 Quad2 1935 Quadrupole family used to fit the tunes 1936 - 1937 nux 1938 Target horizontal tune 1939 0.0 1940 nuz 1941 Target vertical tune 1942 0.0 1943 1944 After fitting the tunes, field strengths of the fitted quadrupoles before and after the fitting are printed to the screen; user can copy the new quadrupole field strengths to the lattice file for further analysis. 1945 FitTuneFlag is a generic command; it works for the lattices with full qudrupoles. 2663 \tracycommand{FitTuneFlag}{ Quad1 Quad2 nux nuz} 2664 2665 \textit{For example:} 2666 \tracycommand{FitTuneFlag}{ q7 q9 18.202 10.317} 2667 2668 The parameters of this command are shown in Table \cite{tab:fittuneflag:paras}. 2669 2670 \begin{table}[h] 2671 \centering 2672 \label{tab:fittuneflag:paras} 2673 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.15\linewidth}|p{0.5\linewidth} |p{0.1\linewidth} | p{0.1\linewidth} |} 2674 \hline 2675 Parameters & Meaning & Default & Units \\ 2676 \hline 2677 Quad1 & Quadrupole family used to fit the tunes & - & - \\ 2678 \hline 2679 Quad2 & Quadrupole family used to fit the tunes & - & - \\ 2680 \hline 2681 nux & Target horizontal tune & 0.0 & - \\ 2682 \hline 2683 nuz & Target vertical tune & 0.0 & - \\ 2684 \hline 2685 \end{tabular*} 2686 \caption{Parameters of the command ``FitTuneFlag''.} 2687 \end{table} 2688 2689 \begin{itemize} 2690 \item 2691 After fitting the tunes, field strengths of the fitted quadrupoles 2692 before and after the fitting are printed to the screen; user can 2693 copy the new quadrupole field strengths to the lattice file for 2694 further analysis. 2695 \item 2696 ``FitTuneFlag'' is a generic command; it works for the lattices with 2697 full qudrupoles. 2698 \end{itemize} 1946 2699 1947 2700 \subsection{FitTune4Flag} 1948 2701 Fit tunes for the lattice with half quadrupoles \\ 1949 2702 1950 For the lattice with each quadrupole cut into two pieces, betatron tunes can be fit using two families of quadrupoles. The command is: 1951 FitTune4Flag Q1a Q1b Q2a Q2b nux nuz 1952 The parameters of this command are shown in Table . 2703 For the lattice with each quadrupole cut into two pieces, betatron 2704 tunes can be fit using two families of quadrupoles. The command is: 2705 \tracycommand{FitTune4Flag}{ Q1a Q1b Q2a Q2b nux nuz} 2706 2707 The parameters of this command are shown in Table \cite{tab:fittune4flag:paras}. 1953 2708 1954 2709 \begin{table}[h] 1955 2710 \centering 1956 \caption{} 1957 \label{} 1958 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.2\linewidth} |p{0.5\linewidth} | p{0.15\linewidth} |} 1959 \hline 2711 \label{tab:fittune4flag:paras} 2712 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.15\linewidth}|p{0.5\linewidth} |p{0.1\linewidth} | p{0.1\linewidth} |} 2713 \hline 2714 Parameters & Meaning & Default & Units \\ 2715 \hline 2716 Q1a &First half of the quadrupole family used to fit the tunes &- & - \\ 2717 \hline 2718 Q1b &Second half of the quadrupole family used to fit the tunes & - & - \\ 2719 \hline 2720 Q2a &First half of the quadrupole family used to fit the tunes& - & - \\ 2721 \hline 2722 Q2b &Second half of the quadrupole family used to fit the tunes &- & - \\ 2723 \hline 2724 nux &Target horizontal tune&0.0 & - \\ 2725 \hline 2726 nuz & Target vertical tune & 0.0 & - \\ 1960 2727 \hline 1961 2728 \end{tabular*} 2729 \caption{Parameters of the command ``FitTune4Flag''.} 1962 2730 \end{table} 1963 2731 1964 Table Parameters of the command âFitTune4Flagâ. 1965 Parameters 1966 Meaning 1967 Default values 1968 Q1a 1969 First half of the quadrupole family used to fit the tunes 1970 - 1971 Q1b 1972 Second half of the quadrupole family used to fit the tunes 1973 - 1974 Q2a 1975 First half of the quadrupole family used to fit the tunes 1976 - 1977 Q2b 1978 Second half of the quadrupole family used to fit the tunes 1979 - 1980 nux 1981 Target horizontal tune 1982 0.0 1983 nuz 1984 Target vertical tune 1985 0.0 1986 1987 For example: 1988 FitTune4Flag qp7a qp7b qp9a qp9b 18.202 10.317 1989 In this example, all the variables have the same meaning as the ones in the command âFitTuneFlagâ, except âqp7aâ and âqp7bâ are the two half pieces of the full quadrupole âqp7â, and âqp9aâ and âqp9bâ are the two half pieces of the full quadrupole 'qp9'. 1990 After fitting the tunes, the field strengths of fitted quadrupole before and after the fitting are printed to the screen; user can copy the new field strengths of quadrupoles to the lattice file for further analysis. 1991 FitTune4Flag is a command that works for the lattices in which each quadrupole are cut into two halves. 2732 2733 2734 \textit{For example:} 2735 \tracycommand{FitTune4Flag}{ qp7a qp7b qp9a qp9b 18.202 10.317} 2736 2737 In this example, all the variables have the same meaning as the ones 2738 in the command ``FitTuneFlag'', except ``qp7a'' and ``qp7b'' are the 2739 two half pieces of the full quadrupole ``qp7'', and ``qp9a'' and ``qp9b'' 2740 are the two half pieces of the full quadrupole ``qp9''. 2741 2742 \begin{itemize} 2743 \item 2744 After fitting the tunes, the field strengths of fitted quadrupole 2745 before and after the fitting are printed to the screen; user can 2746 copy the new field strengths of quadrupoles to the lattice file 2747 for further analysis. 2748 \item 2749 ``FitTune4Flag'' is a command that works for the lattices in 2750 which each quadrupole are cut into two halves. 2751 \end{itemize} 1992 2752 1993 2753 \subsection{FitChromFlag} 1994 2754 Fit chromaticity \\ 1995 2755 1996 Chromaticities can be fit using two families of sextupoles, the command is: 1997 FitChromFlag SX1 SX2 epsilon\_x epsilon\_z 1998 The parameters of this command are shown in Table . 2756 Chromaticities can be fit using two families of sextupoles, the command is: 2757 \tracycommand{FitChromFlag}{ SX1 SX2 epsilon\_x epsilon\_z} 2758 2759 The parameters of this command are shown in Table \cite{tab:fitchromflag:paras}. 1999 2760 2000 2761 \begin{table}[h] 2001 2762 \centering 2002 \caption{} 2003 \label{} 2004 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.2\linewidth} |p{0.5\linewidth} | p{0.15\linewidth} |} 2005 \hline 2763 \label{tab:fitchromflag:paras} 2764 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.15\linewidth}|p{0.5\linewidth} |p{0.1\linewidth} | p{0.1\linewidth} |} 2765 \hline 2766 Parameters & Meaning & Default & Unit \\ 2767 \hline 2768 SX1 & First sextupole family used to fit the chromaticities & - & - \\ 2769 \hline 2770 SX2 & Second sextupole family used to fit the chromaticities & - & - \\ 2771 \hline 2772 epsilon\_x & Target horizontal chromaticity & 0.0 & - \\ 2773 \hline 2774 epsilon\_z & Target vertical chromaticity & 0.0 & - \\ 2006 2775 \hline 2007 2776 \end{tabular*} 2777 \caption{Parameters of the command ``FitChromFlag''.} 2008 2778 \end{table} 2009 2779 2010 Table Parameters of the command âFitChromFlagâ. 2011 Parameters 2012 Meaning 2013 Default values 2014 SX1 2015 First sextupole family used to fit the chromaticities 2016 - 2017 SX2 2018 Second sextupole family used to fit the chromaticities 2019 - 2020 epsilon\_x 2021 Target horizontal chromaticity 2022 0.0 2023 epsilon\_z 2024 Target vertical chromaticity 2025 0.0 2026 2027 For example: 2028 FitChromFlag sx9 sx10 2.0 2.6 2029 After fitting the chromaticites, the field strengths of fitted sextupoles before and after the fitting are printed to the screen; user can copy the new field strengths of sextupoles to the lattice file for further analysis. 2030 2031 \subsection{TouschekFlag (TO BE UPDATED)} 2780 \textit{For example:} 2781 \tracycommand{FitChromFlag}{ sx9 sx10 2.0 2.6} 2782 2783 After fitting the chromaticites, the field strengths of fitted 2784 sextupoles before and after the fitting are printed to the screen; 2785 user can copy the new field strengths of sextupoles to the lattice 2786 file for further analysis. 2787 2788 \subsection{TouschekFlag (TO BE UPDATED)??????} 2032 2789 Touschek lifetime determined by RF acceptance \\ 2033 2790 2034 To calculate Touschek lifetime, use the following command: 2035 TouschekFlag 2036 Here the momentum acceptance is limited by the RF acceptance. 2037 2038 \subsection{IBSFlag (TO BE UPDATED)} 2791 To calculate Touschek lifetime, use the following command: 2792 \tracycommand{TouschekFlag}{} 2793 2794 Here the momentum acceptance is limited by the RF acceptance. 2795 2796 \subsection{IBSFlag (TO BE UPDATED) ????} 2039 2797 Intra Beam Scattering (IBS) \\ 2040 2798 2041 2799 2042 2043 IBSFlag 2800 To calculate Intra Beam Scattering, use the command: 2801 \tracycommand{IBSFlag}{} 2044 2802 2045 2803 \subsection{TousTrackFlag (TO BE UPDATED)} 2046 Touschek lifetime determined by the minimum value of RF acceptance and momentum acceptance \\ 2047 2048 Touschek lifetime can be calculated by 2049 TousTrackFlag 2050 In this case, the energy acceptance at each lattice element is limited by the minimum value of RF acceptance and momentum acceptance obtained by tracking, and the chamber file MUST be defined in the user script. 2804 Touschek lifetime determined by the minimum value of RF acceptance 2805 and momentum acceptance. \\ 2806 2807 Touschek lifetime can be calculated by 2808 \tracycommand{TousTrackFlag}{} 2809 2810 In this case, the energy acceptance at each lattice element is 2811 limited by the minimum value of RF acceptance and momentum acceptance 2812 obtained by tracking, and the chamber file MUST be defined in 2813 the user script. 2051 2814 2052 2815 \subsection{PhaseSpaceFlag} 2053 2816 Obtain phase space by tracking \\ 2054 2817 2055 To calculate phase space, use the command: \\ 2056 \t extbf{PhaseSpaceFlag}Phase\_phase\_file Phase\_Dim Phase\_X Phase\_Px2818 To calculate phase space, use the command: 2819 \tracycommand{PhaseSpaceFlag}{ Phase\_phase\_file Phase\_Dim Phase\_X Phase\_Px 2057 2820 Phase\_Y Phase\_Py Phase\_delta Phase\_ctau 2058 Phase\_nturn damping\_flag 2059 2060 For example: 2061 \t extbf{PhaseSpaceFlag} phasespace.out 6D 1e-6 0.0 1e-6 0.0 0.012 0.0 1000 false2062 2063 The meanings of parameters and defaults values of PhaseSpaceFlag are shown in Table 2821 Phase\_nturn damping\_flag} 2822 2823 \textit{For example:} 2824 \tracycommand{PhaseSpaceFlag}{ phasespace.out 6D 1e-6 0.0 1e-6 0.0 0.012 0.0 1000 false} 2825 2826 The meanings of parameters and defaults values of PhaseSpaceFlag are shown in Table~\ref{tab:phasespace-para}. 2064 2827 If user uses PhaseSpaceFlag without parameters, then the code will use the default values. 2065 2828 2066 2829 \begin{table}[h] 2067 2830 \centering 2068 \caption{Parameters of the command \textbf{PhaseSpaceFlag} to calculate phase space.}2069 2831 \label{tab:phasespace-para} 2070 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}} p{0.2\linewidth} p{0.5\linewidth} p{0.15\linewidth} } 2071 \hline 2072 \hline 2073 \textbf{Symbol} & \textbf{Units} & \textbf{Parameter} \\ 2074 \hline 2075 \textbf{Phase\_phase\_file} & File to save tracked phase space; 2076 saved in the current directory. & phase.out \\ 2077 \textbf{Phase\_Dim} & 4D~/~6D tracking & 4D \\ 2078 \textbf{Phase\_X} & Horizontal coordinate at the start 2079 point of tracking. & 0.0 \\ 2080 \textbf{Phase\_Px} & Horizontal canonical momentum~/~derivative 2081 at the start point of tracking. & 0.0 \\ 2082 \textbf{Phase\_Y} & Vertical coordinate at the start point 2083 of tracking. & 0.0 \\ 2084 \textbf{Phase\_Py} & Vertical canonical momentum~/~derivative 2085 at the start point of tracking. & 0.0 \\ 2086 \textbf{Phase\_delta}& Energy at the start point of tracking & 0.0 \\ 2087 \textbf{Phase\_ctau} & Longitudinal position at the start point 2088 of tracking. & 0.0 \\ 2089 \textbf{Phase\_nturn}& Number of turns for tracking & 512 \\ 2090 \textbf{Damping\_flag}& Boolean flag to turn on~/~off the radiation 2091 damping during the tracking. & false \\ 2092 \hline 2832 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.2\linewidth}|p{0.48\linewidth} |p{0.12\linewidth} | p{0.05\linewidth} |} 2833 \hline 2834 Parameters & Meaning & Default & Unit \\ 2835 \hline 2836 Phase\_phase\_file & File to save tracked phase space; 2837 saved in the current directory. & phase.out & -\\ 2838 \hline 2839 Phase\_Dim & 4D~/~6D tracking & 4D & -\\ 2840 \hline 2841 Phase\_X & Horizontal coordinate at the start 2842 point of tracking. & 0.0 & -\\ 2843 \hline 2844 Phase\_Px & Horizontal canonical momentum~/~derivative 2845 at the start point of tracking. & 0.0 & -\\ 2846 \hline 2847 Phase\_Y & Vertical coordinate at the start point 2848 of tracking. & 0.0 & -\\ 2849 \hline 2850 Phase\_Py & Vertical canonical momentum~/~derivative 2851 at the start point of tracking. & 0.0 & -\\ 2852 \hline 2853 Phase\_delta& Energy at the start point of tracking & 0.0 & -\\ 2854 \hline 2855 Phase\_ctau & Longitudinal position at the start point 2856 of tracking. & 0.0 & -\\ 2857 \hline 2858 Phase\_nturn& Number of turns for tracking & 512 & -\\ 2859 \hline 2860 Damping\_flag& Boolean flag to turn on~/~off the radiation 2861 damping during the tracking. & false & - \\ 2093 2862 \hline 2094 2863 \end{tabular*} 2864 \caption{Parameters of the command ``PhaseSpaceFlag'' to calculate phase space.} 2095 2865 \end{table} 2096 2866 2097 2867 2098 \subsection{IDCorrFlag (Tested for TaiWan light source; TO BE CONTINUE DEVELOPPED.) }2868 \subsection{IDCorrFlag (Tested for TaiWan light source; TO BE CONTINUE DEVELOPPED.)?????} 2099 2869 Insertion device (ID) compensation \\ 2100 2870 2101 To compensate the beta beat introduced by the insertion devices, several families of Quadruoples can be used. Defining the following command in the â*.prmâ can active this action: 2102 IDCorrFlag 2103 User also needs to define the following parameters used for the compensation of insertion device: 2104 N\_calls 1 2105 N\_steps 1 2106 N\_Fam 11 2107 IDCquads qs1 qs2 qs3 qs4 qs5 ql1 ql2 ql3 q1 q2 q3 2108 scl\_dbetax 5e-1 2109 scl\_dbetay 5e-1 2110 scl\_dnux 0.1 2111 scl\_dnuy 0.1 2112 scl\_nux 1e1 2113 scl\_nuy 1e1 2114 ID\_step 0.7 2115 2116 The meanings of the above commands and the default values used to do ID compensation using quadrupoles are shown in Table . 2871 To compensate the beta beat introduced by the insertion devices, several 2872 families of Quadruoples can be used. Defining the following command in 2873 the ``*.prm'' can active this action: 2874 \tracycommand{IDCorrFlag}{} 2875 2876 User also needs to define the following parameters used for the 2877 compensation of insertion device like the following example 2878 in Table \ref{tab:idcorrflag:example}: 2879 2880 \begin{table} 2881 \begin{tabular}{l p{10cm}} 2882 \hline 2883 \hline 2884 N\_calls & 1 \\ 2885 N\_steps& 1\\ 2886 N\_Fam & 11\\ 2887 IDCquads& qs1 qs2 qs3 qs4 qs5 ql1 ql2 ql3 q1 q2 q3\\ 2888 scl\_dbetax& 5e-1\\ 2889 scl\_dbetay& 5e-1\\ 2890 scl\_dnux& 0.1\\ 2891 scl\_dnuy& 0.1\\ 2892 scl\_nux& 1e1\\ 2893 scl\_nuy& 1e1\\ 2894 ID\_step& 0.7\\ 2895 \hline 2896 \hline 2897 \end{tabular} 2898 \label{tab:idcorrflag:example} 2899 \caption{One example to define the parameters to compensate nonlinear dynamics from the 2900 insertion device.} 2901 \end{table} 2902 2903 The meanings of the above commands and the default values used 2904 to do ID compensation using quadrupoles are shown in Table \ref{tab:idcorrflag:paras}. 2117 2905 2118 2906 \begin{table}[h] 2119 2907 \centering 2120 \caption{} 2121 \label{} 2122 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.2\linewidth} |p{0.5\linewidth} | p{0.15\linewidth} |} 2123 \hline 2908 \label{tab:idcorrflag:paras} 2909 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.2\linewidth}|p{0.48\linewidth} |p{0.12\linewidth} | p{0.05\linewidth} |} 2910 \hline 2911 Parameters & Meanings & Default & Units \\ 2912 \hline 2913 N\_calls &Number of calls to do ID compensation & 1 & - \\ 2914 \hline 2915 N\_steps &Number of steps.& 1 & - \\ 2916 \hline 2917 N\_Fam & Number of quadrupole families used to do ID correction. 2918 & 15 & - \\ 2919 \hline 2920 IDCquads & Name of quadrupole families used to do ID correction. & - & - \\ 2921 \hline 2922 scl\_dbetax & Scaling weight factor of the change step of horizontal 2923 beta function during the ID correction. & 1 & - \\ 2924 \hline 2925 scl\_dbetay & Scaling weight factor of the change step of vertical beta 2926 function during the ID correction. & 1 & - \\ 2927 \hline 2928 scl\_dnux & Scaling weight factor of the change step of horizontal 2929 tune during the ID correction. & 0.1 & - \\ 2930 \hline 2931 scl\_dnuy & Scaling weight factor of the change step of vertical 2932 tune during the ID correction. & 0.1 & - \\ 2933 \hline 2934 scl\_nux & Scaling weight factor of horizontal tune during the 2935 ID correction. & 100 & - \\ 2936 \hline 2937 scl\_nuy &Scaling weight factor of vertical tune during the ID correction.& 100 & - \\ 2938 ID\_step & 0.7 & - & - \\ 2124 2939 \hline 2125 2940 \end{tabular*} 2941 \caption{Parameters of commands to do ID compensation using quadrupoles.} 2126 2942 \end{table} 2127 2943 2128 Table Parameters of commands to do ID compensation using quadrupoles. 2129 Parameters 2130 Meanings 2131 Default values 2132 N\_calls 2133 Number of calls to do ID compensation 2134 1 2135 N\_steps 2136 Number of steps. 2137 1 2138 N\_Fam 2139 Number of quadrupole families used to do ID correction. 2140 15 2141 IDCquads 2142 Name of quadrupole families used to do ID correction. 2143 - 2144 scl\_dbetax 2145 Scaling weight factor of the change step of horizontal beta function during the ID correction. 2146 1 2147 scl\_dbetay 2148 Scaling weight factor of the change step of vertical beta function during the ID correction. 2149 1 2150 scl\_dnux 2151 2152 Scaling weight factor of the change step of horizontal tune during the ID correction. 2153 0.1 2154 scl\_dnuy 2155 Scaling weight factor of the change step of vertical tune during the ID correction. 2156 0.1 2157 scl\_nux 2158 2159 Scaling weight factor of horizontal tune during the ID correction. 2160 100 2161 scl\_nuy 2162 2163 Scaling weight factor of vertical tune during the ID correction. 2164 100 2165 ID\_step 2166 2167 2168 0.7 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 Frequency map analysis for on momentum particle, command ``FmapFlag''. 2179 \begin{itemize} 2180 \item 2181 Frequency map analysis for off momentum particle, command ``FmapdpFlag''. 2182 \item 2183 Track momentum acceptance at lattice elements, command ``MomentumAccFlag''. 2184 \end{itemize} 2185 2186 \subsection{Compile} 2187 The commonly used compilers for parallel computation are MPI 2, and Intel MPI which is based on MPI 2. For the cluster of SOLEIL Synchrotron, Intel MPI is installed. To get the parallel Tracy work, three files of the non-parallel version Tracy need to be modified. 2188 The details are shown in the following steps. 2189 \begin{enumerate} 2190 \item 2191 The path of included files of Intel MPI is added in ``Makefile.am'' under 2192 path ``\$HOME/TracyIII/tracy/tracy/src'' (shown in BLUE color): 2193 2194 INCLUDES = -I../inc -I\$(NUM\_REC)/inc 2195 -I/opt/intel/impi/3.2.2.006/include64 2196 \item 2197 The execute file, source file, paths of included files and library of Intel 2198 MPI are modified in ``Makefile.am'' under path ``\$HOME/TracyIII/tracy/tools'' 2199 (shown in BLUE color): 2200 2201 bin\_PROGRAMS = psoltracy 2202 2203 soltracy\_SOURCES = soltracy.cc nrutil.c nrcheck.c 2204 nrlinwww.c nrframe.c ../tracy/src/tracy\_lib.cc -> 2205 psoltracy\_SOURCES = psoltracy.cc nrutil.c nrcheck.c 2206 nrlinwww.c nrframe.c ../tracy/src/tracy\_lib.cc 2207 2208 LIBS = -L\$(NUM\_REC)/lib 2209 -L/opt/intel/impi/3.2.2.006/lib64 -L\$(LIBPATH) 2210 -lrecipes\_c\_icc -lstdc++ -lgfortran -lmpichcxx 2211 2212 INCLUDES = -I\$(TRACY\_LIB)/tracy/inc -I\$(NUM\_REC)/inc 2213 -I/opt/intel/impi/3.2.2.006/include64 2214 \item 2215 The compilers used in the parallel computing are defined in the ``make\_for\_psoltracy.sh'' located in path ``\$HOME/TracyIII'' as (shown in BLUE color): 2216 2217 CC = mpiicc 2218 2219 CXX = mpiicpc 2220 2221 F77 = mpiifort 2222 2223 Depending on the compilers used to do parallel computation, user needs to 2224 update the compilers in ``make\_for\_psoltracy.sh'' and the paths of included 2225 files and library which are shown above with blue color. 2226 2227 After updating compilers, paths of included files and library for parallel 2228 computation, user can run 2229 2230 make\_for\_psoltracy.sh 2231 2232 under the shell script to compile the parallel Tracy. After compilation, 2233 the execute file ``psoltracy'' is automatically generated under the 2234 path ``\$HOME/TracyIII/tracy/tools''. 2235 2236 2237 \end{enumerate} 2238 2239 \subsection{Run} 2240 As the non-parallel version Tracy, user needs to write the commands in a script which must be with the file extension â.prmâ. The syntaxes to define the script â*.prmâ are the same for both non-parallel and parallel Tracy. 2241 To run the parallel Tracy, user need to contact the administrator of their cluster to know how to run parallel programs on the cluster. For the cluster on Synchrotron SOLEIL, the nodes used to do parallel computation are assigned by PBS (Portable Batch System), so a script is need. For example, user define the input script âtest.prmâ to tell Tracy what jobs are need to be done on the cluster, define script âlance\_tracy3\_parallel.shâ to assign the numbers of CPUs to do parallel computation and lance job to the SOLEIL cluster. and then type the following command under the bash shell to submit the job and run the parallel Tracy on the cluster: 2242 2243 lance\_tracy3\_parallel.sh test.prm 2244 2245 \section{ User input script} 2246 There are two types of keywords in the user input script. The first type is to set the file, the file names, and define parameters for the related calculations; the key words for such definitions are ended with the characters âFlagâ. The second type is to define Boolean commands with or without parameters to do different calculations. The rules of the definition of input scripts are: 2247 The blank lines and lines starting with "\#" (comment line) are ignored by the code. 2248 Keywords without âFlagâ as the final 4 characters are NOT executed according to the defined sequence in user input script. If the same command keywords are defined many times in the user script, only the last defined keyword is executed. 2249 The commands with the last 4 characters as âFlagâ are executed according to the sequence in the code. 2250 The definition of lattice file at the beginning of the user script is mandatory. If the lattice file is with any of the following elements: horizontal correctors, vertical correctors, girders, BPM, skew quadrupoles, user must declare the element name at the beginning of input script. 2251 One keyword command uses one line. User can not define more than one command at the same line. 2252 Except explanation, all commands with Boolean flag are the generic commands, and can be used on all the lattice of the ring. 2253 \subsection{ File path} 2254 In the user input script, user can specify the name of the files which are used in the calculation, such as the lattice file, multipole field error file, misalignment error file, vacuum chamber file. When specifying the file name, user can provide the absolute path for the file which is not located at the current path, such as: â/home/physmach/Tracy3/tracy/soleil.latâ; or for convenience, user provides the filename without absolute path, but put the files at a certain directory and then specific this directory using the command: 2255 in\_dir user\_defined\_path 2256 For example: 2257 in\_dir /home/zhang/codes/TracyIII/lattice/ 2258 2259 This command tells the code all the files specified in the script are located at the directory â/home/zhang/codes/TracyIII/lattice/â. If user declares the files without absolute path and does not set the directory through command in\_dir; or the files specified in the script are not found at the current working path, the code will give an error message and stop running. 2260 2261 \section{ File names} 2262 2263 \subsection{Lattice file name} 2264 In the input script, user must define the lattice name, this is mandatory. The command is: 2265 lat\_file lattice\_file\_name 2266 Here âlattice\_file\_nameâ is the lattice file name without â.latâ extension. For example, the following command sets the lattice file of SOLEIL ring: 2267 lat\_file solamor2\_reglage\_focalisation\_chcvqt\_thicksextu\_LQPintermediaire\_QFF 2268 In Tracy 3, after reading the lattice, Twiss parameters are automatically printed to the file âlinlat.outâ. 2269 If one of these elements (Horizontal/vertical correctors or beam position monitors, or girders, or skew quadrupoles.) are defined in the lattice file, for example to read the misalignment errors of the lattice element and then do orbit correction, to read multipole field errors (SOLEIL lattice), etc.; user MUST specify the names of these elements using the corresponding commands in the â*.prmâ script: 2270 h\_corr HCM 2271 v\_corr VCM 2272 gs GS 2273 ge GE 2274 bpm\_name BPM 2275 qt QT 2276 Here âHCMâ is the name of horizontal correctors used for horizontal orbit correction, or the horizontal correctors on which the multipole field errors are added in SOLEIL lattice; âVCMâ is the name of vertical correctors used for vertical orbit correction, or the vertical correctors on which the multipole field errors are added in SOLEIL lattice; âGSâ is the name of the start girder; âGEâ is the name of the end girder; âBPMâ is the name of beam position monitors defined in the lattice file; âQTâ is the name of the skew quadrupoles defined in the lattice. Generally, user needs to define horizontal, vertical correctors and BPMs when reading the misalignment errors or correcting closed orbit distortion 2277 2278 \subsection{Multipole field error file name (SOLEIL lattice)} 2279 User can read the multipole field errors on SOLEIL lattice from an external file; the file is specified in the user script using the following command: 2280 multipole\_file multipole\_file\_name 2281 Here âmultipole\_file\_nameâ is the user defined multipole field error file, the format of this file is given in section Error: Reference source not found. 2282 2283 If the multipole field errors of horizontal, vertical correctors and skew quadrupoles are defined in the âmultipole\_fileâ, user MUST specify the names of these lattice elements in the â*.prmâ file as the following example: 2284 h\_corr CH 2285 v\_corr CV 2286 qt QT 2287 Here âCHâ, âCVâ and âQTâ are the names of horizontal, vertical correctors, and skew quadrupoles respectively which are defined in the lattice file. 2288 2289 \subsection{Files of multipole field errors of correctors and skew quadrupoles (SOLEIL lattice)} 2290 Horizontal, vertical correctors and skew quadrupoles are integrated with the sextupole quadrupoles on SOLEIL storage ring. To define the multipole field errors on these elements, user need to define the orders and relative strengths of multipole field errors in the multipole field error file (section Error: Reference source not found) and specify the file name in the user input script â*.prmâ (section Multipole field error file name), then specify the file names as the following example: 2291 fic\_hcorr corh.txt 2292 fic\_vcorr corv.txt 2293 fic\_skew corqt.txt 2294 Here âcorh.txtâ and âcorv.txtâ are the files with measured current values corh, corv, corqt (with unit [Ampere]) for the horizontal, vertical correctors and skew quadrupoles respectively. Based on the measured current values, user can get the integrated field strength as: 2295 Hcorr\_strength [T.m] = corh *\_convHcorr /brho; (horizontal correctors) 2296 Vcorr\_strength [T.m] = corv *\_convVcorr /brho; (vertical correctors) 2297 Qt\_strength [T.m] = corqt *\_convQt /brho; (skew quadrupoles) 2298 here brho is the momentum rigidity, and the conversion constants between current and field are \_convHcorr = 8.14e-4, \_convVcorr = 4.642e-4, \_convQt = 93.83e-4. 2299 For SOLEIL lattice, the SAME ORDER of multipole field errors on the same elements are added together, so the SAME ORDER of horizontal/vertical, skew quadrupoles, and sextupoles are added together since these elements are integrated at the same magnets. 2300 2301 \subsection{ File to define field strength of virtual coupling source elements (SOLEIL lattice)} 2302 On SOLEIL storage ring, the coupling is thought to come from the rotation of quadrupoles and vertical displacements of sextupoles. The strengths of these coupling sources are written in a file, then read by the following command: 2303 virtualskewquad\_file virtual\_skew\_quad\_currents.txt 2304 2305 Here âvirtual\_skew\_quad\_currents.txtâ is the user defined file with strength of vertical coupling source. 2306 In order to use this command to read the virtual sources of coupling, user needs to define the virtual coupling element as a skew quadrupole in the lattice file: 2307 SQ: quadrupole, tilt=45.0, K= 0.0, method=4, N=1; 2308 and this virtual coupling element MUST be with the name âSQâ. Now there 152 elements defined as the virtual coupling sources in the SOLEIL lattice. The syntaxs to define skew quadrupole are explained in section . 2309 The measured current value qtcorr[i] of the ith coupling source is converted to the corresponding integrated skew quadrupole field strength corr\_strength as 2310 corr\_strength [m-1] = qtcorr[i]*conv/brho; 2311 here brho is momentum rigidity, and the conversion constant conv is 93.88e-4 [A-1.T]. 2312 2313 \subsection{Cut off value} 2314 Set the cut off value of all random distribution (Gaussian distribution) to ânâ times of the RMS value sigma: 2315 normalcut n 2316 2317 \section{Physics: Hamiltionian} 2318 The dynamic motion of a conserved system can be described by a Hamiltonian. For an accelerator system without radiation 2319 damping (energy loss) and RF cavities (energy gain), the motion of a single electron in the magnetic field can be described using the 2320 following Hamitonian in the curvilinear coordinate system (Merz...) 2321 \begin{eqnarray} 2322 H (x,P_x; y, P_y; -t, \delta; s) &=& L + V \\ 2323 &=& -(1+h_{\mathrm{ref}}x)[\sqrt(P^2 - (P_x - eA_x)^2 - (P_y - eA_y)^2 ) + eA_z(x,P_x; y, P_y,s)] \\ 2324 P^2 & =& P_x^2 + P_y^2 + P_z^2 2325 \end{eqnarray} 2326 $h_{\mathrm{ref}}$ is the curvature of reference orbit inside the dipole. 2327 The $(x,P_x; y, P_y; -t, \delta)$ are the canonical cooridinates of the $H$, and $P_x, P_y, P-z$ are respectively the 2328 horizontal, vertical, and longitudinal mechanical momentums. A more convienent way is to expand the electron motion 2329 around the motion of a reference particle with total momentum $P_0$, so 2330 \begin{eqnarray} 2331 \frac{1}{P_0}H (x,P_x; y, P_y; -t, \delta; s) &=& \\ 2332 H (x,p_x; y, p_y; -t, \delta; s) &=& -(1+h_{\mathrm{ref}}x)\sqrt((1+\delta)^2 - (p_x - \frac{e}{P_0}A_x)^2 - (p_y - \frac{e}{P_0}A_y)^2 ) + \frac{e}{P_0}A_z(x,p_x; y, p_y,s) \\ 2333 &=& -(1+h_{\mathrm{ref}}x)\sqrt((1+\delta)^2 - (p_x - \frac{1}{B \rho}A_x)^2 - (p_y - \frac{1}{B \rho}A_y)^2 ) + \frac{1}{B \rho}A_z(x,p_x; y, p_y,s) 2334 \end{eqnarray} 2335 with 2336 \begin{eqnarray} 2337 p_x &=& \frac{P_x}{P_0} \\ 2338 p_y &=& \frac{P_y}{P_0} \\ 2339 p &=& \frac{P}{P_0} = \frac{\Delta P + P_0}{P_0} = (1+\delta) \\ 2340 \delta &=& \frac{\Delta P}{P_0} \\ 2341 B \rho &=& \frac{P_0}{e} (magnetic rigidity) 2342 \end{eqnarray} 2343 2344 With some operations (J. Bengtsson's linear transverse dynamics for sotrage ring with applications to the low energy antiproton ring (LEAR) at CERN; Tracy 2 manual.), 2345 the Hamitonian can be expressed with the canonical coordinates $(x,p_x; y, p_y; -ct, \delta; s)$ (Tracy-2 Manual, J. Bengtsson) 2346 2347 \begin{align*} 2348 %\label{Tracy:Exact:H} 2349 H (x,p_x; y, p_y; -ct, \delta; s) \\ 2350 &=-(1+h_{\mathrm{ref}}x)(\sqrt{(1+\delta)^2 - (p_x - \frac{A_x}{B \rho})^2 - (p_y - \frac{A_y}{B \rho})^2} + \frac{A_z}{B \rho}) + \delta \\ 2351 &= -(1+h_{\mathrm{ref}}x)(\sqrt{(1+\delta)^2 - (p_x - \frac{A_x}{B \rho})^2 - (p_y - \frac{A_y}{B \rho})^2 }) + h_{\mathrm{ref}} x \frac{A_z}{B \rho} \\ 2352 & + \frac{A_z}{B \rho} + \delta \\ 2353 &= \underbrace{-(1+h_{\mathrm{ref}}x)\sqrt{(1+\delta)^2 - (p_x - \frac{A_x}{B \rho})^2 - (p_y - \frac{A_y}{B \rho})^2 )}}_\text{kinetic energy} \\ 2354 & + \underbrace{\frac{x}{\rho} +\frac{x}{2\rho^2}}_\text{Gemometic components due to the curvilinear coordinate inside the dipole}\\ 2355 & +\underbrace{\frac{A_z}{B \rho}}_\text{magnet contribution} \\ 2356 & +\underbrace{\delta}_\text{due to the canonical coordinate $-ct$ instead of $-t$}\\ 2357 A_z & =A_z(x,p_x; y, p_y,s) 2358 \end{align*} 2359 2360 The equation is the exact Hamitonian used in Tracy. The $A_x$ are due to the longidutinal fringe field, this is an natural results due to the Maxwell Equation; $h_{\mathrm{ref}}$ is not zero only inside the dipoles. 2361 2362 For the system without fringe field of the magnet, or only consider the field inside the body of the magnet, $A_x = 0$ and $A_y = 0$, 2363 so the Hamiltonian is 2364 \begin{align} 2365 \label{eqn:exact:H:NoFF} 2366 H (x,p_x; y, p_y; -ct, \delta; s) \\ 2367 &= \underbrace{-(1+h_{\mathrm{ref}}x)\sqrt{(1+\delta)^2 - p_x^2 - p_y^2)}}_\text{kinetic energy} \\ 2368 & + \underbrace{\frac{x}{\rho} +\frac{x}{2\rho^2}}_\text{Gemometic components due to the curvilinear coordinate inside the dipole}\\ 2369 & +\underbrace{\frac{A_z}{B \rho}}_\text{magnet contribution} \\ 2370 & +\underbrace{\delta}_\text{due to the canonical coordinate $-ct$ instead of $-t$}\\ 2371 \end{align} 2372 2373 From eqn.~\ref{eqn:exact:H:NoFF}, it is easy to get the map of the particle inside different lattice elements. 2374 2375 2376 \subsection{Map of drift} 2377 \label{H:drift} 2378 2379 In the drift, $A_z = 0$, and $h_{\mathrm{ref}}$ = 0, from eqn.~\ref{eqn:exact:H:NoFF}, we can get the Hamiltonian 2380 inside a drift is 2381 \begin{align} 2382 \label{eqn:H:exact:drift} 2383 H (x,p_x; y, p_y; -ct, \delta; s) = -\sqrt{(1+\delta)^2 - p_x^2 - p_y^2)} + \delta 2384 \end{align} 2385 2386 In large ring, in order to increase the tracking speed, we can expand the sqare root in 2387 eqn.~\ref{eqn:H:exact:drift} to get the approximate Hamitonian. 2388 That is, 2389 \begin{align} 2390 \label{eqn:H:approxi:drift} 2391 H (x,p_x; y, p_y; -ct, \delta; s) &= -(1+\delta) \left[ 1 - \frac{p_x^2 + p_y^2}{2 (1+\delta)^2} \right] + \delta\\ 2392 &= \frac{p_x^2 + p_y^2}{2(1+\delta)} 2393 \end{align} 2394 2395 2396 From eqn.~\ref{eqn:H:exact:drift}, it is easy to get the map inside the drift for the 2397 \textbf{small ring}: 2398 \begin{align} 2399 x^{'} = \frac{dx}{ds} = \frac{\partial H}{\partial p_{x0}} = \frac{p_{x0}}{\sqrt{(1+\delta_0)^2 -(p_{x0}^2+p_{y0}^2)}} \\ 2400 y^{'} = \frac{dy}{ds} = \frac{\partial H}{\partial p_{y0}}= \frac{p_{y0}}{\sqrt{(1+\delta_0)^2 -(p_{x0}^2+p_{y0}^2)}} \\ 2401 (-ct)^{'} = \frac{d(-ct)}{ds} = \frac{\partial H}{\partial \delta_0} =-\frac{1+\delta_0}{\sqrt{(1+\delta_0)^2 -(p_{x0}^2+p_{y0}^2)}}+1 \\ 2402 or \\ 2403 (ct)^{'} = \frac{1+\delta_0}{\sqrt{(1+\delta_0)^2 -(p_{x0}^2+p_{y0}^2)}}-1 \\ 2404 p_x = p_{x0} \\ 2405 p_y = p_{y0} \\ 2406 \delta = \delta_0 2407 \end{align} 2408 2409 From eqn.~\ref{eqn:H:approxi:drift}, it is easy to get the map inside the drift for the 2410 \textbf{big ring}: 2411 \begin{align} 2412 x^{'} = \frac{dx}{ds} = \frac{\partial H}{\partial p_{x0}} = \frac{p_{x0}}{1+\delta_0} \\ 2413 y^{'} = \frac{dy}{ds} = \frac{\partial H}{\partial p_{y0}}= \frac{p_{y0}}{1+\delta_0} \\ 2414 (-ct)^{'} = \frac{d(-ct)}{ds} = \frac{\partial H}{\partial \delta_0} =-\frac{p_{x0^2}+p_{y0}^2}{2(1+\delta_0)} \\ 2415 or \\ 2416 (ct)^{'} = \frac{p_{x0^2}+p_{y0}^2}{2(1+\delta_0)} \\ 2417 p_x = p_{x0} \\ 2418 p_y = p_{y0} \\ 2419 \delta = \delta_0 2420 \end{align} 2421 2422 \subsection{Map of mutipoles} 2423 From eqn.~\ref{eqn:exact:H:NoFF}, we can get the Hamiltonian 2424 inside a multipole without fringe field is 2425 \begin{align} 2426 \label{eqn:H:exact} 2427 H (x,p_x; y, p_y; -ct, \delta; s) \\ 2428 =& \underbrace{-\sqrt{(1+\delta)^2 - p_x^2 - p_y^2}+\delta}_\text{H drift} \\ 2429 & \underbrace{-h_{\mathrm{ref}}x \sqrt{(1+\delta)^2 - p_x^2 - p_y^2}}_\text{H kick} \\ 2430 & + \underbrace{\frac{x}{\rho} +\frac{x}{2\rho^2}-\frac{A_z}{B \rho}}_\text{H kick} 2431 \end{align} 2432 2433 In eqn.~\ref{eqn:H:exact}, the Hamiltonian is decomposed into two part, one is the Hamiltonian 2434 of the drift which is due to the kinetic energy of the system (section~\ref{H:drift}), another part is the kick 2435 due to the multipoles which will give the kick to the particle. 2436 Now we only need to focus on the Hamiltonian of the multipoles which induces the kick map: 2437 \begin{align} 2438 \label{eqn:H:exact:multipole} 2439 H (x,p_x; y, p_y; -ct, \delta; s) \\ 2440 &=-h_{\mathrm{ref}}x \sqrt{(1+\delta)^2 - p_x^2 - p_y^2} \\ 2441 & +\frac{x}{\rho} +\frac{x}{2\rho^2}-\frac{A_z}{B \rho} 2442 \end{align} 2443 2444 Similarly, by expand the sqare root in eqn.~\ref{eqn:H:exact}, we can get the approximate Hamiltonian 2445 of the multipole as 2446 \begin{align} 2447 \label{eqn:H:approxi:multipole} 2448 H (x,p_x; y, p_y; -ct, \delta; s) \\ 2449 &=-h_{\mathrm{ref}}x \sqrt{(1+\delta)^2 - p_x^2 - p_y^2} \\ 2450 & +\frac{x}{\rho} +\frac{x}{2\rho^2}-\frac{A_z}{B \rho} \\ 2451 &=-h_{\mathrm{ref}} x \delta + \frac{1}{2}h_{\mathrm{ref}} h_{B} x^2 - \frac{A_z}{B \rho}+(h_B - h_{\mathrm{ref}})x 2452 \end{align} 2453 where $h_{\mathrm{ref}}$ is the curvature due to the curlininear coordinates inside the dipole, 2454 $h_{\mathrm{ref}} = 1/\rho_{ref}$; 2455 $h_{\mathrm{bend}}$ is due to the bending curvature of the dipole which is determined by the dipole 2456 field, $h_{\mathrm{bend}} = 1/ \rho_{bend}$. $h_{\mathrm{ref}} \neq 0$ only inside dipoles. 2457 2458 In the dipole, $A_z \neq 0$, and $h_{\mathrm{ref}} \neq $ 0, so 2459 from eqn.~\ref{eqn:H:exact:multipole}, we can get the kick map due to the dipole 2460 in the \textbf{small ring} which use the exact Hamiltonian: 2461 \begin{align} 2462 \label{eqn:kickmap:exact} 2463 x^{'} = \frac{dx}{ds} = \frac{\partial H}{\partial p_{x0}} = h_{\mathrm{ref}} x_0 \frac{p_{x0}}{\sqrt{(1+\delta_0)^2 -(p_{x0}^2+p_{y0}^2)}} \\ 2464 y^{'} = \frac{dy}{ds} = \frac{\partial H}{\partial p_{y0}}= h_{\mathrm{ref}} x_0 \frac{p_{y0}}{\sqrt{(1+\delta_0)^2 -(p_{x0}^2+p_{y0}^2)}} \\ 2465 p_x^{'} = -\frac{\partial H}{\partial y_0} = h_{\mathrm{ref}} \sqrt{(1+\delta_0)^2 - p_{x0}^2 - p_{y0}^2} - h_{\mathrm{bend}} - h_{\mathrm{ref}}h_{\mathrm{bend}}x - \frac{B_y}{B \rho}\\ 2466 p_y^{'} = -\frac{\partial H}{\partial y_0} = \frac{1}{B \rho} \frac{\partial A_z}{\partial y_0} = \frac{B_x}{B \rho}\\ 2467 (-ct)^{'} = \frac{d(-ct)}{ds} = \frac{\partial H}{\partial \delta_0} =-h_{\mathrm{ref}} x_0 \frac{1+\delta_0}{\sqrt{(1+\delta_0)^2 -(p_{x0}^2+p_{y0}^2)}} \\ 2468 or \\ 2469 (ct)^{'} = h_{\mathrm{ref}} x_0 \frac{1+\delta_0}{\sqrt{(1+\delta_0)^2 -(p_{x0}^2+p_{y0}^2)}} \\ 2470 \delta = \delta_0 \\ 2471 B \rho = \frac{p_0}{e} 2472 \end{align} 2473 where 2474 \begin{align} 2475 \frac{\partial A_z}{\partial x} = - B_y \\ 2476 \frac{\partial A_z}{\partial y} = B_x 2477 \end{align} 2478 since 2479 \begin{align} 2480 A_x = 0 \\ 2481 A_y =0 2482 \end{align} 2483 inside the body of the multipoles, and 2484 \begin{align*} 2485 \vec{B} = \Delta \times \vec{A} \\ 2486 \hat{x} & \hat{y} & \hat{z} \\ 2487 \frac{\partial}{x} & \frac{\partial}{y} & \frac{\partial}{z} \\ 2488 A_x & A_y & A_z \\ 2489 \end{align*} 2490 2491 2492 In the dipole, $A_z \neq 0$, and $h_{\mathrm{ref}} \neq $ 0, so 2493 from eqn.~\ref{eqn:H:approxi:multipole}, we can get the kick map due to the dipole 2494 in the \textbf{big ring} which use the exact Hamiltonian: 2495 \begin{align} 2496 \label{eqn:kickmap:approxi} 2497 x^{'} = \frac{dx}{ds} = \frac{\partial H}{\partial p_{x0}} = h_{\mathrm{ref}} x_0 \frac{p_{x0}}{1+\delta_0} \\ 2498 y^{'} = \frac{dy}{ds} = \frac{\partial H}{\partial p_{y0}}= h_{\mathrm{ref}} x_0 \frac{p_{y0}}{1+\delta_0} \\ 2499 p_x^{'} = -\frac{\partial H}{\partial y_0} = h_{\mathrm{ref}} \delta_0 - (h_{\mathrm{bend}} - h_{\mathrm{ref}}) - h_{\mathrm{ref}}h_{\mathrm{bend}}x - \frac{B_y}{B \rho}\\ 2500 p_y^{'} = -\frac{\partial H}{\partial y_0} = \frac{1}{B \rho} \frac{\partial A_z}{\partial y_0} = \frac{B_x}{B \rho}\\ 2501 (-ct)^{'} = \frac{d(-ct)}{ds} = \frac{\partial H}{\partial \delta_0} =\frac{-h_{\mathrm{ref}} x_0}{1+\delta_0} \frac{-(p_{x0}^2+p_{y0}^2)}{2(1+\delta_0)} \\ 2502 or \\ 2503 (ct)^{'} =-\frac{h_{\mathrm{ref}} x_0}{1+\delta_0} \frac{(p_{x0}^2+p_{y0}^2)}{2(1+\delta_0)} \\ 2504 \delta^{'} = 0 2505 \end{align} 2506 2507 For other multipoles (quadrupoles, sextupole, decapole, octupole, etc), the curvilinear coordinate is 2508 the cartesian coordinates, that is $h_{ref}$ = 0, so from eqn.~\ref{eqn:kickmap:exact}, the kick map for 2509 these multipoles in the small ring is: 2510 \begin{align} 2511 \label{eqn:kickmap:exact:multipole} 2512 x^{'} = \frac{dx}{ds} = \frac{\partial H}{\partial p_{x0}} = 0 \\ 2513 y^{'} = \frac{dy}{ds} = \frac{\partial H}{\partial p_{y0}}= 0 \\ 2514 p_x^{'} = -\frac{\partial H}{\partial y_0} = - (h_{\mathrm{bend}} + \frac{B_y}{B \rho})\\ 2515 p_y^{'} = -\frac{\partial H}{\partial y_0} = \frac{1}{B \rho} \frac{\partial A_z}{\partial y_0} = \frac{B_x}{B \rho}\\ 2516 (-ct)^{'} = \frac{d(-ct)}{ds} = \frac{\partial H}{\partial \delta_0} = 0\\ 2517 or \\ 2518 (ct)^{'} = 0 \\ 2519 \delta^{'} = 0 2520 \end{align} 2521 2522 With $h_{ref} = 0$, from eqn:~\ref{eqn:kickmap:approxi}, the kick map for these 2523 multipoles (quadrupoles, sextupole, decapole, octupole, etc) in the big ring is: 2524 \begin{align} 2525 \label{eqn:kickmap:approxi:multipole} 2526 x^{'} = \frac{dx}{ds} = \frac{\partial H}{\partial p_{x0}} = 0 \\ 2527 y^{'} = \frac{dy}{ds} = \frac{\partial H}{\partial p_{y0}}= 0 \\ 2528 p_x^{'} = -\frac{\partial H}{\partial y_0} = - (h_{\mathrm{bend}} + \frac{B_y}{B \rho})\\ 2529 p_y^{'} = -\frac{\partial H}{\partial y_0} = \frac{1}{B \rho} \frac{\partial A_z}{\partial y_0} = \frac{B_x}{B \rho}\\ 2530 (-ct)^{'} = \frac{d(-ct)}{ds} = \frac{\partial H}{\partial \delta_0} = 0\\ 2531 or \\ 2532 (ct)^{'} = 0 \\ 2533 \delta^{'} = 0 2534 \end{align} 2535 2536 From the eqn~\ref{eqn:kickmap:exact} to eqn.~\ref{eqn:kickmap:approxi:multipole}, it's clear 2537 that the kick map from the main body of dipoles are different in the small ring and big ring; 2538 while the kick map from the main body of other type of multipoles are the same in small 2539 rings and big rings. 2540 2541 2542 2543 2544 2545 2546 2547 2548 \section{Magnetic field} 2549 2550 A. Dragt ....(Lie methods for acceleator........) 2551 2552 \section{FF of dipole} 2553 \subsection{kick map} 2554 E. Forest ........... 2555 2556 \section{FF of quadrupole} 2557 \subsection{kick map} 2558 2559 2560 \section{ Lattice file} 2561 In the lattice, RF cavity must be defined!!! Otherwise Tracy will give the error message: 2562 \textcolor{red}{Elem\_GetPos: there are no kids in family 0 ()}. This obigatory is for the 2563 correct calculation of positive/negtive momentum compaction factor. 2564 2565 2566 2567 The followings are the rules to define a lattice file used in Tracy 3. The curvelinear coordinates are 2568 used. \textbf{The ideal particle or design particle sees the perfect magnetic field in all magnets, and its} 2569 \textbf{orbit is used as the reference orbit and base of the curvilinear coordinate}. Since the reference orbit 2570 is a curve inside the dipoles and a straight line in other lattice elements (drifts and the magnets except 2571 dipoles), so the length of the dipole is the the path length of the reference particle inside the dipole 2572 which is equal to $\rho*\theta$ where $\rho$ is the bending radius of the dipole and $theta$ is the bending angle 2573 with unit [rad], and all the other magnet lengths are the straight length of the magnets. 2574 2575 Due to the same reason, the curvature of the curvilinear cooridnates h = 1/$\rho$ is not zero only inside dipole; 2576 in other magnets and drift h = 0, and the curvilinear coordinates goes to cartesian cooridnates. 2577 As a result, the independent variable $s$ inside the dipole harmitonian is the arc length, while the staight 2578 length in other lattice elements. 2579 2580 \subsection{Lattice} 2581 The $n^{th}$ field component of the lattice element is defined as in Tracy (n = 1, 2, 3, 4 ...): 2582 \begin{eqnarray*} 2583 b_n & = & \frac{1}{B \rho} \frac{1}{(n-1)!} \frac{\partial^{n-1} B_y }{\partial x ^{n-1}}|_{x=0,y=0} \\ 2584 a_n & = & \frac{1}{B \rho} \frac{1}{(n-1)!} \frac{\partial^{n-1} B_x }{\partial x ^{n-1}}|_{x=0,y=0} \\ 2585 B \rho & = & \frac{p_0}{e} 2586 \end{eqnarray*} 2587 $B \rho$ is the magnetic rigidity, $p_0$ is the design beam momentum, $e$ is the electric charge. 2588 For example, for sextupole, n = 3, so $b_3$ and $a_3$ are defined as 2589 \begin{eqnarray*} 2590 b_3 & = & \frac{1}{B \rho} \frac{1}{2} \frac{\partial^{2} B_y }{\partial x ^{2}}|_{x=0,y=0} \\ 2591 a_3 & = & \frac{1}{B \rho} \frac{1}{2} \frac{\partial^{2} B_x }{\partial x ^{2}}|_{x=0,y=0} 2592 \end{eqnarray*}. 2593 2594 \textbf{Notes:} 2595 In \textbf{AT} (Accelerator Toolbox) and \textbf{BETA} code, the definition of are the same as in \textbf{Tracy}. 2596 While In \textbf{MAD8}, \textbf{MADX} and \textbf{ELEGANT}, the order of the field compoent start from 0, that is 2597 n = 0, 1, 2, 3, ..., and the $n^{th}$ field strength components of the lattice element $b_n$ and $a_n$ are defined as 2598 \begin{eqnarray*} 2599 b_n & = & \frac{1}{B \rho} \frac{\partial^{n} B_y }{\partial x ^{n}}|_{x=0,y=0} \\ 2600 a_n & = & \frac{1}{B \rho} \frac{\partial^{n} B_x }{\partial x ^{n}}|_{x=0,y=0} \\ 2601 B \rho & = & \frac{p_0}{e} 2602 \end{eqnarray*} 2603 For example, for sextupole, n = 3, its field component $b_2$ and $a_2$ are defined as 2604 \begin{eqnarray*} 2605 b_2 & = & \frac{1}{B \rho} \frac{\partial^{2} B_y }{\partial x ^{2}}|_{x=0,y=0} \\ 2606 a_2 & = & \frac{1}{B \rho} \frac{\partial^{2} B_x }{\partial x ^{2}}|_{x=0,y=0} 2607 \end{eqnarray*}. 2608 2609 2610 2611 \subsection{Syntax} 2612 Every line embraced by â{}â is comment line. For example: 2613 2614 {*****drift space *****} 2615 2616 Each sentence is ended by â;â or no punctuation. 2617 Tracy is not sensitive to capital/small letters in the lattice. 2618 User can define any lattice element with any valid name (but must start with a character) they want, but the element type is fixed. 2619 For the lattice of the ring, the definition of RF cavity is mandatory, and the harmonic number of the RF cavity is also mandatory; for the lattice of the linac, the definition of the RF cavity is optional. 2620 2621 \subsection{Variables} 2622 User can define the variables in the lattice file. For example: 2623 Intmeth = 4; 2624 so when the code is running, each âintmethâ in the lattice file will be replaced by â4â. 2625 2626 \subsection{Start line} 2627 The lattice file must begin with the sentence: 2628 define lattice; 2629 This definition is mandatory. 2630 2631 \subsection{Global variables} 2632 After define the ring, user needs to define the system parameters of the lattice: 2633 Energy, the beam energy with unit [GeV]. 2634 dP, the relative momentum offset of the particle. 2635 CODeps, the convergence for the algorism to find the closed orbit. 2636 For example: 2637 Energy = 2.739; 2638 dP = 1.0d-10; 2639 CODeps= 1.0d-15; 2640 These definitions are mandatory. 2944 2945 2641 2946 2642 2947 \section{Multipole field error file} 2643 2948 \label{sec:mult:field:error} 2644 The multipole field errors of the lattice elements can be defined in a file, and then the file is read into the lattice. User can define the systematic or random multipole field error of the lattice elements. 2645 There are two ways to define the multipole field errors, one way is to define the errors for all the families with the same type, for example, the error for all the quadrupoles; another way is to define the error for each family, for example, the âQ1â family of the quadrupoles. 2949 The multipole field errors of the lattice elements can be defined 2950 in a file, and then the file is read into the lattice. User can 2951 define the systematic or random multipole field error of the 2952 lattice elements. 2953 2954 There are two ways to define the multipole field errors, one way 2955 is to define the errors for all the families with the same type, 2956 for example, the error for all the quadrupoles; another way is 2957 to define the error for each family, for example, the ``Q1'' family 2958 of the quadrupoles. 2646 2959 2647 2960 \subsection{Systematic errors} 2648 To define the systematic multipole field error of the element, the user just need to follow the rules as below. 2649 This command is commonly used to add the mangets design errors in the lattice. 2961 To define the systematic multipole field error of the element, 2962 the user just need to follow the rules as below. 2963 2964 This command is commonly used to add the mangets design errors 2965 in the lattice. 2966 2650 2967 Input format of multipole error: 2651 keywords/name sys $r0$(radius where the multipole field error is measured. If $r0$ = 0, then the An and Bn are the integrated 2652 multipole field strength at the position $x$ = $z$ = 0). 2653 $n$(order of multipole field error, in US. notation. Dip errors is 1, quadrupole error is 2, sextupole field error is 3, decaper field error is 4, octoper field error is 5, etc.), 2654 $Bn$($n^{\mathrm{th}}$ integrated upright component of the 2655 multipole field) An($n^{\mathrm{th}}$ integrated skew component of the multipole field) 2656 m, Bm, Am,...... 2657 The "keywords" means one type of lattice elements or the family name; the keywords of the type of lattice elements are: 2658 dip dipole \\ 2659 quad quadrupole \\ 2660 sext sextupole \\ 2661 hcorr horizontal corrector \\ 2662 vcorr vorizontal corrector \\ 2663 qt skew quadrupole \\ 2664 2665 âsysâ is a keyword to denote that user are setting the systematic multipole error. 2666 Bn defines the upright component of the magnetic field, then for the component of a skew quadrupole or a vertical corrector, Bn = 0 2667 An defines the skew component of the magnetic field, then for the component of a dipole or upright quadrupole, An = 0. 2668 The line start with â\#â is a comment line. 2669 The blank lines in the multipole definition file are neglected by the code. 2670 2671 There are two ways to define the multipole field errors strength, one is to define the measured field errors at the pole tip location $r_0$, 2672 then $b_n$ and $a_n$ are respectively the scale coefficient of the main magnetic field coeffeicient. For example, to define the decupole field 2673 errors inside a horizontal bending dipole with coefficient $b_1$, we define the normal scale coefficience as $c_5$ and skew scale coefficience 2674 as $d_5$, then the $b_5$ component of this decupole is $c_5$ * $b_1$ and the skew coefficience $a_5$ is $d_5$ * $b_1$; that is 2968 \tracycommand{keywords/name}{ sys $r0$, $n$, $An$, $Bn$} 2969 2970 The parameters of the errors are: 2971 \begin{description} 2972 \item[keywords:] 2973 type of lattice elements or the family name; the keywords of the 2974 type of lattice elements are: 2975 \begin{tabular}{l l} 2976 dip & dipole \\ 2977 quad & quadrupole \\ 2978 sext & sextupole \\ 2979 hcorr & horizontal corrector \\ 2980 vcorr & vorizontal corrector \\ 2981 qt & skew quadrupole \\ 2982 2983 \end{tabular} 2984 2985 \item[sys:] keyword to denote that user are setting the 2986 systematic multipole error. 2987 \item[$r0:$] 2988 radius where the multipole field error is measured. 2989 If $r0$ = 0, then the An and Bn are the integrated 2990 multipole field strength at the position $x$ = $z$ = 0. 2991 2992 \item[$n$:] 2993 order of multipole field error, in US. notation. 2994 Dip errors is 1, quadrupole error is 2, sextupole field 2995 error is 3, decaper field error is 4, octoper field error 2996 is 5, etc. 2997 \item[$Bn$:] 2998 $n^{\mathrm{th}}$ 2999 integrated upright component of the multipole field. 3000 For the component of a skew quadrupole or a vertical 3001 corrector, $Bn$ = 0 3002 \item[$An$:] 3003 $n^{\mathrm{th}}$ 3004 integrated skew component of the multipole field. 3005 For the component of a dipole or upright quadrupole, $An$ = 0. 3006 \end{description} 3007 3008 There are two ways to define the multipole field errors strength, 3009 \begin{itemize} 3010 \item 3011 one is to define the measured field errors at the pole tip 3012 location $r_0$, then $b_n$ and $a_n$ are respectively the scale 3013 coefficient of the main magnetic field coeffeicient. 3014 3015 For example, to define the decupole field errors inside a 3016 horizontal bending dipole with coefficient $b_1$, we define the 3017 normal scale coefficience as $c_5$ and skew scale coefficience 3018 as $d_5$, then the $b_5$ component of this decupole is $c_5$ * $b_1$ 3019 and the skew coefficience $a_5$ is $d_5$ * $b_1$; that is 2675 3020 \begin{eqnarray*} 2676 3021 b_5 &=& \frac{1}{B \rho} \frac{c_5 * B_0}{r_0^5} \\ … … 2681 3026 b_1 = \frac{1}{B \rho} B_0. 2682 3027 \end{equation} 2683 This method is the simplest way to define the multipole errors inside a lattice element. The default scaling factors $c_n$ and $d_n$ are 1. 2684 2685 Another way is to direct define the multipole field coefficiences $b_n$ and $a_n$, that is, set $r_0 = 0$. 2686 If the multipole field $\vec{B^{tip}}$ are measured at the tips with radius $r_0$, then $b_n$ and $a_n$ can 3028 3029 This method is the simplest way to define the multipole errors 3030 inside a lattice element. The default scaling factors $c_n$ and $d_n$ are 1. 3031 3032 \item 3033 Another way is to direct define the multipole field coefficiences $b_n$ 3034 and $a_n$, that is, set $r_0 = 0$. If the multipole field $\vec{B^{tip}}$ 3035 are measured at the tips with radius $r_0$, then $b_n$ and $a_n$ can 2687 3036 be calculated using 2688 3037 \begin{eqnarray*} … … 2692 3041 \end{eqnarray*} 2693 3042 2694 The assigned multipoles errors will be added to the corresponding $n^{th}$ order multipole errors of the lattice element. 2695 2696 2697 For the soleil lattice, the use can define the multipole errors for the type or each family. But to define the multipole error for all the quadrupoles, user can NOT define the multipole errors by the type. There are two choice: one is to define the multipole errors for each quadrupole family; second is to define the field errors by quadrupole type, and then define the multipole errors on Q2 and Q7 families (the lattice with full quadrupoles) or QP2a, QP2b, QP7a and QP7b families (lattice with quadrupoles which are cut into two halves). This is due to that Q2/QP2a/QP2b and Q7/QP7a/QP7b are the quadrupoles which have lengths larger than other quadrupoles in the lattice, and the multipole errors on them are different from the ones on the other short quadrupoles. 3043 \end{itemize} 3044 3045 3046 \begin{itemize} 3047 \item 3048 The line start with ``\#'' is a comment line. 3049 \item 3050 The blank lines in the multipole definition file are neglected by the code. 3051 \item 3052 The assigned multipoles errors will be added to the corresponding $n^{th}$ 3053 order multipole errors of the lattice element. 3054 \end{itemize} 3055 3056 3057 For the soleil lattice, the use can define the multipole errors for 3058 the type or each family. But to define the multipole error for all the 3059 quadrupoles, user can NOT define the multipole errors by the type. There 3060 are two choice: 3061 \begin{itemize} 3062 \item 3063 one is to define the multipole errors for each quadrupole family; 3064 \item 3065 second is to define the field errors by quadrupole type, and then define 3066 the multipole errors on Q2 and Q7 families (the lattice with full quadrupoles) 3067 or QP2a, QP2b, QP7a and QP7b families (lattice with quadrupoles which are 3068 cut into two halves). This is due to that Q2/QP2a/QP2b and Q7/QP7a/QP7b are 3069 the quadrupoles which have lengths larger than other quadrupoles in the lattice, 3070 and the multipole errors on them are different from the ones on the 3071 other short quadrupoles. 3072 \end{itemize} 2698 3073 2699 The following is an example file to define systematic multipole errors on Soleil lattice: 2700 3074 The following is an example file to define systematic multipole errors on 3075 Soleil lattice: 3076 \begin{flushleft} 3077 3078 \begin{tabular}{ l l l l l l l l l l l l } 3079 \#dipole & & & & & & & & & & & \\ 3080 dip & sys & 20e-3 & 2 & 2.2e-40 & 0.0 & 3 & -3.0e-4 & 0.0 & & & \\ 3081 4 & 2.0e-5 & 0.0 & 5 & -1.0e-4 & 0.0 & 6 & -6.0e-5 & 0.0 & 7 & -1.0e-4 & 0.0 \\ 3082 & & & & & & & & & & & \\ 3083 \end{tabular} 3084 3085 3086 \#quadrupole \\ 3087 \#for all short quadrupoles \\ 3088 \begin{tabular}{ l l l l l l l l l l l l} 3089 quad & sys & 30e-3 & 6& 2.4e-4& 0.0& 10& 0.7e-4& 0.0& 14& 0.9e-4& 0.0 \\ 3090 & & & & & & & & & & & \\ 3091 \end{tabular} 3092 3093 \#for all long quadrupoles qp2 and qp7 \\ 3094 \begin{tabular}{ l l l l l l l l l l l l} 3095 qp2a & sys & 30e-3 & 6 & 0.7e-4 & 0.0 & 10 & 1.9e-4 & 0.0 & 14 & 1.0e-4 & 0.0\\ 3096 qp2b & sys & 30e-3 & 6 & 0.7e-4 & 0.0 & 10 & 1.9e-4 & 0.0 & 14 & 1.0e-4 & 0.0\\ 3097 qp7a & sys & 30e-3 & 6 & 0.7e-4 & 0.0 & 10 & 1.9e-4 & 0.0 & 14 & 1.0e-4 & 0.0\\ 3098 qp7b & sys & 30e-3 & 6 & 0.7e-4 & 0.0 & 10 & 1.9e-4 & 0.0 & 14 & 1.0e-4 & 0.0\\ 3099 & & & & & & & & & & & \\ 3100 \end{tabular} 3101 3102 \#for all short quadrupoles,sextupole mesure quadrupoles longs \\ 3103 \begin{tabular}{l l l l l l l l l} 3104 quad & sys & 30e-3& 3& -1.6e-4& 0.0& 4& -3.4e-4& 0.0 \\ 3105 & & & & & & & & \\ 3106 \end{tabular} 3107 3108 \#for long quadrupoles qp2 and qp7 3109 \begin{tabular}{l l l l l l l l l} 3110 qp2a &sys& 30e-3& 3& 2.9e-4& 0.0& 4& -8.6e-4& 0.0\\ 3111 qp2b& sys& 30e-3& 3& 2.9e-4& 0.0& 4& -8.6e-4& 0.0\\ 3112 qp7a& sys& 30e-3& 3& 2.9e-4& 0.0& 4& -8.6e-4& 0.0\\ 3113 qp7b& sys& 30e-3& 3& 2.9e-4& 0.0& 4& -8.6e-4& 0.0 \\ 3114 & & & & & & & & \\ 3115 \end{tabular} 3116 3117 \# for sextupoles\\ 3118 \begin{tabular}{l l l l l l l l l l l l l l l} 3119 sext& sys& 32e-3& 5& 5.4e-4& 0.0& 7& 3.3e-4& 0.0& 9& -4.7e-4& 0.0& 15& -9.0e-4& 0.0 \\ 3120 & & & 21& -20.9e-4& 0.0& 27& 0.8e-4& 0.0& & & & & & \\ 3121 & & & & & & & & & & & & & & \\ 3122 \end{tabular} 3123 3124 \# for horizontal correctors, all An=0 3125 \begin{tabular}{l l l l l l l l l l l l} 3126 hcorr& sys& 35e-3& 5& 0.430& 0.0& 7& 0.063& 0.0& 11& -0.037& 0.0\\ 3127 & & & & & & & & & & & \\ 3128 \end{tabular} 3129 3130 \# for vertical correctors, all Bn=0 3131 \begin{tabular}{l l l l l l l l l l l l} 3132 vcorr& sys& 35e-3& 5& 0.0& -0.430& 7& 0.0& 0.063& 11& 0.0& 0.037\\ 3133 & & & & & & & & & & & \\ 3134 \end{tabular} 3135 3136 \# for sextupole associated skew quadrupole, all Bn=0 3137 \begin{tabular}{l l l l l l} 3138 qt& sys& 35e-3& 4& 0.0& -0.0\\ 3139 qt& sys& 35e-3& 4& 0.0& -0.680\\ 3140 \end{tabular} 3141 3142 3143 \end{flushleft} 3144 3145 \subsection{Ramdom error} 3146 To define random multipole field errors on the lattice elements, 3147 user needs to define the seed of the random errors, and then follow 3148 the same rule as the ones to define systematic multipole error except 3149 replacing ``sys'' by ``rms''. 3150 3151 \textit{For example:} 3152 \tracycommand{seed}{seed\_number} 3153 \tracycommand{quad}{rms 30e-3 6 2.4e-4 0.0 10 0.7e-4 0.0 14 0.9e-4 0.0} 3154 3155 The random multipole error is multiplied by the random scale factor; the new 3156 value is added to the corresponding components of the magnetic field. 3157 The random scale factor is generated by a random function which follows 3158 the normal distribution (mean value is 0 and standard deviation is 1). 3159 The cut off value for the normal distribution function is 2 times of 3160 the RMS value. If user does not define seed for the random function 3161 before the setting of errors, then the code will stop and give an 3162 error message. 3163 3164 Here is example file to define random multipole error in the lattice: 3165 3166 \begin{flushleft} 3167 \#define seed for the ramdom multipole error \\ 3168 \begin{tabular}{ l l} 3169 seed & 1000000 \\ 3170 & \\ 3171 \end{tabular} 3172 2701 3173 \#dipole 2702 2703 dip sys 20e-3 2 2.2e-40 0.0 3 -3.0e-4 0.0 4 2.0e-5 0.0 5 -1.0e-4 0.0 6 -6.0e-5 0.0 7 -1.0e-4 0.0 3174 \begin{tabular}{l l l l l l l l l l l l} 3175 dip& rms& 20e-3& 2& 2.2e-40& 0.0& 3& -3.0e-4& 0.0& 4& 2.0e-5& 0.0 \\ 3176 & & & 5& -1.0e-4& 0.0& 6& -6.0e-5& 0.0& 7& -1.0e-4& 0.0 \\ 3177 & & & & & & & & & & & \\ 3178 \end{tabular} 2704 3179 2705 3180 \#quadrupole 2706 2707 2708 \#for all short quadrupoles 2709 2710 2711 quad sys 30e-3 6 2.4e-4 0.0 10 0.7e-4 0.0 14 0.9e-4 0.0 2712 2713 \#for all long quadrupoles qp2 and qp7 2714 2715 qp2a sys 30e-3 6 0.7e-4 0.0 10 1.9e-4 0.0 14 1.0e-4 0.0 2716 qp2b sys 30e-3 6 0.7e-4 0.0 10 1.9e-4 0.0 14 1.0e-4 0.0 2717 qp7a sys 30e-3 6 0.7e-4 0.0 10 1.9e-4 0.0 14 1.0e-4 0.0 2718 qp7b sys 30e-3 6 0.7e-4 0.0 10 1.9e-4 0.0 14 1.0e-4 0.0 2719 2720 \#for all short quadrupoles,sextupole mesure quadrupoles longs 2721 2722 quad sys 30e-3 3 -1.6e-4 0.0 4 -3.4e-4 0.0 2723 2724 \#for long quadrupoles qp2 and qp7 2725 2726 qp2a sys 30e-3 3 2.9e-4 0.0 4 -8.6e-4 0.0 2727 2728 qp2b sys 30e-3 3 2.9e-4 0.0 4 -8.6e-4 0.0 2729 2730 qp7a sys 30e-3 3 2.9e-4 0.0 4 -8.6e-4 0.0 2731 2732 qp7b sys 30e-3 3 2.9e-4 0.0 4 -8.6e-4 0.0 2733 2734 2735 \# for sextupoles 2736 2737 sext sys 32e-3 5 5.4e-4 0.0 7 3.3e-4 0.0 9 -4.7e-4 0.0 15 -9.0e-4 0.0 21 -20.9e-4 0.0 27 0.8e-4 0.0 2738 2739 2740 \# for horizontal correctors, all An=0 2741 hcorr sys 35e-3 5 0.430 0.0 7 0.063 0.0 11 -0.037 0.0 2742 2743 \# for vertical correctors, all Bn=0 2744 2745 vcorr sys 35e-3 5 0.0 -0.430 7 0.0 0.063 11 0.0 0.037 2746 2747 2748 \# for sextupole associated skew quadrupole, all Bn=0 2749 2750 \# qt sys 35e-3 4 0.0 -0.0 2751 2752 qt sys 35e-3 4 0.0 -0.680 2753 2754 \subsection{Ramdom error} 2755 To define random multipole field errors on the lattice elements, user needs to define the seed of the random errors, and then follow the same rule as the ones to define systematic multipole error except replacing âsysâ by ârmsâ. For example: 2756 seed seed\_number 2757 quad rms 30e-3 6 2.4e-4 0.0 10 0.7e-4 0.0 14 0.9e-4 0.0 2758 2759 The random multipole error is multiplied by the random scale factor; the new value is added to the corresponding components of the magnetic field. The random scale factor is generated by a random function which follows the normal distribution (mean value is 0 and standard deviation is 1). The cut off value for the normal distribution function is 2 times of the RMS value. If user does not define seed for the random function before the setting of errors, then the code will stop and give an error message. 2760 2761 Here is example file to define random multipole error in the lattice: 2762 2763 \#define seed for the ramdom multipole error 2764 seed 1000000 2765 2766 \#dipole 2767 \# dip 20e-3 2 2.2e-4 0.0 3 -3.0e-4 0.0 4 2.0e-5 0.0 5 -1.0e-4 0.0 6 -6.0e-5 0.0 7 -1.0e-4 0.0 2768 dip rms 20e-3 2 2.2e-40 0.0 3 -3.0e-4 0.0 4 2.0e-5 0.0 5 -1.0e-4 0.0 6 -6.0e-5 0.0 7 -1.0e-4 0.0 2769 2770 \#quadrupole 2771 quad rms 30e-3 3 -1.6e-4 0.0 4 -3.4e-4 0.0 6 2.4e-4 0.0 10 0.7e-4 0.0 14 0.9e-4 0.0 2772 2773 Q2 rms 30e-3 3 2.9e-4 0.0 4 -8.6e-4 0.0 6 0.7e-4 0.0 10 1.9e-4 0.0 14 1.0e-4 0.0 2774 Q7 rms 30e-3 3 2.9e-4 0.0 4 -8.6e-4 0.0 6 0.7e-4 0.0 10 1.9e-4 0.0 14 1.0e-4 0.0 3181 \begin{tabular}{l l l l l l l l l l l l } 3182 quad& rms& 30e-3& 3& -1.6e-4& 0.0& 4& -3.4e-4& 0.0& 6& 2.4e-4& 0.0\\ 3183 & & & 10& 0.7e-4& 0.0& 14& 0.9e-4& 0.0& & & \\ 3184 Q2& rms& 30e-3& 3& 2.9e-4& 0.0& 4& -8.6e-4& 0.0& 6& 0.7e-4& 0.0\\ 3185 & & &10& 1.9e-4& 0.0& 14& 1.0e-4& 0.0& & & \\ 3186 Q7& rms& 30e-3& 3& 2.9e-4& 0.0& 4& -8.6e-4& 0.0& 6& 0.7e-4& 0.0\\ 3187 & & &10& 1.9e-4& 0.0& 14& 1.0e-4& 0.0& & & \\ 3188 & & & & & & & & & & & \\ 3189 \end{tabular} 3190 \end{flushleft} 3191 2775 3192 2776 3193 \section{ Misalignment error file} 2777 The misalignment error of the lattice elements can be defined in a file, and then the file is read into the lattice. User can define the systematic or random misalignment error of the lattice elements. 2778 There are two ways to define the misalignment error, one way is to define the error for all the families in one type, for example, the error for all the quadrupoles; another way is to define the error for each family, for example, the âQ1â family of the quadrupoles. 2779 The systermatic misalignment error file works for the lattices with full or half quadrupoles; the random misalignment error file only works for lattice with full quadrupoles. 3194 The misalignment error of the lattice elements can be defined in a file, 3195 and then the file is read into the lattice. User can define the systematic 3196 or random misalignment error of the lattice elements. 3197 3198 There are two ways to define the misalignment error, one way is to 3199 define the error for all the families in one type, for example, the error 3200 for all the quadrupoles; another way is to define the error for each family, 3201 for example, the âQ1â family of the quadrupoles. 3202 3203 The systermatic misalignment error file works for the lattices with full 3204 or half quadrupoles; the random misalignment error file only works for 3205 lattice with full quadrupoles. 2780 3206 2781 3207 \subsection{Systematic errors} 2782 To define the systematic misalignment error of the element, user just needs to follow the rules as below. 3208 To define the systematic misalignment error of the element, user 3209 just needs to follow the rules as below. 3210 2783 3211 input format of misalignment error: 2784 type/family name sys dx dy dr 2785 2786 The "keywords" means one type of lattice elements or the name of the family, and keywords of the type of lattice elements are: 2787 All all the elements in the lattice 2788 girder girder 2789 dipole dipole 2790 quad quadrupole 2791 sext sextupole 2792 bpm beam position monitor 2793 family name family name of the elements 2794 âsysâ is a keyword to denote that user are setting the systematic displacement error. 2795 dx defines the displacement in x direction with unit [m]. 2796 dy defines the displacement in y direction with unit [m]. 2797 dr defines the rotation angle with unit [rad]). 3212 \tracycommand{type/family}{name sys dx dy dr} 3213 3214 \begin{flushleft} 3215 \begin{description} 3216 \item[keywords:] 3217 type of lattice elements or the name of the family. 3218 3219 Keywords of the type of lattice elements are: \\ 3220 \begin{tabular}{l l} 3221 All & all the elements in the lattice\\ 3222 girder & girder\\ 3223 dipole & dipole\\ 3224 quad & quadrupole\\ 3225 sext & sextupole\\ 3226 bpm & beam position monitor\\ 3227 family name & family name of the elements\\ 3228 \end{tabular} 3229 3230 \item[sys:] 3231 denote that user are setting the systematic displacement error. 3232 3233 \item[dx:] 3234 defines the displacement in x direction with unit [m]. 3235 3236 \item[dy:] 3237 defines the displacement in y direction with unit [m]. 3238 3239 \item[dr:] 3240 defines the rotation angle with unit [rad]). 3241 \end{description} 3242 3243 \end{flushleft} 3244 3245 \begin{itemize} 3246 \item 2798 3247 The line start with â\#â is comment line. 3248 \item 2799 3249 The blank line in the misalignment error file is neglected by the code. 2800 2801 The following is an example file to define systematic multipole error on Soleil lattice: 2802 2803 \#----------------------------------------------------------------------- 2804 \# systematic alignment error for SOLEIL 2805 \# name x(m) y(m) r (rad) 2806 \#----------------------------------------------------------------------- 2807 \begin{table}[h] 2808 \centering 2809 \caption{} 2810 \label{} 2811 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.2\linewidth} |p{0.5\linewidth} | p{0.15\linewidth} |} 2812 \hline 2813 \hline 2814 \end{tabular*} 2815 \end{table} 2816 2817 girder sys 100.0e-6 100.0e-6 0.5e-03 2818 quad sys 30.0e-6 30.0e-6 80.0e-06 2819 sext sys 30.0e-6 30.0e-6 100.0e-06 2820 dipole sys 500.0e-6 500.0e-6 0.2e-03 3250 \end{itemize} 3251 3252 3253 \begin{flushleft} 3254 The following is an example file to define systematic multipole error on Soleil lattice: \\ 3255 \# systematic alignment error for SOLEIL \\ 3256 \end{flushleft} 3257 \begin{tabular}{l l l l l} 3258 \# name& keyword & x(m)& y(m)& r (rad) \\ 3259 girder& sys& 100.0e-6& 100.0e-6& 0.5e-03 \\ 3260 quad& sys& 30.0e-6& 30.0e-6& 80.0e-06\\ 3261 sext& sys& 30.0e-6& 30.0e-6& 100.0e-06\\ 3262 dipole& sys& 500.0e-6& 500.0e-6& 0.2e-03\\ 3263 \end{tabular} 2821 3264 2822 3265 \subsection{Random errors} 2823 To define random misalignment errors on the lattice elements, user need to follow the same rule as the ones to define systematic misalignment error except replacing âsysâ by ârmsâ. That is: 3266 To define random misalignment errors on the lattice elements, user 3267 need to follow the same rule as the ones to define systematic 3268 misalignment error except replacing ``sys'' by ``rms''. That is: 2824 3269 input format of misalignment error: 2825 seed seed\_number 2826 type/family name rms dx dy dr 2827 The random misalignment error is multiplied by the random scale factor; the new value is added to the corresponding components of the misalignment components. The random scale factor is generated by a random function which follows the normal distribution (mean value is 0 and standard deviation is 1), the cut off value for the normal distribution function is 2 times of the RMS value. 2828 If user does not define seed for the random function before the setting of errors, then the code will stop and give an error message. 2829 Here is example file to define random misalignment error in the lattice: 2830 \#----------------------------------------------------------------------- 2831 \# random alignment error for SOLEIL 2832 \# name x(m) y(m) r (rad) 2833 \#----------------------------------------------------------------------- 2834 \begin{table}[h] 2835 \centering 2836 \caption{} 2837 \label{} 2838 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.2\linewidth} |p{0.5\linewidth} | p{0.15\linewidth} |} 2839 \hline 2840 \hline 2841 \end{tabular*} 2842 \end{table} 2843 2844 girder rms 100.0e-6 100.0e-6 0.5e-03 2845 quad rms 30.0e-6 30.0e-6 80.0e-06 2846 sext rms 30.0e-6 30.0e-6 100.0e-06 2847 dipole rms 500.0e-6 500.0e-6 0.2e-03 2848 5.4 Vacuum chamber file 2849 User can define the script to set the vacuum chamber limitation around the ring. The characteristic for the vacuum chamber script are: 3270 \tracycommand{seed}{seed\_number} 3271 \tracycommand{type/family}{ name rms dx dy dr} 3272 3273 The random misalignment error is multiplied by the random scale factor; 3274 the new value is added to the corresponding components of the misalignment 3275 components. The random scale factor is generated by a random function which 3276 follows the normal distribution (mean value is 0 and standard deviation is 1), 3277 the cut off value for the normal distribution function is 2 times of the 3278 RMS value. 3279 3280 If user does not define seed for the random function before the setting of errors, 3281 then the code will stop and give an error message. 3282 3283 \begin{flushleft} 3284 Here is example file to define random misalignment error in the lattice: \\ 3285 \# random alignment error for SOLEIL \\ 3286 \begin{tabular}{l l l l l} 3287 \# name & keyword & x(m)& y(m)& r (rad)\\ 3288 girder& rms& 100.0e-6& 100.0e-6& 0.5e-03\\ 3289 quad& rms& 30.0e-6& 30.0e-6& 80.0e-06\\ 3290 sext& rms& 30.0e-6& 30.0e-6& 100.0e-06\\ 3291 dipole& rms& 500.0e-6& 500.0e-6& 0.2e-03\\ 3292 \end{tabular} 3293 \end{flushleft} 3294 3295 \subsection{Vacuum chamber file} 3296 User can define the script to set the vacuum chamber limitation 3297 around the ring. 3298 The format of the vacuum chamber definition is 3299 \tracycommand{MK1, MK2,}{ minimum x, maximum x, minimum y, maximum y} 3300 3301 \begin{itemize} 3302 \item 3303 To set the vacuum chamber, it is needed to add two markers in the lattice, 3304 such as MK1 and MK2, MK1 is before the first element and MK2 is after 3305 the end element of the vacuum chamber region. 3306 The numbers of MK1 and MK2 are the same in the lattice. 3307 \item 3308 The units are [meter] for minimum x, maximum x, minimum y, maximum y. 3309 \item 3310 The first line is to define the global vacuum chamber limit around the ring, 3311 and the key words should be "Start","All". 3312 \item 2850 3313 Lines start with â\#â are comment. 2851 The format of the vacuum chamber definition is 2852 MK1, MK2, minimum x, maximum x, minimum y, maximum y. 2853 To set the vacuum chamber, it is needed to add two markers in the lattice, such as MK1 and MK2, MK1 is before the first element and MK2 is after the end element of the vacuum chamber region. 2854 The numbers of MK1 and MK2 are the same in the lattice. 2855 The units are [meter] for minimum x, maximum x, minimum y, maximum y. 2856 The first line is to define the global vacuum chamber limit around the ring, and the key words should be "Start","All". 3314 \end{itemize} 3315 2857 3316 2858 3317 2859 3318 The following is one example of the user vacuum chamber script: 2860 2861 \#********************************************* 2862 \# Script to set the vacuum chamber 2863 \# 2864 \#********************************************** 2865 \# MK1 MK2 dxmin dxmax dymin dymax (Apertures in meter) 2866 Start All -35e-3 35e-3 -12.5e-3 12.5e-3 2867 \#sdm1 esdm -21e-3 21e-3 -5e-3 5e-3 2868 debut ehu600 -35e-3 35e-3 -7e-3 7e-3 2869 ssep esep -20e-3 35e-3 -7e-3 7e-3 2870 ssdm esdm -21e-3 21e-3 -5e-3 5e-3 2871 ssdac esdac -35e-3 25e-3 -2.5e-3 2.5e-3 2872 3319 \begin{flushleft} 3320 \#*********************************************\\ 3321 \# Script to set the vacuum chamber \\ 3322 \#\\ 3323 \#**********************************************\\ 3324 \begin{tabular}{l l l l l l} 3325 \# MK1& MK2& dxmin& dxmax& dymin& dymax \\ 3326 Start& All& -35e-3& 35e-3& -12.5e-3& 12.5e-3\\ 3327 \#sdm1& esdm& -21e-3& 21e-3& -5e-3& 5e-3\\ 3328 debut& ehu600& -35e-3& 35e-3& -7e-3& 7e-3\\ 3329 ssep& esep& -20e-3& 35e-3& -7e-3& 7e-3\\ 3330 ssdm& esdm& -21e-3& 21e-3& -5e-3& 5e-3\\ 3331 ssdac& esdac & -35e-3& 25e-3& -2.5e-3& 2.5e-3\\ 3332 \end{tabular} 3333 \end{flushleft} 2873 3334 \end{document} 2874 3335 -
trunk/tracy/tracy/inc/field.h
r3 r32 233 233 234 234 235 typedef ss_vect<double> Vector; 236 typedef Vector Matrix[ss_dim]; 235 typedef ss_vect<double> Vector; /*6*1 vector*/ 236 typedef Vector Matrix[ss_dim]; /*6*6 matrix*/ 237 237 238 238 -
trunk/tracy/tracy/inc/tracy_global.h
r11 r32 3 3 4 4 typedef struct globvalrec { 5 double dPcommon, // dp for numerical differentiation 5 double dPcommon, // dp for numerical differentiation; defined in lattice 6 6 dPparticle; // energy deviation 7 7 double delta_RF; // RF acceptance … … 9 9 double Omega, 10 10 U0, // energy lost per turn in keV 11 Alphac; // alphap11 Alphac; // momentum compaction factor 12 12 Vector2 Chrom; // chromaticities 13 double Energy; // ring energy 14 long Cell_nLoc, // number of elements in a cell 13 double Energy; // ring energy; defined in lattice 14 long Cell_nLoc, // number of elements in a cell (For example, a lattice can have several same cells) 15 15 Elem_nFam, // number of families 16 16 CODimax; /* maximum number of cod search before 17 17 failing */ 18 double CODeps; // precision for closed orbit finder 18 double CODeps; // precision for closed orbit finder; defined in the lattice 19 19 Vector CODvect; // closed orbit; beam position at the first element of lattice 20 20 … … 35 35 Vi; // imaginal par of the eigenvectors 36 36 37 bool MatMeth, // matrix method 37 bool MatMeth, // matrix method or symplectic tracking? 38 38 Cavity_on, // if true, cavity turned on 39 39 radiation, // if true, radiation turned on 40 emittance, 41 quad_fringe, /* dipole- and quadrupole hard-edge 40 emittance, // calculate emittance? 41 quad_fringe, /* dipole- and quadrupole hard-edge? 42 42 fringe fields. */ 43 H_exact, // "small ring" Hamiltonian.43 H_exact, // "small ring" or approximation Hamiltonian? 44 44 pathlength, // absolute path length 45 45 stable, … … 105 105 mpolArray PBrnd; // random scale factor of rms error PBrms gradient, bn and an 106 106 mpolArray PB; // total field strength(design,sys,rms) gradient, bn and an 107 //basic parameters 107 108 int Porder; // The highest order in PB 108 109 int n_design; // multipole order (design, All = 0, Dip = 1, Quad = 2, Sext = 3, Oct = 4, Dec = 5, Dodec = 6) 109 110 pthicktype Pthick; // thick element 110 // Bending Angles111 // dipole type 111 112 double PTx1; // horizontal entrance angle [deg] 112 113 double PTx2; // horizontal exit angle [deg] 113 114 double PH1; // bending curvature of the entrance pole face of dipole, see P116 SAC-75. 114 115 double PH2; // bending curvature of the exit pole face of dipole, see P116 SAC-75. 115 double Pgap; // total magnetgap [m]116 double Pirho; // angle([radian], but in lattice definition, angle is with unit degree)/length of the dipole,1/rho [1/m]116 double Pgap; // total dipole gap [m] 117 double Pirho; // curvature of the dipoles. 1/rho [1/m] 117 118 double Pc0, Pc1, Ps1; // corrections for roll error of bend 118 119 Matrix AU55, // Upstream 5x5 matrix … … 285 286 maxampl[X_][0] < x < maxampl[X_][1] 286 287 maxampl[Y_][0] < y < maxampl[Y_][1] */ 287 }; 288 289 Vector CODvect; //orbit at the end of the lattice element Added by Jianfeng Zhang @ LAL, 01/04/2014. 290 }; -
trunk/tracy/tracy/src/mathlib.cc
r3 r32 218 218 } 219 219 220 220 /*********************************************************** 221 * void CopyVec(const int n, const Vector &a, Vector &b) 222 * 223 * Copy 6D vector a to b: b = a. 224 * 225 ***********************************************************/ 221 226 void CopyVec(const int n, const Vector &a, Vector &b) 222 227 { 223 int i ;228 int i=0; 224 229 225 230 for (i = 0; i < n; i++) … … 457 462 458 463 464 /********************************************************* 465 * void MulLMat(const int n, const Matrix &A, Matrix &B) 466 * 467 * Matrix multiplication. B = A * B 468 * 469 * 470 **********************************************************/ 459 471 void MulLMat(const int n, const Matrix &A, Matrix &B) 460 472 { 461 int i , j, k;462 double x ;473 int i=0, j=0, k=0; 474 double x=0.0; 463 475 Matrix C; 464 476 … … 474 486 } 475 487 476 488 /********************************************************* 489 * void MulRMat(const int n, const Matrix &A, Matrix &B) 490 * 491 * Matrix multiplication. A = A * B 492 * 493 * 494 **********************************************************/ 477 495 void MulRMat(const int n, Matrix &A, const Matrix &B) 478 496 { 479 int i , j, k;480 double x ;497 int i=0, j=0, k=0; 498 double x=0.0; 481 499 Matrix C; 482 500 … … 492 510 } 493 511 494 512 /********************************************************* 513 * double TrMat(const int n, const Matrix &A) 514 * 515 * Calculate the trance of the matrix A. 516 * 517 * return: 518 * x. 519 * 520 **********************************************************/ 495 521 double TrMat(const int n, const Matrix &A) 496 522 { -
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 { -
trunk/tracy/tracy/src/physlib.cc
r11 r32 263 263 264 264 /****************************************************************************/ 265 /* void printglob2file(void) 266 267 Purpose: 268 Print global variables on screen 269 Print tunes and chromaticities 270 Print Oneturn matrix 265 /* void printglob2file(const char fic[]) 266 267 Purpose: 268 Print global variables, 269 tunes and chromaticities, and 270 Oneturn matrix, 271 to an external file. 271 272 272 273 Input: … … 615 616 void TraceABN(long i0, long i1, const Vector2 &alpha, const Vector2 &beta, 616 617 const Vector2 &eta, const Vector2 &etap, const double dP) { 617 long i , j;618 double sb ;618 long i=0, j=0; 619 double sb=0.0; 619 620 ss_vect<tps> Ascr; 620 621 -
trunk/tracy/tracy/src/prtmfile.cc
r11 r32 86 86 Type codes: 87 87 marker -1 88 drift 88 drift 0 89 89 multipole 1 90 90 cavity 2 … … 166 166 ******************************************************************************/ 167 167 void prtmfile(const char mfile_dat[]) { 168 int i , j;168 int i=0, j=0; 169 169 FILE *mfile; 170 170 … … 192 192 fprintf(mfile, " %23.16e %23.16e %23.16e\n", Cell[i].dS[X_], 193 193 Cell[i].dS[Y_], Cell[i].Elem.M->PdTsys + Cell[i].Elem.M->PdTrms 194 * Cell[i].Elem.M->PdTrnd); 195 194 * Cell[i].Elem.M->PdTrnd); 195 prtHOM(mfile, Cell[i].Elem.M->n_design, Cell[i].Elem.M->PB, 196 196 Cell[i].Elem.M->Porder); 197 197 } -
trunk/tracy/tracy/src/read_script.cc
r11 r32 78 78 79 79 80 char str[max_str]=" voidstring", dummy[max_str]="voidstring",dummy2[max_str]="voidstring", nextpara[max_str]="voidpara";81 char in[max_str] ; //temporary line with preceding white space80 char str[max_str]="", dummy[max_str]="",dummy2[max_str]="", nextpara[max_str]=""; 81 char in[max_str]=""; //temporary line with preceding white space 82 82 char *line = NULL; //line to store the command without preceding white space 83 83 size_t len = 0; 84 84 ssize_t read; 85 char name[max_str]=" voidname";85 char name[max_str]=""; //initialize with empty character array. 86 86 // char lat_file[max_str]="voidlattice"; 87 char EndName[ ]="void";87 char EndName[5]=""; 88 88 89 89 FILE *inf; … … 92 92 long int NameLen=0L; 93 93 int idummy=0; 94 char full_param_file_name[max_str] ;95 char lat_FileName[max_str] ;94 char full_param_file_name[max_str]=""; 95 char lat_FileName[max_str]=""; 96 96 //bool TuneTracFlag; 97 97 char *pch; … … 115 115 116 116 LineNum++; 117 if( prt){117 if(!prt){ 118 118 printf("Line # %ld \n",LineNum); 119 119 printf("Retrieved line of length %zu : \n",read); … … 126 126 if (strstr(line, "#") == NULL && line[0] != '\n' && 127 127 line[0] != '\r' && strcmp(line, "\r\n") != 0 ){ 128 129 128 130 // get initial command token 129 131 sscanf(line, "%s", name); … … 134 136 //find the sequence of the bool flag in user input script 135 137 NameLen = strlen(name); 136 EndName[0] = name[NameLen-4]; 137 EndName[1] = name[NameLen-3]; 138 EndName[2] = name[NameLen-2]; 139 EndName[3] = name[NameLen-1]; 140 138 if(NameLen >= 4 ){ 139 EndName[0] = name[NameLen-4]; 140 EndName[1] = name[NameLen-3]; 141 EndName[2] = name[NameLen-2]; 142 EndName[3] = name[NameLen-1]; 143 } 141 144 //find the bool flag whose last 4 character are 'Flag' 142 145 if(strcmp(EndName,"Flag")==0) -
trunk/tracy/tracy/src/soleilcommon.cc
r11 r32 153 153 /*check whether the RF cavity hormonic number is defined or not*/ 154 154 if(Cell[Elem_GetPos(globval.cav, 1)].Elem.C->Ph == 0){ 155 printf("soleilcommon(): Error!!! Please define RF harmonic number in the lattice! \n" 156 "Because this parameter will be used to calculate stable phase for positive / negative momentum compaction factor\n"); 155 printf("soleilcommon(): Error!!! Please define the RF harmonic number in the lattice! \n" 156 "Because this parameter will be used to calculate the stable phase for the lattice with the " 157 "positive / negative momentum compaction factor\n"); 157 158 exit_(1); 158 159 } … … 169 170 globval.emittance = false; /* emittance on/off */ 170 171 globval.pathlength = false; /* Path lengthening computation */ 171 globval.CODimax = 40L; /* maximum number of iterations for COD algo */172 globval.CODimax = 40L; /* maximum number of iterations for COD algorithm */ 172 173 globval.dPcommon = 1e-10; /* Common energy step for energy differentiation */ 173 174 globval.delta_RF = RFacceptance;/* energy acceptance for SOLEIL */ 174 175 175 /* define x/y physical aperture , use the default values: +- 1 meter */176 /* define x/y physical aperture (vacuum chamber), use the default values: +- 1 meter */ 176 177 globval.Aperture_on = false; 177 178 … … 183 184 else 184 185 { // for transfer lines 185 /* Initial settings : */ 186 beta[0] = 8.1; 187 alpha[0] = 0.0; 188 beta[1] = 8.1; 189 alpha[1] = 0.0; 190 eta[0] = 0.0; 191 etap[0] = 0.0; 192 eta[1] = 0.0; 193 etap[1] = 0.0; 194 186 /* Initial optical parameters of the transfer line: */ 187 beta[0] = 34.46; // beta_x 188 beta[1] = 33.94; // beta_y 189 alpha[0] = -4.24; // alpha_x 190 alpha[1] = -4.34; // alpha_y 191 eta[0] = 0.0; // eta_x 192 etap[0] = 0.0; // etap_x 193 eta[1] = 0.0; // eta_y 194 etap[1] = 0.0; // etap_y 195 196 // set the initial orbit of the transfer line is zero 195 197 for (i = 0; i < ss_dim; i++) { 196 198 { … … 200 202 dP = codvect[4]; 201 203 204 codvect[0]=1e-4; 205 202 206 /* Defines global variables for Tracy code */ 203 207 globval.MatMeth = false; /* matrix method */ … … 214 218 globval.Aperture_on = false; 215 219 216 220 // transfer the optical functions and the orbit 217 221 TransTwiss(alpha, beta, eta, etap, codvect); 222 223 // print location, twiss parameters and close orbit/orbit at all elements position to a file 224 prt_cod("cod.out", globval.bpm, true); 218 225 } 219 226 }//finish read the transfer line -
trunk/tracy/tracy/src/t2cell.cc
r3 r32 798 798 fixed point for the lattice with negative momentum compact factor. 799 799 28/06/11 Correct the one turn map for the lattice with negative momentum compact factor, now the one turn map is 800 tracked around the COD. 800 tracked around the COD. By Jianfeng Zhang @ SOLEIL 801 801 ****************************************************************************/ 802 802 bool Cell_getCOD(long imax, double eps, double dP, long &lastpos) 803 803 { 804 long j = 0 , n = 0, n_iter = 0, h_RF = 0;804 long j = 0L, n = 0L, n_iter = 0L, h_RF = 0L; 805 805 double dxabs = 0.0; 806 806 iVector jj; … … 845 845 } 846 846 847 n_iter = 0;847 848 848 I.identity(); 849 849 -
trunk/tracy/tracy/src/t2elem.cc
r24 r32 885 885 886 886 Comments: 887 06/11/2012 Jianfeng Nadolski@ LAL887 06/11/2012 Jianfeng Zhang @ LAL 888 888 Fix the bug in the kick map of the exact Hamiltonian. 889 889 Add the second order of the approximate Hamiltonian. … … 893 893 void thin_kick(int Order, double MB[], double L, double h_bend, double h_ref, 894 894 ss_vect<T> &x) { 895 int j ;895 int j=0; 896 896 T BxoBrho, ByoBrho, ByoBrho1, B[3]; 897 897 T sqrtpx, dpx, ps2new, psnew; … … 2448 2448 2449 2449 Input: 2450 xref vector2451 x matrix2450 xref: 6*1 orbit 2451 x: 6*6 (optics) transfer matrix? 2452 2452 2453 2453 Output: 2454 xref 2455 x 2454 xref: 6*1 orbit 2455 x: 6*6 (optics) transfer matrix 2456 2456 2457 2457 Return: … … 2622 2622 */ 2623 2623 2624 double L ;2624 double L=0.0; 2625 2625 CellType *cellp; 2626 2626 elemtype *elemp; … … 2674 2674 ( 0 0 0 0 1 ) */ 2675 2675 2676 double t , sk, sk0, s, c;2676 double t=0.0, sk=0.0, sk0=0.0, s=0.0, c=0.0; 2677 2677 Matrix a, ah, av; 2678 2678 … … 2771 2771 cos phi */ 2772 2772 2773 double r , s, c, sk, p, fk, afk;2773 double r=0.0, s=0.0, c=0.0, sk=0.0, p=0.0, fk=0.0, afk=0.0; 2774 2774 Matrix edge, ah, av; 2775 double coef , scoef;2775 double coef=0.0, scoef=0.0; 2776 2776 2777 2777 if (irho == 0.0) { … … 4126 4126 ****************************************************************************/ 4127 4127 void Drift_Init(int Fnum1) { 4128 int i ;4128 int i=1; 4129 4129 ElemFamType *elemfamp; 4130 4130 CellType *cellp; … … 4171 4171 4172 4172 void Mpole_Init(int Fnum1) { 4173 double x ;4174 int i ;4173 double x=0.0; 4174 int i=1; 4175 4175 ElemFamType *elemfamp; 4176 4176 CellType *cellp; -
trunk/tracy/tracy/src/t2lat.cc
r11 r32 258 258 static long CheckUDItable(const char *name, struct LOC_Lattice_Read *LINK) 259 259 { 260 long i , j, FORLIM;260 long i=0, j=0, FORLIM=0; 261 261 262 262 j = 0; … … 2652 2652 QL = 0.0; /* L */ 2653 2653 QKick = 0.0; /* kick angle of the corrector [rad]*/ 2654 Kplane = 0; /* 1 is horizontal corrector, -1 is vertical corrector */2655 k1 = 1; /* N */2656 k2 = Meth_Linear; /* method */2657 dt = 0.0; 2654 Kplane = 1; /* 1 is horizontal corrector, -1 is vertical corrector */ 2655 k1 = 1; /* N, cut piece of corrector */ 2656 k2 = Meth_Linear; /* integartion method */ 2657 dt = 0.0; /* roll angle of the corrector */ 2658 2658 ClearHOMandDBN(&V); 2659 2659 getest__(P_expset(SET, 1 << ((long)comma)), "<, > expected", &V); … … 2668 2668 P_addset(mysys, (long)rollsym); 2669 2669 P_addset(mysys, (long)dbnsym); 2670 do { /*5: read L, K, N, T, T1, T2 */2670 do { /*5: read L, kick angle, cut piece, integartion method, roll angle, T2 */ 2671 2671 test__(mysys, "illegal parameter", &V); sym1 = *V.sym; 2672 2672 if (*V.sym == (long)dbnsym || *V.sym == (long)rollsym || … … 2714 2714 else if (sym1 == versym) 2715 2715 Kplane = -1; 2716 else{ 2717 cout << "t2lat: Error! Must specify the type of the corrector, Horizontal or vertical!" << endl; 2718 exit_(1); 2719 } 2716 2720 GetSym__(&V); 2717 2721 } … … 2743 2747 WITH2->PN = k1; 2744 2748 WITH2->PdTpar = dt; 2745 2746 if(Kplane == 0){2747 cout << "t2lat: Error! Must specify the type of the corrector, Horizontal or vertical!" << endl;2748 exit_(1);2749 }2750 2749 WITH2->PBpar[Kplane*Dip + HOMmax] = -1*QKick; //assign the kick angle [rad] 2751 2750 … … 3755 3754 Reg("inv ", invsym, &V); 3756 3755 Reg("kick ", corkicksym, &V); /* with "corrector", define the kick angle of the corrector , Jianfeng Zhang*/ 3757 Reg("kicker ", kicksym, &V);3756 //Reg("kicker ", kicksym, &V); /*overlap with the lattice element type: corrector*/ 3758 3757 Reg("ks ", kssym, &V); 3759 3758 Reg("lambda ", lmdsym, &V); … … 4121 4120 void GetEnergy(struct LOC_Lattice_Read *LINK) 4122 4121 { 4123 long k ;4122 long k=0; 4124 4123 4125 4124 k = CheckUDItable("energy ", LINK); … … 4137 4136 void GetRingType(struct LOC_Lattice_Read *LINK) 4138 4137 { 4139 long k ;4138 long k=0; 4140 4139 4141 4140 k = CheckUDItable("ringtype ", LINK); -
trunk/tracy/tracy/src/t2ring.cc
r11 r32 196 196 197 197 Purpose: 198 Computes Twiss parameters alpha and beta from the matrix Ascr 198 Assign the Twiss parameters alpha and beta from the matrix Ascr 199 to alpha & beta. 199 200 200 201 M oneturn matrix (A and M are symplectic) … … 218 219 219 220 Return: 220 none221 alpha, beta. 221 222 222 223 Global variables: … … 233 234 void getprm(Matrix &Ascr, Vector2 &alpha, Vector2 &beta) 234 235 { 235 int i , j;236 int i=0, j=0; 236 237 237 238 for (i = 1; i <= 2; i++) { … … 253 254 i0 first element 254 255 i1 last element 255 ring true if a ring 256 ring true if a ring, false is a transfer line 256 257 chroma true if compute chromaticities 257 258 dP energy offset … … 278 279 bool ring, double dP) 279 280 { 280 long int i ;281 int j , k;281 long int i=0L; 282 int j=0, k=0; 282 283 Vector2 nu1, dnu; 283 Vector xref; 284 Matrix Ascr0, Ascr1; 284 Vector xref; /*6*1 vector*/ 285 Matrix Ascr0, Ascr1; /*6*6 matrix*/ 285 286 CellType *cellp; 286 287 287 288 if (dP != globval.dPparticle) Cell_SetdP(dP); 288 289 289 /* Init */290 /* Initize the phase */ 290 291 for (j = 0; j <= 1; j++) 291 nu1[j] = 0.0; 292 293 /* get alpha beta for i0 */292 nu1[j] = 0.0; /*phase advance*/ 293 294 /* get alpha & beta for i0 */ 294 295 cellp = &Cell[i0]; 295 getprm(Ascr, cellp->Alpha, cellp->Beta); 296 memcpy(cellp->Nu, nu1, sizeof(Vector2)); 296 getprm(Ascr, cellp->Alpha, cellp->Beta); /*initialize the alpha & beta functions */ 297 memcpy(cellp->Nu, nu1, sizeof(Vector2)); /*initialize the phase advance*/ 297 298 CopyMat(n+1, Ascr, Ascr0); CopyVec(n+2L, globval.CODvect, xref); 298 299 … … 301 302 /* Ascr1=Elem_M*Ascr0 */ 302 303 /* xref =Elem(xref) */ 303 Elem_Pass_M(i, xref, Ascr1); 304 Elem_Pass_M(i, xref, Ascr1); /* transport orbit & optic matrix */ 304 305 305 306 cellp = &Cell[i]; 306 307 /* get alpha and beta for element i */ 307 308 getprm(Ascr1, cellp->Alpha, cellp->Beta); 309 /*save the orbit at the end of the lattice elment*/ 310 CopyVec(ss_dim, xref,cellp->CODvect); 308 311 309 312 for (j = 0; j <= 1; j++) { … … 861 864 Vector2 &etap, Vector &codvect) 862 865 { 863 long i , j, lastpos;864 double sb ;865 Matrix Ascr; 866 long i=0L, j=0L, lastpos=0L; 867 double sb=0.0; 868 Matrix Ascr; /* 6*6 transfer matrix*/ 866 869 867 870 UnitMat(6L, Ascr);
Note: See TracChangeset
for help on using the changeset viewer.