McStas logo McStas - A neutron ray-trace simulation package ILL; PSI; ESS Niels Bohr Institute DTU Physics NEXMAP


About McStas
 Conditions of use
 Project funding

 Other Downloads (share)

Mailing list

Search web/mailinglist

 Wiki (GitHub)
 McStas manual


Report bugs (GitHub)

Code-repository (GitHub)

McStas: Union_abs_logger_1D_space_event

[ Identification | Description | Input parameters | Links ]

The Union_abs_logger_1D_space_event Component

Logger of absorption in 1D space stored as events


  • Site:
  • Author: Mads Bertelsen
  • Origin: ESS DMSC
  • Date: 19.06.20


Part of the Union components, a set of components that work together and thus
separates geometry and physics within McStas.
The use of this component requires other components to be used.

1) One specifies a number of processes using process components
2) These are gathered into material definitions using Union_make_material
3) Geometries are placed using Union_box/cylinder/sphere, assigned a material
4) Logger and conditional components can be placed which will record what happens
5) A Union_master component placed after all of the above

Only in step 5 will any simulation happen, and per default all geometries
defined before this master, but after the previous will be simulated here.

There is a dedicated manual available for the Union_components

This component is an absorption logger, and thus placed in point 4) above.

A absorption logger will log something for each absorption event happening
in the geometry or geometries on which it is attached. These are specified
in the target_geometry string. By leaving it blank, all geometries are
logged, even the ones not defined at this point in the instrument file.
Multiple geometries are specified as a comma separated list.

This absorption logger stores the absorbed weight as an event including a
pixel_id. The pixel_id is found from the y coordinate of the event position
in the coordinate system of the absorption logger and is binned to a
pixel_id which is necessary when importing the data in Mantid. The y
coordinate corresponds to the height and is natural when attaching this
absorption logger to a cylindrical geometry, as it will record position
along the axis of symmetry, and thus behave like a detector tube. When using
several of these absorption loggers, they will internally avoid reusing the
same pixel_id, but if any other mantid detectors are used, these need to have
pixel_ids larger than the maximum used by these loggers. Each of these components
uses three times the number of bins, as it internally is a 3xn histogram where
only the center line have data, as this is much easier to import in Mantid.
The ocmponent uses Monitor_nD functions for trace and mcdisplay, and for this
reason it can write the xml file required to transfer the detector geometry
to Mantid.

This absorption logger needs to be placed in space, the position is recorded in
the coordinate system of the logger component.

It is possible to attach one or more conditional components to this absorption
logger. Such a conditional component would impose a condition on the state of
the neutron after the Union_master component that executes the simulation,
and the absorption logger will only record the event if this condition is true.

To use the logger_conditional_extend function, set it to some integer value n
and make and extend section to the master component that runs the geometry.
In this extend function, logger_conditional_extend[n] is 1 if the conditional
stack evaluated to true, 0 if not. This way one can check what rays is logged
using regular McStas monitors. Only works if a conditional is applied to this

Input parameters

Parameters in boldface are required; the others are optional.
target_geometrystringComma separated list of geometry names that will be logged, leave empty for all volumes (even not defined yet)"NULL"
yheightmHeight of absorption logger
n1Number of bins along y
fake_event1Number of fake events to add, circumvents issue with empty event lists with MPI0
filenamestringFilename of produced data file"NULL"
order_total1Only log rays that have scattered n times, -1 for all orders-1
order_volume1Only log rays that have scattered n times in the same geometry, -1 for all orders-1
logger_conditional_extend_index1If a conditional is used with this logger, the result of each conditional calculation can be made available in extend as a array called "logger_conditional_extend", and one would then access logger_conditional_extend[n] if logger_conditional_extend_index is set to n-1
initstringname of Union_init component (typically "init", default)"init"


  • Source code for Union_abs_logger_1D_space_event.comp.

[ Identification | Description | Input parameters | Links ]

Generated on 2023-09-19 20:01:36

Last Modified: Tuesday, 16-Apr-2024 20:05:21 CEST
Search website mailinglist archive GitHub repos