Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bugs, Split format version from package #76

Merged
merged 3 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ authors = ["Gordon McCann"]
edition = "2021"
license = "MIT"
license-file = "LICENSE.txt"
version = "0.2.0"
version = "0.2.1"
repository = "https://github.com/ATTPC/attpc_merger"
readme = "README.md"

Expand Down
2 changes: 1 addition & 1 deletion libattpc_merger/src/event_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl EventBuilder {
/// Used at the end of processing a run.
/// Returns None if there were no frames left over.
pub fn flush_final_event(&mut self) -> Option<Event> {
if self.frame_stack.is_empty() {
if !self.frame_stack.is_empty() {
match Event::new(&self.pad_map, &self.frame_stack) {
Ok(event) => Some(event),
Err(_) => None,
Expand Down
4 changes: 3 additions & 1 deletion libattpc_merger/src/hdf_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const FRIB_PHYSICS_NAME: &str = "frib_physics";

// All event counters start from 0 by law
const START_EVENT_NUMBER: u32 = 0;
/// This is the version of the output format
const FORMAT_VERSION: &str = "1.0";

/// A simple struct which wraps around the hdf5-rust library.
///
Expand Down Expand Up @@ -54,7 +56,7 @@ impl HDFWriter {
let run_path = path.file_stem().unwrap();
let parent_file_path = stem.join(format!("{}.yml", run_path.to_string_lossy()));

let merger_version = format!("{}:{}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"));
let merger_version = format!("{}:{}", env!("CARGO_PKG_NAME"), FORMAT_VERSION);

let events_group = file_handle.create_group(EVENTS_NAME)?;
events_group.new_attr::<u64>().create("min_event")?;
Expand Down
4 changes: 3 additions & 1 deletion libattpc_merger/src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ fn flush_final_event(
) -> Result<(), ProcessorError> {
if let Some(event) = evb.flush_final_event() {
writer.write_event(event, event_counter)?;
writer.close()?;
} else {
spdlog::warn!("Last event was not flushed successfully!")
}
writer.close()?;
Ok(())
}

Expand Down