!Example script showing usage of tracking with PTC !author: Piotr Skowronski (CERN) ! examples/ptc_accel/track/track.ptc.madx option,-echo; option,-info; LQL := 0.220; ! length of QL LQS := 0.124; ! length of QS CAVLENGTH := 2.4; QL : QUADRUPOLE, L=LQL; ! QL quadrupole QS : QUADRUPOLE, L=LQS; ! QS quadrupole !****** define the regular linac cell TCAV : TWCAVITY, L=CAVLENGTH, VOLT=14.0d0, LAG=0.d0/360., FREQ=3000.; ds_ql : drift, l=0.25; ! short drift between quads in Daniels design ds_trip : drift, l=(3.34-CAVLENGTH)/2.; ! long drift between quads in Daniels design cell_mrk : marker; cell_q1 : marker; cell_q3 : marker; beforecav : marker; bc : marker; aftercav : marker; k_ls1 := -1.53125*.56/LQL; ! weaker foc. k_ls2 := 1.53125/LQL; ! weaker foc. quad_l1 : quadrupole, l=LQL, k1=k_ls1; quad_l2 : quadrupole, l=LQL/2, k1=k_ls2; LDLS :=(LQL-LQS)/2.; ! half L difference of QL and QS dls : DRIFT, L=LDLS; ! 0.048 m ctfcell : line=( quad_l2,ds_ql,quad_l1,cell_q1,ds_trip ,cell_mrk, beforecav, TCAV, aftercav, ds_trip,cell_q3,quad_l1,ds_ql,quad_l2); ctf : line=(2*ctfcell); ! calculate Twiss parameters for regular cell structure beam, PARTICLE=ELECTRON, ENERGY=0.02d0; USE, period=ctf; ptc_create_universe; ptc_create_layout, model=1, method=6, nst=20, exact=false, closed_layout=false; ptc_setswitch, debuglevel=0, nocavity=false, maxacceleration=true, exact_mis=true, time=false, totalpath=false, fringe=true; PTC_OBSERVE, place=ctf$end; !random set of particles distributed evenly on grid in x (every 0.2mm) and t (every 1 deg from -30 to 30 deg) tno = 0; nt0 = 20; while (tno < nt0) { t0 = 0.000277777*(tno-(nt0-1)/2.0); xpos = 0; nxpos = 20; while (xpos < nxpos) { x0 = 0.001*(xpos-(nxpos-1)/2.0); ptc_start, x=x0, px=0.0, y=0.0, py=0.0, t=t0; xpos = xpos + 1; } tno = tno + 1; } PTC_OBSERVE, place=ctf$end; ptc_trackline, turns=1, onetable; ptc_track_end; ptc_end; stop; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! SSSSS TTTTT OOO PPP ! S T O O P P ! SSSSS T O O PPP ! S T O O P ! SSSSS T OOO P !