1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
|
/*******************************************************************************
* Instrument: Unittest_SPLIT
*
* %I
* Written by: Peter Willendrup
* Date: Oct 28th, 2021
* Origin: DTU
* %INSTRUMENT_SITE: Tests_grammar
*
* SPLIT unittest including samples
*
* %D
* SPLIT unittest.
*
* One unit of intensity is emitted from a 1x1 m.
*
*
* %Example: SAMPLE=1 SPLITS=1 Detector: PSD_I=1
* %Example: SAMPLE=1 SPLITS=10 Detector: PSD_I=10
* %Example: SAMPLE=1 SPLITS=100 Detector: PSD_I=100
* %Example: SAMPLE=2 SPLITS=1 Detector: PSD_I=1
* %Example: SAMPLE=2 SPLITS=10 Detector: PSD_I=10
* %Example: SAMPLE=2 SPLITS=100 Detector: PSD_I=100
* %Example: SAMPLE=3 SPLITS=1 Detector: PSD_I=0.999001
* %Example: SAMPLE=3 SPLITS=1 Detector: PSD_transmission_I=0.00071068
* %Example: SAMPLE=3 SPLITS=1 Detector: PSD_scattered_I=0.00182805
* %Example: SAMPLE=3 SPLITS=10 Detector: PSD_I=9.99001
* %Example: SAMPLE=3 SPLITS=10 Detector: PSD_transmission_I=0.007122
* %Example: SAMPLE=3 SPLITS=10 Detector: PSD_scattered_I=0.0183156
* %Example: SAMPLE=3 SPLITS=100 Detector: PSD_I=99.9001
* %Example: SAMPLE=3 SPLITS=100 Detector: PSD_transmission_I=0.070845
* %Example: SAMPLE=3 SPLITS=100 Detector: PSD_scattered_I=0.182056
*
* %P
* SPLITS: [1] Number of SPLIT to do
* Pp0: [1] Dummy input parameter used internally
*
* %L
* <reference/HTML link>
*
* %E
*******************************************************************************/
DEFINE INSTRUMENT Unittest_SPLIT_sample(int SAMPLE=1, int SPLITS=10, Pp0=1)
DECLARE
%{
%}
USERVARS
%{
%}
INITIALIZE
%{
Pp0=1.0/mcget_ncount();
%}
TRACE
COMPONENT Arm = Arm()
AT (0,0,0) ABSOLUTE
EXTEND %{
// position x in one of 100 bins
x = randpm1()*0.0005;
y = randpm1()*0.0005;
if ( INSTRUMENT_GETPAR(SAMPLE) == 3) {
vz=200+rand01()*4400;
} else
vz= 2200;
p = 1;
%}
SPLIT SPLITS COMPONENT Slit = Arm()
AT (0,0,0) ABSOLUTE
COMPONENT Incoh = Incoherent(radius=0.01,focus_r=1, target_z=1)
WHEN (SAMPLE==1) AT (0,0,0.1) RELATIVE Slit
EXTEND %{
if(!SCATTERED) ABSORB;
p = INSTRUMENT_GETPAR(Pp0);
%}
COMPONENT Powder = PowderN(radius=0.01,reflections="Al.lau",p_inc=0.01,p_transmit=0.01)
WHEN (SAMPLE==2) AT (0,0,0.1) RELATIVE Slit
EXTEND %{
if(!SCATTERED) ABSORB;
p = INSTRUMENT_GETPAR(Pp0);
%}
COMPONENT SX = Single_crystal(radius=0.01,reflections="Al.lau",mosaic=20,order=1)
WHEN (SAMPLE==3) AT (0,0,0.1) RELATIVE Slit
EXTEND %{
if(!SCATTERED) ABSORB;
p = INSTRUMENT_GETPAR(Pp0);
%}
COMPONENT PSD = PSD_monitor_4PI(radius=1, filename="splits", nx=100, ny=100, restore_neutron=1)
AT (0,0,0) RELATIVE Incoh
COMPONENT PSD_transmission = PSD_monitor(xwidth=0.01, yheight=0.01, filename="splits_transmission", nx=100, ny=100, restore_neutron=1)
AT (0,0,0.1) RELATIVE Incoh
COMPONENT detector_direction_1 = Arm()
AT (0,0,0) RELATIVE Incoh
ROTATED (0, 29.65, 0) RELATIVE Incoh
COMPONENT detector_direction_2 = Arm()
AT (0,0,0) RELATIVE Incoh
ROTATED (26.3, 0, 0) RELATIVE detector_direction_1
COMPONENT PSD_scattered = PSD_monitor(xwidth=0.02, yheight=0.02, filename="splits_scattered", nx=100, ny=100, restore_neutron=1)
AT (0,0,0.5) RELATIVE detector_direction_2
FINALLY
%{
%}
END
|