I/O Module
The io class handles all reading and writing of physics data, supporting
both CERN ROOT files (via TFile/TTree) and HDF5 files (via H5Cpp). It inherits
from tools and notification and exposes a template-based read/write API
for arbitrary C++ types.
Class: io
Header: <io/io.h>
Inheritance: tools, notification
HDF5 Methods
Signature |
Description |
|---|---|
|
Opens (or creates) an HDF5 file at filename.
read_write is |
|
Closes the currently open HDF5 file. |
|
Writes the vector inpt to HDF5 dataset set_name. g must be a trivially copyable POD type. |
|
Writes a single scalar inpt to HDF5 dataset set_name. |
|
Reads HDF5 dataset set_name into outpt (resized automatically). |
|
Reads a single scalar from HDF5 dataset set_name into out. |
|
Reads a |
|
Returns a list of all dataset names in the open HDF5 file. |
ROOT Methods
Signature |
Description |
|---|---|
|
Scans all open ROOT files and builds the |
|
Begins an iteration over the |
|
Closes all open TTreeReader instances. |
|
Triggers the pre-compiled macro (PCM) for object dictionaries. |
|
Validates that all file paths in |
|
Returns a map of tree-path → number of entries. |
|
Returns a pointer to the internal |
|
Copies |
Configuration Fields
Field |
Type |
Description |
|---|---|---|
|
|
Enable AMI metadata fetching. Default |
|
|
Path for the local metadata JSON cache. Default |
|
|
Working directory used for relative file paths. Default |
|
|
Name of the sum-of-weights branch in the ROOT file. Default |
|
|
List of ROOT tree names to scan (e.g. |
|
|
List of branch-path filter prefixes. |
|
|
List of leaf-path filter suffixes. |
Internal ROOT Maps (populated by scan_keys)
Field |
Description |
|---|---|
|
Map of filename → open |
|
Map of filename → |
|
Map of filename → {tree-name → |
|
Map of filename → {tree-name → entry count}. |
|
Map of path → {branch-name → |
|
Map of filename → {leaf-name → |
|
Map of filename → {leaf-name → ROOT type string}. |
|
Full nested map: filename → tree → branch → list of leaf names. |
Example:
io reader;
reader.trees = {"nominal"};
reader.leaves = {"jet_pt"};
reader.root_files["sample.root"] = true;
reader.scan_keys();
reader.root_begin();
auto* data = reader.get_data();
// iterate entries via data map
reader.root_end();