diff --git a/cpp/prd_analysis.cpp b/cpp/prd_analysis.cpp index ad06808..162c1ce 100644 --- a/cpp/prd_analysis.cpp +++ b/cpp/prd_analysis.cpp @@ -45,24 +45,24 @@ main(int argc, char* argv[]) // Process events in batches of up to 100 float energy_1 = 0, energy_2 = 0; - std::size_t num_events = 0; + std::size_t num_prompts = 0; float last_time = 0.F; while (reader.ReadTimeBlocks(time_block)) { last_time = time_block.id * header.scanner.listmode_time_block_duration; + num_prompts += time_block.prompt_events.size(); for (auto& event : time_block.prompt_events) { energy_1 += energy_mid_points[event.energy_1_idx]; energy_2 += energy_mid_points[event.energy_2_idx]; - num_events++; } } std::cout << "Last time block at " << last_time << " ms\n"; - std::cout << "Number of events: " << num_events << std::endl; - std::cout << "Average energy_1: " << energy_1 / num_events << std::endl; - std::cout << "Average energy_2: " << energy_2 / num_events << std::endl; + std::cout << "Number of prompt events: " << num_prompts << std::endl; + std::cout << "Average energy_1: " << energy_1 / num_prompts << std::endl; + std::cout << "Average energy_2: " << energy_2 / num_prompts << std::endl; return 0; } diff --git a/python/prd_analysis.py b/python/prd_analysis.py index a30d565..199b729 100644 --- a/python/prd_analysis.py +++ b/python/prd_analysis.py @@ -17,16 +17,16 @@ print(f"Energy mid points: {energy_mid_points}") energy_1, energy_2 = 0.0, 0.0 - num_events = 0 + num_prompts = 0 last_time = 0 for time_block in reader.read_time_blocks(): last_time = time_block.id * header.scanner.listmode_time_block_duration + num_prompts += len(time_block.prompt_events) for event in time_block.prompt_events: energy_1 += energy_mid_points[event.energy_1_idx] energy_2 += energy_mid_points[event.energy_2_idx] - num_events += 1 print(f"Last time block at {last_time} ms") - print(f"Number of events: {num_events}") - print(f"Average energy_1: {energy_1 / num_events}") - print(f"Average energy_2: {energy_2 / num_events}") + print(f"Number of prompt events: {num_prompts}") + print(f"Average energy_1: {energy_1 / num_prompts}") + print(f"Average energy_2: {energy_2 / num_prompts}")