From 1d6a61e49b8eaca40ffab925f575e50c53e23c0a Mon Sep 17 00:00:00 2001 From: Maximilian Reininghaus <maximilian.reininghaus@kit.edu> Date: Mon, 13 Jun 2022 16:42:33 +0200 Subject: [PATCH] adapted examples --- examples/cascade_example.cpp | 6 ++---- examples/cascade_proton_example.cpp | 1 - examples/corsika.cpp | 15 ++++++--------- examples/em_shower.cpp | 5 +++-- examples/hybrid_MC.cpp | 13 ++++--------- examples/mars.cpp | 13 +++++-------- examples/vertical_EAS.cpp | 13 ++++--------- 7 files changed, 24 insertions(+), 42 deletions(-) diff --git a/examples/cascade_example.cpp b/examples/cascade_example.cpp index 6d09fe152..8f846ac81 100644 --- a/examples/cascade_example.cpp +++ b/examples/cascade_example.cpp @@ -136,8 +136,7 @@ int main() { RNGManager<>::getInstance().registerRandomStream("sibyll"); RNGManager<>::getInstance().registerRandomStream("pythia"); - corsika::sibyll::Interaction sibyll; - corsika::sibyll::NuclearInteraction sibyllNuc(sibyll, env); + corsika::sibyll::Interaction sibyll{env}; corsika::sibyll::Decay decay; // cascade with only HE model ==> HE cut @@ -148,8 +147,7 @@ int main() { output.add("tracks", trackWriter); // register TrackWriter // assemble all processes into an ordered process list - auto sequence = make_sequence(stackInspect, make_sequence(sibyllNuc, sibyll), decay, - eLoss, cut, trackWriter); + auto sequence = make_sequence(stackInspect, sibyll, decay, eLoss, cut, trackWriter); // define air shower object, run simulation Cascade EAS(env, tracking, sequence, output, stack); diff --git a/examples/cascade_proton_example.cpp b/examples/cascade_proton_example.cpp index bc30603fb..62ce71079 100644 --- a/examples/cascade_proton_example.cpp +++ b/examples/cascade_proton_example.cpp @@ -122,7 +122,6 @@ int main() { setup::Tracking tracking; StackInspector<setup::Stack<EnvType>> stackInspect(1000, true, E0); - RNGManager<>::getInstance().registerRandomStream("sibyll"); RNGManager<>::getInstance().registerRandomStream("pythia"); corsika::pythia8::Interaction pythia; corsika::pythia8::Decay decay; diff --git a/examples/corsika.cpp b/examples/corsika.cpp index 9d4e05656..112e1fd9d 100644 --- a/examples/corsika.cpp +++ b/examples/corsika.cpp @@ -286,11 +286,8 @@ int main(int argc, char** argv) { TrackWriter tracks; output.add("tracks", tracks); - corsika::sibyll::Interaction sibyll; - InteractionCounter sibyllCounted(sibyll); - corsika::sibyll::NuclearInteraction sibyllNuc(sibyll, env); - InteractionCounter sibyllNucCounted(sibyllNuc); - auto heModelCounted = make_sequence(sibyllNucCounted, sibyllCounted); + corsika::sibyll::Interaction sibyll{env}; + InteractionCounter sibyllCounted{sibyll}; corsika::pythia8::Decay decayPythia; @@ -324,7 +321,8 @@ int main(int argc, char** argv) { // energy threshold for high energy hadronic model. Affects LE/HE switch for hadron // interactions and the hadronic photon model in proposal HEPEnergyType heHadronModelThreshold = 63.1_GeV; - corsika::proposal::Interaction emCascade(env, sibyll, heHadronModelThreshold); + 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); @@ -346,7 +344,7 @@ int main(int argc, char** argv) { bool operator()(const Particle& p) const { return (p.getKineticEnergy() < cutE_); } }; auto hadronSequence = - make_select(EnergySwitch(heHadronModelThreshold), urqmdCounted, heModelCounted); + make_select(EnergySwitch(heHadronModelThreshold), urqmdCounted, sibyllCounted); auto decaySequence = make_sequence(decayPythia, decaySibyll); TrackWriter trackWriter{tracks}; @@ -420,8 +418,7 @@ int main(int argc, char** argv) { observationLevel.getEnergyGround() / 1_GeV, (Efinal / E0 - 1) * 100); // auto const hists = heModelCounted.getHistogram() + urqmdCounted.getHistogram(); - auto const hists = sibyllCounted.getHistogram() + sibyllNucCounted.getHistogram() + - urqmdCounted.getHistogram(); + auto const hists = sibyllCounted.getHistogram() + urqmdCounted.getHistogram(); save_hist(hists.labHist(), labHist_file, true); save_hist(hists.CMSHist(), cMSHist_file, true); diff --git a/examples/em_shower.cpp b/examples/em_shower.cpp index aec2e1a3e..f8fb0fd40 100644 --- a/examples/em_shower.cpp +++ b/examples/em_shower.cpp @@ -163,9 +163,10 @@ int main(int argc, char** argv) { ParticleCut<SubWriter<decltype(dEdX)>> cut(60_GeV, 60_GeV, 100_PeV, 100_PeV, true, dEdX); - corsika::sibyll::Interaction sibyll; + corsika::sibyll::Interaction sibyll{env}; HEPEnergyType heThresholdNN = 80_GeV; - corsika::proposal::Interaction emCascade(env, sibyll, heThresholdNN); + corsika::proposal::Interaction emCascade(env, sibyll.getHadronInteractionModel(), + heThresholdNN); corsika::proposal::ContinuousProcess<SubWriter<decltype(dEdX)>> emContinuous(env, dEdX); // BetheBlochPDG<SubWriter<decltype(dEdX)>> emContinuous{dEdX}; diff --git a/examples/hybrid_MC.cpp b/examples/hybrid_MC.cpp index 0cb65570b..f232ee720 100644 --- a/examples/hybrid_MC.cpp +++ b/examples/hybrid_MC.cpp @@ -234,11 +234,8 @@ int main(int argc, char** argv) { // setup processes, decays and interactions - corsika::sibyll::Interaction sibyll; - InteractionCounter sibyllCounted(sibyll); - - corsika::sibyll::NuclearInteraction sibyllNuc(sibyll, env); - InteractionCounter sibyllNucCounted(sibyllNuc); + corsika::sibyll::Interaction sibyll{env}; + InteractionCounter sibyllCounted{sibyll}; corsika::pythia8::Decay decayPythia; @@ -303,8 +300,7 @@ int main(int argc, char** argv) { return (p.getEnergy() < cutE_); } }; - auto hadronSequence = make_select(EnergySwitch(55_GeV), urqmdCounted, - make_sequence(sibyllNucCounted, sibyllCounted)); + auto hadronSequence = make_select(EnergySwitch(55_GeV), urqmdCounted, sibyllCounted); auto decaySequence = make_sequence(decayPythia, decaySibyll); auto sequence = make_sequence(hadronSequence, decaySequence, eLoss, cut, conex_model, longprof, observationLevel, trackCheck); @@ -327,8 +323,7 @@ int main(int argc, char** argv) { "relative difference (%): {}", Efinal / 1_GeV, (Efinal / E0 - 1) * 100); - auto const hists = sibyllCounted.getHistogram() + sibyllNucCounted.getHistogram() + - urqmdCounted.getHistogram(); + auto const hists = sibyllCounted.getHistogram() + urqmdCounted.getHistogram(); save_hist(hists.labHist(), "inthist_lab_hybrid.npz", true); save_hist(hists.CMSHist(), "inthist_cms_hybrid.npz", true); diff --git a/examples/mars.cpp b/examples/mars.cpp index df9e531fa..e6d77b1cf 100644 --- a/examples/mars.cpp +++ b/examples/mars.cpp @@ -322,11 +322,8 @@ int main(int argc, char** argv) { ParticleCut<SubWriter<decltype(dEdX)>> cut(emcut, emcut, hadcut, hadcut, true, dEdX); /* === START: SETUP PROCESS LIST === */ - corsika::sibyll::Interaction sibyll; + corsika::sibyll::Interaction sibyll{env}; InteractionCounter sibyllCounted(sibyll); - corsika::sibyll::NuclearInteraction sibyllNuc(sibyll, env); - InteractionCounter sibyllNucCounted(sibyllNuc); - auto heModelCounted = make_sequence(sibyllNucCounted, sibyllCounted); corsika::pythia8::Decay decayPythia; @@ -357,7 +354,8 @@ int main(int argc, char** argv) { // interactions and the hadronic photon model in proposal HEPEnergyType heHadronModelThreshold = 63.1_GeV; - corsika::proposal::Interaction emCascade(env, sibyll, heHadronModelThreshold); + 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)>> @@ -380,7 +378,7 @@ int main(int argc, char** argv) { bool operator()(Particle const& p) const { return (p.getKineticEnergy() < cutE_); } }; auto hadronSequence = - make_select(EnergySwitch(heHadronModelThreshold), urqmdCounted, heModelCounted); + make_select(EnergySwitch(heHadronModelThreshold), urqmdCounted, sibyllCounted); auto decaySequence = make_sequence(decayPythia, decaySibyll); // track writer @@ -450,8 +448,7 @@ int main(int argc, char** argv) { "relative difference (%): {}", Efinal / 1_GeV, (Efinal / E0 - 1) * 100); - auto const hists = sibyllCounted.getHistogram() + sibyllNucCounted.getHistogram() + - urqmdCounted.getHistogram(); + auto const hists = sibyllCounted.getHistogram() + urqmdCounted.getHistogram(); save_hist(hists.labHist(), labHist_file, true); save_hist(hists.CMSHist(), cMSHist_file, true); diff --git a/examples/vertical_EAS.cpp b/examples/vertical_EAS.cpp index b5e5f1633..d5117be36 100644 --- a/examples/vertical_EAS.cpp +++ b/examples/vertical_EAS.cpp @@ -223,11 +223,8 @@ int main(int argc, char** argv) { // setup processes, decays and interactions - corsika::sibyll::Interaction sibyll; - InteractionCounter sibyllCounted(sibyll); - - corsika::sibyll::NuclearInteraction sibyllNuc(sibyll, env); - InteractionCounter sibyllNucCounted(sibyllNuc); + corsika::sibyll::Interaction sibyll{env}; + InteractionCounter sibyllCounted{sibyll}; corsika::pythia8::Decay decayPythia; @@ -265,8 +262,7 @@ int main(int argc, char** argv) { : cutE_(cutE) {} bool operator()(const Particle& p) const { return (p.getEnergy() < cutE_); } }; - auto hadronSequence = make_select(EnergySwitch(55_GeV), urqmdCounted, - make_sequence(sibyllNucCounted, sibyllCounted)); + auto hadronSequence = make_select(EnergySwitch(55_GeV), urqmdCounted, sibyllCounted)); auto decaySequence = make_sequence(decayPythia, decaySibyll); // directory for outputs @@ -299,8 +295,7 @@ int main(int argc, char** argv) { EAS.run(); output.endOfShower(); - auto const hists = sibyllCounted.getHistogram() + sibyllNucCounted.getHistogram() + - urqmdCounted.getHistogram(); + auto const hists = sibyllCounted.getHistogram() + urqmdCounted.getHistogram(); save_hist(hists.labHist(), labHist_file, true); save_hist(hists.CMSHist(), cMSHist_file, true); -- GitLab