IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 34769cbb authored by Felix Riehn's avatar Felix Riehn Committed by ralfulrich
Browse files

made check proper SecondariesProcess

parent d077a388
No related branches found
No related tags found
No related merge requests found
...@@ -122,6 +122,7 @@ int main() { ...@@ -122,6 +122,7 @@ int main() {
random::RNGManager::GetInstance().RegisterRandomStream("s_rndm"); random::RNGManager::GetInstance().RegisterRandomStream("s_rndm");
process::sibyll::Interaction sibyll; process::sibyll::Interaction sibyll;
process::sibyll::Decay decay; process::sibyll::Decay decay;
process::sibyll::CheckDecay checkDecay;
process::particle_cut::ParticleCut cut(20_GeV); process::particle_cut::ParticleCut cut(20_GeV);
...@@ -129,7 +130,7 @@ int main() { ...@@ -129,7 +130,7 @@ int main() {
MyBoundaryCrossingProcess<true> boundaryCrossing("crossings.dat"); MyBoundaryCrossingProcess<true> boundaryCrossing("crossings.dat");
// assemble all processes into an ordered process list // 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 particle stack, and add primary particles
setup::Stack stack; setup::Stack stack;
......
...@@ -99,7 +99,7 @@ int main() { ...@@ -99,7 +99,7 @@ int main() {
const int nuclA = 4; const int nuclA = 4;
const int nuclZ = int(nuclA / 2.15 + 0.7); const int nuclZ = int(nuclA / 2.15 + 0.7);
const HEPMassType mass = GetNucleusMass(nuclA, nuclZ); const HEPMassType mass = GetNucleusMass(nuclA, nuclZ);
const HEPEnergyType E0 = nuclA * 1_TeV; const HEPEnergyType E0 = nuclA * 100_TeV;
double theta = 0.; double theta = 0.;
double phi = 0.; double phi = 0.;
...@@ -135,13 +135,14 @@ int main() { ...@@ -135,13 +135,14 @@ int main() {
process::sibyll::Interaction sibyll; process::sibyll::Interaction sibyll;
process::sibyll::NuclearInteraction sibyllNuc(sibyll, env); process::sibyll::NuclearInteraction sibyllNuc(sibyll, env);
process::sibyll::Decay decay; process::sibyll::Decay decay;
process::sibyll::CheckDecay checkDecay;
process::particle_cut::ParticleCut cut(20_GeV); process::particle_cut::ParticleCut cut(20_GeV);
process::track_writer::TrackWriter trackWriter("tracks.dat"); process::track_writer::TrackWriter trackWriter("tracks.dat");
process::energy_loss::EnergyLoss eLoss; process::energy_loss::EnergyLoss eLoss;
// assemble all processes into an ordered process list // 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; << trackWriter;
// define air shower object, run simulation // define air shower object, run simulation
......
...@@ -129,13 +129,14 @@ int main() { ...@@ -129,13 +129,14 @@ int main() {
process::sibyll::Interaction sibyll; process::sibyll::Interaction sibyll;
process::sibyll::NuclearInteraction sibyllNuc(sibyll, env); process::sibyll::NuclearInteraction sibyllNuc(sibyll, env);
process::sibyll::Decay decay; process::sibyll::Decay decay;
process::sibyll::CheckDecay checkDecay;
process::particle_cut::ParticleCut cut(20_GeV); process::particle_cut::ParticleCut cut(20_GeV);
process::track_writer::TrackWriter trackWriter("tracks.dat"); process::track_writer::TrackWriter trackWriter("tracks.dat");
process::energy_loss::EnergyLoss eLoss; process::energy_loss::EnergyLoss eLoss;
// assemble all processes into an ordered process list // 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 // define air shower object, run simulation
cascade::Cascade EAS(env, tracking, sequence, stack); cascade::Cascade EAS(env, tracking, sequence, stack);
......
...@@ -167,10 +167,10 @@ namespace corsika::process::sibyll { ...@@ -167,10 +167,10 @@ namespace corsika::process::sibyll {
} }
template <> template <>
EProcessReturn Decay::DoSecondaries(SetupView& vS) { // corsika::setup::StackView&vS){} EProcessReturn CheckDecay::DoSecondaries(SetupView& vS) { // corsika::setup::StackView&vS){}
auto pCode = vS.GetProjectile().GetPID(); auto pCode = vS.GetProjectile().GetPID();
if (vS.GetSize() == 1 && pCode == vS.GetNextParticle().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 here we could also post-process the decay products and let short-lived resonances
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <corsika/particles/ParticleProperties.h> #include <corsika/particles/ParticleProperties.h>
#include <corsika/process/DecayProcess.h> #include <corsika/process/DecayProcess.h>
#include <corsika/process/SecondariesProcess.h>
#include <vector> #include <vector>
...@@ -54,6 +55,15 @@ namespace corsika::process { ...@@ -54,6 +55,15 @@ namespace corsika::process {
template <typename TParticleView> template <typename TParticleView>
EProcessReturn DoSecondaries(TParticleView&); EProcessReturn DoSecondaries(TParticleView&);
}; };
class CheckDecay : public corsika::process::SecondariesProcess<CheckDecay> {
public:
CheckDecay() {};
void Init() {};
template <typename TSecondaryView>
EProcessReturn DoSecondaries(TSecondaryView&);
};
} // namespace sibyll } // namespace sibyll
} // namespace corsika::process } // namespace corsika::process
......
...@@ -158,19 +158,21 @@ TEST_CASE("SibyllInterface", "[processes]") { ...@@ -158,19 +158,21 @@ TEST_CASE("SibyllInterface", "[processes]") {
auto particle = stack.AddParticle( auto particle = stack.AddParticle(
std::tuple<particles::Code, units::si::HEPEnergyType, std::tuple<particles::Code, units::si::HEPEnergyType,
corsika::stack::MomentumVector, geometry::Point, units::si::TimeType>{ 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); corsika::stack::SecondaryView view(particle);
auto projectile = view.GetProjectile(); auto projectile = view.GetProjectile();
Decay model; Decay model;
CheckDecay checkModel;
model.Init(); model.Init();
/*[[maybe_unused]] const process::EProcessReturn ret =*/model.DoDecay(projectile); /*[[maybe_unused]] const process::EProcessReturn ret =*/model.DoDecay(projectile);
// run checks // run checks
model.DoSecondaries(view); checkModel.DoSecondaries(view);
[[maybe_unused]] const TimeType time = model.GetLifetime(particle); [[maybe_unused]] const TimeType time = model.GetLifetime(particle);
} }
SECTION("DecayConfiguration") { SECTION("DecayConfiguration") {
Decay model; Decay model;
......
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