From 159d6fae89815135a9f4a872723968684ee59b35 Mon Sep 17 00:00:00 2001 From: Jean-Marco Alameddine <jean-marco.alameddine@udo.edu> Date: Mon, 30 Jan 2023 23:34:24 +0100 Subject: [PATCH] add switch between BetheBloch and PROPOSAL for continuous processes in corsika and mars example --- examples/corsika.cpp | 13 ++++++++++--- examples/mars.cpp | 15 ++++++++++----- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/examples/corsika.cpp b/examples/corsika.cpp index 4673b8326..9ba93a7f0 100644 --- a/examples/corsika.cpp +++ b/examples/corsika.cpp @@ -322,9 +322,16 @@ int main(int argc, char** argv) { HEPEnergyType heHadronModelThreshold = 63.1_GeV; corsika::proposal::Interaction emCascade(env, sibyll.getHadronInteractionModel(), heHadronModelThreshold); - // NOT available for PROPOSAL due to interface trouble: - // InteractionCounter emCascadeCounted(emCascade); - corsika::proposal::ContinuousProcess<SubWriter<decltype(dEdX)>> emContinuous(env, dEdX); + + // use BetheBlochPDG for hadronic continuous losses, and proposal otherwise + corsika::proposal::ContinuousProcess<SubWriter<decltype(dEdX)>> emContinuousProposal(env, dEdX); + BetheBlochPDG<SubWriter<decltype(dEdX)>> emContinuousBethe{dEdX}; + struct EMHadronSwitch { + EMHadronSwitch() = default; + bool operator()(const Particle& p) const { return is_hadron(p.getPID()); } + }; + auto emContinuous = + make_select(EMHadronSwitch(), emContinuousBethe, emContinuousProposal); LongitudinalWriter profile{showerAxis, 200, 10_g / square(1_cm)}; output.add("profile", profile); diff --git a/examples/mars.cpp b/examples/mars.cpp index 8beca32f9..d92e4ae23 100644 --- a/examples/mars.cpp +++ b/examples/mars.cpp @@ -356,11 +356,16 @@ int main(int argc, char** argv) { corsika::proposal::Interaction emCascade(env, sibyll.getHadronInteractionModel(), heHadronModelThreshold); - // NOT possible right now, due to interface difference for PROPOSAL: - // InteractionCounter emCascadeCounted(emCascade); - // corsika::proposal::ContinuousProcess<SubWriter<decltype(dEdX)>> - corsika::proposal::ContinuousProcess<SubWriter<decltype(dEdX)>> emContinuous(env, dEdX); - // BetheBlochPDG<SubWriter<decltype(dEdX)>> emContinuous{dEdX}; + + // use BetheBlochPDG for hadronic continuous losses, and proposal otherwise + corsika::proposal::ContinuousProcess<SubWriter<decltype(dEdX)>> emContinuousProposal(env, dEdX); + BetheBlochPDG<SubWriter<decltype(dEdX)>> emContinuousBethe{dEdX}; + struct EMHadronSwitch { + EMHadronSwitch() = default; + bool operator()(const Particle& p) const { return is_hadron(p.getPID()); } + }; + auto emContinuous = + make_select(EMHadronSwitch(), emContinuousBethe, emContinuousProposal); LongitudinalWriter longprof{showerAxis}; output.add("profile", longprof); -- GitLab