diff --git a/corsika/detail/modules/thinning/EMThinning.inl b/corsika/detail/modules/thinning/EMThinning.inl index ca686b3ea1c3234a7930b7dbe1d62a0ec49188d4..29ed5ad46d2268700b505fde6f386782cf06e8bc 100644 --- a/corsika/detail/modules/thinning/EMThinning.inl +++ b/corsika/detail/modules/thinning/EMThinning.inl @@ -13,9 +13,10 @@ namespace corsika { - EMThinning::EMThinning(HEPEnergyType threshold, double maxWeight) + EMThinning::EMThinning(HEPEnergyType threshold, double maxWeight, bool const eraseParticles) : threshold_{threshold} - , maxWeight_{maxWeight} {} + , maxWeight_{maxWeight} + , eraseParticles_ {eraseParticles} {} template <typename TStackView> void EMThinning::doSecondaries(TStackView& view) { @@ -76,10 +77,13 @@ namespace corsika { } } - // erase discared particles - // TODO: skip this for multithinning - for (auto& p : view) { - if (auto const w = p.getWeight(); w == 0) { p.erase(); } + // erase discared particles in case of multithinning + if (eraseParticles_) { + for (auto& p : view) { + if (auto const w = p.getWeight(); w == 0) { p.erase(); } + } + } else { + return; } } diff --git a/corsika/modules/thinning/EMThinning.hpp b/corsika/modules/thinning/EMThinning.hpp index d7c580b9073be79fcedb667efe922c58c26ac69c..a32c05a6345d533217c0b1653b8ecfb6886d5308 100644 --- a/corsika/modules/thinning/EMThinning.hpp +++ b/corsika/modules/thinning/EMThinning.hpp @@ -28,7 +28,7 @@ namespace corsika { * @param threshold: thinning applied below this energy * @param maxWeight: maximum allowed weight */ - EMThinning(HEPEnergyType threshold, double maxWeight); + EMThinning(HEPEnergyType threshold, double maxWeight, bool const eraseParticles=true); /** * Apply thinning to secondaries. Only EM primaries with two EM secondaries are @@ -50,6 +50,7 @@ namespace corsika { std::uniform_real_distribution<double> uniform_{}; HEPEnergyType const threshold_; double const maxWeight_; + bool const eraseParticles_; }; } // namespace corsika