!---|----1----|----2----|----3----|----4----|----5----|----6----|----7----|---8 !Option, warn,info,echo,thin_foc=false; Option, warn,info,echo; System,"rm -rf temp"; System,"mkdir temp"; Title, "LHC 6.5 thin lens lattice with errors and correction using MADX"; !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++; ! TARGET TUNE; !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++; QX0 = 64.280; QY0 = 59.310; !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++; ! TARGET CHROMATICITY ; !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++; QPRIME = 2.0; !---------------------------------------------------------------; ! CALL IN SELECTION, SEQUENCE and OPTICS FILES; !---------------------------------------------------------------; Option, -echo,warn,info; SU=1.0; Title, "Thin lens Optics for the LHC 6.4 lattice with MADX"; Option, -echo, info; !call, file = "../share/LHC/LHCRing/V6.503/V6.5.seq"; !call, file = "../share/LHC/LHCRing/V6.503/V6.5.thin.inj.str"; call, file = "V6.5.seq"; call, file = "V6.5.thin.inj.str"; call, file = "slice_new.madx"; ! switch crossing angles ON on_x1x5 := 1; on_x2 := 1; on_x8 := 1; Beam, particle = proton, sequence=lhcb1, energy = 450.0, NPART=1.05E11, sige= 4.5e-4 ; use,sequence=lhcb1; makethin,sequence=lhcb1; !save,beam,sequence=lhcb1,file="version3_00_00"; option,warn,echo; Use, period=lhcb1; select, flag=twiss, clear; select, flag=twiss, pattern="IP\.*",column=name,s,betx,bety,alfx,alfy; TWISS,sequence=lhcb1; SEEDSYS = 1; SEEDRAN = 1; !call, file = 'errors/0210'; !call, file = '0210'; call, file = '0507'; !b11gM_MBX := -0.01449; ! change reported to the MEB 8.11.2002 !call, file = 'errors/MB_newerr.madx'; ! ask Stephane !call, file = "errors/Esubroutines.madx"; !call, file = 'MB_newerr.madx'; ! ask Stephane call, file = "Esubroutines.madx"; !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ! SET THE MAGNETIC IMPERFECTIONS !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ! Select the magnets to be perturbed (only those selected are set) ON_MB = 1; !Main and Disp. Suppr. dipoles (MB); ON_MBXR = 0; !Separator: RHIC single channel dipoles (MBX, MBRS); ON_MBR = 0; !Separator: RHIC 2-1 dipoles (MBRT); ON_MBW = 0; !Separator: single channel (MBXW) and 2-1 warm (MBW) dipoles ; ON_MQ = 0; !Arc (MQ),DS (MQML, MQM, MQMC) quads; ON_MQIP = 0; !Insertion 2-1 Quadrupoles (MQ, MQML, MQM); ON_MQTL = 0; !DS trim (MQTL, MQT) and arc tune shift (MQT) quads; ON_MQR = 0; !Single aperture RF/quadrupoles(MQR, MQRL); ON_MQX = 0; !Low-Beta (MQX) and Low-Beta long quadrupoles (MQXL); ON_MQY = 0; !Wide aperture quadrupoles(MQY); ON_MQW = 0; !Warm quadrupoles (MQW); ON_XSPOOL = 0;!Inner triplet correctors, alignment; ON_CORR = 0;!Activating the Triplet corrector magnets; ! Select the multipole orders of the perturbations (all multipoles are set to ON_BDOT = 0 ; ! do not take into account ramp induced errors; ON_PERS = 1 ; ! enable persistent current errors; ON_A1s = 0 ; ON_A1r = 0 ; ON_B1s = 0 ; ON_B1r = 0; ON_A2s = 0 ; ON_A2r = 0 ; ON_B2s = 0 ; ON_B2r = 0; 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; !--------------------------------------------------------------- option,-info; !call, file = "errors/Efcompb1.madx"; call, file = "Efcompb1.madx"; option,echo,info,warn; select, flag=twiss, clear; select, flag=twiss, pattern="IP\.*",column=name,s,betx,bety,alfx,alfy; TWISS,sequence=lhcb1; option,-echo,-info,warn; !call, file = "errors/MB.measurementsb1.fix.madx";! Simulate the magnet measurements call, file = "MB.measurementsb1.fix.madx";! Simulate the magnet measurements option,-echo,info,warn; !------------------------------------------------------------------------ ! Correct the average B3 using the 'MAGNETIC MEASUREMENTS' ! with the b3 spool-piece families !------------------------------------------------------------------------ N_MCS = 154; ! number of sextupole spoole piece elements KCS.A12B1 := -b3sum_mb.12 /N_MCS / l.MCS; KCS.A23B1 := -b3sum_mb.23 /N_MCS / l.MCS; KCS.A34B1 := -b3sum_mb.34 /N_MCS / l.MCS; KCS.A45B1 := -b3sum_mb.45 /N_MCS / l.MCS; KCS.A56B1 := -b3sum_mb.56 /N_MCS / l.MCS; KCS.A67B1 := -b3sum_mb.67 /N_MCS / l.MCS; KCS.A78B1 := -b3sum_mb.78 /N_MCS / l.MCS; KCS.A81B1 := -b3sum_mb.81 /N_MCS / l.MCS; select, flag=twiss, clear; select, flag=twiss, pattern="IP\.*",column=name,s,betx,bety,alfx,alfy; TWISS,sequence=lhcb1; !------------------------------------------------------------------------ ! Correct the average B4 using the 'MAGNETIC MEASUREMENTS' ! with the b4 spool-piece families !------------------------------------------------------------------------ N_MCO = 77; ! number of octupole spoole piece elements KCO.A12B1 := -b4sum_mb.12 /N_MCO / l.MCO; KCO.A23B1 := -b4sum_mb.23 /N_MCO / l.MCO; KCO.A34B1 := -b4sum_mb.34 /N_MCO / l.MCO; KCO.A45B1 := -b4sum_mb.45 /N_MCO / l.MCO; KCO.A56B1 := -b4sum_mb.56 /N_MCO / l.MCO; KCO.A67B1 := -b4sum_mb.67 /N_MCO / l.MCO; KCO.A78B1 := -b4sum_mb.78 /N_MCO / l.MCO; KCO.A81B1 := -b4sum_mb.81 /N_MCO / l.MCO; select, flag=twiss, clear; select, flag=twiss, pattern="IP\.*",column=name,s,betx,bety,alfx,alfy; TWISS,sequence=lhcb1; !------------------------------------------------------------------------ ! Correct the average B5 using the 'MAGNETIC MEASUREMENTS' ! with the b5 spool-piece families !------------------------------------------------------------------------ N_MCD = 77; ! number of decapole spoole piece elements KCD.A12B1 := -b5sum_mb.12 /N_MCD / l.MCD; KCD.A23B1 := -b5sum_mb.23 /N_MCD / l.MCD; KCD.A34B1 := -b5sum_mb.34 /N_MCD / l.MCD; KCD.A45B1 := -b5sum_mb.45 /N_MCD / l.MCD; KCD.A56B1 := -b5sum_mb.56 /N_MCD / l.MCD; KCD.A67B1 := -b5sum_mb.67 /N_MCD / l.MCD; KCD.A78B1 := -b5sum_mb.78 /N_MCD / l.MCD; KCD.A81B1 := -b5sum_mb.81 /N_MCD / l.MCD; select, flag=twiss, clear; select, flag=twiss, pattern="IP\.*",column=name,s,betx,bety,alfx,alfy; TWISS,sequence=lhcb1; !--------------------------------------------------------------- ! Adjust the chromaticity for Beam-1 !--------------------------------------------------------------- Title, " Chromaticity correction"; match,sequence=lhcb1; global, dQ1=QPRIME,dQ2=QPRIME; vary, name=KSF.B1, step=0.00001; vary, name=KSD.B1, step=0.00001; lmdif, tolerance=1.0E-7, calls=100; endmatch; value, KSF.B1; value, KSD.B1; !--------------------------------------------------------------- ! Adjust the tune for Beam-1 !--------------------------------------------------------------- match,sequence=lhcb1; constraint,sequence=lhcb1,range=#e,mux=QX0,muy=QY0; vary, name=KQTF.B1, step=1.0E-6; vary, name=KQTD.B1, step=1.0E-6; lmdif,calls=5000,tolerance=1.e-21; endmatch; value, KQTF.B1; value, KQTD.B1; VRF400=16; select, flag=twiss, clear; select, flag=twiss, pattern="IP\.*",column=name,s,betx,bety,alfx,alfy; TWISS,sequence=lhcb1; emit; !sixtrack, radius=rr; PTC_CREATE_UNIVERSE; PTC_CREATE_LAYOUT,model=2,method=6,nst=1; SELECT, flag=ptc_twiss, clear; SELECT, flag=ptc_twiss, column=name,s,beta11,mu1,mu2,mu3; ptc_twiss,closed_orbit,icase=6,file="twiss_lhc",summary_file="summaryMomentumCompaction"; ! jluc select_ptc_normal, dq1,dq2; ptc_normal,closed_orbit,normal,icase=5,no=2; write, table=normal_results,file="normal_results"; stop;