deepaksamuel-cuk commited on
Commit
ef79c35
·
verified ·
1 Parent(s): 5ea7254

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +163 -1
README.md CHANGED
@@ -1,3 +1,165 @@
1
  ---
2
- license: mit
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ license: unknown
3
+ tags:
4
+ - physics
5
+ - particle-physics
6
+ - high-energy-physics
7
+ - detector-simulation
8
+ - cherenkov
9
+ - eic
10
+ - drich
11
  ---
12
+
13
+ # dRICH simulated hit data (bljul21 baseline)
14
+
15
+ Real, non-synthetic simulated photon-hit data from the EPIC dRICH detector
16
+ (the dual-radiator RICH — aerogel + gas — of the EIC's EPIC experiment),
17
+ for 4 charged-particle species. This is the exact data used to train and
18
+ evaluate a Vision-Transformer particle-ID baseline (**ViT-BL**).
19
+
20
+ **No injected noise, no synthetic mixing, no QE (quantum-efficiency) hit
21
+ loss, no pixel-gap simulation, no augmentation of any kind, at any
22
+ stage** (generation, training, or testing). Every hit in every file here
23
+ is a real simulated photon hit.
24
+
25
+ ## Files in this repo
26
+
27
+ | file | size | contents |
28
+ |---|---|---|
29
+ | `dataset.npz` | 18 MB | per-event metadata for all 600,020 events |
30
+ | `hits_xy.npy` | 1.70 GB | every photon hit's (x, y) sensor-plane position [mm], all events concatenated |
31
+ | `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 |
32
+
33
+ ### `dataset.npz` fields
34
+
35
+ | key | dtype / shape | meaning |
36
+ |---|---|---|
37
+ | `label` | int8, (600020,) | 0=electron, 1=pion, 2=kaon, 3=proton |
38
+ | `mom` | float32, (600020,) | generated momentum [GeV/c] |
39
+ | `eta` | float32, (600020,) | generated pseudorapidity |
40
+ | `phi` | float32, (600020,) | generated azimuth [rad] |
41
+ | `center` | float32, (600020,2) | per-event median hit (x,y) [mm] (only used for zoomed/crop visualizations) |
42
+ | `offsets` | int64, (600021,) | `hits_xy[offsets[j]:offsets[j+1]]` = event `j`'s hits |
43
+ | `split` | int8, (600020,) | 0=train, 1=val, 2=test (80/10/10, split independently per species) |
44
+
45
+ `hits_xy.npy` contains **all** splits together, undivided — train, val,
46
+ and test hits all live in the same array; only `dataset.npz['split']`
47
+ tells you which is which.
48
+
49
+ ## Particle ID convention
50
+
51
+ Standard PDG codes: `11`=electron, `211`=pion(+), `321`=kaon(+),
52
+ `2212`=proton. Filenames (and the raw `hits_t.tar.gz` contents) follow
53
+ `{PID}_{MOM}_{ETA}_{PHI}` — momentum in GeV/c, eta as generated, phi in
54
+ radians.
55
+
56
+ ## Generated kinematic ranges
57
+
58
+ - momentum: 0.5–60.5 GeV/c, in 0.1 GeV/c steps (601 grid values)
59
+ - eta: 1.5–3.5, in 0.1 steps (21 grid values)
60
+ - phi: 0–2π, in 0.1 rad steps (63 grid values)
61
+
62
+ Each species independently randomly sampled ~150,000 (p, eta, phi)
63
+ triples from that ~795,000-point grid — this is **not** a shared grid
64
+ reused across species; any overlap between species' kinematic points is
65
+ coincidental (matches the ~19% overlap expected from independent random
66
+ sampling from the same grid).
67
+
68
+ ## Aerogel Cherenkov threshold (n = 1.026)
69
+
70
+ `p_thr = mass / sqrt(n^2 - 1)`. Used to define the "above threshold"
71
+ (ATH) vs "below threshold" (BTH) splits in the companion ViT-BL baseline.
72
+
73
+ | species | mass [GeV] | p_thr [GeV/c] |
74
+ |---|---|---|
75
+ | electron | 0.000511 | 0.0022 |
76
+ | pion | 0.139570 | 0.6081 |
77
+ | kaon | 0.493677 | 2.1510 |
78
+ | proton | 0.938272 | 4.0881 |
79
+
80
+ ## How this data was created
81
+
82
+ 1. **hepmc generation** — one single-event hepmc file per (PID, momentum,
83
+ eta, phi) combination, covering the full grid above.
84
+ 2. **Geant4 simulation** — each hepmc file run through the EPIC detector
85
+ simulation (`drich-dev/simulate.py`), one event per output file.
86
+ 3. **Extraction** — `DRICHHits/cellID` and `DRICHHits/time` pulled from
87
+ each simulation ROOT file (`uproot` + `awkward`), one `.npz` per event
88
+ containing the raw `cellID`/`time` arrays — this is `hits_t.tar.gz`.
89
+ The raw simulation ROOT files were deleted immediately after
90
+ extraction to save disk space (not recoverable — only the extracted
91
+ hits remain).
92
+ 4. **Geometry resolution** — every unique `cellID` resolved to a global
93
+ (x, y, z) mm position via `dd4hep`'s `CellIDPositionConverter`, run
94
+ against the real EPIC/dRICH detector geometry. This lookup table
95
+ (`cellid_positions.npz`) is geometry-specific and not included in this
96
+ repo; regenerate it from the EPIC compact detector XML if needed.
97
+ 5. **Consolidation** — all 600,020 events' hits (now resolved to x,y)
98
+ concatenated into `hits_xy.npy`, with per-event metadata gathered into
99
+ `dataset.npz`.
100
+
101
+ ## Quick start: load an event's hits
102
+
103
+ ```python
104
+ import numpy as np
105
+ from huggingface_hub import hf_hub_download
106
+
107
+ REPO = "deepaksamuel-cuk/simhits"
108
+ dataset_path = hf_hub_download(REPO, "dataset.npz", repo_type="dataset")
109
+ hits_path = hf_hub_download(REPO, "hits_xy.npy", repo_type="dataset")
110
+
111
+ d = np.load(dataset_path)
112
+ label, mom, eta, phi, offsets = d["label"], d["mom"], d["eta"], d["phi"], d["offsets"]
113
+ hits = np.load(hits_path, mmap_mode="r") # ~1.6 GiB -- mmap avoids loading it all into RAM
114
+
115
+ j = 0 # any event index, 0 <= j < 600020
116
+ a, b = offsets[j], offsets[j + 1]
117
+ pts = np.asarray(hits[a:b], dtype=np.float32) # this event's (x, y) hit positions [mm]
118
+ print(label[j], mom[j], eta[j], phi[j], len(pts), "hits")
119
+ ```
120
+
121
+ ## Rasterizing into a training-style image
122
+
123
+ Pixel value = `log1p(hit count)` — cells with more hits get more weight
124
+ (brighter), full detector extent (384x384 px over a 3540 mm window,
125
+ matching the real dRICH sensor plane's physical size). Multiple hits
126
+ landing in the same sensor cell are **summed**, not overwritten or
127
+ capped — `np.add.at` is used specifically because it correctly
128
+ accumulates duplicate indices, unlike plain indexed assignment.
129
+
130
+ ```python
131
+ FULL_IMG, FULL_WINDOW = 384, 3540.0
132
+
133
+ def rasterize(pts, img_size=FULL_IMG, window=FULL_WINDOW):
134
+ img = np.zeros((img_size, img_size), dtype=np.float32)
135
+ if len(pts) == 0:
136
+ return img
137
+ rel = (pts - (-window / 2)) * (img_size / window)
138
+ ij = np.floor(rel).astype(np.int64)
139
+ ok = (ij[:, 0] >= 0) & (ij[:, 0] < img_size) & (ij[:, 1] >= 0) & (ij[:, 1] < img_size)
140
+ ij = ij[ok]
141
+ np.add.at(img, (ij[:, 1], ij[:, 0]), 1.0) # accumulate, never overwrite
142
+ return np.log1p(img)
143
+
144
+ img = rasterize(pts) # (384, 384) float32, ready to imshow() or feed to a model
145
+ ```
146
+
147
+ ## Ready-to-run code in this repo
148
+
149
+ - **`view_hits.py`** — command-line script. Pick a PID/momentum/eta/phi,
150
+ it finds the closest real matching event (the grid above means your
151
+ exact input almost never exists as an event) and saves a PNG of the
152
+ rasterized hit image:
153
+ ```bash
154
+ python view_hits.py --pid 2212 --mom 30 --eta 2.0 --phi 3.14 --out proton.png
155
+ ```
156
+ - **`colab_hit_viewer.ipynb`** — the same lookup, as an interactive
157
+ Colab notebook (dropdown + text fields, live plotly plot). Upload it
158
+ to https://colab.research.google.com directly.
159
+
160
+ ## Related model
161
+
162
+ A ViT-BL baseline model (Vision Transformer, trained from scratch, no
163
+ ImageNet pretraining) trained on this data's above-threshold events is
164
+ published separately at
165
+ [deepaksamuel-cuk/drich-vit-baseline](https://huggingface.co/deepaksamuel-cuk/drich-vit-baseline).