From d8adf55dbe3e60afa10b4b962ea3b31c54a7f88c Mon Sep 17 00:00:00 2001
From: Alan Coleman <alanc@udel.edu>
Date: Tue, 27 Aug 2024 18:16:13 -0400
Subject: [PATCH] Fix fluka initialization in the examples

---
 examples/cascade_examples/mars.cpp  | 5 +++--
 examples/cascade_examples/water.cpp | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/examples/cascade_examples/mars.cpp b/examples/cascade_examples/mars.cpp
index fc6ed95e6..2610f15d0 100644
--- a/examples/cascade_examples/mars.cpp
+++ b/examples/cascade_examples/mars.cpp
@@ -324,7 +324,8 @@ int main(int argc, char** argv) {
   set_energy_production_threshold(Code::TauPlus, std::min({emcut, hadcut}));
 
   /* === START: SETUP PROCESS LIST === */
-  corsika::sibyll::Interaction sibyll(corsika::get_all_elements_in_universe(env));
+  auto const all_elements = corsika::get_all_elements_in_universe(env);
+  corsika::sibyll::Interaction sibyll(all_elements);
   InteractionCounter sibyllCounted(sibyll);
 
   corsika::pythia8::Decay decayPythia;
@@ -352,7 +353,7 @@ int main(int argc, char** argv) {
   output.add("profile", longprof);
   LongitudinalProfile<SubWriter<decltype(longprof)>> profile{longprof};
 
-  corsika::fluka::Interaction leIntModel{env};
+  corsika::fluka::Interaction leIntModel{all_elements};
   InteractionCounter leIntCounted{leIntModel};
   StackInspector<StackType> stackInspect(5000, false, E0);
 
diff --git a/examples/cascade_examples/water.cpp b/examples/cascade_examples/water.cpp
index 8dceb7c62..6bf603a80 100644
--- a/examples/cascade_examples/water.cpp
+++ b/examples/cascade_examples/water.cpp
@@ -225,7 +225,8 @@ int main(int argc, char** argv) {
   HEPEnergyType heHadronModelThreshold = std::pow(10, 1.9) * 1_GeV;
   corsika::sibyll::Interaction sibyll(corsika::get_all_elements_in_universe(env));
 
-  corsika::fluka::Interaction leIntModel{env};
+  auto const all_elements = corsika::get_all_elements_in_universe(env);
+  corsika::fluka::Interaction leIntModel{all_elements};
   InteractionCounter leIntCounted{leIntModel};
   struct EnergySwitch {
     HEPEnergyType cutE_;
-- 
GitLab