diff --git a/examples/corsika.cpp b/examples/corsika.cpp index 4673b83264bb949f8cf56a02742eeb471a925146..9ba93a7f0b57779d295eb4448511c715c65c4fab 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 8beca32f95706caa5d0feee5ba783047944abfcf..d92e4ae2361cb05b9546f8746681ca575566d6fb 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);