source: PSPA/madxPSPA/tests/test-ptc-trackline-2/test-ptc-trackline-2.madx @ 430

Last change on this file since 430 was 430, checked in by touze, 11 years ago

import madx-5.01.00

File size: 2.3 KB
Line 
1!Example script showing usage of tracking with PTC
2!author: Piotr Skowronski (CERN)
3! examples/ptc_accel/track/track.ptc.madx
4
5option,-echo;
6option,-info;
7
8LQL := 0.220; ! length of QL
9LQS := 0.124; ! length of QS
10CAVLENGTH := 2.4;
11QL  : QUADRUPOLE, L=LQL; ! QL quadrupole
12QS  : QUADRUPOLE, L=LQS; ! QS quadrupole
13
14!****** define the regular linac cell
15
16TCAV      : TWCAVITY,  L=CAVLENGTH, VOLT=14.0d0, LAG=0.d0/360., FREQ=3000.;
17
18ds_ql     : drift, l=0.25;    ! short drift between quads in Daniels design
19ds_trip   : drift, l=(3.34-CAVLENGTH)/2.; ! long drift between quads in Daniels design
20cell_mrk  : marker;
21cell_q1   : marker;
22cell_q3   : marker;
23beforecav : marker;
24bc : marker;
25aftercav  : marker;
26k_ls1     := -1.53125*.56/LQL; ! weaker foc.
27k_ls2     :=  1.53125/LQL;     ! weaker foc.
28quad_l1   : quadrupole, l=LQL,   k1=k_ls1;
29quad_l2   : quadrupole, l=LQL/2, k1=k_ls2;
30LDLS      :=(LQL-LQS)/2.; ! half L difference of QL and QS
31dls       : DRIFT, L=LDLS; ! 0.048 m
32
33ctfcell  : 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
40ctf   : line=(2*ctfcell);
41
42! calculate Twiss parameters for regular cell structure
43beam, PARTICLE=ELECTRON, ENERGY=0.02d0;
44
45
46USE, period=ctf;
47
48
49ptc_create_universe;
50ptc_create_layout, model=1, method=6, nst=20, exact=false, closed_layout=false;
51
52ptc_setswitch, debuglevel=0, nocavity=false,
53               maxacceleration=true, exact_mis=true, time=false,
54               totalpath=false, fringe=true;
55
56
57
58PTC_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)
62tno = 0;
63nt0 = 20;
64
65while (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
83PTC_OBSERVE, place=ctf$end;
84ptc_trackline, turns=1, onetable;
85
86
87ptc_track_end;
88
89
90
91ptc_end;
92stop;
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
Note: See TracBrowser for help on using the repository browser.