Project

General

Profile

110428_get_mad_lat.txt

Kyle Hazelwood, 01/15/2015 11:48 AM

 
1
*+042811 MEM:get_mad_lat
2
- read MAD twiss tape output text file
3
-- all markers, complete ring
4
-- MAD data header, the last number is total number of markers 
5
SUN SunO   TWISS30/10/0910.48.28 SUN   m       1       F   12269
6
-- MAD data for a marker
7
VMONVP329               0.000000 0.000000000E+00 0.000000000E+00 0.000000000E+00
8
 0.000000000E+00 0.000000000E+00 0.000000000E+00 0.000000000E+00 0.000000000E+00
9
-2.127613800E+00 3.014526159E+01 1.838865211E-01-1.265177970E+00-6.992423526E-02
10
 2.178419598E+00 4.308621760E+01 1.374446278E-01-2.857228699E-03 1.728676514E-03
11
 3.897222524E-03 1.426788131E-04 6.405196205E-03-3.118477193E-04 2.408762976E+01
12

    
13
-- 25 fields for each marker,5 lines to read 
14
-- read line 0: sscanf(buf,"%s%f%e%e%e",name,&q[0],&q[1],&q[2],&q[3]);
15
-- read other 4 lines: use "%e%e%e%e%e\n"
16
-- field0 is name(4 character as type, rest as name) 
17
-- field1-24, goto array q[0:23]
18
-- q[9:13] alpha_x,beta_x,psi_x,disp_x,d_prime_x
19
-- q[14:18] alpha_y,beta_y,psi_y,disp_y,d_prime_y
20
-- q[23] s_value between two markers
21

    
22
-- 'standard' database record
23
typedef struct {
24
   int		rid; /*0 for MI,1 for RR */
25
   int		fid;
26
   int  slot;
27
   char element_name[MY_MODEL_ELEMENT_NAME_LENGTH];
28
   char element_type[MY_MODEL_LATTICE_NAME_LENGTH];   /* See above */
29
   float s_value;   /* Units of meters  */
30
   float alpha_x;   /* unitless */
31
   float beta_x;    /* Units of meters  */
32
   float psi_x;     /* units of radians */
33
   float disp_x;    /* units of meters  */
34
   float d_prime_x; /* unitless */
35
   float alpha_y;   /* unitless */
36
   float beta_y;    /* units of meters  */
37
   float psi_y;     /* units of radians */
38
   float disp_y;    /* units of meters  */
39
   float d_prime_y; /* unitless */
40
 }  __attribute__((packed)) /* Added by the PACKINATOR(tm) */ LA_REC_STRUCT;