hipo-filter¶
Filter events based on bank presence or complex expressions.
Synopsis¶
Description¶
hipo-filter creates a new HIPO file containing only events that match specified criteria. Supports filtering by:
- Expressions: Column value comparisons with
==,!=,<,<=,>,>=,IN,BETWEEN - Bank presence: Require banks to have/not have data
- Row count: Minimum total rows across banks
Multiple expressions can be combined with AND (default) or OR logic.
Options¶
| Option | Description |
|---|---|
-o, --output <file> | Output file (required) |
-e, --expr <expr> | Filter expression (repeatable) |
--or | Use OR logic for expressions (default: AND) |
-b, --has-bank <bank> | Require bank to have data (repeatable) |
-B, --no-bank <bank> | Require bank to be empty (repeatable) |
-m, --min-rows <n> | Minimum total rows across all banks |
-i, --invert | Invert filter (keep non-matching events) |
-q, --quiet | Suppress progress output |
--no-color | Disable colored output |
Examples¶
Filter by Particle Type¶
# Keep events with electrons (pid == 11)
hipo-filter -e "REC::Particle.pid == 11" -o electrons.hipo data.hipo
# Keep events with electrons or positrons
hipo-filter -e "REC::Particle.pid IN (11, -11)" -o leptons.hipo data.hipo
Filter by Value Range¶
# Momentum between 0.5 and 2.0 GeV
hipo-filter -e "REC::Particle.p BETWEEN 0.5 AND 2.0" -o filtered.hipo data.hipo
Multiple Conditions¶
# AND logic (both must match)
hipo-filter -e "REC::Particle.pid == 11" \
-e "REC::Track.ndf >= 10" \
-o good_electrons.hipo data.hipo
# OR logic (either matches)
hipo-filter -e "REC::Particle.pid == 11" \
-e "REC::Particle.pid == -11" \
--or \
-o electrons_or_positrons.hipo data.hipo
Filter by Bank Presence¶
# Keep events with track data
hipo-filter -b REC::Track -o with_tracks.hipo data.hipo
# Keep events with calorimeter AND tracking
hipo-filter -b REC::Track -b REC::Calorimeter -o matched.hipo data.hipo
# Keep events WITHOUT particles (inverted)
hipo-filter -b REC::Particle --invert -o no_particles.hipo data.hipo
Combined Filtering¶
# Charged particles with minimum rows
hipo-filter -e "REC::Particle.charge != 0" -m 2 -o charged.hipo data.hipo
See Also¶
- hipo-search - Search without creating output file
- Expression Syntax - Full expression reference