From 29ae1150cd8186ba6104fc725d6d01a0445f9241 Mon Sep 17 00:00:00 2001 From: ralfulrich <ralf.ulrich@kit.edu> Date: Thu, 1 Oct 2020 18:23:35 +0200 Subject: [PATCH] produce REAL error message --- Processes/Proposal/ProposalProcessBase.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Processes/Proposal/ProposalProcessBase.cc b/Processes/Proposal/ProposalProcessBase.cc index d2ab2a220..b24143570 100644 --- a/Processes/Proposal/ProposalProcessBase.cc +++ b/Processes/Proposal/ProposalProcessBase.cc @@ -14,11 +14,11 @@ #include <corsika/setup/SetupTrajectory.h> #include <corsika/units/PhysicalUnits.h> #include <corsika/utl/COMBoost.h> +#include <cstdlib> #include <limits> #include <memory> #include <random> #include <tuple> -#include <cstdlib> namespace corsika::process::proposal { bool ProposalProcessBase::CanInteract(particles::Code pcode) const { @@ -55,8 +55,14 @@ namespace corsika::process::proposal { //! 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"; + if (auto data_path = std::getenv("CORSIKA_DATA")) { + PROPOSAL::InterpolationDef::path_to_tables = std::string(data_path) + "/PROPOSAL"; + } else { + throw std::runtime_error( + "It is not recommended to run PROPOSAL without its tables in " + "$CORSIKA_DATA/PROPOSAL. This would be extremely slow. Please provide the " + "table directory. "); + } } size_t ProposalProcessBase::hash::operator()(const calc_key_t& p) const noexcept { -- GitLab