|
60 | 60 | 'on_sep8h': collider.vars['on_sep8h']._value, |
61 | 61 | 'on_sep8v': collider.vars['on_sep8v']._value, |
62 | 62 | } |
63 | | - |
64 | | -res = collider.match( |
| 63 | +tw0 = collider.twiss(lines=['lhcb1', 'lhcb2']) |
| 64 | +opt = collider.match( |
65 | 65 | solver_options={'n_bisections': 3, 'min_step': 1e-5, 'n_steps_max': 200}, |
66 | 66 | ele_start=['e.ds.l8.b1', 's.ds.r8.b2'], |
67 | 67 | ele_stop=['s.ds.r8.b1', 'e.ds.l8.b2'], |
68 | | - twiss_init='preserve', |
| 68 | + twiss_init=tw0, ele_init=xt.START, |
69 | 69 | lines=['lhcb1', 'lhcb2'], |
70 | 70 | vary=[ |
71 | 71 | # Knobs to control the separation |
|
95 | 95 | collider.vars['on_sep8v'] = knob_values_before_ideal_matching['on_sep8v'] |
96 | 96 |
|
97 | 97 | # Leveling with crossing angle and bump rematching |
| 98 | +tw0 = collider.twiss(lines=['lhcb1', 'lhcb2']) |
98 | 99 | collider.match( |
99 | 100 | solver_options={'n_bisections': 3, 'min_step': 0, 'n_steps_max': 200}, |
100 | 101 | lines=['lhcb1', 'lhcb2'], |
101 | 102 | ele_start=['e.ds.l8.b1', 's.ds.r8.b2'], |
102 | 103 | ele_stop=['s.ds.r8.b1', 'e.ds.l8.b2'], |
103 | | - twiss_init='preserve', |
| 104 | + twiss_init=tw0, ele_init=xt.START, |
104 | 105 | targets=[ |
105 | 106 | # Luminosity |
106 | 107 | xt.TargetLuminosity( |
|
111 | 112 | # Separation plane inclination |
112 | 113 | xt.TargetSeparationOrthogonalToCrossing(ip_name='ip8'), |
113 | 114 | # Preserve crossing angle |
114 | | - xt.TargetList(['px', 'py'], at='ip8', line='lhcb1', value='preserve', tol=1e-7, scale=1e3), |
115 | | - xt.TargetList(['px', 'py'], at='ip8', line='lhcb2', value='preserve', tol=1e-7, scale=1e3), |
| 115 | + xt.TargetList(['px', 'py'], at='ip8', line='lhcb1', value=tw0, tol=1e-7, scale=1e3), |
| 116 | + xt.TargetList(['px', 'py'], at='ip8', line='lhcb2', value=tw0, tol=1e-7, scale=1e3), |
116 | 117 | # Close the bumps |
117 | | - xt.TargetList(['x', 'y'], at='s.ds.r8.b1', line='lhcb1', value='preserve', tol=1e-5, scale=1), |
118 | | - xt.TargetList(['px', 'py'], at='s.ds.r8.b1', line='lhcb1', value='preserve', tol=1e-5, scale=1e3), |
119 | | - xt.TargetList(['x', 'y'], at='e.ds.l8.b2', line='lhcb2', value='preserve', tol=1e-5, scale=1), |
120 | | - xt.TargetList(['px', 'py'], at='e.ds.l8.b2', line='lhcb2', value='preserve', tol=1e-5, scale=1e3), |
| 118 | + xt.TargetList(['x', 'y'], at='s.ds.r8.b1', line='lhcb1', value=tw0, tol=1e-5, scale=1), |
| 119 | + xt.TargetList(['px', 'py'], at='s.ds.r8.b1', line='lhcb1', value=tw0, tol=1e-5, scale=1e3), |
| 120 | + xt.TargetList(['x', 'y'], at='e.ds.l8.b2', line='lhcb2', value=tw0, tol=1e-5, scale=1), |
| 121 | + xt.TargetList(['px', 'py'], at='e.ds.l8.b2', line='lhcb2', value=tw0, tol=1e-5, scale=1e3), |
121 | 122 | ], |
122 | 123 | vary=[ |
123 | 124 | xt.VaryList(['on_sep8h', 'on_sep8v'], step=1e-4), # to control separation |
|
213 | 214 |
|
214 | 215 | # Match separation to 2 sigmas in IP2 |
215 | 216 | print(f'Knobs before matching: on_sep2 = {collider.vars["on_sep2"]._value}') |
| 217 | +tw0 = collider.twiss(lines=['lhcb1', 'lhcb2']) |
216 | 218 | collider.match( |
217 | 219 | lines=['lhcb1', 'lhcb2'], |
218 | 220 | ele_start=['e.ds.l2.b1', 's.ds.r2.b2'], |
219 | 221 | ele_stop=['s.ds.r2.b1', 'e.ds.l2.b2'], |
220 | | - twiss_init='preserve', |
| 222 | + twiss_init=tw0, ele_init=xt.START, |
221 | 223 | targets=[ |
222 | 224 | xt.TargetSeparation(ip_name='ip2', separation_norm=3, plane='x', tol=1e-4, |
223 | 225 | nemitt_x=nemitt_x, nemitt_y=nemitt_y), |
224 | 226 | # Preserve crossing angle |
225 | | - xt.TargetList(['px', 'py'], at='ip2', line='lhcb1', value='preserve', tol=1e-7, scale=1e3), |
226 | | - xt.TargetList(['px', 'py'], at='ip2', line='lhcb2', value='preserve', tol=1e-7, scale=1e3), |
| 227 | + xt.TargetList(['px', 'py'], at='ip2', line='lhcb1', value=tw0, tol=1e-7, scale=1e3), |
| 228 | + xt.TargetList(['px', 'py'], at='ip2', line='lhcb2', value=tw0, tol=1e-7, scale=1e3), |
227 | 229 | # Close the bumps |
228 | | - xt.TargetList(['x', 'y'], at='s.ds.r2.b1', line='lhcb1', value='preserve', tol=1e-5, scale=1), |
229 | | - xt.TargetList(['px', 'py'], at='s.ds.r2.b1', line='lhcb1', value='preserve', tol=1e-5, scale=1e3), |
230 | | - xt.TargetList(['x', 'y'], at='e.ds.l2.b2', line='lhcb2', value='preserve', tol=1e-5, scale=1), |
231 | | - xt.TargetList(['px', 'py'], at='e.ds.l2.b2', line='lhcb2', value='preserve', tol=1e-5, scale=1e3), |
| 230 | + xt.TargetList(['x', 'y'], at='s.ds.r2.b1', line='lhcb1', value=tw0, tol=1e-5, scale=1), |
| 231 | + xt.TargetList(['px', 'py'], at='s.ds.r2.b1', line='lhcb1', value=tw0, tol=1e-5, scale=1e3), |
| 232 | + xt.TargetList(['x', 'y'], at='e.ds.l2.b2', line='lhcb2', value=tw0, tol=1e-5, scale=1), |
| 233 | + xt.TargetList(['px', 'py'], at='e.ds.l2.b2', line='lhcb2', value=tw0, tol=1e-5, scale=1e3), |
232 | 234 | ], |
233 | 235 | vary= |
234 | 236 | [xt.Vary('on_sep2', step=1e-4), |
|
0 commit comments