IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 2e75bd86 authored by Maximilian Reininghaus's avatar Maximilian Reininghaus :vulcan:
Browse files

use pre-step cross-section/lifetime; doSecondaries() only after real

event generation
parent f6944f28
No related branches found
No related tags found
1 merge request!540Resolve "`Cascade.inl` does not take into account decreasing cross sections anymore (possibly?)"
Pipeline #11194 canceled
...@@ -303,15 +303,11 @@ namespace corsika { ...@@ -303,15 +303,11 @@ namespace corsika {
false; // only erase original particle if it decayed or interacted false; // only erase original particle if it decayed or interacted
if (distance_interact < distance_decay) { if (distance_interact < distance_decay) {
CrossSectionType const total_cx_post = composition.getWeightedSum(xs_function);
eraseParticle = isInteracted( eraseParticle = isInteracted(
interaction(secondaries, projectileP4Post, composition, total_cx_post)); interaction(secondaries, projectileP4Post, composition, total_cx_pre));
} else { } else {
[[maybe_unused]] auto projectile = secondaries.getProjectile(); [[maybe_unused]] auto projectile = secondaries.getProjectile();
if (decay(secondaries, total_inv_lifetime_pre) == ProcessReturn::Decayed) {
InverseTimeType const total_inv_lifetime_post =
sequence_.getInverseLifetime(particle);
if (decay(secondaries, total_inv_lifetime_post) == ProcessReturn::Decayed) {
eraseParticle = true; eraseParticle = true;
if (secondaries.getSize() == 1 && if (secondaries.getSize() == 1 &&
projectile.getPID() == secondaries.getNextParticle().getPID()) { projectile.getPID() == secondaries.getNextParticle().getPID()) {
...@@ -321,8 +317,11 @@ namespace corsika { ...@@ -321,8 +317,11 @@ namespace corsika {
} }
} }
sequence_.doSecondaries(secondaries); if (eraseParticle) {
if (eraseParticle) particle.erase(); // doSecondaries() makes sense only if there was an actual event
sequence_.doSecondaries(secondaries);
particle.erase();
}
} }
template <typename TTracking, typename TProcessList, typename TOutput, typename TStack> template <typename TTracking, typename TProcessList, typename TOutput, typename TStack>
......
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