source: TRACY3/branches/tracy3-3.10.1b/tracy/tracy/inc/tracy_global.h @ 23

Last change on this file since 23 was 23, checked in by zhangj, 10 years ago

Clean version of Tracy: SoleilVersion at the end of 2011.Use this clean version to find the correct dipole fringe field to have the correct FMAP and FMAPDP of ThomX. Modified files: tpsa_lin.cc, soleillib.cc, prtmfile.cc, rdmfile.cc, read_script.cc, physlib.cc, tracy.cc, t2lat.cc, t2elem.cc, naffutils.cc in /tracy/tracy/src folder; naffutils.h, tracy_global.h, physlib.h, tracy.h, read_script.h, solielilib.h, t2elem.h in /tracy/tracy.inc folder; soltracy.cc in tracy/tools folder

  • Property svn:executable set to *
File size: 11.8 KB
Line 
1#define PLANES 2
2#define BPM_MAX 120
3
4typedef struct globvalrec {
5  double        dPcommon,       // dp for numerical differentiation
6                dPparticle;     // energy deviation
7  double        delta_RF;       // RF acceptance
8  Vector2       TotalTune;      // transverse tunes
9  double        Omega,
10                U0,             // energy lost per turn in keV
11                Alphac;         // alphap
12  Vector2       Chrom;          // chromaticities
13  double        Energy;         // ring energy
14  long          Cell_nLoc,      // number of elements in a cell
15                Elem_nFam,      // number of families
16                CODimax;        /* maximum number of cod search before
17                                   failing */
18  double        CODeps;         // precision for closed orbit finder
19  Vector        CODvect;        // closed orbit; beam position at the first element of lattice
20 
21  // family index for special elements
22  long int       bpm;          // family index of bpm
23  long int       hcorr;          // family index of horizontal corrector which are used for orbit correction
24  long int       vcorr;          // family index of vertical corrector which are used for orbit correction
25  long int       qt;           // family index of skew quadrupole
26  int            gs;             // family number of start girder 
27  int            ge;             // family number of end girder
28  long int       cav;          // family index of RF cavity
29 
30  // matrix
31  Matrix        OneTurnMat,     // oneturn matrix
32                Ascr,
33                Ascrinv,
34                Vr,             // real part of the eigenvectors
35                Vi;             // imaginal par of the eigenvectors
36
37  bool          MatMeth,        // matrix method
38                Cavity_on,      // if true, cavity turned on
39                radiation,      // if true, radiation turned on
40                emittance,
41                quad_fringe,    /* dipole- and quadrupole hard-edge
42                                   fringe fields. */
43                H_exact,        // "small ring" Hamiltonian.
44                pathlength,     // absolute path length
45                stable,
46                Aperture_on,
47                EPU,
48                wake_on;
49
50  double        dE,             // energy loss
51                alpha_rad[DOF], // damping coeffs.
52                D_rad[DOF],     // diffusion coeffs (Floquet space)
53                J[DOF],         // partition numbers
54                tau[DOF];       // damping times
55  bool          IBS;            // intrabeam scattering
56  double        Qb,             // bunch charge
57                D_IBS[DOF];     // diffusion matrix (Floquet space)
58  Vector        wr, wi;         // real and imaginary part of eigenvalues
59  Vector3       eps,            // 3 motion invariants, emittance?
60                epsp;           /* transverse and longitudinal projected
61                                   emittances */
62  int           RingType;       // 1 if a ring (0 if transfer line)
63 
64 long bpm_list[BPM_MAX];        /* list of position for bpms into the lattice */
65 long hcorr_list[BPM_MAX];      /* list of position for horizontal correctors */
66 long vcorr_list[BPM_MAX];      /* list of position for vertical correctors  */
67 long qt_list[BPM_MAX];        /* list of position for vertical correctors into the lattice */
68
69
70} globvalrec;
71
72
73struct DriftType {
74  Matrix D55; // Linear matrix
75};
76
77
78struct MpoleType {
79  int         Pmethod;   // Integration Method
80  int         PN;        // Number of integration steps
81  long        quadFF1;         /* Entrance quadrupole Fringe field flag */
82  long        quadFF2;         /* Exit quadrupole Fringe field flag */
83  double      quadFFscaling;         /* quadrupole Fringe field scaling factor flag */
84  long        sextFF1;         /* Entrance sextupole Fringe field flag */
85  long        sextFF2;         /* Exit sextupole Fringe field flag */
86 
87  bool         Status;         /* specific for correctors used for orbit correction. If true, use the corrector
88                                  to correct orbit, if false, not use. */
89 
90  // Displacement Errors
91  Vector2     PdSsys;    // systematic displacement error[m]
92  Vector2     PdSrms;    // rms value of the displacement error[m]
93  Vector2     PdSrnd;    // (normal)random scale factor to displacement error PdSrms
94  // Roll angle
95  double      PdTpar;    // design rotation angle, if not equal zero, then skew multipole[deg]
96  double      PdTsys;    // systematic [deg]
97  double      PdTrms;    // rms rotation error of the element[deg]
98  double      PdTrnd;    // (normal)random scale factor to rotation error PdTrms
99  // Multipole strengths
100  mpolArray   PBpar;     // design field strength
101  mpolArray   PBsys;     // systematic multipole errors
102  mpolArray   PBrms;     // rms multipole field errors
103  mpolArray   PBrnd;     // random scale factor of rms error PBrms
104  mpolArray   PB;        // total field strength(design,sys,rms)
105  int         Porder;    // The highest order in PB
106  int         n_design;  // multipole order (design, All = 0, Dip = 1, Quad = 2, Sext = 3, Oct = 4, Dec = 5, Dodec = 6)
107  pthicktype  Pthick;    // thick element
108  // Bending Angles
109  double PTx1;           // horizontal entrance angle [deg]
110  double PTx2;           // horizontal exit angle [deg]
111  double Pgap;           // total magnet gap [m]
112  double Pirho;          // angle([radian], but in lattice definition, angle is with unit degree)/length of the dipole, 1/rho [1/m]
113  double Pc0, Pc1, Ps1;  // corrections for roll error of bend
114  Matrix AU55,           // Upstream 5x5 matrix
115    AD55;           // Downstream 5x5 matrix
116};
117
118const int  n_harm_max = 10;
119
120struct WigglerType {
121  int Pmethod;                // Integration Method
122  int PN;                     // number of integration steps
123  // Displacement Error
124  Vector2 PdSsys;             // systematic [m] 
125  Vector2 PdSrms;             // rms [m]
126  Vector2 PdSrnd;             // random number
127  // Roll angle
128  double PdTpar;              // design [deg]
129  double PdTsys;              // systematic [deg]
130  double PdTrms;              // rms [deg]
131  double PdTrnd;              // random number
132  double lambda;              // lambda
133  int    n_harm;              // no of harmonics
134  int    harm[n_harm_max];    // harmonic number
135  double BoBrhoV[n_harm_max]; // B/Brho vertical
136  double BoBrhoH[n_harm_max]; // B/Brho horizontal
137  double kxV[n_harm_max];     // vertical kx
138  double kxH[n_harm_max];     // horizontal kx
139  double phi[n_harm_max];     // phi
140  mpolArray PBW;
141  Matrix W55;                 // Transport matrix
142  int Porder;                 // The highest order in PB
143};
144
145
146const int  i_max_FM = 100, j_max_FM = 100, k_max_FM = 1000;
147
148struct FieldMapType {
149  int     n_step; // number of integration steps
150  int     n[3];                                         // no of steps
151  double  scl;
152  double  xyz[3][i_max_FM][j_max_FM][k_max_FM];         // [x, y, z]
153  double  B[3][i_max_FM][j_max_FM][k_max_FM];           // [B_x, B_y, B_z]
154  double  **AxoBrho, **AxoBrho2, **AyoBrho, **AyoBrho2; // Ax(y, s), Ay(x, s)
155};
156
157
158/* ID Laurent */
159#define IDXMAX 500
160#define IDZMAX 100
161
162struct InsertionType {
163  int Pmethod;      /* Integration Method */
164  int PN;           /* number of integration steps */
165  char fname1[100]; /* Filename for insertion description: first order */
166  char fname2[100]; /* Filename for insertion description: second order */
167  int nx1;           /* Horizontal point number */
168  int nx2;           /* Horizontal point number */
169  int nz1;           /* Vertical point number */
170  int nz2;           /* Vertical point number */
171  double scaling1;   /* static scaling factor as in BETA ESRF first order*/
172  double scaling2;   /* static scaling factor as in BETA ESRF second order*/
173  bool linear;      /* if true linear interpolation else spline */
174  bool firstorder;  /* true if first order kick map loaded */
175  bool secondorder; /* true if second order kick map loaded */
176  double tabx1[IDXMAX]; /* spacing in H-plane */
177  double tabz1[IDZMAX]; /* spacing in V-plane */
178  double tabx2[IDXMAX]; /* spacing in H-plane */
179  double tabz2[IDZMAX]; /* spacing in V-plane */
180  double thetax2[IDZMAX][IDXMAX], thetax1[IDZMAX][IDXMAX]; /* 1 for 1st order */
181  double thetaz2[IDZMAX][IDXMAX], thetaz1[IDZMAX][IDXMAX];
182  double **tx2, **tz2, **f2x2, **f2z2; // used for splie2 and splin2 (Spline interpolation)
183  double **tx1, **tz1, **f2x1, **f2z1; // used for splie2 and splin2
184  double *TabxOrd1, *TabzOrd1; // tab of x and z meshes from Radia code in increasing order
185  double *TabxOrd2, *TabzOrd2; // tab of x and z meshes from Radia code in increasing order
186 
187  /* Displacement Error */
188  Vector2 PdSsys;   /* systematic [m]  */
189  Vector2 PdSrms;   /* rms [m] */
190  Vector2 PdSrnd;   /* random number */
191  /* Roll angle */
192  double PdTpar;    /* design [deg] */
193  double PdTsys;    /* systematic [deg] */
194  double PdTrms;    /* rms [deg] */
195  double PdTrnd;    /* random number */
196  Matrix K55;        /* Transport matrix:kick part */
197  Matrix D55;        /* Transport matrix:drift part */
198  Matrix KD55;       /* Transport matrix:concatenation of kicks and drifts */
199  int Porder;        /* The highest order in PB */
200};
201
202struct CavityType {
203  double Pvolt;   // Vrf [V]
204  double Pfreq;   // Vrf [Hz]
205  double phi;     // RF phase
206  int    Ph;      // Harmonic number
207};
208
209struct CellType;
210
211const int  Spreader_max = 10;
212
213struct SpreaderType {
214  double    E_max[Spreader_max];      // energy levels in increasing order
215  CellType  *Cell_ptrs[Spreader_max];
216};
217
218struct RecombinerType {
219  double    E_min;
220  double    E_max;
221};
222
223struct SolenoidType {
224  int         N;         // Number of integration steps
225  // Displacement Errors
226  Vector2     PdSsys;    // systematic [m]
227  Vector2     PdSrms;    // rms [m]
228  Vector2     PdSrnd;    // random number
229  // Roll angle
230  double      dTpar;     // design [deg]
231  double      dTsys;     // systematic [deg]
232  double      dTrms;     // rms [deg]
233  double      dTrnd;     // random number
234  double      BoBrho;    // normalized field strength
235};
236
237struct elemtype {
238  partsName PName;   /* Element name */
239  double PL;         /* Length[m]    */
240  PartsKind Pkind;   /* Enumeration  for magnet types */
241  union
242  {
243    DriftType      *D;   // Drift
244    MpoleType      *M;   // Multipole
245    WigglerType    *W;   // Wiggler
246    FieldMapType   *FM;  // Field Map
247    InsertionType  *ID;  // Insertion
248    CavityType     *C;   // Cavity
249    SpreaderType   *Spr; // Spreader
250    RecombinerType *Rec; // Recombiner
251    SolenoidType   *Sol; // Solenoid
252  };
253};
254
255struct ElemFamType {
256  elemtype    ElemF;    /* Structure (name, type) */
257  int         nKid;         /* number of Kids in a family */
258  int         KidList[nKidMax]; /* list of kid index in the total lattice*/
259  int         NoDBN;
260  DBNameType  DBNlist[nKidMax];
261};
262
263// LEGO block structure for each element of the lattice
264struct CellType {
265  long int              Fnum;        // Element Family #
266  long int              Knum;        // Element Kid #
267  double           S;           // Position in the ring [m]
268  CellType*        next_ptr;    // pointer to next cell (for tracking)
269  Vector2          dS,          // displacement error of the element[m]
270                   dT;          // rotation error of the element[degree], dT = (cos(dT), sin(dT))
271  elemtype         Elem;        // Structure (name, type)
272  Vector2          Nu,          // Phase advances
273                   Alpha,       // Alpha functions (redundant)
274                   Beta,        // beta fonctions (redundant)
275                   Eta, Etap;   // dispersion and its derivative (redundant)
276  Vector           BeamPos;     // position of the beam at the cell;
277  Matrix           A,           // Floquet space to phase space transformation
278                   sigma;       // sigma matrix (redundant)
279  Vector2          maxampl[PLANES]; /* Horizontal and vertical physical
280                                       apertures:
281                                         maxampl[X_][0] < x < maxampl[X_][1]
282                                         maxampl[Y_][0] < y < maxampl[Y_][1] */
283};
Note: See TracBrowser for help on using the repository browser.