From 34769cbb50a73777f657316f64b136df757850fc Mon Sep 17 00:00:00 2001 From: Felix Riehn <felix@matilda> Date: Tue, 4 Jun 2019 07:59:48 +0100 Subject: [PATCH] made check proper SecondariesProcess --- Documentation/Examples/boundary_example.cc | 3 ++- Documentation/Examples/cascade_example.cc | 5 +++-- Documentation/Examples/vertical_EAS.cc | 3 ++- Processes/Sibyll/Decay.cc | 4 ++-- Processes/Sibyll/Decay.h | 10 ++++++++++ Processes/Sibyll/testSibyll.cc | 8 +++++--- 6 files changed, 24 insertions(+), 9 deletions(-) diff --git a/Documentation/Examples/boundary_example.cc b/Documentation/Examples/boundary_example.cc index f9839a7b2..d0857537f 100644 --- a/Documentation/Examples/boundary_example.cc +++ b/Documentation/Examples/boundary_example.cc @@ -122,6 +122,7 @@ 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); @@ -129,7 +130,7 @@ int main() { MyBoundaryCrossingProcess<true> boundaryCrossing("crossings.dat"); // assemble all processes into an ordered process list - auto sequence = sibyll << decay << cut << boundaryCrossing << trackWriter; + auto sequence = sibyll << decay << checkDecay << 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 3b5d56100..31281b56b 100644 --- a/Documentation/Examples/cascade_example.cc +++ b/Documentation/Examples/cascade_example.cc @@ -99,7 +99,7 @@ int main() { const int nuclA = 4; const int nuclZ = int(nuclA / 2.15 + 0.7); const HEPMassType mass = GetNucleusMass(nuclA, nuclZ); - const HEPEnergyType E0 = nuclA * 1_TeV; + const HEPEnergyType E0 = nuclA * 100_TeV; double theta = 0.; double phi = 0.; @@ -135,13 +135,14 @@ 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 << eLoss << cut + auto sequence = stackInspect << sibyll << sibyllNuc << decay << checkDecay << eLoss << cut << trackWriter; // define air shower object, run simulation diff --git a/Documentation/Examples/vertical_EAS.cc b/Documentation/Examples/vertical_EAS.cc index 0b3d4641a..0b9a8537c 100644 --- a/Documentation/Examples/vertical_EAS.cc +++ b/Documentation/Examples/vertical_EAS.cc @@ -129,13 +129,14 @@ 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 << eLoss << cut << stackInspect; + auto sequence = sibyll << sibyllNuc << decay << checkDecay << eLoss << cut << stackInspect; // define air shower object, run simulation cascade::Cascade EAS(env, tracking, sequence, stack); diff --git a/Processes/Sibyll/Decay.cc b/Processes/Sibyll/Decay.cc index f7f0c1f36..595d3b1b0 100644 --- a/Processes/Sibyll/Decay.cc +++ b/Processes/Sibyll/Decay.cc @@ -167,10 +167,10 @@ namespace corsika::process::sibyll { } template <> - EProcessReturn Decay::DoSecondaries(SetupView& vS) { // corsika::setup::StackView&vS){} + 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::Decay: Particle decays into itself!"); + throw std::runtime_error("Sibyll::CheckDecay: Particle decays into itself!"); /* here we could also post-process the decay products and let short-lived resonances diff --git a/Processes/Sibyll/Decay.h b/Processes/Sibyll/Decay.h index 745a83072..c332aed69 100644 --- a/Processes/Sibyll/Decay.h +++ b/Processes/Sibyll/Decay.h @@ -13,6 +13,7 @@ #include <corsika/particles/ParticleProperties.h> #include <corsika/process/DecayProcess.h> +#include <corsika/process/SecondariesProcess.h> #include <vector> @@ -54,6 +55,15 @@ namespace corsika::process { template <typename TParticleView> 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 diff --git a/Processes/Sibyll/testSibyll.cc b/Processes/Sibyll/testSibyll.cc index 3a0f365d5..9da1dc0d0 100644 --- a/Processes/Sibyll/testSibyll.cc +++ b/Processes/Sibyll/testSibyll.cc @@ -158,19 +158,21 @@ TEST_CASE("SibyllInterface", "[processes]") { auto particle = stack.AddParticle( std::tuple<particles::Code, units::si::HEPEnergyType, corsika::stack::MomentumVector, geometry::Point, units::si::TimeType>{ - particles::Code::Proton, E0, plab, pos, 0_ns}); + particles::Code::Lambda0, E0, plab, pos, 0_ns}); corsika::stack::SecondaryView view(particle); auto projectile = view.GetProjectile(); Decay model; - + CheckDecay checkModel; + model.Init(); /*[[maybe_unused]] const process::EProcessReturn ret =*/model.DoDecay(projectile); // run checks - model.DoSecondaries(view); + checkModel.DoSecondaries(view); [[maybe_unused]] const TimeType time = model.GetLifetime(particle); } + SECTION("DecayConfiguration") { Decay model; -- GitLab