source: TRACY3/trunk/tracy/tracy/inc/nsls-ii_lib.h @ 3

Last change on this file since 3 was 3, checked in by zhangj, 12 years ago

Initiale import

  • Property svn:executable set to *
File size: 9.5 KB
Line 
1// global params
2
3extern char     in_dir[];
4
5extern bool     DA_bare, freq_map, tune_shift;
6extern int      n_aper, n_track, n_orbit, n_scale;
7
8extern bool     bba;
9extern int      n_lin,
10                SQ_per_scell, BPM_per_scell, HCM_per_scell, VCM_per_scell;
11extern double   kick;
12extern int      n_stat;
13
14extern double   VDweight, HVweight, VHweight;
15
16extern int      n_x, n_y, n_dp, n_tr;
17extern double   x_max_FMA, y_max_FMA, delta_FMA;
18
19extern double   delta_DA_;
20
21extern char     ae_file[max_str], fe_file[max_str], ap_file[max_str];
22
23//For ID correction
24extern const int  N_Fam_max;  //number of quadrupoles for ID correction
25extern int     N_calls, N_steps, N_Fam, Q_Fam[]; 
26extern double  scl_nux,scl_nuy, scl_dbetax,scl_dbetay, scl_dnux,scl_dnuy, ID_step;
27
28
29extern double   disp_wave_y;
30extern Vector2  beta_ref;
31
32extern ss_vect<tps>  map;
33extern MNF_struct    MNF;
34
35void lwr_case(char str[]);
36
37void upr_case(char str[]);
38
39//void prt_trace (void);
40
41void file_rd(ifstream &inf, const char file_name[]);
42
43void file_wr(ofstream &outf, const char file_name[]);
44
45FILE* file_read(const char file_name[]);
46
47FILE* file_write(const char file_name[]);
48
49void chk_cod(const bool cod, const char *proc_name);
50
51void no_sxt(void);
52
53void get_map(void);
54
55tps get_h(void);
56
57void get_m2(const ss_vect<tps> &ps, tps m2[]);
58
59ss_vect<tps> get_S(const int n_DOF);
60
61ss_vect<tps> tp_S(const int n_DOF, const ss_vect<tps> &A);
62
63void get_dnu(const ss_vect<tps> &A, double dnu[]);
64
65ss_vect<tps> get_A_CS(const ss_vect<tps> &A, double dnu[]);
66
67void get_twoJ(const int n_DOF, const ss_vect<double> &ps,
68              const ss_vect<tps> &A, double twoJ[]);
69
70double get_curly_H(const double alpha_x, const double beta_x,
71                   const double eta_x, const double etap_x);
72
73double get_eps_x(void);
74
75void GetEmittance(const int Fnum, const bool prt);
76
77void prt_lat(const char *fname, const int Fnum, const bool all);
78
79void prt_chrom_lat(void);
80
81void prt_cod(const char *file_name, const int Fnum, const bool all);
82
83void prt_beampos(const char *file_name);
84
85void CheckAlignTol(const char *OutputFile);
86
87void misalign_rms_elem(const int Fnum, const int Knum,
88                       const double dx_rms, const double dy_rms,
89                       const double dr_rms, const bool new_rnd);
90
91void misalign_sys_elem(const int Fnum, const int Knum,
92                       const double dx_sys, const double dy_sys,
93                       const double dr_sys);
94
95void misalign_rms_fam(const int Fnum,
96                      const double dx_rms, const double dy_rms,
97                      const double dr_rms, const bool new_rnd);
98
99void misalign_sys_fam(const int Fnum,
100                      const double dx_sys, const double dy_sys,
101                      const double dr_sys);
102
103void misalign_rms_type(const int type,
104                       const double dx_rms, const double dy_rms,
105                       const double dr_rms, const bool new_rnd);
106
107void misalign_sys_type(const int type,
108                       const double dx_sys, const double dy_sys,
109                       const double dr_sys);
110
111void misalign_rms_girders(const int gs, const int ge,
112                          const double dx_rms, const double dy_rms,
113                          const double dr_rms, const bool new_rnd);
114
115void misalign_sys_girders(const int gs, const int ge,
116                          const double dx_sys, const double dy_sys,
117                          const double dr_sys);
118
119void LoadAlignTol(const char *AlignFile, const bool Scale_it,
120                  const double Scale, const bool new_rnd, const int k);
121
122void set_aper_elem(const int Fnum, const int Knum, 
123                   const double Dxmin, const double Dxmax, 
124                   const double Dymin, const double Dymax);
125
126void set_aper_fam(const int Fnum,
127                  const double Dxmin, const double Dxmax, 
128                  const double Dymin, const double Dymax);
129
130void set_aper_type(const int type, const double Dxmin, const double Dxmax, 
131                   const double Dymin, const double Dymax);
132
133void LoadApers(const char *AperFile, const double scl_x, const double scl_y);
134
135double get_L(const int Fnum, const int Knum);
136
137void set_L(const int Fnum, const int Knum, const double L);
138
139void set_L(const int Fnum, const double L);
140
141void set_dL(const int Fnum, const int Knum, const double dL);
142
143void get_bn_design_elem(const int Fnum, const int Knum,
144                        const int n, double &bn, double &an);
145
146void get_bnL_design_elem(const int Fnum, const int Knum,
147                         const int n, double &bnL, double &anL);
148
149void set_bn_design_elem(const int Fnum, const int Knum,
150                        const int n, const double bn, const double an);
151
152void set_dbn_design_elem(const int Fnum, const int Knum,
153                         const int n, const double dbn, const double dan);
154
155void set_bn_design_fam(const int Fnum,
156                       const int n, const double bn, const double an);
157
158void set_dbn_design_fam(const int Fnum,
159                        const int n, const double dbn, const double dan);
160
161void set_bnL_design_elem(const int Fnum, const int Knum,
162                         const int n, const double bnL, const double anL);
163
164void set_dbnL_design_elem(const int Fnum, const int Knum,
165                         const int n, const double dbnL, const double danL);
166
167void set_bnL_design_fam(const int Fnum,
168                        const int n, const double bnL, const double anL);
169
170void set_dbnL_design_fam(const int Fnum,
171                         const int n, const double dbnL, const double danL);
172
173void set_bnL_design_type(const int type,
174                         const int n, const double bnL, const double anL);
175
176void set_bnL_sys_elem(const int Fnum, const int Knum,
177                      const int n, const double bnL, const double anL);
178
179void set_bnL_sys_fam(const int Fnum,
180                     const int n, const double bnL, const double anL);
181
182void set_bnL_sys_type(const int type,
183                      const int n, const double bnL, const double anL);
184
185void set_bnL_rms_elem(const int Fnum, const int Knum,
186                      const int n, const double bnL, const double anL,
187                      const bool new_rnd);
188
189void set_bnL_rms_fam(const int Fnum,
190                     const int n, const double bnL, const double anL,
191                     const bool new_rnd);
192
193void set_bnL_rms_type(const int type,
194                      const int n, const double bnL, const double anL,
195                      const bool new_rnd);
196
197void set_bnr_sys_elem(const int Fnum, const int Knum,
198                      const int n, const double bnr, const double anr);
199
200void set_bnr_sys_fam(const int Fnum,
201                     const int n, const double bnr, const double anr);
202
203void set_bnr_sys_type(const int type,
204                      const int n, const double bnr, const double anr);
205
206void set_bnr_rms_elem(const int Fnum, const int Knum,
207                      const int n, const double bnr, const double anr,
208                      const bool new_rnd);
209
210void set_bnr_rms_fam(const int Fnum,
211                     const int n, const double bnr, const double anr,
212                     const bool new_rnd);
213
214void set_bnr_rms_type(const int type,
215                      const int n, const double bnr, const double anr,
216                      const bool new_rnd);
217
218double get_Wiggler_BoBrho(const int Fnum, const int Knum);
219
220void set_Wiggler_BoBrho(const int Fnum, const int Knum, const double BoBrhoV);
221
222void set_Wiggler_BoBrho(const int Fnum, const double BoBrhoV);
223
224void set_ID_scl(const int Fnum, const int Knum, const double scl);
225
226void SetFieldValues_fam(const int Fnum, const bool rms, const double r0,
227                        const int n, const double Bn, const double An,
228                        const bool new_rnd);                   
229                       
230void SetFieldValues_type(const int N, const bool rms, const double r0,
231                         const int n, const double Bn, const double An,
232                         const bool new_rnd);
233
234void SetFieldErrors(const char *name, const bool rms, const double r0,
235                    const int n, const double Bn, const double An,
236                    const bool new_rnd);
237                   
238char* get_prm(void);
239
240void LoadFieldErr(const char *FieldErrorFile, const bool Scale_it,
241                  const double Scale, const bool new_rnd);
242
243bool CorrectCOD(int n_orbit);
244
245void Align_BPMs(const int n);
246
247void get_bare();
248
249void get_dbeta_dnu(double m_dbeta[], double s_dbeta[],
250                   double m_dnu[], double s_dnu[]);
251
252bool CorrectCOD_N(const char *ae_file, const int n_orbit,
253                  const int n, const int k);
254
255void ini_skew_cor(const double deta_y_max);
256
257void corr_eps_y(void);
258
259void get_IDs(void);
260
261void set_IDs(const double scl);
262
263void reset_quads(void);
264
265void ini_ID_corr(void);
266
267// From Taiwan light source
268bool ID_corr0(void);
269
270bool ID_corr(const int N_calls, const int N_steps);
271
272void get_param(const char *param_file);
273
274void error_and_correction(const char *param_file, bool rd_lat);
275
276void prt_codcor_lat(void);
277
278void prt_beamsizes();
279
280double Touschek(const double Qb, const double delta_RF,
281              const double eps_x, const double eps_y,
282                const double sigma_delta, const double sigma_s);
283
284double Touschek(const double Qb, const double delta_RF,const bool consistent,
285                const double eps_x, const double eps_y,
286                const double sigma_delta, double sigma_s,
287                const int n_turn, const bool aper_on,
288                double sum_delta[][2], double sum2_delta[][2]);
289
290void IBS(const double Qb,
291         const double eps_SR[], double eps[],
292         const double alpha_z, const double beta_z);
293
294void rm_space(char *name);
295
296void get_bn(char file_name[], int n, const bool prt);
297
298double get_dynap(const double delta);
299
300double get_chi2(long int n, double x[], double y[], long int m, Vector b);
301
302void pol_fit(int n, double x[], double y[], int order, Vector &b,
303             double &sigma);
304
305void get_ksi2(const double d_delta);
306
307bool get_nu(const double Ax, const double Ay, const double delta,
308            double &nu_x, double &nu_y);
309
310void dnu_dA(const double Ax_max, const double Ay_max, const double delta);
311
312bool orb_corr(const int n_orbit);
313
314double get_code(CellType &Cell);
315
316void get_alphac(void);
317
318void get_alphac2(void);
319
320void bend_cal_Fam(const int Fnum);
321
322void bend_cal(void);
323
324double h_ijklm(const tps &h, const int i, const int j, const int k,
325               const int l, const int m);
326
327ss_vect<tps> get_A(const double alpha[], const double beta[],
328                   const double eta[], const double etap[]);
329
330
331void get_ab(const ss_vect<tps> &A,
332            double alpha[], double beta[], double eta[], double etap[]);
333
334void set_tune(const char file_name1[], const char file_name2[], const int n);
335
336void prt_H_long(const int n, const double phi_max, const double delta_max,
337                const double U0);
Note: See TracBrowser for help on using the repository browser.