Warning, /firebird/docs/open-root-events.md is written in an unsupported language. File is not indexed.
0001 # Opening ROOT files in the browser
0002
0003 Firebird can read an EDM4eic or EDM4hep ROOT file straight from your computer,
0004 or from a URL, and show its events — no server, no conversion step, no upload.
0005
0006 ## Using the panel
0007
0008 1. Press the **folder** button in the top bar. The data selector drops down,
0009 open on the **Manual** tab (or on **Presets** when a preset is loaded).
0010 2. In the **Events** field, pick **Upload** and drop a `.root` file on the
0011 zone (or click it to choose one), or stay on **Select** and paste a
0012 `https://` URL. The **Geometry** field works the same way for a TGeo file.
0013 3. Firebird looks inside every `.root` file: a detector geometry dropped into
0014 the Events field moves to the Geometry field, with a note.
0015 4. A ROOT event file reports its data model (`edm4eic` or `edm4hep`) and how
0016 many events it holds, and shows the **Events** range and **Convert**
0017 group inputs under the field.
0018 5. Type which events you want and press **Show**.
0019
0020 The **Events** range takes a single number, a list, or a range — `3`,
0021 `0,2,4-5`, `10-19`. Everything you ask for lands in the event selector in the
0022 toolbar, so the usual next/previous controls step through them. Events the
0023 file does not hold are skipped, and one warning in the browser console lists
0024 them: `0-99` on a 10-event file converts events 0-9. A range with no event in
0025 the file fails with a message that names the file's event count. One request
0026 may name at most 1000 events. pyrobird applies the same rules to the files it
0027 converts and logs the warning on the server.
0028
0029 The **Convert** checkboxes choose which collection groups the conversion
0030 produces — tracker hits, tracks, MC particles. They list what the opened
0031 file's data model offers, and all groups start on. Unchecking a group leaves
0032 it out of the converted event; press **Show** again to re-convert with a
0033 different choice.
0034
0035 A DEX file (`.firebird.json`, `.firebird.zip`) loads all its events when you
0036 press **Show**; there is nothing to pick.
0037
0038 The other tabs of the same panel, **Presets** and **Physics**, offer the
0039 datasets the installation lists; see the [data catalog](/extensions#data-catalog-and-the-data-selector)
0040 for how those lists are made.
0041
0042 ## Deep links
0043
0044 `?dex=` accepts a ROOT URL, so a link can carry a whole view:
0045
0046 ```
0047 /display?geometry=epic://tgeo/epic_craterlake.root
0048 &dex=https://example.org/reco.edm4eic.root
0049 &config.events.rootEventRange=0-4
0050 ```
0051
0052 `config.events.rootEventRange` chooses the events, exactly like the panel's
0053 Events box. `config.events.rootCollections` chooses the collection groups,
0054 exactly like the panel's Convert checkboxes — a comma-separated list such as
0055 `tracker_hits,mc_particles`; leave it out (or empty) for all groups. The URL
0056 must be reachable by your browser and its server must answer HTTP Range
0057 requests — which is how only the needed bytes are fetched.
0058
0059 ## The file is not uploaded, and not even fully read
0060
0061 A local file never leaves your computer, and Firebird does not load it into
0062 memory either: it reads the file's directory and tree structure once, and after
0063 that only the compressed blocks that hold the events you asked for. Converting
0064 one event of the reference test files costs 20–30 kB of reading. Multi-GB files
0065 work the same way as small ones, over a URL just as much as from disk.
0066
0067 That means the cost of "show event 5000" does not grow with the size of the
0068 file.
0069
0070 ## Which converter runs
0071
0072 | Source | Converted by |
0073 |---|---|
0074 | A file you picked or dropped | your browser |
0075 | `http(s)://…/file.root` | your browser (HTTP Range) |
0076 | `root://…` (XRootD) | pyrobird, which opens the remote file and converts |
0077 | A path served by pyrobird | pyrobird |
0078
0079 XRootD access is unchanged: those URLs go to the server exactly as before. If
0080 you would rather always convert server-side, set `events.rootConverter` to
0081 `server`.
0082
0083 ## What you get
0084
0085 The conversion is the same one `pyrobird convert` performs, so the picture is
0086 the same whether the file went through the Python CLI or through the browser:
0087
0088 - **EDM4eic** — every `TrackerHitData` collection becomes a box-hit piece
0089 (box size from the hit's position error), and `CentralTrackSegments` becomes
0090 trajectories with their track parameters.
0091 - **EDM4hep** — every `SimTrackerHitData` collection becomes a box-hit piece
0092 with a fixed box size (simulation hits carry no errors), plus MC-truth
0093 trajectories that connect each particle's hits in time order. The
0094 collections listed in `config.events.trajectoryExcludedCollections` show as
0095 hits but stay out of the trajectories. List the Cherenkov and PID
0096 collections there: their photon hits are attributed to the charged particle
0097 that emitted them and draw zigzags across the photosensors. The ePIC pack
0098 lists `DIRCBarHits`, `DRICHHits` and `PFRICHHits`, the same list pyrobird
0099 excludes by default.
0100 - **MC particles** (both models) — every particle of the `MCParticles`
0101 collection becomes a straight line from its vertex to its endpoint, with
0102 points on a fixed time grid so the time animation reveals each line at the
0103 particle's real speed (computed from its momentum and mass). Nothing is
0104 filtered: the line count equals the collection size, and the trajectory id
0105 equals the MCParticle index. The piece converts by default but starts
0106 **hidden** — open the left panel (Physics tree) and press the eye on the
0107 `MCParticles` row to show it. A deep link can show it too:
0108 `config.painters.byPiece.MCParticles.visible=true`.
0109
0110 For pieces with tens of thousands of trajectories (background frames), select
0111 the batched painter in the right-pane painter panel — or with
0112 `config.painters.byPiece.MCParticles=trajectory-lines-batched` — which draws
0113 the whole piece in two draw calls instead of one object per trajectory. All
0114 tracks then share one line width and dash pattern; coloring, time animation,
0115 and click selection work as usual.
0116
0117 ## Limits
0118
0119 - One file at a time; opening another replaces it.
0120 - A remote file needs a server that answers Range requests and allows
0121 cross-origin reads. Without that, use a `root://` URL through pyrobird, or
0122 convert ahead of time with `pyrobird convert` (see [Pyrobird](/pyrobird)).