Skip to content
Open
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 @@ -62,26 +63,40 @@ 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")
COMPONENT box_geometry = 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")
COMPONENT sphere_geometry = 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")
COMPONENT cylinder_geometry = 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")
COMPONENT cone_geometry = 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

// Insert loggers to be tested here
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 @@ -58,25 +58,38 @@ 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")
COMPONENT box_geometry = 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")
COMPONENT sphere_geometry = 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")
COMPONENT cylinder_geometry = 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")
COMPONENT cone_geometry = 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,38 +54,52 @@ 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()
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")
COMPONENT box_geometry = 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")
COMPONENT sphere_geometry = 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")
COMPONENT cylinder_geometry = 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")
COMPONENT cone_geometry = 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_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=5.40132e-12
* %Example: Detector: abs_logger_1D_space_tof_to_lambda_relative_I=5.41367e-12
* %Example: Detector: abs_logger_1D_space_tof_to_lambda_con_I=8.13732e-13
*
* %End
*******************************************************************************/
Expand Down Expand Up @@ -57,6 +58,10 @@ COMPONENT material = Union_make_material(my_absorption=4.0,
process_string="incoherent,powder")
AT (0,0,0) ABSOLUTE

COMPONENT inc_material = Union_make_material(my_absorption=1.0,
process_string="incoherent")
AT (0,0,0) ABSOLUTE

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

Expand All @@ -69,46 +74,73 @@ AT (0,0,0) RELATIVE Origin
COMPONENT geometry_center = Arm()
AT (0,0,10.0) RELATIVE source

COMPONENT sphere = Union_sphere(radius=0.02, priority=6, material_string="material")
COMPONENT sphere_geometry = Union_sphere(
radius=0.02, priority=6, material_string="inc_material", p_interact=0.2,
focus_xw=0.1, focus_xh=0.9, target_x=-0.5, target_y=0, target_z=0)
AT (0,0,0) RELATIVE geometry_center

COMPONENT box = Union_box(xwidth=0.10, yheight=0.15, zdepth=0.03, priority=5, material_string="material")
COMPONENT box_geometry = Union_box(
xwidth=0.10, yheight=0.15, zdepth=0.03, priority=5, material_string="inc_material", p_interact=0.2,
focus_xw=0.1, focus_xh=0.9, target_x=-0.5, target_y=0, target_z=0)
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")
COMPONENT cone_geometry = Union_cone(
radius_top=0.02, radius_bottom=0.055, yheight=0.09, priority=8, material_string="inc_material", p_interact=0.2,
focus_xw=0.1, focus_xh=0.9, target_x=-0.5, target_y=0, target_z=0)
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_geometry = 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,
target_geometry="cylinder",
target_geometry="cylinder_geometry",
ref_component=-5,
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.dat")
AT (0,0,0) RELATIVE cylinder
AT (0,0,0) RELATIVE cylinder_geometry

COMPONENT abs_logger_1D_space_tof_to_lambda_relative = Union_abs_logger_1D_space_tof_to_lambda(
yheight=0.8, yn=100,
target_geometry="cylinder",
target_geometry="cylinder_geometry",
ref_component=-6,
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_relative.dat",
relative_measured=1, relative_min=0.95, relative_max=1.05, relative_bins=100)
AT (0,0,0) RELATIVE cylinder
AT (0,0,0) RELATIVE cylinder_geometry

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_geometry",
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_geometry

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.2, yheight=1.5,
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_geometry = 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_geometry = Union_sphere(radius=0.05, priority=6, material_string="material")
AT (0.03,0,-0.04) RELATIVE geometry_center

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

COMPONENT cone_geometry = 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
Loading
Loading