Skip to content

Integration

ROOT RDataFrame

The HipoDataFrame extension provides a ROOT RDataSource for HIPO files, enabling analysis with RDataFrame:

#include "RHipoDS.hxx"

auto df = MakeHipoDataFrame("data.hipo");
auto h = df.Histo1D("REC::Particle_px");
h->Draw();

Note

The RDataFrame extension requires ROOT >= 6.28 and is only built when ROOT is detected.

Column Naming

RDataFrame flattens HIPO bank columns using underscores:

  • REC::Particle column pid becomes REC::Particle_pid
  • REC::Event column startTime becomes REC::Event_startTime

Building with ROOT

ROOT support is auto-detected during build. Ensure ROOT is in your PATH:

source /path/to/root/bin/thisroot.sh
meson setup build

Python (hipopy)

Full-featured Python bindings built with pybind11, providing NumPy and Awkward Array integration.

Installation

pip install pybind11 numpy          # required
pip install awkward                  # optional, for ragged arrays
meson setup build -Dpython_bindings=true
ninja -C build

High-Level API

The simplest way to read HIPO files from Python:

import hipopy
import numpy as np

with hipopy.open("data.hipo", banks=["REC::Particle"]) as f:
    for banks in f:
        bank = banks["REC::Particle"]
        pid = bank["pid"]       # NumPy int32 array
        px  = bank["px"]        # NumPy float32 array
        py  = bank["py"]
        pt  = np.sqrt(px**2 + py**2)

Low-Level API

Mirrors the C++ API directly:

reader = hipopy.Reader("data.hipo")
dict_  = hipopy.Dictionary()
reader.read_dictionary(dict_)

bank  = hipopy.Bank(dict_["REC::Particle"])
event = hipopy.Event()

while reader.next():
    reader.read(event)
    event.read(bank)
    arr = bank.get_array("px")       # NumPy array (copy)
    arr = bank.get_array("px", copy=False)  # zero-copy view (unsafe across events)

NumPy Batch Reading

Read all events into flat concatenated NumPy arrays (no per-event structure):

data = hipopy.read_columns("data.hipo", "REC::Particle", ["pid", "px", "py", "pz"])
pt = np.sqrt(data["px"]**2 + data["py"]**2)
electrons = data["pid"] == 11

Awkward Array Reading

Read into ragged arrays that preserve per-event structure:

import awkward as ak

particles = hipopy.read_bank("data.hipo", "REC::Particle", ["pid", "px", "py"])
# particles.px[0] = first event, particles.px[1] = second event, ...
n_per_event = ak.num(particles.pid)
pt = np.sqrt(particles.px**2 + particles.py**2)

Multi-File Processing

# Chain-based (file management)
chain = hipopy.Chain()
chain.add("file1.hipo")
chain.add("file2.hipo")

# Fusion (multi-handle random access)
fusion = hipopy.Fusion()
h1 = fusion.open("file1.hipo")
h2 = fusion.open("file2.hipo")
fusion.define(h1, "REC::Particle")
while fusion.next(h1):
    n = fusion.get_size(h1, "REC::Particle")

Expression Parsing

parser = hipopy.Parser("sqrt(px*px + py*py)")
parser["px"] = 3.0
parser["py"] = 4.0
pt = parser.evaluate()  # 5.0

See Python API Reference for the complete API documentation.

Julia

using Hipo

reader = HipoReader("data.hipo")
for event in reader
    particles = event["REC::Particle"]
    # process...
end

Fortran

A Fortran wrapper provides basic read functionality:

program read_hipo
    use hipo_module
    implicit none

    type(hipo_reader) :: reader
    call reader%open("data.hipo")
    ! ...
end program

See the extensions/ directory for wrapper implementations.

pkg-config

After installation, use pkg-config to link against HIPO in other build systems:

# Get compiler flags
pkg-config --cflags hipo4

# Get linker flags
pkg-config --libs hipo4

CMake

find_package(PkgConfig REQUIRED)
pkg_check_modules(HIPO4 REQUIRED hipo4)

target_include_directories(myapp PRIVATE ${HIPO4_INCLUDE_DIRS})
target_link_libraries(myapp ${HIPO4_LIBRARIES})

Makefile

CXXFLAGS += $(shell pkg-config --cflags hipo4)
LDFLAGS  += $(shell pkg-config --libs hipo4)