IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 17174010 authored by Felix Riehn's avatar Felix Riehn Committed by Maximilian Reininghaus
Browse files

fixed definition of stable particles in epos. can be called only once!

parent b7c9cd0e
No related branches found
No related tags found
1 merge request!449Fix epos again again
......@@ -34,8 +34,8 @@ namespace corsika::epos {
data_path_ = (std::string(corsika_data("EPOS").c_str()) + "/").c_str();
}
initialize();
setParticlesStable();
}
setParticlesStable();
}
inline void InteractionModel::setParticlesStable() const {
......@@ -45,15 +45,30 @@ namespace corsika::epos {
if (!is_hadron(p)) continue;
int const eid = convertToEposRaw(p);
if (eid != 0) {
::epos::nodcy_.nrnody = ::epos::nodcy_.nrnody + 1;
::epos::nodcy_.nody[::epos::nodcy_.nrnody - 1] = eid;
// LCOV_EXCL_START
// this is only a safeguard against messing up the epos internals by initializing
// more than once.
unsigned int const n_particles_stable_epos =
::epos::nodcy_.nrnody; // avoid waring -Wsign-compare
if (n_particles_stable_epos < ::epos::mxnody) {
CORSIKA_LOGGER_TRACE(logger_, "setting {} with EposId={} stable inside EPOS.",
p, eid);
::epos::nodcy_.nrnody = ::epos::nodcy_.nrnody + 1;
::epos::nodcy_.nody[::epos::nodcy_.nrnody - 1] = eid;
} else {
CORSIKA_LOGGER_ERROR(logger_, "List of stable particles too long for Epos!");
throw std::runtime_error("Epos initialization error!");
}
// LCOV_EXCL_STOP
} else {
CORSIKA_LOG_DEBUG(
CORSIKA_LOG_TRACE(
"particle conversion Corsika-->Epos not known for {}. Using {}. Setting "
"unstable in Epos!",
p, eid);
}
}
CORSIKA_LOGGER_DEBUG(logger_, "set {} particles stable inside Epos",
::epos::nodcy_.nrnody);
}
inline bool InteractionModel::isValid(Code const projectileId, Code const targetId,
......
......@@ -89,16 +89,18 @@ namespace corsika::epos {
void doInteraction(TSecondaries&, Code const projectileId, Code const targetId,
FourMomentum const& projectileP4, FourMomentum const& targetP4);
void initialize() const;
void initializeEventCoM(Code const, int const, int const, Code const, int const,
int const, HEPEnergyType const) const;
void initializeEventLab(Code const, int const, int const, Code const, int const,
int const, HEPEnergyType const) const;
void configureParticles(Code const, int const, int const, Code const, int const,
int const) const;
void setParticlesStable() const;
private:
// initialize and setParticlesStable are private since they can only be called once at
// the beginning and are already called in the constructor!
void initialize() const;
void setParticlesStable() const;
inline static bool isInitialized_ = false;
std::string data_path_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment