diff --git a/Processes/Sibyll/Decay.cc b/Processes/Sibyll/Decay.cc index 04113d40ba9c9fd545ece366bfc8a9d4f2989cb9..d1a0c0cb1aff2d14a7ca98f8f5b2422af83de80a 100644 --- a/Processes/Sibyll/Decay.cc +++ b/Processes/Sibyll/Decay.cc @@ -42,7 +42,6 @@ namespace corsika::process::sibyll { } Decay::~Decay() { cout << "Sibyll::Decay n=" << fCount << endl; } - void Decay::Init() {} bool Decay::CanHandleDecay(const particles::Code vParticleCode) { using namespace corsika::particles; diff --git a/Processes/Sibyll/Decay.h b/Processes/Sibyll/Decay.h index de8a730d17a9c5fcef7ec8a72178fb55bbfb8e70..85e62273741ba784ada7efee5a2b685702abf357 100644 --- a/Processes/Sibyll/Decay.h +++ b/Processes/Sibyll/Decay.h @@ -27,7 +27,6 @@ namespace corsika::process { Decay(); Decay(std::set<particles::Code>); ~Decay(); - void Init(); void PrintDecayConfig(const corsika::particles::Code); void PrintDecayConfig(); diff --git a/Processes/Sibyll/Interaction.cc b/Processes/Sibyll/Interaction.cc index 4894301e729825941a1120777eabafca845ca179..19a13678d84ca0e20b42d3d691c63d077c1eecf3 100644 --- a/Processes/Sibyll/Interaction.cc +++ b/Processes/Sibyll/Interaction.cc @@ -32,14 +32,7 @@ using Track = Trajectory; namespace corsika::process::sibyll { - Interaction::Interaction() {} - - Interaction::~Interaction() { - cout << "Sibyll::Interaction n=" << count_ << " Nnuc=" << nucCount_ << endl; - } - - void Interaction::Init() { - + Interaction::Interaction() { using random::RNGManager; // initialize Sibyll @@ -49,6 +42,10 @@ namespace corsika::process::sibyll { } } + Interaction::~Interaction() { + cout << "Sibyll::Interaction n=" << count_ << " Nnuc=" << nucCount_ << endl; + } + void Interaction::SetAllStable() { for (int i = 0; i < 99; ++i) s_csydec_.idb[i] = -1 * abs(s_csydec_.idb[i]); } diff --git a/Processes/Sibyll/Interaction.h b/Processes/Sibyll/Interaction.h index 80a1282185c100084b02766833a1cc7e9a83b52d..a37021e80af1544f1e1f3b243056e26ff860f983 100644 --- a/Processes/Sibyll/Interaction.h +++ b/Processes/Sibyll/Interaction.h @@ -26,8 +26,6 @@ namespace corsika::process::sibyll { Interaction(); ~Interaction(); - void Init(); - void SetAllStable(); bool WasInitialized() { return initialized_; } diff --git a/Processes/Sibyll/NuclearInteraction.cc b/Processes/Sibyll/NuclearInteraction.cc index 802cee9334e4a5f5303da3d7152d4149ac679072..451a5c643478a54db7199a0ef919ddc464cacb5c 100644 --- a/Processes/Sibyll/NuclearInteraction.cc +++ b/Processes/Sibyll/NuclearInteraction.cc @@ -34,12 +34,6 @@ using Track = Trajectory; namespace corsika::process::sibyll { - template <> - NuclearInteraction<SetupEnvironment>::NuclearInteraction( - process::sibyll::Interaction& hadint, SetupEnvironment const& env) - : environment_(env) - , hadronicInteraction_(hadint) {} - template <> NuclearInteraction<SetupEnvironment>::~NuclearInteraction() { cout << "Nuclib::NuclearInteraction n=" << count_ << " Nnuc=" << nucCount_ << endl; @@ -134,26 +128,6 @@ namespace corsika::process::sibyll { } } - template <> - void NuclearInteraction<SetupEnvironment>::Init() { - // initialize hadronic interaction module - // TODO: safe to run multiple initializations? - if (!hadronicInteraction_.WasInitialized()) hadronicInteraction_.Init(); - - // check compatibility of energy ranges, someone could try to use low-energy model.. - if (!hadronicInteraction_.IsValidCoMEnergy(GetMinEnergyPerNucleonCoM()) || - !hadronicInteraction_.IsValidCoMEnergy(GetMaxEnergyPerNucleonCoM())) - throw std::runtime_error( - "NuclearInteraction: hadronic interaction model incompatible!"); - - // initialize nuclib - // TODO: make sure this does not overlap with sibyll - nuc_nuc_ini_(); - - // initialize cross sections - InitializeNuclearCrossSections(); - } - template <> units::si::CrossSectionType NuclearInteraction<SetupEnvironment>::ReadCrossSectionTable( const int ia, particles::Code pTarget, units::si::HEPEnergyType elabnuc) { @@ -608,4 +582,27 @@ namespace corsika::process::sibyll { return process::EProcessReturn::eOk; } + template <> + NuclearInteraction<SetupEnvironment>::NuclearInteraction( + process::sibyll::Interaction& hadint, SetupEnvironment const& env) + : environment_(env) + , hadronicInteraction_(hadint) { + + // initialize hadronic interaction module + // TODO: safe to run multiple initializations? + + // check compatibility of energy ranges, someone could try to use low-energy model.. + if (!hadronicInteraction_.IsValidCoMEnergy(GetMinEnergyPerNucleonCoM()) || + !hadronicInteraction_.IsValidCoMEnergy(GetMaxEnergyPerNucleonCoM())) + throw std::runtime_error( + "NuclearInteraction: hadronic interaction model incompatible!"); + + // initialize nuclib + // TODO: make sure this does not overlap with sibyll + nuc_nuc_ini_(); + + // initialize cross sections + InitializeNuclearCrossSections(); + } + } // namespace corsika::process::sibyll diff --git a/Processes/Sibyll/NuclearInteraction.h b/Processes/Sibyll/NuclearInteraction.h index 061545c76a7dfdd5b2ed1a25e74c2e98fc98cb41..8897d199dfa605f76c43a53c6edfeb838f797d7b 100644 --- a/Processes/Sibyll/NuclearInteraction.h +++ b/Processes/Sibyll/NuclearInteraction.h @@ -30,7 +30,7 @@ namespace corsika::process::sibyll { public: NuclearInteraction(corsika::process::sibyll::Interaction&, TEnvironment const&); ~NuclearInteraction(); - void Init(); + void InitializeNuclearCrossSections(); void PrintCrossSectionTable(corsika::particles::Code); corsika::units::si::CrossSectionType ReadCrossSectionTable( diff --git a/Processes/Sibyll/SibStack.h b/Processes/Sibyll/SibStack.h index 41cbce1e412ebde01858f2a54ff0af9d28b2ef2d..e3ebcc8ff87ba629a32c93f30840c131d5ae0cbb 100644 --- a/Processes/Sibyll/SibStack.h +++ b/Processes/Sibyll/SibStack.h @@ -22,7 +22,6 @@ namespace corsika::process::sibyll { class SibStackData { public: - void Init(); void Dump() const {} void Clear() { s_plist_.np = 0; } diff --git a/Processes/Sibyll/testSibyll.cc b/Processes/Sibyll/testSibyll.cc index 7568f2b74b81912707e61e24563c6c209d774a22..2aab98c2ab9716d82e2cd78cf5f0ae6b817381eb 100644 --- a/Processes/Sibyll/testSibyll.cc +++ b/Processes/Sibyll/testSibyll.cc @@ -135,7 +135,6 @@ TEST_CASE("SibyllInterface", "[processes]") { Interaction model; - model.Init(); [[maybe_unused]] const process::EProcessReturn ret = model.DoInteraction(projectile); [[maybe_unused]] auto const pSum = sumMomentum(view, cs); @@ -163,7 +162,6 @@ TEST_CASE("SibyllInterface", "[processes]") { Interaction hmodel; NuclearInteraction model(hmodel, env); - model.Init(); [[maybe_unused]] const process::EProcessReturn ret = model.DoInteraction(projectile); [[maybe_unused]] const GrammageType length = model.GetInteractionLength(particle); } @@ -187,8 +185,6 @@ TEST_CASE("SibyllInterface", "[processes]") { model.PrintDecayConfig(); - model.Init(); - [[maybe_unused]] const TimeType time = model.GetLifetime(particle); /*[[maybe_unused]] const process::EProcessReturn ret =*/model.DoDecay(projectile);