From 38b1f88d26ed56731e9a79b0e06085ba33275558 Mon Sep 17 00:00:00 2001 From: Luke Shingles Date: Mon, 16 Sep 2024 14:46:18 +0100 Subject: [PATCH] Update update_packets.cc --- update_packets.cc | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/update_packets.cc b/update_packets.cc index f1af51f1f..05804f815 100644 --- a/update_packets.cc +++ b/update_packets.cc @@ -109,20 +109,24 @@ void do_nonthermal_predeposit(Packet &pkt, const int nts, const double t2) { pkt.prop_time = t_new; } - if (priortype == TYPE_NONTHERMAL_PREDEPOSIT_BETAMINUS) { - atomicadd(globals::dep_estimator_electron[nonemptymgi], en_deposited); - if (pkt.type == TYPE_NTLEPTON_DEPOSITED) { - atomicadd(globals::timesteps[nts].electron_dep_discrete, pkt.e_cmf); - } - } else if (priortype == TYPE_NONTHERMAL_PREDEPOSIT_BETAPLUS) { - atomicadd(globals::dep_estimator_positron[nonemptymgi], en_deposited); - if (pkt.type == TYPE_NTLEPTON_DEPOSITED) { - atomicadd(globals::timesteps[nts].positron_dep_discrete, pkt.e_cmf); - } - } else if (priortype == TYPE_NONTHERMAL_PREDEPOSIT_ALPHA) { - atomicadd(globals::dep_estimator_alpha[nonemptymgi], en_deposited); - if (pkt.type == TYPE_NTLEPTON_DEPOSITED) { - atomicadd(globals::timesteps[nts].alpha_dep_discrete, pkt.e_cmf); + // gamma-ray deposition (which then gave energy to a beta particle) was already counted so only count the beta decay + // products + if (pkt.originated_from_particlenotgamma) { + if (priortype == TYPE_NONTHERMAL_PREDEPOSIT_BETAMINUS) { + atomicadd(globals::dep_estimator_electron[nonemptymgi], en_deposited); + if (pkt.type == TYPE_NTLEPTON_DEPOSITED) { + atomicadd(globals::timesteps[nts].electron_dep_discrete, pkt.e_cmf); + } + } else if (priortype == TYPE_NONTHERMAL_PREDEPOSIT_BETAPLUS) { + atomicadd(globals::dep_estimator_positron[nonemptymgi], en_deposited); + if (pkt.type == TYPE_NTLEPTON_DEPOSITED) { + atomicadd(globals::timesteps[nts].positron_dep_discrete, pkt.e_cmf); + } + } else if (priortype == TYPE_NONTHERMAL_PREDEPOSIT_ALPHA) { + atomicadd(globals::dep_estimator_alpha[nonemptymgi], en_deposited); + if (pkt.type == TYPE_NTLEPTON_DEPOSITED) { + atomicadd(globals::timesteps[nts].alpha_dep_discrete, pkt.e_cmf); + } } } }