X_DIM = 9

# Conditioning continuous-feature width (Phase 2): pre_pos(3), log(pre_E)(1),
# pre_dir(3), layer_id(1). n_sec and log(e_sec) are removed — they are now
# *outputs* predicted by Stage 1, not conditioning inputs.
COND_DIM = 8

# Maximum number of secondary slots. From data: max(n_sec)=14 in PbWO4 dataset;
# K_MAX=15 covers it with one spare slot.
K_MAX = 15

# Per-slot secondary target dimension: 1 (stick-breaking logit) + 3 (local dir) +
# EMB_DIM (continuous type embedding). EMB_DIM must match DenoisingMLP.emb_dim.
# Default emb_dim=16 → SEC_SLOT_DIM=20.
SEC_SLOT_DIM = 20  # 1 + 3 + 16
EMB_DIM = 16  # must match model emb_dim default

# Per-slot continuous (non-embedding) width: stick-breaking logit + local dir.
CONT_SLOT_DIM = SEC_SLOT_DIM - EMB_DIM  # 4

# Flattened Stage-2 target dimension
SEC_DIM = K_MAX * SEC_SLOT_DIM  # 15 * 20 = 300

# Stage-1 9D target names (unchanged from energy-conservation PoC)
LOCAL_TARGET_NAMES = [
    "log_step_length",
    "edep_logit",
    "sec_logit",
    "post_dx",
    "post_dy",
    "post_dz",
    "travel_dx",
    "travel_dy",
    "travel_dz",
]

# Parquet schema metadata written by `giant predict` and checked by
# giant.analysis loaders, so a file's format can be verified without
# guessing from its column names.
PREDICT_COORD_METADATA_KEY = "giant.predict.coord"
PREDICT_SCHEMA_VERSION_KEY = "giant.predict.schema_version"
PREDICT_SCHEMA_VERSION = "2"

# Coord-metadata value tagging a `giant rollout` steps parquet (world frame,
# autoregressive shower output). Distinct from predict's "global"/"local".
ROLLOUT_COORD_VALUE = "rollout"

# Per-track termination reasons recorded by the rollout driver. "escaped"
# energy is treated as leakage (not deposited); every other stop deposits the
# track's remaining energy locally so total energy is conserved.
TERM_ESCAPED = "escaped"
TERM_ENERGY_CUTOFF = "energy_cutoff"
TERM_MAX_STEPS = "max_steps"
TERM_NATURAL_END = "natural_end"
TERM_UNKNOWN_PDG = "unknown_pdg"
TERM_MAX_TRACKS = "max_tracks"
