IAP GITLAB

Skip to content
Snippets Groups Projects

Resolve "Implement thinning algorithms"

Merged Maximilian Reininghaus requested to merge 445-implement-thinning-algorithms into master
2 files
+ 12
7
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -13,9 +13,10 @@
@@ -13,9 +13,10 @@
namespace corsika {
namespace corsika {
EMThinning::EMThinning(HEPEnergyType threshold, double maxWeight)
EMThinning::EMThinning(HEPEnergyType threshold, double maxWeight, bool const eraseParticles)
: threshold_{threshold}
: threshold_{threshold}
, maxWeight_{maxWeight} {}
, maxWeight_{maxWeight}
 
, eraseParticles_ {eraseParticles} {}
template <typename TStackView>
template <typename TStackView>
void EMThinning::doSecondaries(TStackView& view) {
void EMThinning::doSecondaries(TStackView& view) {
@@ -76,10 +77,13 @@ namespace corsika {
@@ -76,10 +77,13 @@ namespace corsika {
}
}
}
}
// erase discared particles
// erase discared particles in case of multithinning
// TODO: skip this for multithinning
if (eraseParticles_) {
for (auto& p : view) {
for (auto& p : view) {
if (auto const w = p.getWeight(); w == 0) { p.erase(); }
if (auto const w = p.getWeight(); w == 0) { p.erase(); }
 
}
 
} else {
 
return;
}
}
}
}
Loading