From 7e3df7d7e820a0ae38bc774f4cd16d2079ae4777 Mon Sep 17 00:00:00 2001
From: Jean-Marco Alameddine <jean-marco.alameddine@tu-dortmund.de>
Date: Fri, 3 Jul 2020 11:04:35 +0200
Subject: [PATCH] Add muons and tau to PROPOSAL particle propagation

---
 Processes/Proposal/ContinuousProcess.h | 25 +++++++++++++
 Processes/Proposal/Interaction.h       | 49 ++++++++++++++++++++++++++
 2 files changed, 74 insertions(+)

diff --git a/Processes/Proposal/ContinuousProcess.h b/Processes/Proposal/ContinuousProcess.h
index e123ee938..58b19ec29 100644
--- a/Processes/Proposal/ContinuousProcess.h
+++ b/Processes/Proposal/ContinuousProcess.h
@@ -73,6 +73,31 @@ namespace corsika::process::proposal {
             calc.insert({std::make_pair(&comp, corsika_code), PROPOSAL::make_displacement(cross, true)});
             return insert_it;
         }
+        if (corsika_code == particles::Code::MuMinus) {
+            auto cross = GetStdCrossSections(PROPOSAL::MuMinusDef(), media.at(&comp), cut, true);
+            auto [insert_it, success] =
+            calc.insert({std::make_pair(&comp, corsika_code), PROPOSAL::make_displacement(cross, true)});
+            return insert_it;
+        }
+        if (corsika_code == particles::Code::MuPlus) {
+            auto cross = GetStdCrossSections(PROPOSAL::MuPlusDef(), media.at(&comp), cut, true);
+            auto [insert_it, success] =
+            calc.insert({std::make_pair(&comp, corsika_code), PROPOSAL::make_displacement(cross, true)});
+            return insert_it;
+        }
+        if (corsika_code == particles::Code::TauMinus) {
+            auto cross = GetStdCrossSections(PROPOSAL::TauMinusDef(), media.at(&comp), cut, true);
+            auto [insert_it, success] =
+            calc.insert({std::make_pair(&comp, corsika_code), PROPOSAL::make_displacement(cross, true)});
+            return insert_it;
+        }
+        if (corsika_code == particles::Code::TauPlus) {
+            auto cross = GetStdCrossSections(PROPOSAL::TauPlusDef(), media.at(&comp), cut, true);
+            auto [insert_it, success] =
+            calc.insert({std::make_pair(&comp, corsika_code), PROPOSAL::make_displacement(cross, true)});
+            return insert_it;
+        }
+        throw std::runtime_error("PROPOSAL could not find corresponding builder");
     }
     
     template <typename Particle>
diff --git a/Processes/Proposal/Interaction.h b/Processes/Proposal/Interaction.h
index 48f3fbeb1..b95b6afdb 100644
--- a/Processes/Proposal/Interaction.h
+++ b/Processes/Proposal/Interaction.h
@@ -92,6 +92,55 @@ namespace corsika::process::proposal {
                                PROPOSAL::make_displacement(cross, true))});
         return insert_it;
       }
+      if (corsika_code == particles::Code::MuMinus) {
+          std::cout << "Build MuMinus tables" << std::endl;
+        auto cross =
+            GetStdCrossSections(PROPOSAL::MuMinusDef(), media.at(&comp), cut, true);
+        auto inter_types = PROPOSAL::CrossSectionVector::GetInteractionTypes(cross);
+        auto [insert_it, success] = calculators.insert(
+            {std::make_pair(&comp, corsika_code), make_tuple(PROPOSAL::make_secondaries(
+                                   inter_types, PROPOSAL::MuMinusDef(), media.at(&comp)),
+                               PROPOSAL::make_interaction(cross, true),
+                               PROPOSAL::make_displacement(cross, true))});
+        return insert_it;
+      }
+      if (corsika_code == particles::Code::MuPlus) {
+          std::cout << "Build MuPlus tables" << std::endl;
+        auto cross =
+            GetStdCrossSections(PROPOSAL::MuPlusDef(), media.at(&comp), cut, true);
+        auto inter_types = PROPOSAL::CrossSectionVector::GetInteractionTypes(cross);
+        auto [insert_it, success] = calculators.insert(
+            {std::make_pair(&comp, corsika_code), make_tuple(PROPOSAL::make_secondaries(
+                                   inter_types, PROPOSAL::MuPlusDef(), media.at(&comp)),
+                               PROPOSAL::make_interaction(cross, true),
+                               PROPOSAL::make_displacement(cross, true))});
+        return insert_it;
+      }
+      if (corsika_code == particles::Code::TauMinus) {
+          std::cout << "Build TauMinus tables" << std::endl;
+        auto cross =
+            GetStdCrossSections(PROPOSAL::TauMinusDef(), media.at(&comp), cut, true);
+        auto inter_types = PROPOSAL::CrossSectionVector::GetInteractionTypes(cross);
+        auto [insert_it, success] = calculators.insert(
+            {std::make_pair(&comp, corsika_code), make_tuple(PROPOSAL::make_secondaries(
+                                   inter_types, PROPOSAL::TauMinusDef(), media.at(&comp)),
+                               PROPOSAL::make_interaction(cross, true),
+                               PROPOSAL::make_displacement(cross, true))});
+        return insert_it;
+      }
+      if (corsika_code == particles::Code::TauPlus) {
+          std::cout << "Build TauPlus tables" << std::endl;
+        auto cross =
+            GetStdCrossSections(PROPOSAL::TauPlusDef(), media.at(&comp), cut, true);
+        auto inter_types = PROPOSAL::CrossSectionVector::GetInteractionTypes(cross);
+        auto [insert_it, success] = calculators.insert(
+            {std::make_pair(&comp, corsika_code), make_tuple(PROPOSAL::make_secondaries(
+                                   inter_types, PROPOSAL::TauPlusDef(), media.at(&comp)),
+                               PROPOSAL::make_interaction(cross, true),
+                               PROPOSAL::make_displacement(cross, true))});
+        return insert_it;
+      }
+      throw std::runtime_error("PROPOSAL could not find corresponding builder");
     } // namespace corsika::process::proposal
 
     enum { SECONDARIES, INTERACTION, DISPLACEMENT };
-- 
GitLab