1pub mod constants;
2pub mod detectors;
3pub mod enums;
4pub mod histograms;
5pub mod parsers;
6pub mod particles;
7pub mod run_periods;
8pub mod utils;
10
11use thiserror::Error;
12
13pub type Id = i64;
15
16pub type RunNumber = i64;
18
19pub type RESTVersion = usize;
21
22#[derive(Error, Debug, Clone, PartialEq)]
24pub enum GlueXCoreError {
25 #[error("timestamp \"{0}\" has no digits")]
27 TimestampNoDigits(String),
28 #[error("invalid timestamp: {0}")]
30 TimestampChrono(String),
31 #[error("histogram edges must contain at least two values (found {len})")]
33 HistogramTooFewEdges { len: usize },
34 #[error("histogram edge at index {index} is not finite: {value}")]
36 HistogramNonFiniteEdge { index: usize, value: f64 },
37 #[error(
39 "histogram edges must be strictly increasing (edges[{index}]={left}, edges[{next_index}]={right})"
40 )]
41 HistogramNotStrictlyIncreasing {
42 index: usize,
43 next_index: usize,
44 left: f64,
45 right: f64,
46 },
47 #[error("counts length mismatch: expected {expected}, found {found}")]
49 HistogramCountLengthMismatch { expected: usize, found: usize },
50 #[error("errors length mismatch: expected {expected}, found {found}")]
52 HistogramErrorLengthMismatch { expected: usize, found: usize },
53 #[error("weights length mismatch: expected {expected}, found {found}")]
55 HistogramWeightLengthMismatch { expected: usize, found: usize },
56 #[error("uniform histogram requires at least one bin")]
58 HistogramEmptyBinCount,
59 #[error(
61 "uniform histogram limits must be finite and strictly increasing (min={min}, max={max})"
62 )]
63 HistogramInvalidUniformLimits { min: f64, max: f64 },
64 #[error("Run number {0} not in range of any known run period")]
66 UnknownRunPeriod(RunNumber),
67 #[error("Could not parse run period from string {0}")]
69 RunPeriodParse(String),
70 #[error("Run period {0:?} is missing REST version metadata")]
72 MissingRESTVersions(crate::run_periods::RunPeriod),
73 #[error("REST version {requested} is not defined for run period {run_period:?}")]
75 UnknownRESTVersion {
76 run_period: crate::run_periods::RunPeriod,
77 requested: RESTVersion,
78 },
79}
80
81pub use crate::detectors::DetectorSystem;
82pub use crate::enums::Polarization;
83pub use crate::histograms::Histogram;
84pub use crate::particles::{Charge, Particle};
85pub use crate::run_periods::{RESTVersionSelection, RunPeriod};