From b9df7dd3b55086412460705ce622dfeabe30cf01 Mon Sep 17 00:00:00 2001 From: Remy Prechelt <prechelt@hawaii.edu> Date: Fri, 10 Jul 2020 08:38:25 -1000 Subject: [PATCH] Remove Init() from Pythia. --- Processes/Pythia/Decay.cc | 15 +++++++-------- Processes/Pythia/Decay.h | 1 - Processes/Pythia/Interaction.cc | 5 +++-- Processes/Pythia/Interaction.h | 4 +--- Processes/Pythia/testPythia8.cc | 6 ++---- 5 files changed, 13 insertions(+), 18 deletions(-) diff --git a/Processes/Pythia/Decay.cc b/Processes/Pythia/Decay.cc index 21f9d92a2..ea8112100 100644 --- a/Processes/Pythia/Decay.cc +++ b/Processes/Pythia/Decay.cc @@ -28,14 +28,7 @@ using Track = Trajectory; namespace corsika::process::pythia { - Decay::Decay() {} - Decay::Decay(std::set<particles::Code> vHandled) - : handleAllDecays_(false) - , handledDecays_(vHandled) {} - - Decay::~Decay() { cout << "Pythia::Decay n=" << fCount << endl; } - - void Decay::Init() { + Decay::Decay() { // set random number generator in pythia Pythia8::RndmEngine* rndm = new corsika::process::pythia::Random(); @@ -77,6 +70,12 @@ namespace corsika::process::pythia { throw std::runtime_error("Pythia::Decay: Initialization failed!"); } + Decay::Decay(std::set<particles::Code> vHandled) + : handleAllDecays_(false) + , handledDecays_(vHandled) {} + + Decay::~Decay() { cout << "Pythia::Decay n=" << fCount << endl; } + bool Decay::CanHandleDecay(const particles::Code vParticleCode) { using namespace corsika::particles; // if known to pythia and not proton, electron or neutrino it can decay diff --git a/Processes/Pythia/Decay.h b/Processes/Pythia/Decay.h index 4e2d423a2..dfa1a2580 100644 --- a/Processes/Pythia/Decay.h +++ b/Processes/Pythia/Decay.h @@ -26,7 +26,6 @@ namespace corsika::process { Decay(); Decay(std::set<particles::Code>); ~Decay(); - void Init(); // is Pythia::Decay set to handle the decay of this particle? bool IsDecayHandled(const corsika::particles::Code); diff --git a/Processes/Pythia/Interaction.cc b/Processes/Pythia/Interaction.cc index 0b22b5b5e..f6b2a0140 100644 --- a/Processes/Pythia/Interaction.cc +++ b/Processes/Pythia/Interaction.cc @@ -29,9 +29,10 @@ namespace corsika::process::pythia { typedef corsika::geometry::Vector<corsika::units::si::hepmomentum_d> MomentumVector; - Interaction::~Interaction() { cout << "Pythia::Interaction n=" << fCount << endl; } + Interaction::~Interaction() {} - void Interaction::Init() { + Interaction::Interaction() { + cout << "Pythia::Interaction n=" << fCount << endl; using random::RNGManager; diff --git a/Processes/Pythia/Interaction.h b/Processes/Pythia/Interaction.h index 117c23251..d6e3862bf 100644 --- a/Processes/Pythia/Interaction.h +++ b/Processes/Pythia/Interaction.h @@ -24,11 +24,9 @@ namespace corsika::process::pythia { bool fInitialized = false; public: - Interaction() {} + Interaction(); ~Interaction(); - void Init(); - void SetParticleListStable(std::vector<particles::Code> const&); void SetUnstable(const corsika::particles::Code); void SetStable(const corsika::particles::Code); diff --git a/Processes/Pythia/testPythia8.cc b/Processes/Pythia/testPythia8.cc index 1a7ba3cc2..f947a8b81 100644 --- a/Processes/Pythia/testPythia8.cc +++ b/Processes/Pythia/testPythia8.cc @@ -65,8 +65,6 @@ TEST_CASE("Pythia", "[processes]") { random::RNGManager::GetInstance().RegisterRandomStream("pythia"); process::pythia::Decay model; - - model.Init(); } } @@ -136,7 +134,7 @@ TEST_CASE("pythia process") { auto projectile = view.GetProjectile(); process::pythia::Decay model; - model.Init(); + [[maybe_unused]] const TimeType time = model.GetLifetime(particle); model.DoDecay(projectile); CHECK(stack.GetSize() == 3); @@ -186,7 +184,7 @@ TEST_CASE("pythia process") { auto projectile = view.GetProjectile(); process::pythia::Interaction model; - model.Init(); + [[maybe_unused]] const process::EProcessReturn ret = model.DoInteraction(projectile); [[maybe_unused]] const GrammageType length = model.GetInteractionLength(particle); } -- GitLab