1 | !Example script showing usage of tracking with PTC |
---|
2 | !author: Piotr Skowronski (CERN) |
---|
3 | ! examples/ptc_accel/track/track.ptc.madx |
---|
4 | |
---|
5 | option,-echo; |
---|
6 | option,-info; |
---|
7 | |
---|
8 | LQL := 0.220; ! length of QL |
---|
9 | LQS := 0.124; ! length of QS |
---|
10 | CAVLENGTH := 2.4; |
---|
11 | QL : QUADRUPOLE, L=LQL; ! QL quadrupole |
---|
12 | QS : QUADRUPOLE, L=LQS; ! QS quadrupole |
---|
13 | |
---|
14 | !****** define the regular linac cell |
---|
15 | |
---|
16 | TCAV : TWCAVITY, L=CAVLENGTH, VOLT=14.0d0, LAG=0.d0/360., FREQ=3000.; |
---|
17 | |
---|
18 | ds_ql : drift, l=0.25; ! short drift between quads in Daniels design |
---|
19 | ds_trip : drift, l=(3.34-CAVLENGTH)/2.; ! long drift between quads in Daniels design |
---|
20 | cell_mrk : marker; |
---|
21 | cell_q1 : marker; |
---|
22 | cell_q3 : marker; |
---|
23 | beforecav : marker; |
---|
24 | bc : marker; |
---|
25 | aftercav : marker; |
---|
26 | k_ls1 := -1.53125*.56/LQL; ! weaker foc. |
---|
27 | k_ls2 := 1.53125/LQL; ! weaker foc. |
---|
28 | quad_l1 : quadrupole, l=LQL, k1=k_ls1; |
---|
29 | quad_l2 : quadrupole, l=LQL/2, k1=k_ls2; |
---|
30 | LDLS :=(LQL-LQS)/2.; ! half L difference of QL and QS |
---|
31 | dls : DRIFT, L=LDLS; ! 0.048 m |
---|
32 | |
---|
33 | ctfcell : line=( quad_l2,ds_ql,quad_l1,cell_q1,ds_trip ,cell_mrk, |
---|
34 | beforecav, |
---|
35 | TCAV, |
---|
36 | aftercav, |
---|
37 | ds_trip,cell_q3,quad_l1,ds_ql,quad_l2); |
---|
38 | |
---|
39 | |
---|
40 | ctf : line=(2*ctfcell); |
---|
41 | |
---|
42 | ! calculate Twiss parameters for regular cell structure |
---|
43 | beam, PARTICLE=ELECTRON, ENERGY=0.02d0; |
---|
44 | |
---|
45 | |
---|
46 | USE, period=ctf; |
---|
47 | |
---|
48 | |
---|
49 | ptc_create_universe; |
---|
50 | ptc_create_layout, model=1, method=6, nst=20, exact=false, closed_layout=false; |
---|
51 | |
---|
52 | ptc_setswitch, debuglevel=0, nocavity=false, |
---|
53 | maxacceleration=true, exact_mis=true, time=false, |
---|
54 | totalpath=false, fringe=true; |
---|
55 | |
---|
56 | |
---|
57 | |
---|
58 | PTC_OBSERVE, place=ctf$end; |
---|
59 | |
---|
60 | |
---|
61 | !random set of particles distributed evenly on grid in x (every 0.2mm) and t (every 1 deg from -30 to 30 deg) |
---|
62 | tno = 0; |
---|
63 | nt0 = 20; |
---|
64 | |
---|
65 | while (tno < nt0) |
---|
66 | { |
---|
67 | |
---|
68 | t0 = 0.000277777*(tno-(nt0-1)/2.0); |
---|
69 | |
---|
70 | xpos = 0; |
---|
71 | nxpos = 20; |
---|
72 | |
---|
73 | while (xpos < nxpos) |
---|
74 | { |
---|
75 | x0 = 0.001*(xpos-(nxpos-1)/2.0); |
---|
76 | |
---|
77 | ptc_start, x=x0, px=0.0, y=0.0, py=0.0, t=t0; |
---|
78 | xpos = xpos + 1; |
---|
79 | } |
---|
80 | tno = tno + 1; |
---|
81 | } |
---|
82 | |
---|
83 | PTC_OBSERVE, place=ctf$end; |
---|
84 | ptc_trackline, turns=1, onetable; |
---|
85 | |
---|
86 | |
---|
87 | ptc_track_end; |
---|
88 | |
---|
89 | |
---|
90 | |
---|
91 | ptc_end; |
---|
92 | stop; |
---|
93 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
94 | ! SSSSS TTTTT OOO PPP |
---|
95 | ! S T O O P P |
---|
96 | ! SSSSS T O O PPP |
---|
97 | ! S T O O P |
---|
98 | ! SSSSS T OOO P |
---|
99 | ! |
---|
100 | |
---|