event_file_reader/lib.rs
1//! Generic event file reader.
2//!
3//! This crate provides the [EventFileReader] struct for reading
4//! scattering event files in different formats. See the [Features
5//! section](#features) for a list of supported formats and the [avery
6//! crate](https://docs.rs/avery/latest/avery/event/struct.Event.html)
7//! for the format of the returned events.
8//!
9//! # Example
10//!
11//! ```no_run
12//!# fn main() -> Result<(), Box<dyn std::error::Error>> {
13//! use event_file_reader::EventFileReader as Reader;
14//!
15//! let reader = Reader::new("events.lhe.gz")?;
16//! for event in reader {
17//! let event = event?;
18//! // do something with the event
19//! }
20//!# Ok(())
21//!# }
22//! ```
23//!
24//! # Features
25//!
26//! ## Default Features
27//!
28//! - `lhef`: Support for event files in the [Les Houches Event File format](https://crates.io/crates/lhef).
29//! - `hepmc2`: Support for event files in the [HepMC 2 format](https://crates.io/crates/hepmc2).
30//! - `flate2`: Support for DEFLATE compressed event files, e.g. gzip.
31//! - `zstd`: Support for event files compressed with [zstd](https://en.wikipedia.org/wiki/Zstd).
32//!
33//! ## Non-default Features
34//!
35//! - `all`: Enable all mutually compatible features. Use `--features all` instead of `--all-features`.
36//! - `bzip2`: Support for [bzip2](https://en.wikipedia.org/wiki/Bzip2) compressed event files.
37//! - `ntuple`: Support for [ntuple event files](https://crates.io/crates/ntuple).
38//! - `lz4`: Support for [lz4](https://en.wikipedia.org/wiki/LZ4_(compression_algorithm)) compressed event files using the [lz4 crate](https://crates.io/crates/lz4). Incompatible with the `lz4_flex` feature.
39//! - `lz4_flex`: Support for [lz4](https://en.wikipedia.org/wiki/LZ4_(compression_algorithm)) compressed event files using the [lz4_flex crate](https://crates.io/crates/lz4_flex). Incompatible with the `lz4` feature.
40//!
41
42#[cfg(feature = "hepmc2")]
43mod hepmc2;
44#[cfg(feature = "lhef")]
45mod lhef;
46#[cfg(feature = "ntuple")]
47mod ntuple;
48mod reader;
49
50pub use reader::EventFileReader;