simhits / README.md
deepaksamuel-cuk's picture
Upload README.md with huggingface_hub
722469f verified
|
Raw
History Blame Contribute Delete
7.24 kB
metadata
license: unknown
tags:
  - physics
  - particle-physics
  - high-energy-physics
  - detector-simulation
  - cherenkov
  - eic
  - drich

dRICH simulated hit data (bljul21 baseline)

Real, non-synthetic simulated photon-hit data from the EPIC dRICH detector (the dual-radiator RICH — aerogel + gas — of the EIC's EPIC experiment), for 4 charged-particle species. This is the exact data used to train and evaluate a Vision-Transformer particle-ID baseline (ViT-BL).

No injected noise, no synthetic mixing, no QE (quantum-efficiency) hit loss, no pixel-gap simulation, no augmentation of any kind, at any stage (generation, training, or testing). Every hit in every file here is a real simulated photon hit.

Files in this repo

file size contents
dataset.npz 18 MB per-event metadata for all 600,020 events
hits_xy.npy 1.70 GB every photon hit's (x, y) sensor-plane position [mm], all events concatenated
hits_t.tar.gz 1.39 GB the raw per-event source: 600,020 individual hits_{PID}_{MOM}_{ETA}_{PHI}.npz files, each with cellID (uint64) + time (float32, ns), before cellID was resolved to a physical position
cellid_positions.npz 6.2 MB sensor geometry lookup: cellids (sorted uint64) → xyz (float32, mm) for all 322,560 real dRICH sensor pixels. Needed to resolve raw cellID values (from hits_t.tar.gz, or from a fresh simulation) into physical hit positions

dataset.npz fields

key dtype / shape meaning
label int8, (600020,) 0=electron, 1=pion, 2=kaon, 3=proton
mom float32, (600020,) generated momentum [GeV/c]
eta float32, (600020,) generated pseudorapidity
phi float32, (600020,) generated azimuth [rad]
center float32, (600020,2) per-event median hit (x,y) [mm] (only used for zoomed/crop visualizations)
offsets int64, (600021,) hits_xy[offsets[j]:offsets[j+1]] = event j's hits
split int8, (600020,) 0=train, 1=val, 2=test (80/10/10, split independently per species)

hits_xy.npy contains all splits together, undivided — train, val, and test hits all live in the same array; only dataset.npz['split'] tells you which is which.

Particle ID convention

Standard PDG codes: 11=electron, 211=pion(+), 321=kaon(+), 2212=proton. Filenames (and the raw hits_t.tar.gz contents) follow {PID}_{MOM}_{ETA}_{PHI} — momentum in GeV/c, eta as generated, phi in radians.

Generated kinematic ranges

  • momentum: 0.5–60.5 GeV/c, in 0.1 GeV/c steps (601 grid values)
  • eta: 1.5–3.5, in 0.1 steps (21 grid values)
  • phi: 0–2π, in 0.1 rad steps (63 grid values)

Each species independently randomly sampled ~150,000 (p, eta, phi) triples from that ~795,000-point grid — this is not a shared grid reused across species; any overlap between species' kinematic points is coincidental (matches the ~19% overlap expected from independent random sampling from the same grid).

Aerogel Cherenkov threshold (n = 1.026)

p_thr = mass / sqrt(n^2 - 1). Used to define the "above threshold" (ATH) vs "below threshold" (BTH) splits in the companion ViT-BL baseline.

species mass [GeV] p_thr [GeV/c]
electron 0.000511 0.0022
pion 0.139570 0.6081
kaon 0.493677 2.1510
proton 0.938272 4.0881

How this data was created

  1. hepmc generation — one single-event hepmc file per (PID, momentum, eta, phi) combination, covering the full grid above.
  2. Geant4 simulation — each hepmc file run through the EPIC detector simulation (drich-dev/simulate.py), one event per output file.
  3. ExtractionDRICHHits/cellID and DRICHHits/time pulled from each simulation ROOT file (uproot + awkward), one .npz per event containing the raw cellID/time arrays — this is hits_t.tar.gz. The raw simulation ROOT files were deleted immediately after extraction to save disk space (not recoverable — only the extracted hits remain).
  4. Geometry resolution — every unique cellID resolved to a global (x, y, z) mm position via dd4hep's CellIDPositionConverter, run against the real EPIC/dRICH detector geometry. This lookup table is cellid_positions.npz, included in this repo.
  5. Consolidation — all 600,020 events' hits (now resolved to x,y) concatenated into hits_xy.npy, with per-event metadata gathered into dataset.npz.

Quick start: load an event's hits

import numpy as np
from huggingface_hub import hf_hub_download

REPO = "deepaksamuel-cuk/simhits"
dataset_path = hf_hub_download(REPO, "dataset.npz", repo_type="dataset")
hits_path = hf_hub_download(REPO, "hits_xy.npy", repo_type="dataset")

d = np.load(dataset_path)
label, mom, eta, phi, offsets = d["label"], d["mom"], d["eta"], d["phi"], d["offsets"]
hits = np.load(hits_path, mmap_mode="r")  # ~1.6 GiB -- mmap avoids loading it all into RAM

j = 0  # any event index, 0 <= j < 600020
a, b = offsets[j], offsets[j + 1]
pts = np.asarray(hits[a:b], dtype=np.float32)  # this event's (x, y) hit positions [mm]
print(label[j], mom[j], eta[j], phi[j], len(pts), "hits")

Rasterizing into a training-style image

Pixel value = log1p(hit count) — cells with more hits get more weight (brighter), full detector extent (384x384 px over a 3540 mm window, matching the real dRICH sensor plane's physical size). Multiple hits landing in the same sensor cell are summed, not overwritten or capped — np.add.at is used specifically because it correctly accumulates duplicate indices, unlike plain indexed assignment.

FULL_IMG, FULL_WINDOW = 384, 3540.0

def rasterize(pts, img_size=FULL_IMG, window=FULL_WINDOW):
    img = np.zeros((img_size, img_size), dtype=np.float32)
    if len(pts) == 0:
        return img
    rel = (pts - (-window / 2)) * (img_size / window)
    ij = np.floor(rel).astype(np.int64)
    ok = (ij[:, 0] >= 0) & (ij[:, 0] < img_size) & (ij[:, 1] >= 0) & (ij[:, 1] < img_size)
    ij = ij[ok]
    np.add.at(img, (ij[:, 1], ij[:, 0]), 1.0)  # accumulate, never overwrite
    return np.log1p(img)

img = rasterize(pts)  # (384, 384) float32, ready to imshow() or feed to a model

Ready-to-run code in this repo

  • view_hits.py — command-line script. Pick a PID/momentum/eta/phi, it finds the closest real matching event (the grid above means your exact input almost never exists as an event) and saves a PNG of the rasterized hit image:
    python view_hits.py --pid 2212 --mom 30 --eta 2.0 --phi 3.14 --out proton.png
    
  • colab_hit_viewer.ipynb — the same lookup, as an interactive Colab notebook (dropdown + text fields, live plotly plot). Upload it to https://colab.research.google.com directly.

Related model

A ViT-BL baseline model (Vision Transformer, trained from scratch, no ImageNet pretraining) trained on this data's above-threshold events is published separately at deepaksamuel-cuk/drich-vit-baseline, including a predict_from_root.py script that runs the model directly on a raw simulation .root file using this repo's cellid_positions.npz.