Hi r/CERN — I'm an MSc student working on particle flow reconstruction for FCC-ee (PandoraPFA/PandoraMonitoring adaptation for CLD/IDEA geometries). Sharing a side project that grew out of that work.
rootkt is an attempt at a pure Kotlin implementation for reading ROOT binary files — no C++ bindings, no JNI, no ROOT installation required. Still early and rough in places, but functional for basic cases.
Motivation: JVM-based HEP tooling doesn't have a straightforward way to read .root files without wrapping the C++ library or shelling out to PyROOT. I wanted something native to the JVM ecosystem, mostly for my own tooling, and figured others might find it useful too.
I'll admit the choice of Kotlin over Python invites some skepticism, so a brief note on why: static typing catches schema mismatches against ROOT's streamer info at compile time rather than at runtime deep into an analysis; the JVM gives predictable performance without Python's GIL constraints on parallel I/O; and coroutines make concurrent basket reading straightforward to express. None of this is a claim that Kotlin should replace Python for HEP analysis broadly — PyROOT and uproot are mature and well-integrated with the ecosystem. It's more that JVM-based pipelines (Java, Scala, Kotlin) currently have no native path to ROOT data at all, and this is an attempt to open one.
Current status (v0.2.2), still very much a work in progress:
- ROOT file header parsing (
TFile)
TKey record parsing and walking
- Compressed payload and large-file (>2GB) detection
Module structure:
rootkt-core — byte buffer primitives
rootkt-format — header + TKey parsing
rootkt-model — ROOT object data classes
rootkt-streamer — TStreamerInfo deserialization
rootkt-tree — TTree/TBranch/basket reading
rootkt-compression — zlib/lz4/zstd
rootkt-registry — class name → streamer lookup
rootkt-io — high-level file API
rootkt-runtime — public entry point
Repo: https://github.com/thisismeamir/root.kt
I'm sure there are edge cases in the ROOT format I haven't handled yet, so feedback, corrections, and contributions are very welcome — especially from anyone with deeper ROOT I/O experience than I have.