Python API¶
from delphi_eventdisplay import read_event, build, build3d
from delphi_eventdisplay.schema import to_dict
e = read_event("Y13709.126.edm4hep.root", 3990)
fig = build(e, rich=[20, 22, 21], groups={20: ("φ → K⁺K⁻", "#d62728")})
fig.write_html("event.html")
build and build3d take an Event and return a plotly.graph_objects.Figure. Neither touches
the filesystem, which is what lets the same code run unmodified in the browser under Pyodide.
Reading¶
delphi_eventdisplay.read ¶
edm4hep -> a plain Event object.
Everything the display draws is a measured quantity read here; the decoding rules (VD strip coordinates, the perigee track state, AABTAG vertex acceptance) are the ones validated in the original matplotlib display, see README.
Event
dataclass
¶
One event, decoded. Lengths in mm, momenta in GeV, angles in rad.
Source code in src/delphi_eventdisplay/read.py
read_event ¶
read_event(path: str, entry: int, *, collections: dict | None = None, domains: dict | None = None) -> Event
Read one entry of an edm4hep file into an Event.
collections overrides which collection each part of the display draws, by role ("tracks", "secondary_vertices", ...); anything not given is resolved from the file's own podio metadata. See schema.ROLES.
Source code in src/delphi_eventdisplay/read.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
Collection discovery¶
delphi_eventdisplay.schema ¶
What is actually in this file: collections, their types, links and provenance.
The display used to pin one collection of each kind by name. A file offers many (three Track collections, seven Vertex, four Cluster, twenty-odd ParticleID), so instead we read podio's own metadata -- the same source the converter's collection map is built from -- and let the caller choose.
Domains are the one field podio does not carry; they come from the converter's published collection map when it is supplied, and are "unknown" otherwise.
Schema
dataclass
¶
Source code in src/delphi_eventdisplay/schema.py
resolve ¶
role -> collection name, from the preference lists (overrides win).
Source code in src/delphi_eventdisplay/schema.py
Collection
dataclass
¶
Source code in src/delphi_eventdisplay/schema.py
read_schema ¶
Every collection in the file, with per-event counts when an entry is given.
Source code in src/delphi_eventdisplay/schema.py
to_dict ¶
The shape the web page reads: same vocabulary as the converter's collection map.
Source code in src/delphi_eventdisplay/schema.py
load_domains ¶
collection -> domain, from the converter's published collection map.
Source code in src/delphi_eventdisplay/schema.py
Geometry¶
delphi_eventdisplay.geometry ¶
Helices, the curvature-sign check and where each track starts.
The display draws nothing it has not measured: a track is the helix of its own perigee parameters, started at the vertex it belongs to, and the part between the IP and that vertex is drawn dotted so the picture never claims a path the particle did not travel.
helix ¶
Point(s) at arc length s on the helix with perigee parameters p.
p = [x0, y0, z0, phi0, omega, tanLambda]; omega is the signed curvature, so the sign argument lets the caller flip it (see curvature_sign).
Source code in src/delphi_eventdisplay/geometry.py
track_to ¶
The helix from arc length s0 out to radius rmax, at most half a turn.
Source code in src/delphi_eventdisplay/geometry.py
curvature_sign ¶
+1 or -1: which sign of omega actually bends tracks onto their own calorimeter clusters.
Re-checked per event rather than hard-coded, because the convention has moved between converter versions. Returns (sign, message).
Source code in src/delphi_eventdisplay/geometry.py
start_points ¶
Arc length at which to start each track, and where its dotted back-extrapolation begins.
A track on a vertex starts at that vertex; otherwise it starts at the primary vertex when it passes within 1 mm of it, and at its own perigee when it does not.
Source code in src/delphi_eventdisplay/geometry.py
fit_vertex ¶
Least-squares crossing point of the IP direction lines of the given tracks.
Our own straight-line fit, not a DELPHI vertex: the figure labels it as such.
Source code in src/delphi_eventdisplay/geometry.py
vd_residuals ¶
Check the VD strip decoding against each track's own crossing of the layer.
A median r-phi residual of a few microns is what says the strip decoding is right; plotting the raw (x, y) instead would show hundreds of mm here.
Source code in src/delphi_eventdisplay/geometry.py
impact_parameter ¶
Closest approach of track i to the primary vertex in r-phi [mm].
Source code in src/delphi_eventdisplay/geometry.py
Figures¶
delphi_eventdisplay.figure ¶
Build the four-panel DELPHI event display as one Plotly figure.
Panels, all from measured quantities only: (a) r-phi, whole event (b) r-z, r signed by thrust hemisphere (c) vertex detector r-phi -- zoom into the vertex region with the mouse (d) RICH Cherenkov angle vs momentum, liquid and gas radiators
What Plotly buys over the matplotlib original: hover that names every track, a legend that switches classes of object on and off, and a zoom that replaces the fixed inset.
build ¶
build(e: Event, *, groups: dict | None = None, rich: list | None = None, fit_vertices: list | None = None, hide: dict | None = None, jets: bool = False, title: str = '', note: str = '', width: int = 1500, height: int = 1450) -> go.Figure
Assemble the figure. groups maps particle index -> (label, colour).
Source code in src/delphi_eventdisplay/figure.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 | |
logo_image ¶
The DELPHI + EDM4hep mark, as a layout image in the top margin.
Anchored top-RIGHT: the subplot titles are left-aligned over their own panel, so a top-left mark lands straight on top of "(a) r-phi view".
Embedded as a data URI, so it survives PNG/SVG export and an offline HTML file.
Source code in src/delphi_eventdisplay/figure.py
delphi_eventdisplay.figure3d ¶
The event as a 3-D scene, the way a general-purpose event display shows it.
Same rule as the panels: only measured quantities. That rule bites hardest here. A vertex-detector hit is a strip, not a space point -- a type-0 hit measures R and phi but not z, a type-1 hit measures R and z but not phi -- so in three dimensions a single hit is a line, not a dot. Hits that belong to a track are placed at the z (or phi) their own track supplies, which is a real measurement; hits belonging to no track are drawn as the line they actually constrain, not as invented points.
build3d ¶
build3d(e: Event, *, groups: dict | None = None, fit_vertices: list | None = None, hide: dict | None = None, jets: bool = False, title: str = '', note: str = '', show_barrel: bool = True, width: int = 1250, height: int = 900) -> go.Figure
Source code in src/delphi_eventdisplay/figure3d.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
Site manifest¶
delphi_eventdisplay.pages ¶
Build the manifest that the GitHub Pages viewer and editor read.
Scans docs/events/*.json (the figure JSON written by delphi-display) and writes
docs/events/index.json. The pages are static: publishing an event is committing its JSON.