! S. Fartoukh March 2012 ! General Sample job with or w/o beam-beam and with errors in collision for SLHCV3.1b ! !---|----1----|----2----|----3----|----4----|----5----|----6----|----7----|---8; Option, -warn,-info, -echo; !---------------------------------------------------------------; ! CALL IN SELECTION, MACRO's, SEQUENCE, BEAM, NRJ and OPTICS FILES; !---------------------------------------------------------------; call,file="macro.madx"; !Call some macro facilities !Call sequence V6.503 with finite length for the TAN REAL CONST l.TAN = 3.7 ;REAL CONST l.TANAL = l.TAN; REAL CONST l.TANAR = l.TAN;REAL CONST l.TANC = l.TAN; REAL CONST l.TCT = 1.0;REAL CONST l.TCTH = l.TCT;REAL CONST l.TCTVA = l.TCT; call,file="../share/LHC/LHCRing/V6.503/V6.5.seq"; !Install new triplet, D1 & corrector package call,file="slhc_sequence.madx"; !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ! RF multipoles installation !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ exec,crab_remove(A); exec,crab_remove(B); exec,crab_remove(C); call, file="crab_install_all.madx"; on_crab1 := 1; on_crab5 := 1; !Cycling w.r.t. to IP3 (mandatory to find closed orbit in collision in the presence of errors) seqedit,sequence=lhcb1;flatten;cycle,start=IP3;endedit; !Thin lens exec,myslice; !******************************************** mylhcbeam:=1 ;// LHC beam 1 (clockwise) !NRJ:= 450.0 ; // injection NRJ:= 7000.0 ; // collision !General switch to select collision (0/1) ON_COLLISION:=0; !General switch to install bb lens (0/1) ON_BB_SWITCH:=0; gamma_rel := NRJ/pmass; emittance_norm := 3.75e-6; epsx:=emittance_norm /gamma_rel; epsy:=emittance_norm /gamma_rel; !******************************************** tsplit= 2.0; !new tune split qx00 = 62.0; !integer h tune qy00 = 60.0; !integer v tune if (NRJ<4999.9999) { !Inj. optics in thin lens call,file="../share/LHC/LHCRing/SLHCV3.1b/opt_5500_5500thin.madx"; ! beta* [m]=5.5/10/5.5/10 in IR1/2/5/8 qx0 = 62.28; qy0 = 60.31; qprime = 2.0; Beam,particle=proton,sequence=lhcb1,energy=NRJ,sigt=0.130,bv= 1, NPART=1.15E11,sige=4.5e-4,ex=epsx,ey=epsy; }; if (NRJ>5000.0000) { call,file="../share/LHC/LHCRing/SLHCV3.1b/opt_0150_0150thin.madx"; ! beta*=15cm in IR1/5, beta*=10 m in IR2/8 qx0 = 62.31; qy0 = 60.32; qprime = 2.0; ON_QPP :=0; ! Correction of residual Q'' by MO's ON_DISP :=1; ! Correction of spurious dispersion Beam,particle=proton,sequence=lhcb1,energy=NRJ,sigt=0.075,bv= 1, NPART=1.15E11,sige=1.1e-4,ex=epsx,ey=epsy; }; !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++; ! Sequence & Beam selection !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++; if(mylhcbeam==1) {use, sequence=lhcb1;}; !!!!!!!!!!!!NO LONGER ANY "USE" AFTER THIS POINT !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++; ! Prepare nominal twiss tables !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++; ! Record actual Xschemes on0_x1=on_x1; on0_sep1=on_sep1; on0_x2=on_x2; on0_sep2=on_sep2; on0_alice=on_alice; on0_x5=on_x5; on0_sep5=on_sep5; on0_x8=on_x8; on0_sep8=on_sep8; on0_lhcb =on_lhcb; ! Switch off Xschemes on_x1:=0; on_sep1:=0; on_x2:=0; on_sep2:=0; on_alice:=0; on_x5:=0; on_sep5:=0; on_x8:=0; on_sep8:=0; on_lhcb :=0; twiss, table=nominal; // used by orbit correction beta.ip1=table(twiss,IP1,betx);value,beta.ip1; ! print nominal optics parameter at the MB, MQS and MSS for ! b2, b3, b4, b5, a2 and a3 correction select, flag=twiss, clear; select, flag=twiss,pattern=MB\. ,class=multipole,column=name,k0L,k1L,betx,bety,dx,mux,muy; select, flag=twiss,pattern=MQT\.14,class=multipole,column=name,k0L,k1L,betx,bety,dx,mux,muy; select, flag=twiss,pattern=MQT\.15,class=multipole,column=name,k0L,k1L,betx,bety,dx,mux,muy; select, flag=twiss,pattern=MQT\.16,class=multipole,column=name,k0L,k1L,betx,bety,dx,mux,muy; select, flag=twiss,pattern=MQT\.17,class=multipole,column=name,k0L,k1L,betx,bety,dx,mux,muy; select, flag=twiss,pattern=MQT\.18,class=multipole,column=name,k0L,k1L,betx,bety,dx,mux,muy; select, flag=twiss,pattern=MQT\.19,class=multipole,column=name,k0L,k1L,betx,bety,dx,mux,muy; select, flag=twiss,pattern=MQT\.20,class=multipole,column=name,k0L,k1L,betx,bety,dx,mux,muy; select, flag=twiss,pattern=MQT\.21,class=multipole,column=name,k0L,k1L,betx,bety,dx,mux,muy; select, flag=twiss,class=MQS ,column=name,k0L,k1L,betx,bety,dx,mux,muy; select, flag=twiss,class=MSS ,column=name,k0L,k1L,betx,bety,dx,mux,muy; twiss; ! print nominal optics parameter at the D1, MQX and triplet corrector ! for triplet correction select, flag=twiss, clear; select, flag=twiss, pattern=MQX , class=multipole, column=name,betx,bety,x,y; select, flag=twiss, pattern=MBX , class=multipole, column=name,betx,bety,x,y; select, flag=twiss, pattern=MBRC , class=multipole, column=name,betx,bety,x,y; select, flag=twiss, pattern=MBRD , class=multipole, column=name,betx,bety,x,y; select, flag=twiss, pattern=MQSX , column=name,betx,bety,x,y; select, flag=twiss, pattern=MCSX , column=name,betx,bety,x,y; select, flag=twiss, pattern=MCTX , column=name,betx,bety,x,y; select, flag=twiss, pattern=MCOSX , column=name,betx,bety,x,y; select, flag=twiss, pattern=MCOX , column=name,betx,bety,x,y; select, flag=twiss, pattern=MCSSX , column=name,betx,bety,x,y; select, flag=twiss, pattern=MCDX , column=name,betx,bety,x,y; select, flag=twiss, pattern=MCDSX , column=name,betx,bety,x,y; select, flag=twiss, pattern=MCTSX , column=name,betx,bety,x,y; twiss; !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ! Switch ON/OFF some multipole !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ !exec, ON_ALL_MULT; ON_LSF:=1; ! to be set to 0 if run is performed on BOINC. ON_A1s = 0 ; ON_A1r = 0 ; ON_B1s = 0 ; ON_B1r = 0; ON_A2s = 1 ; ON_A2r = 1 ; ON_B2s = 1 ; ON_B2r = 1; ON_A3s = 1 ; ON_A3r = 1 ; ON_B3s = 1 ; ON_B3r = 1; ON_A4s = 1 ; ON_A4r = 1 ; ON_B4s = 1 ; ON_B4r = 1; ON_A5s = 1 ; ON_A5r = 1 ; ON_B5s = 1 ; ON_B5r = 1; ON_A6s = 1 ; ON_A6r = 1 ; ON_B6s = 1 ; ON_B6r = 1; ON_A7s = 1 ; ON_A7r = 1 ; ON_B7s = 1 ; ON_B7r = 1; ON_A8s = 1 ; ON_A8r = 1 ; ON_B8s = 1 ; ON_B8r = 1; ON_A9s = 1 ; ON_A9r = 1 ; ON_B9s = 1 ; ON_B9r = 1; ON_A10s = 1; ON_A10r = 1; ON_B10s = 1; ON_B10r = 1; ON_A11s = 1; ON_A11r = 1; ON_B11s = 1; ON_B11r = 1; ON_A12s = ON_LSF; ON_A12r = ON_LSF; ON_B12s = ON_LSF; ON_B12r = ON_LSF; ON_A13s = ON_LSF; ON_A13r = ON_LSF; ON_B13s = ON_LSF; ON_B13r = ON_LSF; ON_A14s = ON_LSF; ON_A14r = ON_LSF; ON_B14s = ON_LSF; ON_B14r = ON_LSF; ON_A15s = ON_LSF; ON_A15r = ON_LSF; ON_B15s = ON_LSF; ON_B15r = ON_LSF; !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ! correct orbit distortion resulting from MB magnets !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ if((ON_A1S)^2+(ON_A1r)^2+(ON_B1S)^2+(ON_B1r)^2 >0) { exec, initial_micado(4); exec, initial_micado(4); }; !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ! apply field errors to all other magnets !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ! New IT/D1/D2/Q4/Q5 myseed=1; !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ! final orbit correction before applying crossing scheme !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ if((ON_A1S)^2+(ON_A1r)^2+(ON_B1S)^2+(ON_B1r)^2 >0) { exec, final_micado(0.004); }; ! end of orbit correction, now switch ON crossing scheme on_x1=on0_x1; on_sep1=on0_sep1; on_x2=on0_x2; on_sep2=on0_sep2; on_alice=on0_alice; on_x5=on0_x5; on_sep5=on0_sep5; on_x8=on0_x8; on_sep8=on0_sep8; on_lhcb =on0_lhcb; on_disp=on0_disp; value,on_x1,on_x2,on_x5,on_x8,on_sep1,on_sep2,on_sep5,on_sep8,on_alice,on_lhcb,on_disp; !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ! matching of orbit, tune and chromaticity !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ if(ON_COLLISION==0) {ON_BB_CHARGE:=1;}; ! W/o head-on Q and Q' are matched with bb !Rematch the Xscheme towards specified separation and Xange in IP1/2/5/8 call,file="../share/LHC/LHCRing/SLHCV3.1b/toolkit/rematchCOIP.madx"; !Rematch the CO in the arc for dispersion correction if(ON_DISP<>0) {call,file="../share/LHC/LHCRing/SLHCV3.1b/toolkit/rematchCOarc.madx";}; if(mylhcbeam==1) {kqtf=kqtf.b1;kqtd=kqtd.b1;kqtf.b1:=kqtf;kqtd.b1:=kqtd; ksf=ksf.b1;ksd=ksd.b1;ksf.b1:=ksf;ksd.b1:=ksd;}; if(mylhcbeam>1) {kqtf=kqtf.b2;kqtd=kqtd.b2;kqtf.b2:=kqtf;kqtd.b2:=kqtd; ksf=ksf.b2;ksd=ksd.b2;ksf.b2:=ksf;ksd.b2:=ksd;}; !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ! final twiss before tracking !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ON_BB_CHARGE:=1; b2:=114./abrho/3.; b3:=1260.*2./abrho/3.; b4:=1760.*6./abrho/3.; on_crab1 := 1; on_crab5 := 1; !/* if (NRJ<4999.9999) {VRF400:=8. ;LAGRF400.B1=0.5;LAGRF400.B2=0.;}; if (NRJ>5000.0000) {VRF400:=16.;LAGRF400.B1=0.5;LAGRF400.B2=0.;}; twiss; !emit; value, table(summ,q1); value, table(summ,q2); value, table(summ,dq1); value, table(summ,dq2); !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ! YIL inserted tracking !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ use, sequence= lhcb1; track, dump; start; run, turns= 400, ffile=20; endtrack; stop;