Skip to content

Commit 540331e

Browse files
author
Emmanuel FARHI
committed
mcxtrace: fix fluo test example values
1 parent 51081d0 commit 540331e

3 files changed

Lines changed: 46 additions & 25 deletions

File tree

mcxtrace-comps/examples/Tests_samples/Test_FluoPowder/Test_FluoPowder.instr

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
*
66
* %Identification
77
* Written by: Emmanuel Farhi (emmanuel.farhi.synchrotron-soleil.fr)
8-
* Date: 2009
9-
* Origin: SOLEIL
10-
* Version: 1.0
8+
* Date: 2025
9+
* Origin: Synchrotron Soleil
10+
* Release: McXtrace 3.5
11+
* Version: $Revision$
1112
* %INSTRUMENT_SITE: Tests_samples
1213
*
1314
* Unit-test instrument for the FluoPowder sample component.
@@ -17,16 +18,16 @@
1718
* The default sample itself is an LaB6-powder.
1819
* The idea is to compare the fluorescence and diffraction patterns:
1920
* - index=1: use PowderN (no fluorescence)
20-
* - index=2: use Single_crystal (no fluorescence, very slow)
21+
* - index=2: use Single_crystal (no fluorescence, slower, powder mode)
2122
* - index=3: use FluoPowder (exact)
2223
* - index=4: use Fluorescence (no diffraction)
23-
* - index=5: use Fluorescence+PowderN (slow, under estimates contributions)
24+
* - index=5: use Fluorescence+PowderN (under estimates contributions)
2425
*
25-
* %Example: Test_FluoPowder.instr E0=15 index=1 Detector: Sph_mon_I=2.2379e-18
26+
* %Example: Test_FluoPowder.instr E0=15 index=1 Detector: Sph_mon_I=2.23119e-18
2627
* %Example: Test_FluoPowder.instr E0=15 index=2 Detector: Sph_mon_I=1.89376e-18
27-
* %Example: Test_FluoPowder.instr E0=15 index=3 Detector: Sph_mon_I=2.79924e-18
28+
* %Example: Test_FluoPowder.instr E0=15 index=3 Detector: Sph_mon_I=2.83261e-18
2829
* %Example: Test_FluoPowder.instr E0=15 index=4 Detector: Sph_mon_I=7.63749e-19
29-
* %Example: Test_FluoPowder.instr E0=15 index=5 Detector: Sph_mon_I=2.96629e-18
30+
* %Example: Test_FluoPowder.instr E0=15 index=5 Detector: Sph_mon_I=2.11144e-18
3031
*
3132
* %Parameters
3233
* E0: [keV] Source mean energy of xrays.
@@ -37,7 +38,7 @@
3738
*
3839
* %End
3940
*******************************************************************************/
40-
DEFINE INSTRUMENT Test_FluoPowder(E0=15, dE=1, L1=10, string material="LaB6.cif",
41+
DEFINE INSTRUMENT Test_FluoPowder(E0=15, dE=0.05, L1=10, string material="LaB6.cif",
4142
int index=3)
4243

4344
USERVARS %{
@@ -114,7 +115,7 @@ EXTEND %{
114115
scatt_type = type;
115116
%}
116117

117-
COMPONENT FluoG = COPY(Fluo)
118+
COMPONENT FluoG = COPY(Fluo)(p_interact=0.5)
118119
WHEN (index == 5)
119120
AT (0, 0, 0) RELATIVE sample_cradle
120121
GROUP FluPow

mcxtrace-comps/examples/Tests_samples/Test_Fluorescence/Test_Fluorescence.instr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Written by: E. Farhi (emmanuel.farhi@synchrotron-soleil.fr)
88
* Date: March '21
99
* Origin: Synchrotron SOLEIL
10-
* Release: McXtrace 1.7
10+
* Release: McXtrace 3.5
1111
* Version: $Revision$
1212
* %INSTRUMENT_SITE: Tests_samples
1313
*
@@ -17,7 +17,7 @@
1717
* This instrument simply has a lab source, a few monitors and a sample
1818
* to model material fluorescence, Compton and Rayleigh scattering.
1919
*
20-
* %Example: Test_Fluorescence.instr material=LaB6 -n1e5 Detector: emon_I=7.3e-13
20+
* %Example: Test_Fluorescence.instr material=LaB6 -n1e5 Detector: emon_I=1.04399e-12
2121
*
2222
* %Parameters
2323
* material: [str] Material file to use, e.g. chemical formulae "Pb2SnO4"

mcxtrace-comps/examples/Tests_samples/Test_SX/Test_SX.instr

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,55 +7,73 @@
77
* Written by: E. Farhi
88
* Date: Sept 26th 2019
99
* Origin: Synchrotron Soleil
10-
* Version: 0.2
10+
* Release: McXtrace 3.5
11+
* Version: $Revision$
1112
* %INSTRUMENT_SITE: Tests_samples
1213
*
1314
* Unit-test instrument for the Single_crystal sample component.
1415
*
1516
* Simply a model source illuminating a SX sample.
16-
* The sample itself is a Mo bulk crystal.
17+
* The default sample itself is a Mo bulk crystal.
1718
* The idea is to compare the fluorescence and diffraction patterns:
1819
* - index=1: use Single_crystal
1920
* - index=2: use FluoCrystal
2021
* - index=3: use Fluorescence+Single_crystal in a GROUP
2122
*
22-
* %Example: index=1 Detector: psd4pi_I=1.18843e-13
23-
* %Example: index=2 Detector: psd4pi_I=6.89931e-12
24-
* %Example: index=3 Detector: psd4pi_I=4.4547e-13
23+
* %Example: index=1 Detector: psd_Diff_I=2.29638e-13
24+
* %Example: index=2 Detector: psd_Diff_I=6.60276e-14
25+
* %Example: index=3 Detector: psd_Diff_I=1.19386e-13
2526
*
2627
* %Parameters
2728
* reflections: [str] List of powder reflections, LAU/CIF format.
2829
* index: [1] Index of the sample component to use. 1=Single_crystal, 2=FluoCrystal, 3=Fluorescence+Single_crystal in a GROUP
30+
* E0: [keV] Source mean energy of xrays.
31+
* dE: [keV] Source energy half spread of x-rays.
2932
*
3033
* %End
3134
*******************************************************************************/
3235

33-
DEFINE INSTRUMENT Test_SX(string reflections="Mo.lau", index=1)
36+
DEFINE INSTRUMENT Test_SX(string reflections="Mo.lau", int index=1, E0 = 7, dE = 6.9)
3437

3538
USERVARS %{
3639
int Stype;
3740
%}
3841

42+
INITIALIZE %{
43+
MPI_MASTER(
44+
switch (index) {
45+
case 1:
46+
printf("%s: Using Single_crystal (pure diffraction)\n", NAME_INSTRUMENT); break;
47+
case 2:
48+
printf("%s: Using FluoCrystal (fluorescence+diffraction)\n", NAME_INSTRUMENT); break;
49+
case 3:
50+
printf("%s: Using Fluorescence+Single_crystal in a GROUP (fluorescence+diffraction)\n", NAME_INSTRUMENT); break;
51+
default:
52+
exit(printf("%s: Unknown sample index %i. Use index=1-4.", NAME_INSTRUMENT, index));
53+
});
54+
%}
55+
3956
TRACE
4057
COMPONENT src = Source_flat(
4158
yheight = 1e-3, xwidth = 1e-3, dist = 10, focus_xw = 1e-3,
42-
focus_yh = 1e-3, E0 = 7, dE = 6.9)
59+
focus_yh = 1e-3, E0 = E0, dE = dE)
4360
AT (0, 0, 0) ABSOLUTE
4461

4562
COMPONENT sample_pos=Arm()
4663
AT (0, 0, 10) RELATIVE PREVIOUS
4764

4865
COMPONENT sample = Single_crystal(reflections=reflections, material_datafile="NULL",
49-
radius = .5e-4, yheight = 1e-3, mosaic=1)
66+
radius = .5e-4, yheight = 1e-3, mosaic=5)
5067
WHEN(index==1)
5168
AT (0, 0, 0) RELATIVE sample_pos
5269
EXTEND %{
5370
if(!SCATTERED) ABSORB;
54-
else Stype=DIFFRACTION;
71+
else if (hkl_info.type == 'c') Stype=DIFFRACTION;
72+
else Stype=FLUORESCENCE;
5573
%}
5674

5775
COMPONENT sampleF = FluoCrystal(material=reflections,
58-
radius = .5e-4, yheight = 1e-3, sx_mosaic=5)
76+
radius = .5e-4, yheight = 1e-3, mosaic=5)
5977
WHEN(index==2)
6078
AT (0, 0, 0) RELATIVE sample_pos
6179
EXTEND %{
@@ -64,7 +82,7 @@ EXTEND %{
6482
%}
6583

6684
COMPONENT FluoG = Fluorescence(
67-
radius = .5e-4, yheight = 1e-3, material=reflections)
85+
radius = .5e-4, yheight = 1e-3, material=reflections, p_interact=0.5)
6886
WHEN (index == 3)
6987
AT (0, 0, 0) RELATIVE sample_pos
7088
GROUP FluSX
@@ -77,8 +95,10 @@ WHEN (index == 3)
7795
AT (0, 0, 0) RELATIVE sample_pos
7896
GROUP FluSX
7997
EXTEND %{
80-
if (SCATTERED) Stype=DIFFRACTION;
81-
else ABSORB;
98+
if (SCATTERED) {
99+
if (hkl_info.type == 'c') Stype=DIFFRACTION;
100+
else Stype=FLUORESCENCE;
101+
} else ABSORB;
82102
%}
83103

84104
COMPONENT psd4pi = PSD_monitor_4PI(

0 commit comments

Comments
 (0)