From 14c783564f9b5521e4e54797b9ff62e7af9ee421 Mon Sep 17 00:00:00 2001 From: Leander Schlegel Date: Tue, 21 May 2024 14:41:11 +0200 Subject: [PATCH] small optimization for case of haveSecondaries=False, as pointed out by Julien --- src/module/EMInverseComptonScattering.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/module/EMInverseComptonScattering.cpp b/src/module/EMInverseComptonScattering.cpp index 55c7637b5..c15d689d6 100644 --- a/src/module/EMInverseComptonScattering.cpp +++ b/src/module/EMInverseComptonScattering.cpp @@ -189,9 +189,9 @@ void EMInverseComptonScattering::performInteraction(Candidate *candidate) const double Enew = distribution.sample(E, s); // add up-scattered photon - double Esecondary = E - Enew; - double f = Enew / E; if (havePhotons) { + double Esecondary = E - Enew; + double f = Enew / E; if (random.rand() < pow(1 - f, thinning)) { double w = 1. / pow(1 - f, thinning); Vector3d pos = random.randomInterpolatedPosition(candidate->previous.getPosition(), candidate->current.getPosition());