Skip to main content

McStas components and tools mimicking ESS Readout Master detector readouts: collect simulated events to HDF5, combine files, and replay them to Event Formation Units

Project description

McStas Readout Master for ESS detectors

Components and tools linking McStas 3.3+ ray-tracing neutron simulations to the ESS data pipeline via the Event Formation Unit (EFU).

Simulated readout records are collected to HDF5 files while the simulation runs, combined across repeated runs or scan points, and replayed to EFUs afterwards, statistically correctly — the data-acquisition stack does not need to be running (or reachable) during the simulation.

Documentation

Guides, per-component parameter references, CLI documentation, and the C/C++ API reference are published at

https://mcdotstar.github.io/mcstas-readout-master/

To build the site locally (requires Doxygen):

cmake -S . -B build-docs -DREADOUT_DOCS_ONLY=ON
cmake --build build-docs --target docs
# open build-docs/docs/html/index.html

Quickstart

1. Install

git clone https://github.com/mcdotstar/mcstas-readout-master.git
cmake -S mcstas-readout-master -B mcstas-readout-master-build -DCMAKE_INSTALL_PREFIX=~/.local
cmake --build mcstas-readout-master-build --target install

This installs libreadout, the readout-config, readout-combine, and readout-replay tools, and the McStas component files.

2. Collect

Add a Collector* component matching your detector electronics (CAEN, TTLMonitor, CDT, VMM3, BM0, BM2, BMI) to the end of your instrument's TRACE section. Identifying values are read by name from particle variables (typically USER_VARS set in an EXTEND block):

TRACE
  ...
  SEARCH SHELL "readout-config --show compdir"
  COMPONENT collect = CollectorCAEN(
    ring="ring_id", tube="tube_id", a_name="left", b_name="right",
    filename="run", dataset_name="caen_bank0")
  AT (0, 0, 0) ABSOLUTE

Each run produces a cue-based HDF5 file; several collectors can share one file, each writing its own named group.

3. Combine

readout-combine validate run_*.h5
readout-combine append      --output merged.h5 run_a.h5 run_b.h5   # identical parameters
readout-combine concatenate --output scan.h5   point_*.h5          # scan points

4. Replay

readout-replay --time 2.0 --seed 42 --addr my-efu.example.org --port 9000 scan.h5

Replay steps through the stored points, publishes each point's parameters, draws n ~ Poisson(w * counting_time) events per stored readout, and sends them to EFUs resolved from explicit configuration, file-embedded attributes, or the command-line defaults — in that order. See the CLI reference for all options.

Legacy runtime streaming

The original per-ray streaming components remain available for use cases where the EFU runs alongside the simulation: ReadoutCAEN and ReadoutTTLMonitor make a Poisson-distributed Monte Carlo choice per traced neutron and send packets immediately, and ReadoutDiscreteCAEN sends an exact number of weighted-sampled events at the end of the run. Their parameters are documented on the site and in the component headers (mcdoc-compatible).

MPI support

The Collector* components gather records to the master node, which writes one HDF5 file. For the streaming Readout* components, all nodes need network access to the EFU host.

Development

See DEVELOPMENT.md for the development-mode build (-DREADOUT_DEVELOPMENT_MODE=ON), test suites, and the reasoning behind the self-locating readout-config.

Use with McStas 3.2

The SEARCH SHELL automatic path modification used above requires McStas 3.3+. With McStas 3.2, copy the component files into one of the McStas component search directories and omit the SEARCH SHELL line.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcstas_readout_master-0.5.0.tar.gz (326.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

mcstas_readout_master-0.5.0-py3-none-manylinux_2_28_x86_64.whl (9.1 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

mcstas_readout_master-0.5.0-py3-none-macosx_14_0_x86_64.whl (5.8 MB view details)

Uploaded Python 3macOS 14.0+ x86-64

mcstas_readout_master-0.5.0-py3-none-macosx_14_0_arm64.whl (4.8 MB view details)

Uploaded Python 3macOS 14.0+ ARM64

File details

Details for the file mcstas_readout_master-0.5.0.tar.gz.

File metadata

  • Download URL: mcstas_readout_master-0.5.0.tar.gz
  • Upload date:
  • Size: 326.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mcstas_readout_master-0.5.0.tar.gz
Algorithm Hash digest
SHA256 8fd16c951ee3d10ceeaf1f84640b995b2fff62dd2b648f527c770309094f0b9e
MD5 d5d05199b5fb8619cb51b1cc093a7c2f
BLAKE2b-256 802756d95b121e6a488b175367f6531b8f3d7b0b3c29d5b52f04d8fe3b0e14d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcstas_readout_master-0.5.0.tar.gz:

Publisher: wheels.yml on mcdotstar/mcstas-readout-master

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcstas_readout_master-0.5.0-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mcstas_readout_master-0.5.0-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d0563cf6374c55acd42fc216e4557a682d61dd2863a1e2c7bb83e840d28453fd
MD5 4c85307b44d20b2329f499b8ff9b2d65
BLAKE2b-256 532b2be79ed75c9efc46b6e5cda08913ddd47641254b7a6a64b0a702299c77c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcstas_readout_master-0.5.0-py3-none-manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on mcdotstar/mcstas-readout-master

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcstas_readout_master-0.5.0-py3-none-macosx_14_0_x86_64.whl.

File metadata

File hashes

Hashes for mcstas_readout_master-0.5.0-py3-none-macosx_14_0_x86_64.whl
Algorithm Hash digest
SHA256 64590e1c8daa45ab421fd9237084ae4c47a72dd496474f9d1f9646003e709c40
MD5 0b1457c6c5a05bad67fba3630dfad717
BLAKE2b-256 4c2d457eb0368214231031b66cf01ad2ce09ecf052baf06d7ba25b4d308637c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcstas_readout_master-0.5.0-py3-none-macosx_14_0_x86_64.whl:

Publisher: wheels.yml on mcdotstar/mcstas-readout-master

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcstas_readout_master-0.5.0-py3-none-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for mcstas_readout_master-0.5.0-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 d65ba54b468d5c23e84ca2e828d73c2d4317335109a6f849d6ea6cb742f376e3
MD5 9229cd8bf6e5bf07c1c223e030788532
BLAKE2b-256 a5613ec36a65dd7b6ad64ddffcc3888a323531d162b905a2d9ac1a3208305750

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcstas_readout_master-0.5.0-py3-none-macosx_14_0_arm64.whl:

Publisher: wheels.yml on mcdotstar/mcstas-readout-master

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page