IAP GITLAB

Skip to content
Snippets Groups Projects
Commit b951567e authored by Nikos Karastathis's avatar Nikos Karastathis :ocean:
Browse files

implement erase particles flag

parent f6ed04ca
No related branches found
No related tags found
1 merge request!466Resolve "Implement thinning algorithms"
Pipeline #9823 passed with warnings
......@@ -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;
}
}
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment