Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* Often used for detectors.
*
* %Example: Detector: abs_logger_1D_I=1.12609e-09
* %Example: Detector: abs_logger_1D_con_I=4.95914e-13
*
* %End
*******************************************************************************/
Expand Down Expand Up @@ -79,9 +80,23 @@ COMPONENT abs_logger_1D = Union_abs_logger_1D_space(
yheight=0.2, n=100,
filename="Union_abs_logger_1D_space.dat")
AT (0,0,0) RELATIVE geometry_center

// This logger will be affected by a conditional, impacts code path
COMPONENT abs_logger_1D_con = Union_abs_logger_1D_space(
yheight=0.2, n=100,
filename="Union_abs_logger_1D_space_con.dat")
AT (0,0,0) RELATIVE geometry_center

// Conditional that takes right part of transmitted beam
COMPONENT PSD_conditional = Union_conditional_PSD(
xwidth=0.1, yheight=0.2,
target_loggers="abs_logger_1D_con")
AT (-0.05,0,1.0) RELATIVE geometry_center

// Master at odd position to ensure that does not impact results
COMPONENT master = Union_master()
AT(0,0,0) RELATIVE geometry_center
AT(3, 0, -1) RELATIVE geometry_center
ROTATED(20, -5, 8) RELATIVE geometry_center

COMPONENT transmission = PSD_monitor(
xwidth=0.1, yheight=0.08, nx=200, ny=200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,26 @@ AT (-0.03,0,0.02) RELATIVE geometry_center
COMPONENT cone = Union_cone(radius_top=0.02, radius_bottom=0.055, yheight=0.09, priority=8, material_string="material")
AT (0.03,0,0.07) RELATIVE geometry_center

COMPONENT abs_logger_1D = Union_abs_logger_1D_space_event(
COMPONENT abs_logger_1D_space_event = Union_abs_logger_1D_space_event(
yheight=0.2, n=100, fake_event=1,
filename="Union_abs_logger_1D_space_event.dat")
AT (0,0,0) RELATIVE geometry_center

COMPONENT abs_logger_1D_space_event_con = Union_abs_logger_1D_space_event(
yheight=0.2, n=100, fake_event=1,
filename="Union_abs_logger_1D_space_event_con.dat")
AT (0,0,0) RELATIVE geometry_center

// Conditional that takes right part of transmitted beam
COMPONENT PSD_conditional = Union_conditional_PSD(
xwidth=0.1, yheight=0.2,
target_loggers="abs_logger_1D_space_event_con")
AT (-0.05,0,1.0) RELATIVE geometry_center

// Master at odd position to ensure that does not impact results
COMPONENT master = Union_master()
AT(0,0,0) RELATIVE geometry_center
AT (3, 0, -1) RELATIVE geometry_center
ROTATED (20, -5, 8) RELATIVE geometry_center

COMPONENT transmission = PSD_monitor(
xwidth=0.1, yheight=0.08, nx=200, ny=200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* time of absorption in a histogram.
*
* %Example: Detector: abs_logger_1D_space_tof_I=1.12682e-09
* %Example: Detector: abs_logger_1D_space_tof_con_I=5.38067e-13
*
* %End
*******************************************************************************/
Expand Down Expand Up @@ -53,9 +54,9 @@ COMPONENT Origin = Progress_bar()
AT (0,0,0) ABSOLUTE

COMPONENT source = Source_div(
xwidth=0.02, yheight=0.002,
focus_aw=0.01, focus_ah=0.01,
E0=10, dE=0.1)
xwidth=0.02, yheight=0.002,
focus_aw=0.01, focus_ah=0.01,
E0=10, dE=0.1)
AT (0,0,0) RELATIVE Origin

COMPONENT geometry_center = Arm()
Expand All @@ -74,17 +75,31 @@ COMPONENT cone = Union_cone(radius_top=0.02, radius_bottom=0.055, yheight=0.09,
AT (0.03,0,0.07) RELATIVE geometry_center

COMPONENT abs_logger_1D_space_tof = Union_abs_logger_1D_space_tof(
yheight=0.2, n=100,
time_min=0.0013, time_max=0.0022, time_bins=1000,
filename="Union_abs_logger_1D_space_tof.dat")
yheight=0.2, n=100,
time_min=0.0013, time_max=0.0022, time_bins=1000,
filename="Union_abs_logger_1D_space_tof.dat")
AT (0,0,0) RELATIVE geometry_center


COMPONENT abs_logger_1D_space_tof_con = Union_abs_logger_1D_space_tof(
yheight=0.2, n=100,
time_min=0.0013, time_max=0.0022, time_bins=1000,
filename="Union_abs_logger_1D_space_tof_con.dat")
AT (0,0,0) RELATIVE geometry_center

// Conditional that takes right part of transmitted beam
COMPONENT PSD_conditional = Union_conditional_PSD(
xwidth=0.1, yheight=0.2,
target_loggers="abs_logger_1D_space_tof_con")
AT (-0.05,0,1.0) RELATIVE geometry_center

// Master at odd position to ensure that does not impact results
COMPONENT master = Union_master()
AT(0,0,0) RELATIVE geometry_center
AT (3, 0, -1) RELATIVE geometry_center
ROTATED (20, -5, 8) RELATIVE geometry_center

COMPONENT transmission = PSD_monitor(
xwidth=0.1, yheight=0.08, nx=200, ny=200,
filename="PSD.dat", restore_neutron=1)
xwidth=0.1, yheight=0.08, nx=200, ny=200,
filename="PSD.dat", restore_neutron=1)
AT (0,0,1) RELATIVE geometry_center

COMPONENT stop = Union_stop()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
* both the standard view with measured and true wavelength on each axis, and the
* relative where they have been normalized and a value of 1 is expected.
*
* %Example: Detector: abs_logger_1D_space_tof_to_lambda_I=9.82157e-12
* %Example: Detector: abs_logger_1D_space_tof_to_lambda_relative_I=1.02297e-11
* %Example: Detector: abs_logger_1D_space_tof_to_lambda_I=6.67576e-11
* %Example: Detector: abs_logger_1D_space_tof_to_lambda_relative_I=6.6763e-11
* %Example: Detector: abs_logger_1D_space_tof_to_lambda_con_I=5.07195e-12
*
* %End
*******************************************************************************/
Expand Down Expand Up @@ -78,8 +79,8 @@ AT (-0.03,0,-0.01) RELATIVE geometry_center
COMPONENT cone = Union_cone(radius_top=0.02, radius_bottom=0.055, yheight=0.09, priority=8, material_string="material")
AT (0.03,0,0.02) RELATIVE geometry_center

COMPONENT cylinder = Union_cylinder(radius=0.02, yheight=0.8, priority=7, material_string="material")
AT (-1.0,0,0.0) RELATIVE geometry_center
COMPONENT cylinder = Union_cylinder(radius=0.03, yheight=0.8, priority=7, material_string="material")
AT (-0.5,0,0.0) RELATIVE geometry_center

COMPONENT abs_logger_1D_space_tof_to_lambda = Union_abs_logger_1D_space_tof_to_lambda(
yheight=0.8, yn=100,
Expand All @@ -99,16 +100,36 @@ COMPONENT abs_logger_1D_space_tof_to_lambda_relative = Union_abs_logger_1D_space
filename="Union_abs_logger_1D_space_tof_to_lambda_relative.dat",
relative_measured=1, relative_min=0.95, relative_max=1.05, relative_bins=100)
AT (0,0,0) RELATIVE cylinder

COMPONENT abs_logger_1D_space_tof_to_lambda_con = Union_abs_logger_1D_space_tof_to_lambda(
yheight=0.8, yn=100,
target_geometry="cylinder",
ref_component=-7,
source_sample_dist=10.0,
lambda_min=2.0, lambda_max=8.0, lambda_bins=200,
filename="Union_abs_logger_1D_space_tof_to_lambda_con.dat")
AT (0,0,0) RELATIVE cylinder

COMPONENT conditional_direction = Arm()
AT (0,0,0) RELATIVE geometry_center
ROTATED (0,-90,0) RELATIVE geometry_center

// Conditional in direction of cylinder
COMPONENT PSD_conditional = Union_conditional_PSD(
xwidth=0.1, yheight=1.0,
target_loggers="abs_logger_1D_space_tof_to_lambda_con")
AT (0,0,0.6) RELATIVE conditional_direction

// Master at odd position to ensure that does not impact results
COMPONENT master = Union_master()
AT(0,0,0) RELATIVE geometry_center
AT(3,0,-1) RELATIVE geometry_center
ROTATED(20,-5,8) RELATIVE geometry_center

COMPONENT transmission = PSD_monitor(
xwidth=0.1, yheight=0.08, nx=200, ny=200,
filename="PSD.dat", restore_neutron=1)
AT (0,0,1) RELATIVE geometry_center


COMPONENT stop = Union_stop()
AT (0,0,0) ABSOLUTE

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/*******************************************************************************
*
* McStas, neutron ray-tracing package
* Copyright (C) 1997-2008, All rights reserved
* Risoe National Laboratory, Roskilde, Denmark
* Institut Laue Langevin, Grenoble, France
*
* Instrument: Unit_test_abs_logger_1D_time
*
* %Identification
* Written by: Mads Bertelsen
* Date: April 2026
* Origin: ESS
* %INSTRUMENT_SITE: Tests_union
*
* Test of Union 1D time absorption logger
*
* %Description
* Test instrument for the Union 1D absorption logger component that can log
* absorbed intensity as a function of time.
*
* %Example: Detector: Union_abs_logger_1D_time_I=5.66453e-09
* %Example: Detector: Union_abs_logger_1D_time_con_I=2.80778e-12
*
* %End
*******************************************************************************/

DEFINE INSTRUMENT Unit_test_abs_logger_1D_time()

DECLARE
%{
%}

INITIALIZE
%{
%}

TRACE

COMPONENT init = Union_init()
AT (0,0,0) ABSOLUTE

COMPONENT incoherent = Incoherent_process(sigma=0.2, packing_factor=1, unit_cell_volume=66.4)
AT (0,0,0) ABSOLUTE

COMPONENT powder = Powder_process(reflections="Cu2MnAl.laz")
AT (0,0,0) ABSOLUTE

COMPONENT material = Union_make_material(my_absorption=4.0,
process_string="incoherent,powder")
AT (0,0,0) ABSOLUTE

COMPONENT Origin = Progress_bar()
AT (0,0,0) ABSOLUTE

COMPONENT source = Source_div(
xwidth=0.02, yheight=0.002,
focus_aw=0.01, focus_ah=0.01,
E0=10, dE=0.1)
AT (0,0,0) RELATIVE Origin

COMPONENT geometry_center = Arm()
AT (0,0,2.0) RELATIVE source

COMPONENT box = Union_box(xwidth=0.10, yheight=0.15, zdepth=0.03, priority=5, material_string="material")
AT (-0.03,0,-0.05) RELATIVE geometry_center

COMPONENT sphere = Union_sphere(radius=0.05, priority=6, material_string="material")
AT (0.03,0,-0.04) RELATIVE geometry_center

COMPONENT cylinder = Union_cylinder(radius=0.045, yheight=0.1, priority=7, material_string="material")
AT (-0.03,0,0.02) RELATIVE geometry_center

COMPONENT cone = Union_cone(radius_top=0.02, radius_bottom=0.055, yheight=0.09, priority=8, material_string="material")
AT (0.03,0,0.07) RELATIVE geometry_center

COMPONENT Union_abs_logger_1D_time = Union_logger_1D(
min_value=0.0013, max_value=0.0022, n1=200,
filename="Union_abs_logger_1D_time.dat")
AT (0,0,0) RELATIVE geometry_center

COMPONENT Union_abs_logger_1D_time_con = Union_logger_1D(
min_value=0.0013, max_value=0.0022, n1=200,
filename="Union_abs_logger_1D_time_con.dat")
AT (0,0,0) RELATIVE geometry_center

// Conditional that takes right part of transmitted beam
COMPONENT PSD_conditional = Union_conditional_PSD(
xwidth=0.1, yheight=0.2,
target_loggers="Union_abs_logger_1D_time_con")
AT (-0.05,0,1.0) RELATIVE geometry_center

// Master at odd position to ensure that does not impact results
COMPONENT master = Union_master()
AT (3, 0, -1) RELATIVE geometry_center
ROTATED (20, -5, 8) RELATIVE geometry_center

COMPONENT transmission = PSD_monitor(
xwidth=0.1, yheight=0.08, nx=200, ny=200,
filename="PSD.dat", restore_neutron=1)
AT (0,0,1) RELATIVE geometry_center

COMPONENT stop = Union_stop()
AT (0,0,0) ABSOLUTE

END
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* Test of absorption logger with basic geometry from Unit_test_loggers_base.
*
* %Example: Detector: Union_abs_logger_2D_space_zx_I=1.1258e-09
* %Example: Detector: Union_abs_logger_2D_space_zx_con_I=5.22667e-13
*
* %End
*******************************************************************************/
Expand Down Expand Up @@ -83,9 +84,23 @@ COMPONENT Union_abs_logger_2D_space_zy = Union_abs_logger_2D_space(
D_direction_2="y", D2_min=-0.1, D2_max=0.1, n2=200,
filename="Union_abs_logger_2D_space_zy.dat")
AT (0,0,0) RELATIVE geometry_center

COMPONENT Union_abs_logger_2D_space_zx_con = Union_abs_logger_2D_space(
D_direction_1="z", D1_min=-0.15, D1_max=0.15, n1=200,
D_direction_2="x", D2_min=-0.1, D2_max=0.1, n2=200,
filename="Union_abs_logger_2D_space_zx_con.dat")
AT (0,0,0) RELATIVE geometry_center

// Conditional that takes right part of transmitted beam
COMPONENT PSD_conditional = Union_conditional_PSD(
xwidth=0.1, yheight=0.2,
target_loggers="Union_abs_logger_2D_space_zx_con")
AT (-0.05,0,1.0) RELATIVE geometry_center

// Master at odd position to ensure that does not impact results
COMPONENT master = Union_master()
AT(0,0,0) RELATIVE geometry_center
AT (3, 0, -1) RELATIVE geometry_center
ROTATED (20, -5, 8) RELATIVE geometry_center

COMPONENT transmission = PSD_monitor(
xwidth=0.1, yheight=0.08, nx=200, ny=200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,20 @@ AT (0.03,0,0.07) RELATIVE geometry_center

COMPONENT Union_abs_logger_event = Union_abs_logger_event(filename="Union_abs_logger_event")
AT (0,0,0) RELATIVE geometry_center

COMPONENT Union_abs_logger_event_con = Union_abs_logger_event(filename="Union_abs_logger_event_con")
AT (0,0,0) RELATIVE geometry_center

// Conditional that takes right part of transmitted beam
COMPONENT PSD_conditional = Union_conditional_PSD(
xwidth=0.1, yheight=0.2,
target_loggers="Union_abs_logger_event_con")
AT (-0.05,0,1.0) RELATIVE geometry_center

// Master at odd position to ensure that does not impact results
COMPONENT master = Union_master()
AT(0,0,0) RELATIVE geometry_center
AT (3, 0, -1) RELATIVE geometry_center
ROTATED (20, -5, 8) RELATIVE geometry_center

COMPONENT transmission = PSD_monitor(
xwidth=0.1, yheight=0.08, nx=200, ny=200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* geometry, leaving the ray positions where they were.
*
* %Example: Detector: abs_logger_nD_I=1.58102e-09
* %Example: Detector: abs_logger_nD_con_I=2.11523e-12
*
* %End
*******************************************************************************/
Expand Down Expand Up @@ -76,9 +77,23 @@ COMPONENT abs_logger_nD = Union_abs_logger_nD(
options="preivous, y limits=[-0.1 0.1] bins=100",
filename="Union_abs_logger_nD.dat")
AT (0,0,0) RELATIVE geometry_center

COMPONENT master = Union_master(verbal=0)
AT(0,0,0) RELATIVE geometry_center

COMPONENT abs_logger_nD_con = Union_abs_logger_nD(
xwidth=0.1, yheight=0.02,
options="preivous, y limits=[-0.1 0.1] bins=100",
filename="Union_abs_logger_nD_con.dat")
AT (0,0,0) RELATIVE geometry_center

// Conditional that takes right part of transmitted beam
COMPONENT PSD_conditional = Union_conditional_PSD(
xwidth=0.1, yheight=0.2,
target_loggers="abs_logger_nD_con")
AT (-0.05,0,1.0) RELATIVE geometry_center

// Master at odd position to ensure that does not impact results
COMPONENT master = Union_master()
AT (3,0,-1) RELATIVE geometry_center
ROTATED (20,-5,8) RELATIVE geometry_center

COMPONENT transmission = PSD_monitor(
xwidth=0.1, yheight=0.08, nx=200, ny=200,
Expand Down
Loading
Loading