diff --git a/Framework/Cascade/Cascade.h b/Framework/Cascade/Cascade.h index 73d7c8de27bff2f6b0c6313307b0328a190edddc..15d5522d58bc6760984d24ad140b6b7a70f5c05c 100644 --- a/Framework/Cascade/Cascade.h +++ b/Framework/Cascade/Cascade.h @@ -218,19 +218,6 @@ namespace corsika::cascade { std::cout << "sth. happening before geometric limit ? " << ((min_distance < geomMaxLength) ? "yes" : "no") << std::endl; - /* - Create SecondaryView object on Stack. The data container - remains untouched and identical, and 'projectil' is identical - to 'vParticle' above this line. However, - projectil.AddSecondaries populate the SecondaryView, which can - then be used afterwards for further processing. Thus: it is - important to use projectle (and not vParticle) for Interaction, - and Decay! - */ - - TStackView secondaries(vParticle); - [[maybe_unused]] auto projectile = secondaries.GetProjectile(); - if (min_distance < geomMaxLength) { // interaction to happen within geometric limit // check whether decay or interaction limits this step the @@ -238,39 +225,58 @@ namespace corsika::cascade { // secondaries, b) the projectile particle deleted (or // changed) - if (min_distance == distance_interact) { - std::cout << "collide" << std::endl; - - InverseGrammageType const current_inv_length = - fProcessSequence.GetTotalInverseInteractionLength(vParticle); - - random::UniformRealDistribution<InverseGrammageType> uniDist( - current_inv_length); - const auto sample_process = uniDist(fRNG); - InverseGrammageType inv_lambda_count = 0. * meter * meter / gram; - fProcessSequence.SelectInteraction(vParticle, projectile, sample_process, - inv_lambda_count); - } else if (min_distance == distance_decay) { - std::cout << "decay" << std::endl; - InverseTimeType const actual_decay_time = - fProcessSequence.GetTotalInverseLifetime(vParticle); - - random::UniformRealDistribution<InverseTimeType> uniDist(actual_decay_time); - const auto sample_process = uniDist(fRNG); - InverseTimeType inv_decay_count = 0 / second; - fProcessSequence.SelectDecay(vParticle, projectile, sample_process, - inv_decay_count); + TStackView secondaries(vParticle); + + if (min_distance != distance_max) { + /* + Create SecondaryView object on Stack. The data container + remains untouched and identical, and 'projectil' is identical + to 'vParticle' above this line. However, + projectil.AddSecondaries populate the SecondaryView, which can + then be used afterwards for further processing. Thus: it is + important to use projectle (and not vParticle) for Interaction, + and Decay! + */ + + [[maybe_unused]] auto projectile = secondaries.GetProjectile(); + + if (min_distance == distance_interact) { + std::cout << "collide" << std::endl; + + InverseGrammageType const current_inv_length = + fProcessSequence.GetTotalInverseInteractionLength(vParticle); + + random::UniformRealDistribution<InverseGrammageType> uniDist( + current_inv_length); + const auto sample_process = uniDist(fRNG); + InverseGrammageType inv_lambda_count = 0. * meter * meter / gram; + fProcessSequence.SelectInteraction(vParticle, projectile, sample_process, + inv_lambda_count); + } else { + assert(min_distance == distance_decay); + std::cout << "decay" << std::endl; + InverseTimeType const actual_decay_time = + fProcessSequence.GetTotalInverseLifetime(vParticle); + + random::UniformRealDistribution<InverseTimeType> uniDist(actual_decay_time); + const auto sample_process = uniDist(fRNG); + InverseTimeType inv_decay_count = 0 / second; + fProcessSequence.SelectDecay(vParticle, projectile, sample_process, + inv_decay_count); + } + + fProcessSequence.DoSecondaries(secondaries); + vParticle.Delete(); // todo: this should be reviewed. Where + // exactly are particles best deleted, and + // where they should NOT be + // deleted... maybe Delete function should + // be "protected" and not accessible to physics + } else { // step-length limitation within volume std::cout << "step-length limitation" << std::endl; + fProcessSequence.DoSecondaries(secondaries); } - fProcessSequence.DoSecondaries(secondaries); - vParticle.Delete(); // todo: this should be reviewed. Where - // exactly are particles best deleted, and - // where they should NOT be - // deleted... maybe Delete function should - // be "protected" and not accessible to physics - auto const assertion = [&] { auto const* numericalNodeAfterStep = fEnvironment.GetUniverse()->GetContainingNode(vParticle.GetPosition());