from_parquet_to_root.py¶
Purpose: Convert a Parquet file to ROOT TTree format
Use case: Converting pre-processed Parquet data for ROOT-based analysis workflows
Features:
- Reads a Parquet file efficiently
- Creates ROOT TTree with flat branch structure
- One branch per column (hit1, hit2, adc, etc.)
- Optional alphabetical branch sorting
- Compatible with ROOT and uproot analysis workflows
- Output filename is fixed to
run.rootin the input directory
Required input: run.parquet produced by from_jsonl_to_parquet.py
Usage:
# Basic conversion (reads READ_FROM/run.parquet)
uv run examples/from_parquet_to_root.py 20251221_run126/
# Preserve original column order
uv run examples/from_parquet_to_root.py 20251221_run126/ --no-sort-branches
# With verbose output
uv run examples/from_parquet_to_root.py 20251221_run126/ --verbose
# Overwrite existing output
uv run examples/from_parquet_to_root.py 20251221_run126/ --overwrite
CLI Options:
| Option | Default | Description |
|---|---|---|
READ_FROM |
(required) | Directory containing Parquet file |
--pattern |
run.parquet |
Parquet filename pattern |
--sort-branches / --no-sort-branches |
on | Sort branches alphabetically |
--overwrite |
off | Overwrite existing output file |
--verbose / --quiet |
--quiet |
Show or suppress status messages |
--log-level |
error |
Log level (debug/info/error) |
Output file: READ_FROM/run.root
- Flat branch structure (one branch per column)
- Branch names match Parquet column names