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
This commit is part of merge request !466. Comments created here will be created in the context of that merge request.
...@@ -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;
} }
} }
......
...@@ -28,7 +28,7 @@ namespace corsika { ...@@ -28,7 +28,7 @@ namespace corsika {
* @param threshold: thinning applied below this energy * @param threshold: thinning applied below this energy
* @param maxWeight: maximum allowed weight * @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 * Apply thinning to secondaries. Only EM primaries with two EM secondaries are
...@@ -50,6 +50,7 @@ namespace corsika { ...@@ -50,6 +50,7 @@ namespace corsika {
std::uniform_real_distribution<double> uniform_{}; std::uniform_real_distribution<double> uniform_{};
HEPEnergyType const threshold_; HEPEnergyType const threshold_;
double const maxWeight_; double const maxWeight_;
bool const eraseParticles_;
}; };
} // namespace corsika } // 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