Skip to content

Commit dbb18d8

Browse files
authored
Merge pull request #2941 from mccode-dev/2026-10-mirror-curved-fixes
McXtrace Mirror_curved: follow-up to #2936 (miss handling, instrument repairs, new targets)
2 parents 1c723c8 + f64d8d7 commit dbb18d8

19 files changed

Lines changed: 102 additions & 88 deletions

File tree

‎mcxtrace-comps/examples/MAXIV/MAXIV_Bloch/MAXIV_Bloch.instr‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* P2 parameters are used when the strain of the beamline is the FOI, i.e what happens when the distances change.
2121
*
2222
* %Example: E0=0.03 dE=0 undK=0 Nper=187 zm_mirror1=14 theta_mirror1=3 R0_M1=1 zm_mirror2=2 R0_M2=1 grating_mode=0 zm_mirror3=1 theta_mirror3=3 R0_M3=1 zm_ExitSlit=9 xwidth_ExSlit=0.005 yheight_ExSlit=0.005 zm_mirror4=19 theta_mirror4=3 R0_M4=1 SourceChoice=0 cff=2.25 m=3 Exitslit_yshift=2 Detector: M4Before_e_monitor_I=5.64942e-20
23-
* %Example: E0=0.6 Detector: M4Before_e_monitor_I=1.80435e-21
23+
* %Example: E0=0.6 Detector: M4Before_e_monitor_I=2.6528e-21
2424
*
2525
* %Parameters:
2626
* E0: [keV] The central energy to sample from source model.

‎mcxtrace-comps/examples/SOLEIL/SOLEIL_CRISTAL/SOLEIL_CRISTAL.instr‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* modelled; hutch diagnostics such as xbpm, beam imagers and attenuators are
2626
* omitted for simplicity.
2727
*
28-
* %Example: CRISTAL_E0=12 Detector: CRISTAL_detector_diffraction_I=700000.0
28+
* %Example: CRISTAL_E0=12 Detector: CRISTAL_detector_diffraction_I=6.2037e+05
2929
*
3030
* %Parameters
3131
* CRISTAL_E0: [keV] Central energy of the beam
@@ -91,7 +91,13 @@ INITIALIZE
9191
"%s: ERROR: Si(111) can not reflect CRISTAL_E0=%g keV (valid range ~5-30 keV). Aborting.\n",
9292
NAME_INSTRUMENT, CRISTAL_E0));
9393

94-
CRISTAL_DCM_theta = asin(sin_theta)*RAD2DEG;
94+
CRISTAL_DCM_theta = asin(sin_theta);
95+
// refraction shifts the Si(111) reflection above the kinematic Bragg angle by 2*delta/sin(2 theta);
96+
// with the narrow source band the DCM would otherwise only pass rays ~20 urad off axis
97+
double lambda = 12.398/CRISTAL_E0*1e-10; // [m]
98+
double n_e = 14*8/(5.4309e-10*5.4309e-10*5.4309e-10); // Si electron density [1/m^3]
99+
double delta = 2.8179403e-15*lambda*lambda*n_e/(2*PI);
100+
CRISTAL_DCM_theta = (CRISTAL_DCM_theta + 2*delta/sin(2*CRISTAL_DCM_theta))*RAD2DEG;
95101
}
96102

97103
MPI_MASTER(

‎mcxtrace-comps/examples/SOLEIL/SOLEIL_DIFFABS/SOLEIL_DIFFABS.instr‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ INITIALIZE
7575

7676
// DCM
7777
{
78-
double DM= 5.4909; // Si d-spacing
78+
double DM= 5.4309; // Si d-spacing
7979
double d = DM/sqrt(3); // <111> reflection |<111>|=3
8080
DIFFABS_dcm_gap = 0.01; // gap between the 2 monochromator crystals
8181

‎mcxtrace-comps/examples/SOLEIL/SOLEIL_DISCO/SOLEIL_DISCO.instr‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* 5306.77,5738.39,6151.91,6565.99,6979.47,7395.13,7786.17,8199.52,
1919
* 8631.53,9051.46,9483.21,9913.98,10299.5 }
2020
*
21-
* %Example: DISCO_grazing_angle_one=22.5 -n 1e5 Detector: DISCO_second_HFP_I=1.445e+16
21+
* %Example: DISCO_grazing_angle_one=22.5 -n 1e5 Detector: DISCO_second_HFP_I=1.104e+16
2222
*
2323
* %Parameters
2424
* DISCO_grazing_angle_one: [deg] Mirrors M1/M2 rotation angle

‎mcxtrace-comps/examples/SOLEIL/SOLEIL_GALAXIES/SOLEIL_GALAXIES.instr‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
* - M2B focus: 75 x 35 um^2 FWHM (H x V), ~6e13 ph/s @ 8 keV
4949
* - KB focus: 14 x 9 um^2 FWHM (open sec. slits), 5x7 um^2 (30x30 um^2 slits)
5050
*
51-
* %Example: GALAXIES_E0=10 Detector: GALAXIES_mon_dcm_xy_I=6.05992e+12
51+
* %Example: GALAXIES_E0=10 Detector: GALAXIES_mon_dcm_xy_I=1.1407e+19
5252
*
5353
* %Parameters
5454
* GALAXIES_E0: [keV] Nominal energy (2.3 - 12).
@@ -138,7 +138,7 @@ INITIALIZE
138138
%{
139139
{
140140
// --- DCM Si(111) Bragg angle from GALAXIES_E0
141-
double DM = 5.4909; // Si d-spacing
141+
double DM = 5.4309; // Si d-spacing
142142
double d111 = DM/sqrt(3);
143143
double sin_theta = 2*PI/E2K/GALAXIES_E0 / 2 / d111;
144144
if (fabs(sin_theta) >= 1)

‎mcxtrace-comps/examples/SOLEIL/SOLEIL_LUCIA/SOLEIL_LUCIA.instr‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ DECLARE
4747
INITIALIZE
4848
%{
4949
{
50-
double DM= 5.4909; // Si d-spacing
50+
double DM= 5.4309; // Si d-spacing
5151
double d = DM/sqrt(3); // <111> reflection |<111>|=3
5252
LUCIA_dcm_gap = 0.02; // gap between the 2 monochromator crystals
5353

‎mcxtrace-comps/examples/SOLEIL/SOLEIL_NANOSCOPIUM/SOLEIL_NANOSCOPIUM.instr‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* 154.961 | Mirror KB2 (elliptic) : horizontal focus
3434
* 155.140 | Nano-probe 2
3535
*
36-
* %Example: NANO_E0=11 Detector: NANO_e_dcm_out_I=4.09492e+10
36+
* %Example: NANO_E0=11 Detector: NANO_e_dcm_out_I=9.8902e+10
3737
*
3838
* %Parameters
3939
* NANO_E0 [keV] Energy selected at the Undulator.

‎mcxtrace-comps/examples/SOLEIL/SOLEIL_PSICHE/SOLEIL_PSICHE.instr‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ DECLARE
5353
INITIALIZE
5454
%{
5555
{
56-
double DM= 5.4909; // Si d-spacing
56+
double DM= 5.4309; // Si d-spacing
5757
double d = DM/sqrt(3); // <111> reflection |<111>|=3
5858
PSICHE_dcm_gap = 0.02; // gap between the 2 monochromator crystals
5959
PSICHE_dcm_scatter = PSICHE_DCM_present;

‎mcxtrace-comps/examples/SOLEIL/SOLEIL_PUMA/SOLEIL_PUMA.instr‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* spectroscopy (XANES), X-ray diffraction (XRD), and
2121
* X-ray-excited optical luminescence spectroscopy (XEOL)
2222
*
23-
* %Example: PUMA_E0=10 Detector: PUMA_mon_sample_e_I=1.82885e+12
23+
* %Example: PUMA_E0=10 -n 1e7 Detector: PUMA_mon_sample_e_I=1.2410e+11
2424
*
2525
* %Parameters
2626
* PUMA_E0: [keV] Central energy selected by the DCM. Set to 0 to derive it from PUMA_DCM_theta.
@@ -67,7 +67,7 @@ INITIALIZE
6767
{
6868
// HFM mirror
6969
double p_HFM = 21.0;
70-
PUMA_HFM_radius = 2*p_HFM*PUMA_HFM_focal / ((p_HFM+PUMA_HFM_focal) * (sin(PUMA_HFM_angle*DEG2RAD)));
70+
PUMA_HFM_radius = 2*p_HFM*PUMA_HFM_focal / ((p_HFM+PUMA_HFM_focal) * (sin(PUMA_HFM_angle/2*DEG2RAD))); // grazing angle is half the deflection
7171

7272
// DCM
7373
double DM = 5.4309;
@@ -94,11 +94,11 @@ INITIALIZE
9494

9595
// KB VFM
9696
double p_KB_VFM = 62.515, q_KB_VFM = 0.785;
97-
PUMA_KB_VFM_radius = 2*p_KB_VFM*q_KB_VFM / ((p_KB_VFM+q_KB_VFM) * (sin(PUMA_KB_angle*DEG2RAD)));
97+
PUMA_KB_VFM_radius = 2*p_KB_VFM*q_KB_VFM / ((p_KB_VFM+q_KB_VFM) * (sin(PUMA_KB_angle/2*DEG2RAD)));
9898

9999
// KB HFM
100100
double p_KB_HFM = 62.975, q_KB_HFM = 0.325;
101-
PUMA_KB_HFM_radius = 2*p_KB_HFM*q_KB_HFM / ((p_KB_HFM+q_KB_HFM) * (sin(PUMA_KB_angle*DEG2RAD)));
101+
PUMA_KB_HFM_radius = 2*p_KB_HFM*q_KB_HFM / ((p_KB_HFM+q_KB_HFM) * (sin(PUMA_KB_angle/2*DEG2RAD)));
102102
}
103103
%}
104104

@@ -284,7 +284,7 @@ COMPONENT PUMA_mirror_KB_VFM = Mirror_curved(
284284
width = 0.04, coating = PUMA_KB_coating // Rh or B4C
285285
)
286286
AT(0, 0, 0)RELATIVE PUMA_KB_VFM_rotated
287-
ROTATED (0, 0, 0) RELATIVE PUMA_KB_VFM_rotated
287+
ROTATED (0, 0, -90) RELATIVE PUMA_KB_VFM_rotated // Mirror_curved deflects in its XZ plane: roll it to focus vertically
288288
EXTEND %{
289289
if (!SCATTERED) ABSORB;
290290
%}
@@ -345,7 +345,7 @@ AT (0, 0, 0) RELATIVE PREVIOUS
345345

346346
/* -------------------------------------------------- Sample */
347347
COMPONENT PUMA_sample_location = Arm()
348-
AT (-7.88e-5, 0.002366 , (63.3 - 62.975)) RELATIVE PREVIOUS
348+
AT (0, 0, (63.3 - 62.975)) RELATIVE PREVIOUS
349349

350350
// Monitors
351351
COMPONENT PUMA_mon_sample_xy = PSD_monitor(

‎mcxtrace-comps/examples/SOLEIL/SOLEIL_PX1/SOLEIL_PX1.instr‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
* - Electron beam sizes are nominal SOLEIL short straight section values
8888
* (beta_x=2.19 m, beta_y=1.09 m, emittance 3.74 nm rad, 1% coupling).
8989
*
90-
* %Example: PX1_E0=12.67 Detector: PX1_sample_monitor_I=1.232e+20
90+
* %Example: PX1_E0=12.67 Detector: PX1_sample_monitor_I=1.8992e+21
9191
*
9292
* %Parameters
9393
* PX1_E0: [keV] Energy selected at the Undulator (reference energy 12.67 keV, standard range 6.5-15 keV).
@@ -213,14 +213,14 @@ COMPONENT PX1_vfm = Mirror_curved(
213213
width=0.1,
214214
radius=PX1_vfm_radius)
215215
AT (0,0,0) RELATIVE PX1_vfm_location
216-
ROTATED (0,-PX1_mirror_grazing_angle,0) RELATIVE PX1_vfm_in_xz_plane
216+
ROTATED (0,-PX1_mirror_grazing_angle*RAD2DEG,0) RELATIVE PX1_vfm_in_xz_plane
217217
EXTEND %{
218218
flag_vfm=SCATTERED;
219219
%}
220220

221221
COMPONENT PX1_vfm_takeoff = COPY(PX1_vfm_location)
222222
AT (0,0,0) RELATIVE PX1_vfm_in_xz_plane
223-
ROTATED (-2*PX1_mirror_grazing_angle, 0, 0) RELATIVE PX1_vfm_location
223+
ROTATED (-2*PX1_mirror_grazing_angle*RAD2DEG, 0, 0) RELATIVE PX1_vfm_location
224224

225225
// KB 2nd mirror: horizontal focusing, at 1.95 m from the sample
226226
COMPONENT PX1_hfm_location = COPY(PX1_vfm_location)
@@ -232,14 +232,14 @@ COMPONENT PX1_hfm = Mirror_curved(
232232
width=0.1,
233233
radius=PX1_hfm_radius)
234234
AT (0,0,0) RELATIVE PX1_hfm_location
235-
ROTATED (0,-PX1_mirror_grazing_angle,0) RELATIVE PX1_hfm_location
235+
ROTATED (0,-PX1_mirror_grazing_angle*RAD2DEG,0) RELATIVE PX1_hfm_location
236236
EXTEND %{
237237
flag_hfm=SCATTERED;
238238
%}
239239

240240
COMPONENT PX1_hfm_takeoff = COPY(PX1_vfm_location)
241241
AT (0,0,0) RELATIVE PX1_hfm_location
242-
ROTATED (0,-2*PX1_mirror_grazing_angle,0) RELATIVE PX1_hfm_location
242+
ROTATED (0,-2*PX1_mirror_grazing_angle*RAD2DEG,0) RELATIVE PX1_hfm_location
243243

244244
// Sample ----------------------------------------------------------------------
245245
// We centre the beam after the KB. Sample position (SG) at 23.846 m.

0 commit comments

Comments
 (0)