! dipole and quad  fringe effects not included
! linac end focus defocus effects included

q: charge,total=1e-9

! **** Section A ****
! The first chicane
b1A: sbend, l=0.2, angle=0.1226460, e1= 0, e2=0.1226460
b2A: sbend, l=0.2, angle=-0.1226460, e1=-0.1226460, e2=0
b3A: sbend, l=0.2, angle=-0.1226460, e1= 0, e2=-0.1226460
b4A: sbend, l=0.2, angle=0.1226460, e1=0.1226460,e2=0

LdA: drif, l=2.5
L23: drif, l=1.5

chicane1: line=(b1A,LdA,b2A,L23,b3A,LdA,b4A)

!**** Section B ****
! lattice line is {667*cavity1  chicane2  1333*cavity2}
cavity1: rfca,freq=2856e6,l=0.3,volt=1.89653e6,phase=81.3591,change_p0=1,end1_focus=1,end2_focus=1,linearize=1
cavity2: rfca,freq=2856e6,l=0.3,volt=4.31428e6,phase=142.523,change_p0=1,end1_focus=1,end2_focus=1,linearize=1

b1B: sbend, l=0.2, angle=0.0971366, e1= 0, e2=0.0971366
b2B: sbend, l=0.2, angle=-0.0971366, e1=-0.0971366, e2=0
b3B: sbend, l=0.2, angle=-0.0971366, e1= 0, e2=-0.0971366
b4B: sbend, l=0.2, angle=0.0971366, e1=0.0971366,e2=0

LdB: drif, l=2.5
!L23: drif, l=1.5

chicane2: line=(b1B,LdB,b2B,L23,b3B,LdB,b4B)

!######################################
w1: watch,filename="%s.w1",mode=coord
w2: watch,filename="%s.w2",mode=coord
w3: watch,filename="%s.w3",mode=coord
w4: watch,filename="%s.w4",mode=coord
w5: watch,filename="%s.w5",mode=coord
w6: watch,filename="%s.w6",mode=coord

!**** beam line ****
lineA: line=(q,w1,chicane1,w2)
lineB: line=(667*cavity1,w3,chicane2,w4,1333*cavity2,w5)

lineAB: line=(lineA,lineB)
