Changing the quad settings
facet home → Profile Monitor → LI20 → SPEC LINE GUI
New SPECLINE GUI (Fall 2023):
- Leave big "Dipole" switch in "Without" setting (dipole energy is not adjusted)
- Set "Z Object" to the position where the beam should be imaged, e.g., the center of the PB
- Set "Z Image" to the position of the screen, e.g., z=2015.26 for DTOTR
- Note: You can select from a few preassigned beamline locations with the dropdown menu, or, select "custom"
- M12, M34: transfer-matrix elements (set both to 0 for re-imaging)
- Energy: determines where the focus is
- Press "Calculate and Trim"
Assumptions of this script:
- Magnet length: 1m
LEFF_QS0 = 1; % [m]
LEFF_QS1 = 1; % [m]
LEFF_QS2 = 1; % [m] - Quad positions:
z_QS0 = 1996.98249; % [m], middle of quad
z_QS1 = 1999.206615; % [m], middle of quad
z_QS2 = 2001.431049; % [m], middle of quad - Other important positions:
1993.27370 # [m] FILS
1992.82000 # [m] PIC_CENT
2015.62984 # [m] LFOV
2017.52998 # [m] PRDMP
...
...
Changing the dipole settings
- It is important that the e-beam never passes through the CsI array (see Dump-table electron diagnostics)
- Call ACR for changing the main dipole
- ATTENTION: there is no possibility to calculate without actually changing the magnets. There will be no elog entry! (2023, Nov 17)
- Note - the "Trim" button does not do anything yet.
Dump table motors and filters:
IP2 Table on LI20 Profile monitor page:
Provides easier access to the dump table flippers (DTOTR1/2, LFOV) and motors.
Scripts for dealing with the spectrometer
- FACET_EspecImaging.m (Alex Knetsch
...
- , Nov 13, 2023)
...
...
keep_KQS0_eq_KQS2=1; % set to one if QS0=QS2
E0 = 10;
isok = 1;
if(nargin < 4); m12_req = 0; end;
if(nargin < 5); m34_req = 0; end;
% initial guesses (2012 values)
KQS0_0 = -0.3;
KQS1_0 = 0.23;
KQS2_0 = -0.3;
...
- .m (FACET MATLAB TNG repo, Nov 13, 2023): script to calculate quad settings
- espec_trim.py (Sebastian Meuren, Nov 13, 2023)
Assumptions made in this script:
- Magnet length: 1m
LEFF_QS0 = 1; % [m]
LEFF_QS1 = 1; % [m]
LEFF_QS2 = 1; % [m]
OO = zeros(2,2);
d1 = (z_QS0-LEFF_QS0/2) - z_ob ;
d2 = (z_QS1-LEFF_QS1/2) - (z_QS0+LEFF_QS0/2);
d3 = (z_QS2-LEFF_QS2/2) - (z_QS1+LEFF_QS1/2);
d4 = z_im - (z_QS2+LEFF_QS2/2);
M_01 = [1 d1; 0 1];
M4_01 = [M_01 OO; OO M_01];
M_02 = [1 d2; 0 1];
M4_02 = [M_02 OO; OO M_02];
M_03 = [1 d3; 0 1];
M4_03 = [M_03 OO; OO M_03];
M_04 = [1 d4; 0 1];
M4_04 = [M_04 OO; OO M_04];
options = optimset('TolX',1e-8);
if keep_KQS0_eq_KQS2
[fit_result, chi2] = fminsearch(@transportError_2, [KQS0_0 KQS1_0],options);
BDES0 = fit_result(1) * (E0+QS) * LEFF_QS0 / 0.0299792458;
BDES1 = fit_result(2) * (E0+QS) * LEFF_QS1 / 0.0299792458;
BDES2 = fit_result(1) * (E0+QS) * LEFF_QS2 / 0.0299792458;
else
[fit_result, chi2] = fminsearch(@transportError, [KQS0_0 KQS1_0 KQS2_0],options);
BDES0 = fit_result(1) * (E0+QS) * LEFF_QS0 / 0.0299792458;
BDES1 = fit_result(2) * (E0+QS) * LEFF_QS1 / 0.0299792458;
BDES2 = fit_result(3) * (E0+QS) * LEFF_QS2 / 0.0299792458;
end
...
BMAX = 385; % max value, from SCP
if(abs(BDES1) > BMAX || abs(BDES2) > BMAX || abs(BDES0) > BMAX)
isok = 0;
warning('solution is outside QS range');
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function chi2 = transportError(K)
% QS0 transport matrix
k = abs(K(1));
phi = LEFF_QS0*sqrt(k);
M_F = [cos(phi) (1/sqrt(k))*sin(phi)
-sqrt(k)*sin(phi) cos(phi)];
M_D = [cosh(phi) (1/sqrt(k))*sinh(phi)
sqrt(k)*sinh(phi) cosh(phi)];
M4_D1 = [M_D OO; OO M_F];
% QS1 transport matrix
k = abs(K(2));
phi = LEFF_QS1*sqrt(k);
M_F = [cos(phi) (1/sqrt(k))*sin(phi)
-sqrt(k)*sin(phi) cos(phi)];
M_D = [cosh(phi) (1/sqrt(k))*sinh(phi)
sqrt(k)*sinh(phi) cosh(phi)];
M4_F = [M_F OO; OO M_D];
% QS2 transport matrix
k = abs(K(3));
phi = LEFF_QS2*sqrt(k);
M_F = [cos(phi) (1/sqrt(k))*sin(phi)
-sqrt(k)*sin(phi) cos(phi)];
M_D = [cosh(phi) (1/sqrt(k))*sinh(phi)
sqrt(k)*sinh(phi) cosh(phi)];
M4_D2 = [M_D OO; OO M_F];
% dump line optics
M4 = M4_04*M4_D2*M4_03*M4_F*M4_02*M4_D1*M4_01;
chi2 = (M4(1,2)-m12_req)^2 + (M4(3,4)-m34_req)^2;
end
function chi2 = transportError_2(K)
% QS0 transport matrix
k = abs(K(1));
phi = LEFF_QS0*sqrt(k);
M_F = [cos(phi) (1/sqrt(k))*sin(phi)
-sqrt(k)*sin(phi) cos(phi)];
M_D = [cosh(phi) (1/sqrt(k))*sinh(phi)
sqrt(k)*sinh(phi) cosh(phi)];
M4_D1 = [M_D OO; OO M_F];
% QS1 transport matrix
k = abs(K(2));
phi = LEFF_QS1*sqrt(k);
M_F = [cos(phi) (1/sqrt(k))*sin(phi)
-sqrt(k)*sin(phi) cos(phi)];
M_D = [cosh(phi) (1/sqrt(k))*sinh(phi)
sqrt(k)*sinh(phi) cosh(phi)];
M4_F = [M_F OO; OO M_D];
% QS2 transport matrix
k = abs(K(1));
phi = LEFF_QS2*sqrt(k);
M_F = [cos(phi) (1/sqrt(k))*sin(phi)
-sqrt(k)*sin(phi) cos(phi)];
M_D = [cosh(phi) (1/sqrt(k))*sinh(phi)
sqrt(k)*sinh(phi) cosh(phi)];
M4_D2 = [M_D OO; OO M_F];
% dump line optics
M4 = M4_04*M4_D2*M4_03*M4_F*M4_02*M4_D1*M4_01;
chi2 = (M4(1,2)-m12_req)^2 + (M4(3,4)-m34_req)^2;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
end
Python code to reproduce MATLAB settings above (Nov 13, 2023)
...
- Quad positions:
z_QS0 = 1996.98249; % [m], middle of quad
...
- z_QS1 = 1999.206615; % [m], middle of quad
...
- z_QS2 = 2001.431049; % [m], middle of quad
...
- Other important positions:
1993.27370 # [m] FILS
...
- 1992.82000
...
- # [m] PIC_CENT
...
- 2015.62984 # [m]
...
q1d_pos = 1999.206615 # [m]
q1d_length = 1.00 # [m]
q1d_G = 1.0 # [T/m]
q2d_pos = 2001.431049 # [m]
q2d_length = 1.00 # [m]
q2d_G = 1.0 # [T/m]
...
- LFOV
2017.52998 # [m] PRDMP
...
def get_quad_matrix(length, G, eps):
# length: [m]
# G: [T/m]
# eps: [GeV]
# omega^2 = qGc^3/(\gamma mc^2)
# phi = \omega L /c
# sqrt((Tesla / meter) * (elementary charge ) * (speed of light)^3 / GeV)/ (speed of light)
# \approx 0.5475 (1/meter)
omegaoverc = np.sqrt(G/eps) * 0.5475 #[1/m]
phi = omegaoverc * length
return np.array([[np.cos(phi), (1.0/omegaoverc) * np.sin(phi)], [-omegaoverc * np.sin(phi), np.cos(phi)]])
def get_quad_matrix_h(length, G, eps):
# length: [m]
# G: [T/m]
# eps: [GeV]
omegaoverc = np.sqrt(G/eps) * 0.5475 #[1/m]
phi = omegaoverc * length
return np.array([[np.cosh(phi), (1.0/omegaoverc) * np.sinh(phi)], [omegaoverc * np.sinh(phi), np.cosh(phi)]])
...
#d1 = (z_QS0-LEFF_QS0/2) - z_ob ;
#d2 = (z_QS1-LEFF_QS1/2) - (z_QS0+LEFF_QS0/2);
#d3 = (z_QS2-LEFF_QS2/2) - (z_QS1+LEFF_QS1/2);
#d4 = z_im - (z_QS2+LEFF_QS2/2);
...
current = get_free_matrix(q0d_pos-q0d_length/2.0-xstart)
next = None
if(getx == True):
next = get_quad_matrix_h(q0d_length, G_out, eps)
else:
next = get_quad_matrix(q0d_length, G_out, eps)
current = np.matmul(next, current)
next = get_free_matrix((q1d_pos-q1d_length/2.0)-(q0d_pos+q0d_length/2.0))
current = np.matmul(next, current)
if(getx == True):
next = get_quad_matrix(q1d_length, G_in, eps)
else:
next = get_quad_matrix_h(q1d_length, G_in, eps)
current = np.matmul(next, current)
next = get_free_matrix((q2d_pos-q2d_length/2.0)-(q1d_pos+q1d_length/2.0))
current = np.matmul(next, current)
if(getx == True):
next = get_quad_matrix_h(q2d_length, G_out, eps)
else:
next = get_quad_matrix(q2d_length, G_out, eps)
current = np.matmul(next, current)
next = get_free_matrix(xend-(q2d_pos+q2d_length/2.0))
current = np.matmul(next, current)
return current
...
Quad PVs
- LI20:LGPS:3141:BACT
- LI20:LGPS:3261:BACT
- LI20:LGPS:3091:BACT
- Dipole: LI20:LGPS:3330:BACT
BPMs
- #BPM before IP: 3156
bpm_3156_z = 1991.29 - #BPM Q0: 3218
bpm_3218_z = 1997.77 - #BPM Q1: 3265
bpm_3265_z = 2000.0 - #BPM Q2: 3315
bpm_3315_z = 2002.22
Quad Scan functions
- Spec_Quad_E (change energy for which the imaging conditions are calculated)
- Spec_Quad_M12 (angle at object plane to position at image plane matrix element: horizontal axis)
- Spec_Quad_M34 (angle at object plane to position at image plane matrix element: vertical axis)
- Spec_Quad_zim (position of image plane)
- Spec_Quad_zob (position of object plane)
Changing the dipole settings
- It is important that the e-beam never passes through the CsI array (see Dump-table electron diagnostics)
BNDS_LI20_3330 scan function
for LFOV: 6 to 22. Never go higher than 22!
from scipy.optimize import fmin
...