gluex-lumi

Crates.iogluex-lumi
lib.rsgluex-lumi
version0.1.5
created_at2025-12-18 17:05:58.098998+00
updated_at2026-01-22 18:33:04.805686+00
descriptionA Rust crate to calculate luminosity data for the GlueX experiment
homepagehttps://github.com/denehoffman/gluex-rs
repositoryhttps://github.com/denehoffman/gluex-rs
max_upload_size
id1992889
size61,517
Nathaniel D. Hoffman (denehoffman)

documentation

https://docs.rs/gluex-lumi

README

gluex-lumi

Luminosity calculators for GlueX analyses. This crate can take a set of runs (optionally selecting a REST version for each run period) and produce histogram distributions of luminosity and flux in the hodoscope/microscope. It ships with a CLI that has similar inputs but prints JSON data for the histograms to stdout to be read by other tools (plotters, etc.).

Installation

Add to an existing Rust project:

cargo add gluex-lumi

or install as a CLI tool:

cargo install gluex-lumi

Example

use gluex_core::run_periods::RunPeriod;
use gluex_lumi::{get_flux_histograms, RestSelection};
use std::collections::HashMap;

fn main() -> Result<(), gluex_lumi::GlueXLumiError> {
    let mut selection = HashMap::new();
    selection.insert(RunPeriod::RP2018_08, RestSelection::Current); // uses current timestamp rather than REST version
    let edges: Vec<f64> = (0..=20).map(|i| 7.5 + 0.05 * i as f64).collect();
    let flux = get_flux_histograms(
        selection,
        &edges,
        true, // coherent peak only
        false, // false -> include AMO runs
        "/path/to/rcdb.sqlite",
        "/path/to/ccdb.sqlite",
        None,
    )?;
    println!("Tagged luminosity in pb^{-1}: {:?}", flux.tagged_luminosity.counts);
    Ok(())
}

License

Dual-licensed under Apache-2.0 or MIT.

Commit count: 77

cargo fmt