diff --git a/Documentation/Examples/cascade_example.cc b/Documentation/Examples/cascade_example.cc index c988b4f5db6814468ade253002ded2358ff8a747..28c0315f7de5e679db04c8aa8278f10a4a79f540 100644 --- a/Documentation/Examples/cascade_example.cc +++ b/Documentation/Examples/cascade_example.cc @@ -23,8 +23,6 @@ #include <corsika/geometry/Sphere.h> -//#include <corsika/process/proposal/Interaction.h> - #include <corsika/process/sibyll/Decay.h> #include <corsika/process/sibyll/Interaction.h> #include <corsika/process/sibyll/NuclearInteraction.h> @@ -137,35 +135,31 @@ int main() { random::RNGManager::GetInstance().RegisterRandomStream("sibyll"); random::RNGManager::GetInstance().RegisterRandomStream("pythia"); - // random::RNGManager::GetInstance().RegisterRandomStream("proposal"); process::sibyll::Interaction sibyll; process::sibyll::NuclearInteraction sibyllNuc(sibyll, env); process::sibyll::Decay decay; // cascade with only HE model ==> HE cut process::particle_cut::ParticleCut cut(80_GeV, true, true); - // process::proposal::Interaction proposal(env, cut); process::track_writer::TrackWriter trackWriter("tracks.dat"); process::energy_loss::EnergyLoss eLoss{showerAxis}; // assemble all processes into an ordered process list - auto sequence = stackInspect << sibyll << sibyllNuc /* << proposal*/ - << decay - /* << eLoss */ - << cut << trackWriter; + auto sequence = stackInspect << sibyll << sibyllNuc << decay << eLoss << cut + << trackWriter; // define air shower object, run simulation cascade::Cascade EAS(env, tracking, sequence, stack); EAS.Run(); - /* eLoss.PrintProfile(); // print longitudinal profile */ + eLoss.PrintProfile(); // print longitudinal profile cut.ShowResults(); const HEPEnergyType Efinal = cut.GetCutEnergy() + cut.GetInvEnergy() + cut.GetEmEnergy(); cout << "total cut energy (GeV): " << Efinal / 1_GeV << endl << "relative difference (%): " << (Efinal / E0 - 1) * 100 << endl; - /* cout << "total dEdX energy (GeV): " << eLoss.GetTotal() / 1_GeV << endl */ - /* << "relative difference (%): " << eLoss.GetTotal() / E0 * 100 << endl; */ + cout << "total dEdX energy (GeV): " << eLoss.GetTotal() / 1_GeV << endl + << "relative difference (%): " << eLoss.GetTotal() / E0 * 100 << endl; } diff --git a/Documentation/Examples/em_shower.cc b/Documentation/Examples/em_shower.cc index d83cdacf51cf28cf70a0f97dae8f6a63ae672c91..5bc85b48cb624e96369820257d1a4fd027683dd3 100644 --- a/Documentation/Examples/em_shower.cc +++ b/Documentation/Examples/em_shower.cc @@ -130,9 +130,6 @@ int main(int argc, char** argv) { // setup processes, decays and interactions // PROPOSAL processs proposal{...}; - PROPOSAL::InterpolationDef::path_to_tables = "~/.local/share/PROPOSAL/tables/"; - PROPOSAL::InterpolationDef::path_to_tables_readonly = "~/.local/share/PROPOSAL/tables/"; - process::particle_cut::ParticleCut cut(10_GeV, false, true); process::proposal::Interaction proposal(env, cut); process::proposal::ContinuousProcess em_continuous(env, cut); diff --git a/Documentation/Examples/vertical_EAS.cc b/Documentation/Examples/vertical_EAS.cc index 9c0a72a871d05c45362ecaa3d83d2bcce6cad4c0..be0749fed4bc6061dcfbbf39dfb8198f620eaa3a 100644 --- a/Documentation/Examples/vertical_EAS.cc +++ b/Documentation/Examples/vertical_EAS.cc @@ -184,9 +184,6 @@ int main(int argc, char** argv) { decaySibyll.PrintDecayConfig(); // PROPOSAL processs proposal{...}; - PROPOSAL::InterpolationDef::path_to_tables = "~/.local/share/PROPOSAL/tables/"; - PROPOSAL::InterpolationDef::path_to_tables_readonly = "~/.local/share/PROPOSAL/tables/"; - process::particle_cut::ParticleCut cut{60_GeV, false, true}; process::proposal::Interaction proposal(env, cut); process::proposal::ContinuousProcess em_continuous(env, cut); diff --git a/Processes/Proposal/ProposalProcessBase.cc b/Processes/Proposal/ProposalProcessBase.cc index 815f032b533de2aca85587dd036d7d3a43b20417..d2ab2a2209fb5d5e7beac33f957c559383da253a 100644 --- a/Processes/Proposal/ProposalProcessBase.cc +++ b/Processes/Proposal/ProposalProcessBase.cc @@ -18,6 +18,7 @@ #include <memory> #include <random> #include <tuple> +#include <cstdlib> namespace corsika::process::proposal { bool ProposalProcessBase::CanInteract(particles::Code pcode) const { @@ -50,6 +51,12 @@ namespace corsika::process::proposal { PROPOSAL::InterpolationDef::order_of_interpolation = 2; PROPOSAL::InterpolationDef::nodes_cross_section = 100; PROPOSAL::InterpolationDef::nodes_propagate = 1000; + + //! If corsika data exist store interpolation tables to the corresponding + //! path, otherwise interpolation tables would only stored in main memory if + //! no explicit intrpolation def is specified. + if(auto data_path = std::getenv("CORSIKA_DATA")) + PROPOSAL::InterpolationDef::path_to_tables = std::string(data_path) + "/PROPOSAL"; } size_t ProposalProcessBase::hash::operator()(const calc_key_t& p) const noexcept {