From 800858e8168baa68490da75816f1ea6c4b80976b Mon Sep 17 00:00:00 2001 From: ralfulrich <ralf.ulrich@kit.edu> Date: Sat, 8 Jun 2019 20:35:32 +0200 Subject: [PATCH] move CheckDecay into Cascade::Step --- Documentation/Examples/boundary_example.cc | 3 +-- Documentation/Examples/cascade_example.cc | 3 +-- Documentation/Examples/vertical_EAS.cc | 3 +-- Framework/Cascade/Cascade.h | 5 +++++ Processes/Sibyll/Decay.cc | 17 ----------------- Processes/Sibyll/Decay.h | 9 +-------- Processes/Sibyll/testSibyll.cc | 2 -- 7 files changed, 9 insertions(+), 33 deletions(-) diff --git a/Documentation/Examples/boundary_example.cc b/Documentation/Examples/boundary_example.cc index d0857537f..f9839a7b2 100644 --- a/Documentation/Examples/boundary_example.cc +++ b/Documentation/Examples/boundary_example.cc @@ -122,7 +122,6 @@ int main() { random::RNGManager::GetInstance().RegisterRandomStream("s_rndm"); process::sibyll::Interaction sibyll; process::sibyll::Decay decay; - process::sibyll::CheckDecay checkDecay; process::particle_cut::ParticleCut cut(20_GeV); @@ -130,7 +129,7 @@ int main() { MyBoundaryCrossingProcess<true> boundaryCrossing("crossings.dat"); // assemble all processes into an ordered process list - auto sequence = sibyll << decay << checkDecay << cut << boundaryCrossing << trackWriter; + auto sequence = sibyll << decay << cut << boundaryCrossing << trackWriter; // setup particle stack, and add primary particles setup::Stack stack; diff --git a/Documentation/Examples/cascade_example.cc b/Documentation/Examples/cascade_example.cc index 328cc11fc..3b5d56100 100644 --- a/Documentation/Examples/cascade_example.cc +++ b/Documentation/Examples/cascade_example.cc @@ -135,14 +135,13 @@ int main() { process::sibyll::Interaction sibyll; process::sibyll::NuclearInteraction sibyllNuc(sibyll, env); process::sibyll::Decay decay; - process::sibyll::CheckDecay checkDecay; process::particle_cut::ParticleCut cut(20_GeV); process::track_writer::TrackWriter trackWriter("tracks.dat"); process::energy_loss::EnergyLoss eLoss; // assemble all processes into an ordered process list - auto sequence = stackInspect << sibyll << sibyllNuc << decay << checkDecay << eLoss << cut + auto sequence = stackInspect << sibyll << sibyllNuc << decay << eLoss << cut << trackWriter; // define air shower object, run simulation diff --git a/Documentation/Examples/vertical_EAS.cc b/Documentation/Examples/vertical_EAS.cc index 0b9a8537c..0b3d4641a 100644 --- a/Documentation/Examples/vertical_EAS.cc +++ b/Documentation/Examples/vertical_EAS.cc @@ -129,14 +129,13 @@ int main() { process::sibyll::Interaction sibyll; process::sibyll::NuclearInteraction sibyllNuc(sibyll, env); process::sibyll::Decay decay; - process::sibyll::CheckDecay checkDecay; process::particle_cut::ParticleCut cut(20_GeV); process::track_writer::TrackWriter trackWriter("tracks.dat"); process::energy_loss::EnergyLoss eLoss; // assemble all processes into an ordered process list - auto sequence = sibyll << sibyllNuc << decay << checkDecay << eLoss << cut << stackInspect; + auto sequence = sibyll << sibyllNuc << decay << eLoss << cut << stackInspect; // define air shower object, run simulation cascade::Cascade EAS(env, tracking, sequence, stack); diff --git a/Framework/Cascade/Cascade.h b/Framework/Cascade/Cascade.h index 873e47817..547c2604a 100644 --- a/Framework/Cascade/Cascade.h +++ b/Framework/Cascade/Cascade.h @@ -263,6 +263,10 @@ namespace corsika::cascade { InverseTimeType inv_decay_count = 0 / second; fProcessSequence.SelectDecay(vParticle, projectile, sample_process, inv_decay_count); + // make sure particle actually did decay if it should have done so + if (secondaries.GetSize() == 1 && + projectile.GetPID() == secondaries.GetNextParticle().GetPID()) + throw std::runtime_error("Cascade::Step: Particle decays into itself!"); } fProcessSequence.DoSecondaries(secondaries); @@ -273,6 +277,7 @@ namespace corsika::cascade { // be "protected" and not accessible to physics } else { // step-length limitation within volume + std::cout << "step-length limitation" << std::endl; fProcessSequence.DoSecondaries(secondaries); } diff --git a/Processes/Sibyll/Decay.cc b/Processes/Sibyll/Decay.cc index 595d3b1b0..ea50d4477 100644 --- a/Processes/Sibyll/Decay.cc +++ b/Processes/Sibyll/Decay.cc @@ -166,21 +166,4 @@ namespace corsika::process::sibyll { ss.Clear(); } - template <> - EProcessReturn CheckDecay::DoSecondaries(SetupView& vS) { // corsika::setup::StackView&vS){} - auto pCode = vS.GetProjectile().GetPID(); - if (vS.GetSize() == 1 && pCode == vS.GetNextParticle().GetPID()) - throw std::runtime_error("Sibyll::CheckDecay: Particle decays into itself!"); - - /* - here we could also post-process the decay products and let short-lived resonances - decay, etc - - See Issue 196 - - https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/issues/196 - - */ - return EProcessReturn::eOk; - } } // namespace corsika::process::sibyll diff --git a/Processes/Sibyll/Decay.h b/Processes/Sibyll/Decay.h index c332aed69..feb2309da 100644 --- a/Processes/Sibyll/Decay.h +++ b/Processes/Sibyll/Decay.h @@ -56,15 +56,8 @@ namespace corsika::process { EProcessReturn DoSecondaries(TParticleView&); }; - class CheckDecay : public corsika::process::SecondariesProcess<CheckDecay> { - public: - CheckDecay() {}; - void Init() {}; - template <typename TSecondaryView> - EProcessReturn DoSecondaries(TSecondaryView&); - }; - } // namespace sibyll + } // namespace corsika::process #endif diff --git a/Processes/Sibyll/testSibyll.cc b/Processes/Sibyll/testSibyll.cc index 9da1dc0d0..17706ebd8 100644 --- a/Processes/Sibyll/testSibyll.cc +++ b/Processes/Sibyll/testSibyll.cc @@ -163,12 +163,10 @@ TEST_CASE("SibyllInterface", "[processes]") { auto projectile = view.GetProjectile(); Decay model; - CheckDecay checkModel; model.Init(); /*[[maybe_unused]] const process::EProcessReturn ret =*/model.DoDecay(projectile); // run checks - checkModel.DoSecondaries(view); [[maybe_unused]] const TimeType time = model.GetLifetime(particle); } -- GitLab