From c26b199058bfa5f98843b54619ccb153070fa60a Mon Sep 17 00:00:00 2001 From: Marc Granado Date: Wed, 23 Oct 2024 14:16:25 +0200 Subject: [PATCH] Fixing small bug when target_pitch is best_pitch --- source/digits_hits/src/GateVirtualSegmentationSD.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/digits_hits/src/GateVirtualSegmentationSD.cc b/source/digits_hits/src/GateVirtualSegmentationSD.cc index afe840117..8ee984876 100644 --- a/source/digits_hits/src/GateVirtualSegmentationSD.cc +++ b/source/digits_hits/src/GateVirtualSegmentationSD.cc @@ -295,6 +295,8 @@ G4double GateVirtualSegmentationSD::calculatePitch(G4double crystal_size, G4doub double min_diff = 999; int num_pitches = 1; + if (std::fmod(crystal_size, target_pitch) == 0) return target_pitch; + while (true) { double pitch = crystal_size / num_pitches;