From 65f94a8d28243d174137c5e566206814099573b1 Mon Sep 17 00:00:00 2001 From: GuySten Date: Wed, 28 Jan 2026 23:52:06 +0200 Subject: [PATCH 1/3] warn users that tally heating photon bin without electron and positron --- src/tallies/tally.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/tallies/tally.cpp b/src/tallies/tally.cpp index 6eef1da9cfd..19993b25b9c 100644 --- a/src/tallies/tally.cpp +++ b/src/tallies/tally.cpp @@ -535,6 +535,7 @@ void Tally::set_scores(const vector& scores) bool legendre_present = false; bool cell_present = false; bool cellfrom_present = false; + bool particle_present = false; bool surface_present = false; bool meshsurface_present = false; bool non_cell_energy_present = false; @@ -555,6 +556,8 @@ void Tally::set_scores(const vector& scores) surface_present = true; } else if (filt->type() == FilterType::MESH_SURFACE) { meshsurface_present = true; + } else if (filt->type() == FilterType::PARTICLE) { + particle_present = true; } } @@ -624,8 +627,28 @@ void Tally::set_scores(const vector& scores) break; case HEATING: - if (settings::photon_transport) + if (settings::photon_transport) { estimator_ = TallyEstimator::COLLISION; + if (particle_present) { + const auto particles = get_filter().particles(); + if (contains(particles, "photon")) { + bool electron_present = contains(particles, "electron"); + bool positron_present = contains(particles, "positron"); + if (!positron_present || !electron_present) { + if (!electron_present) + warning("Tally {} contains heating score with photon bin but " + "without electron bin.", + id_); + if (!positron_present) + warning("Tally {} contains heating score with photon bin but " + "without positron bin.", + id_); + warning("Forgetting to specify charged particles in particle " + "filter when using heating score is a common gotcha."); + } + } + } + } break; case SCORE_PULSE_HEIGHT: From 4cd44bf512721cb72fc5e517ded277f66c4f6c26 Mon Sep 17 00:00:00 2001 From: GuySten Date: Thu, 29 Jan 2026 00:10:44 +0200 Subject: [PATCH 2/3] fix typo --- src/tallies/tally.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/tallies/tally.cpp b/src/tallies/tally.cpp index 19993b25b9c..3f4cfba9302 100644 --- a/src/tallies/tally.cpp +++ b/src/tallies/tally.cpp @@ -636,13 +636,15 @@ void Tally::set_scores(const vector& scores) bool positron_present = contains(particles, "positron"); if (!positron_present || !electron_present) { if (!electron_present) - warning("Tally {} contains heating score with photon bin but " - "without electron bin.", - id_); + warning(fmt::format( + "Tally {} contains heating score with photon bin but " + "without electron bin.", + id_)); if (!positron_present) - warning("Tally {} contains heating score with photon bin but " - "without positron bin.", - id_); + warning(fmt::format( + "Tally {} contains heating score with photon bin but " + "without positron bin.", + id_)); warning("Forgetting to specify charged particles in particle " "filter when using heating score is a common gotcha."); } From 39770f9f2318f7b0f47efd57471fa3503278f6db Mon Sep 17 00:00:00 2001 From: GuySten Date: Thu, 29 Jan 2026 00:13:15 +0200 Subject: [PATCH 3/3] fix typo --- src/tallies/tally.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tallies/tally.cpp b/src/tallies/tally.cpp index 3f4cfba9302..f9cbd1010d8 100644 --- a/src/tallies/tally.cpp +++ b/src/tallies/tally.cpp @@ -630,10 +630,10 @@ void Tally::set_scores(const vector& scores) if (settings::photon_transport) { estimator_ = TallyEstimator::COLLISION; if (particle_present) { - const auto particles = get_filter().particles(); - if (contains(particles, "photon")) { - bool electron_present = contains(particles, "electron"); - bool positron_present = contains(particles, "positron"); + const auto particles = get_filter()->particles(); + if (contains(particles, ParticleType::photon)) { + bool electron_present = contains(particles, ParticleType::electron); + bool positron_present = contains(particles, ParticleType::positron); if (!positron_present || !electron_present) { if (!electron_present) warning(fmt::format(