pub struct Dataset {
pub events: Vec<Event>,
/* private fields */
}Expand description
A collection of EventData with optional metadata for name-based lookups.
Fields§
§events: Vec<Event>Implementations§
Source§impl Dataset
impl Dataset
Sourcepub fn iter(&self) -> DatasetIter<'_> ⓘ
pub fn iter(&self) -> DatasetIter<'_> ⓘ
Iterate over all events in the dataset. When MPI is enabled, this will visit every event across all ranks, fetching remote events on demand.
Sourcepub fn metadata(&self) -> &DatasetMetadata
pub fn metadata(&self) -> &DatasetMetadata
Borrow the dataset metadata used for name lookups.
Sourcepub fn metadata_arc(&self) -> Arc<DatasetMetadata>
pub fn metadata_arc(&self) -> Arc<DatasetMetadata>
Clone the internal metadata handle for external consumers (e.g., language bindings).
Sourcepub fn p4_index(&self, name: &str) -> Option<usize>
pub fn p4_index(&self, name: &str) -> Option<usize>
Resolve the index of a four-momentum by name.
Sourcepub fn aux_index(&self, name: &str) -> Option<usize>
pub fn aux_index(&self, name: &str) -> Option<usize>
Resolve the index of an auxiliary scalar by name.
Sourcepub fn named_event(&self, index: usize) -> Event
pub fn named_event(&self, index: usize) -> Event
Borrow event data together with metadata-based helpers as an Event view.
Sourcepub fn p4_by_name(&self, event_index: usize, name: &str) -> Option<Vec4>
pub fn p4_by_name(&self, event_index: usize, name: &str) -> Option<Vec4>
Retrieve a four-momentum by name for the event at event_index.
Sourcepub fn aux_by_name(&self, event_index: usize, name: &str) -> Option<f64>
pub fn aux_by_name(&self, event_index: usize, name: &str) -> Option<f64>
Retrieve an auxiliary scalar by name for the event at event_index.
Sourcepub fn index_local(&self, index: usize) -> &Event
pub fn index_local(&self, index: usize) -> &Event
Get a reference to the EventData at the given index in the Dataset (non-MPI
version).
§Notes
This method is not intended to be called in analyses but rather in writing methods
that have mpi-feature-gated versions. Most users should just index into a Dataset
as if it were any other Vec:
let ds: Dataset = Dataset::new(events);
let event_0 = ds[0];Source§impl Dataset
impl Dataset
Sourcepub fn new_local(
events: Vec<Arc<EventData>>,
metadata: Arc<DatasetMetadata>,
) -> Self
pub fn new_local( events: Vec<Arc<EventData>>, metadata: Arc<DatasetMetadata>, ) -> Self
Create a new Dataset from a list of EventData (non-MPI version).
§Notes
This method is not intended to be called in analyses but rather in writing methods
that have mpi-feature-gated versions. Most users should just call Dataset::new instead.
Sourcepub fn new_with_metadata(
events: Vec<Arc<EventData>>,
metadata: Arc<DatasetMetadata>,
) -> Self
pub fn new_with_metadata( events: Vec<Arc<EventData>>, metadata: Arc<DatasetMetadata>, ) -> Self
Create a dataset with explicit metadata for name-based lookups. Create a dataset with explicit metadata for name-based lookups.
Sourcepub fn n_events_local(&self) -> usize
pub fn n_events_local(&self) -> usize
The number of EventDatas in the Dataset (non-MPI version).
§Notes
This method is not intended to be called in analyses but rather in writing methods
that have mpi-feature-gated versions. Most users should just call Dataset::n_events instead.
Source§impl Dataset
impl Dataset
Sourcepub fn weights_local(&self) -> Vec<f64>
pub fn weights_local(&self) -> Vec<f64>
Extract a list of weights over each EventData in the Dataset (non-MPI version).
§Notes
This method is not intended to be called in analyses but rather in writing methods
that have mpi-feature-gated versions. Most users should just call Dataset::weights instead.
Sourcepub fn n_events_weighted_local(&self) -> f64
pub fn n_events_weighted_local(&self) -> f64
Returns the sum of the weights for each EventData in the Dataset (non-MPI version).
§Notes
This method is not intended to be called in analyses but rather in writing methods
that have mpi-feature-gated versions. Most users should just call Dataset::n_events_weighted instead.
Sourcepub fn n_events_weighted(&self) -> f64
pub fn n_events_weighted(&self) -> f64
Sourcepub fn bootstrap_local(&self, seed: usize) -> Arc<Dataset>
pub fn bootstrap_local(&self, seed: usize) -> Arc<Dataset>
Generate a new dataset with the same length by resampling the events in the original datset with replacement. This can be used to perform error analysis via the bootstrap method. (non-MPI version).
§Notes
This method is not intended to be called in analyses but rather in writing methods
that have mpi-feature-gated versions. Most users should just call Dataset::bootstrap instead.
Sourcepub fn bootstrap(&self, seed: usize) -> Arc<Dataset>
pub fn bootstrap(&self, seed: usize) -> Arc<Dataset>
Generate a new dataset with the same length by resampling the events in the original datset with replacement. This can be used to perform error analysis via the bootstrap method.
Sourcepub fn filter(
&self,
expression: &VariableExpression,
) -> LadduResult<Arc<Dataset>>
pub fn filter( &self, expression: &VariableExpression, ) -> LadduResult<Arc<Dataset>>
Filter the Dataset by a given VariableExpression, selecting events for which
the expression returns true.
Sourcepub fn bin_by<V>(
&self,
variable: V,
bins: usize,
range: (f64, f64),
) -> LadduResult<BinnedDataset>where
V: Variable,
pub fn bin_by<V>(
&self,
variable: V,
bins: usize,
range: (f64, f64),
) -> LadduResult<BinnedDataset>where
V: Variable,
Sourcepub fn boost_to_rest_frame_of<S>(&self, names: &[S]) -> Arc<Dataset>
pub fn boost_to_rest_frame_of<S>(&self, names: &[S]) -> Arc<Dataset>
Boost all the four-momenta in all EventDatas to the rest frame of the given set of
four-momenta identified by name.
Sourcepub fn from_parquet(
file_path: &str,
options: &DatasetReadOptions,
) -> LadduResult<Arc<Dataset>>
pub fn from_parquet( file_path: &str, options: &DatasetReadOptions, ) -> LadduResult<Arc<Dataset>>
Open a file and construct a Dataset using named columns.
Each entry in p4_names identifies a particle; the loader expects columns named
{identifier}_px, {identifier}_py, {identifier}_pz, and {identifier}_e for
each identifier (component suffixes are matched case-insensitively). Auxiliary scalars are
listed explicitly via aux_names and stored in the same order. Columns may be encoded as
Float32 or Float64 and are promoted to f64 on load.
Load a dataset from a Parquet file.
Sourcepub fn from_root(
file_path: &str,
options: &DatasetReadOptions,
) -> LadduResult<Arc<Dataset>>
pub fn from_root( file_path: &str, options: &DatasetReadOptions, ) -> LadduResult<Arc<Dataset>>
Load a dataset from a ROOT TTree using the oxyroot backend.
When reading ROOT files containing multiple trees, set DatasetReadOptions::tree
to select one.
Sourcepub fn to_parquet(
&self,
file_path: &str,
options: &DatasetWriteOptions,
) -> LadduResult<()>
pub fn to_parquet( &self, file_path: &str, options: &DatasetWriteOptions, ) -> LadduResult<()>
Write the dataset to a Parquet file.
Sourcepub fn to_root(
&self,
file_path: &str,
options: &DatasetWriteOptions,
) -> LadduResult<()>
pub fn to_root( &self, file_path: &str, options: &DatasetWriteOptions, ) -> LadduResult<()>
Write the dataset to a ROOT TTree using the oxyroot backend.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Dataset
impl RefUnwindSafe for Dataset
impl Send for Dataset
impl Sync for Dataset
impl Unpin for Dataset
impl UnwindSafe for Dataset
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<I, F> SumWithAccumulator<F> for Iwhere
I: IntoIterator<Item = F>,
impl<I, F> SumWithAccumulator<F> for Iwhere
I: IntoIterator<Item = F>,
Source§fn sum_with_accumulator<Acc>(self) -> Fwhere
Acc: SumAccumulator<F>,
F: Zero,
fn sum_with_accumulator<Acc>(self) -> Fwhere
Acc: SumAccumulator<F>,
F: Zero,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.