Skip to content

hipo-merge

Combine multiple HIPO files into a single output file.

Synopsis

hipo-merge [options] <files...>

Description

hipo-merge combines multiple HIPO files into one. Supports two modes:

  • Sequential (default): Events from each file are appended one after another
  • Bank content merging: Event N from each input is merged into output event N, combining bank rows

Options

Option Description Default
-o, --output <file> Output file (required) -
-n, --max-events <n> Maximum events to write (-1 = all) -1
--skip-empty Skip empty events -
--merge-banks Merge bank content event-by-event (combine rows) -
--source-column <name> Add integer column to track source file index -
--banks <names> Comma-separated list of banks to merge (default: all) -
--repeat Repeat smaller files to match the largest file -
-q, --quiet Suppress progress output -
--no-color Disable colored output -

Automatic Merge Mode

Using --source-column, --banks, or --repeat automatically enables --merge-banks.

Merge Modes

Sequential (Default)

Events from each file are appended one after another:

File1: [E1, E2, E3]
File2: [E4, E5]
Output: [E1, E2, E3, E4, E5]

Bank Content Merging

With --merge-banks, event N from each input file is merged into output event N. Bank rows are combined:

File1 Event1: Bank has 2 rows
File2 Event1: Bank has 3 rows
Output Event1: Bank has 5 rows

Examples

Sequential Merge

# Append files (default mode)
hipo-merge -o combined.hipo run*.hipo

# With event limit
hipo-merge -o merged.hipo -n 100000 file1.hipo file2.hipo

Event-by-Event Bank Merging

# Merge bank content from multiple simulations
hipo-merge -o merged.hipo --merge-banks sim1.hipo sim2.hipo

# Track which file each row came from
# Each row gets "order" column: 0 for sim1.hipo, 1 for sim2.hipo
hipo-merge -o merged.hipo --merge-banks --source-column order sim1.hipo sim2.hipo

Selective Bank Merging

# Merge only specific banks, copy others from first file
hipo-merge -o merged.hipo --merge-banks --banks MC::Particle,MC::True file1.hipo file2.hipo

Handle Different Event Counts

# Cycle smaller file when it runs out of events
hipo-merge -o merged.hipo --merge-banks --repeat large.hipo small.hipo

Notes

  • With --merge-banks, files should have matching schemas for merged banks
  • --source-column adds an integer column (0, 1, 2...) indicating source file for each row
  • --repeat cycles smaller files from the beginning when they run out of events

See Also