Repository navigation
concepts lund data contract
This page is generated from docs/concepts/lund-data-contract.md. Do not edit it directly; change the repository source and let automation publish the Wiki.
For example, a uniform electron–proton event is written as one header line followed by two particle lines. The source code chooses the particles; the common writer formats their records for the LUND reader in GEMC. This page defines those fields and the logs that record how the files were made. These settings, input details, and source versions are called provenance.
Provenance is information about how output was produced, stored in the LUND creation log and Slurm submission log. It is not a separate file or a check that the output suits a physics analysis. Both logs are JSON files written automatically; the campaign record combines them with results and scientific comparisons assembled by the person responsible for the study.
Particle stores a PDG identifier, mass, three-momentum, and vertex. Event stores an event ID,
Uniform events contain one electron or an electron followed by one hadron. Physical GENIE events contain the scattered electron followed by supported GST particles in input order. Every particle in one event has the same vertex.
Electron, proton, neutron, and charged-pion masses come through TargetGeometry from external targets.h; photon mass is exactly zero. The writer calculates energy as
| Field | Uniform | GENIE GST conversion |
|---|---|---|
| 1 | Particle count | Retained particle count, including electron |
| 2 | Configured |
Configured |
| 3 | Configured |
Configured |
| 4 | 0 | GST resid
|
| 5 | 0 | 0 |
| 6 | 11 | 11 |
| 7 | Beam energy | Beam energy |
| 8 | RG-M convention: 1 | RG-M convention: 1 |
| 9 | Zero-based generated-event ID | Zero-based GST entry index |
| 10 | 1 | QE=1, MEC=2, RES=3, DIS=4 |
For GENIE GST conversion, field 4 is the LUND slot otherwise used for target polarization. Storing resid there follows the pinned RG-M GENIE-to-LUND converter, in which RES_ID replaced the earlier targP polarization value1. This is a compatibility mapping: resid remains the GENIE resonance identifier and is not interpreted as polarization.
Field 8 is always the literal value 1. GEMC lists this user-defined column as the interacted-nucleon ID, but RG-M LUND-writing code widely uses 1 for uniform particles, GENIE events, and GCF events2. This code preserves that RG-M convention. The value is not an interaction count and is not interpreted as a proton or neutron PDG identifier; GEMC retains this user-defined header value but does not use it for particle transport.
Field 5 is zero in GEMC's first-particle spin-$z$ slot. Field 6 identifies an electron beam (PDG 11), and field 7 records its energy in
Field 9 must fit a signed 32-bit integer (at most 2147483647); the writer rejects larger IDs. Physical IDs can have gaps because unsupported input events are skipped.
Every header uses this exact format:
%i \t %i \t %i \t %f \t %f \t %i \t %f \t %i \t %d \t %.2f \n
Fields 4, 5, and 7 therefore have six digits after the decimal point; field 10 has two. A 5.986360.
| Field | Meaning |
|---|---|
| 1 | One-based particle index |
| 2 | 0 in GEMC's user-defined lifetime slot (nanoseconds) |
| 3 | 1, propagated particle |
| 4 | PDG identifier |
| 5 | 0 in the user-defined parent-index slot |
| 6 | 0 in the user-defined first-daughter-index slot |
| 7–9 |
|
| 10 | Calculated energy |
| 11 | Mass |
| 12–14 |
|
Momentum, energy, mass, and vertex values have five digits after the decimal point. The writer rejects empty events and non-finite energy or vertex data.
For convenience, a LUND file can in principle include additional truth-level quantities encoded as particle records whose field 3 is 0. GEMC propagates only records whose field 3 is 1 through Geant4. The pinned RG-M GCF-to-LUND converter demonstrates the type = 0 convention for a non-propagated truth-level record3.
This technique has not yet been tested with this code, and preservation of a field-3 value of 0 through GEMC output, HIPO, and reconstruction has not been verified. The current LundWriter always writes 1 and provides no option for auxiliary records. Treat type = 0 as an experimental extension: validate the resulting files and downstream banks before production use, and include every added record in the event-header particle count.
Supported physical output species are the electron
Neutral pions are not written. The input production must decay them upstream so their photons exist in GST. The physical LUND converter skips a residual PDG 111 instead of inventing daughter momenta. The physical LUND converter guide identifies the GENIE decay setting required during input production.
The serialized masses are:
| Species |
|
|---|---|
| 0.00051 | |
| 0.93827 | |
| 0.93957 | |
|
|
0.13957 |
| 0.00000 |
These are the masses after formatting with five decimal places for LUND. Energy is calculated before that rounding, using the values in targets.h (for example, electron 0.000511 and proton 0.938272). Photon mass is exactly zero.
LUND filenames are lundfiles/<PREFIX>_<INDEX>.txt, with one-based file indexes. A file opens only when an event is ready, so a successful run has no empty rollover file. Uniform event IDs remain continuous across files.
After writing events-per-file events, the writer starts another file when the next event is ready. Physical conversion also uses this setting to decide whether enough input remains to start a later file, as explained in the physical LUND converter guide. The LUND creation log records the actual count in every file, including a short final file.
The LUND creation log, lund-creation-log.json, is the completion manifest named in command output and error messages. A manifest is a list describing a set of files; this one also records the completed run's settings and event counts.
After event writing and, for uniform samples, the monitoring routine return successfully, the writer closes the LUND file and writes the LUND creation log, a JSON file, to lund-creation-log.json.tmp. Only after that write succeeds does it rename the temporary file to lund-creation-log.json. This rename is atomic: the final name appears in one filesystem operation, so submission does not read a half-written final LUND creation log. The final name marks successful creation.
The LUND creation log marks completion of the program’s checked stages. Uniform monitoring checks ROOT-file creation and histogram writes, but PDF/PNG export calls have no subsequent file verification. A final LUND creation log is therefore not independent proof that every rendered plot exists or opens. Inspect those products using the monitoring guide.
Schema version 1 contains:
| Member | Meaning |
|---|---|
schema_version |
LUND creation log schema, currently 1 |
workflow |
uniform or physical
|
version, revision, root_version
|
Code version, configure-time Git description, and ROOT version |
targets_sha256 |
Hash of the compiled external target header |
git |
Configure-time repository, branch, commit, status, tag, and tracking details |
scanned_events, written_events
|
Scanned source entries (input entries for physical conversion) and written events |
config |
Complete resolved settings as strings |
files |
Relative LUND paths and event counts in creation order |
The git object includes the repository, branch, commit message, complete commit hash, commit date and author, working-tree status summary, nearest tag, detached-HEAD state, tracking branch, ahead/behind counts, and an exact-commit GitHub source link when the repository address permits one.
For uniform creation, scanned and written event counts are equal. For physical conversion, their difference includes skipped interactions and may also reflect where conversion stopped. The LUND creation log does not hash the original GST input or save uncommitted source edits for later recovery. Keep the original input and source revision as part of the separate campaign record.
Git fields describe the checkout when CMake configured the executable. Reusing a build after changing the working tree does not update them automatically; reconfigure with CMake and rebuild when provenance must reflect new source.
After sbatch accepts an array, the coordinator writes the Slurm submission log, a JSON file at reconhipo/slurm-submission-log.json. It records the returned job ID, exact command, resolved worker environment, runtime Git state, and hashes of the GCARD, YAML, and worker payload. It records that Slurm accepted the submission. It does not establish task completion, detector database state, or scientific validity.
1. RG-M, GENIE to LUND converter, pinned revision d0d6050, source line defining RES_ID in place of targP. ↩
2. Examples at pinned RG-M revision d0d6050: p_LUND.cpp; iso_p_LUND.cpp; GENIE_to_LUND.C; GCF_to_LUND.C; Neutron Veto generate_neutrons.C and generate_protons.C; and Simulation generate_neutrons.C. ↩
3. RG-M, GCF to LUND converter, pinned revision d0d6050, non-propagated truth record with particle type 0. ↩
Generated from the e4nu/CLAS12-sample-tools documentation.
Source links use branch main. Source checkout: 6281a91714f4; commit date: 2026-10-13T14:50:21+03:00. Source checkout was clean when generated.
- Getting started
- Dependencies and execution environments
- Quickstart
- Run directories and outputs
- Troubleshooting
- Create LUND files
- Uniform LUND creation
- Physical LUND conversion
- LUND-creation configuration reference
- Uniform monitoring
- LUND-creation examples
- Sample profiles
- Submit GEMC and reconstruction jobs
- Ifarm environment and checkout model
- Simulation submission guide
- Submission configuration reference
- Follow jobs and verify output
- Submission examples
- GEMC and reconstruction worker
- Concepts and contracts
- Architecture
- LUND data contract and provenance
- Sampling models and random numbers
- External geometry and detector inputs