eventDispenser
Loading...
Searching...
No Matches
Event Dispenser Module
Run-weighted event dispatch

Introduction

The Event Dispenser module distributes simulation events across one or more run numbers. The distribution is driven either by a single user-selected run number, or by a file that specifies multiple runs and their relative weights.

Details

At runtime, EventDispenser:

  • Reads user configuration from a GOptions instance.
  • Builds an internal run list and a run-to-weight map when a run-weight file is provided.
  • Derives a per-run event allocation by sampling a uniform random variable against the cumulative weight distribution.
  • For each run, initializes (or re-initializes) the available GDynamicDigitization routines so each run can load its run-dependent constants and translation tables.
  • Dispatches the actual event generation to Geant4 via UI commands (e.g. /run/beamOn).
Processing stages inside each allocated event

Typical usage

A typical application flow is:

Available Options and their usage

This module reads the following option keys from the runtime option provider:

  • n
    • Type: integer
    • Meaning: requested number of events to process
    • Behavior:
      • 0 typically means "no events requested" (module may still initialize and report configuration)
      • positive values are used to compute the per-run event allocation
  • run
    • Type: integer
    • Meaning: conditions run number used when no run-weight file is provided
    • Behavior:
      • used as the single run number for the full event set when run_weights is unset
    • Note: not to be confused with the Geant4 internal run id (g4runno), which GEMC manages separately.
  • run_weights
    • Type: string (path)
    • Meaning: text file containing run numbers and relative weights
    • Behavior:
      • when set, the module reads the file and distributes events across the listed run numbers
      • weights are interpreted as relative ratios and normalized internally
    • File format:
      • two columns: <run_number> <weight>

Example weights and their long-run expectation for -n=100:

Run Relative weight Normalized probability Expected events
11 1 0.10 10
12 7 0.70 70
13 2 0.20 20

Each event is assigned using an independent random draw. Actual integer counts can differ from the expected values, but every requested event increments exactly one run counter.

Run-weight sampling intervals

This module’s option schema is composed by eventDispenser::defineOptions(), which aggregates:

Additional keys contributed by gdynamicdigitization::defineOptions() affect digitization selection and per-run initialization behavior. Refer to that module’s documentation for the full list.

Module verbosity

EventDispenser uses the standard GEMC GLogger infrastructure. The practical meaning of verbosity levels is:

  • info level 0: high-level summary (initialization and final distribution table).
  • info level 1: per-run progress messages (start/end of each run).
  • info level 2: additional operational detail (reserved for more verbose progress).

Debug output (enabled through the logger configuration) prints diagnostic information such as:

  • which digitization routine is being called,
  • which run number and variation are being used for constants / translation-table loading,
  • and other function-level traces useful during development.

Examples

auto gopts = std::make_shared<GOptions>(argc, argv, eventDispenser::defineOptions());
EventDispenser eventDisp(gopts, dynamicRoutinesMap);
auto runEvents = eventDisp.getRunEvents();
eventDisp.processEvents();
Distributes events among run numbers and coordinates dynamic digitization initialization.
GOptions defineOptions()
Builds and returns the complete set of options supported by the Event Dispenser module.



Author

© Maurizio Ungaro
e-mail: ungar.nosp@m.o@jl.nosp@m.ab.or.nosp@m.g