13 #include <type_traits> 24 enum class EposCode : int32_t;
25 using EposCodeIntType = std::underlying_type<EposCode>::type;
30 enum class EposXSClass : int8_t {
37 using EposXSClassIntType = std::underlying_type<EposXSClass>::type;
39 #include <corsika/modules/epos/Generated.inc> 43 EposCodeIntType
const eposPdg =
static_cast<EposCodeIntType
>(eposId);
44 return int(eposPdg / 10) % 1000;
48 EposCodeIntType
const eposPdg =
static_cast<EposCodeIntType
>(eposId);
49 return int(eposPdg / 10000) % 1000;
52 EposCode constexpr convertToEpos(Code
const code) {
53 return corsika2epos[
static_cast<CodeIntType
>(code)];
56 Code constexpr convertFromEpos(EposCode
const eposId) {
57 EposCodeIntType
const s =
static_cast<EposCodeIntType
>(eposId);
59 if (s >= 1000000000) {
62 auto const corsikaCode = epos2corsika[s - minEpos];
63 if (corsikaCode == Code::Unknown) {
64 throw std::runtime_error(std::string(
"EPOS/CORSIKA conversion of ")
66 .append(
" impossible"));
71 int constexpr convertToEposRaw(Code
const code) {
72 return static_cast<int>(convertToEpos(code));
75 int constexpr getEposXSCode(Code
const code) {
76 if (
is_nucleus(code)) {
return static_cast<EposXSClassIntType
>(EposXSClass::Baryon); }
77 return static_cast<EposXSClassIntType
>(
78 corsika2eposXStype[
static_cast<CodeIntType
>(code)]);
81 bool constexpr canInteract(Code
const code) {
82 return is_nucleus(code) || getEposXSCode(code) > 0;
85 HEPMassType getEposMass(Code
const);
87 PDGCode getEposPDGId(Code
const);
91 #include <corsika/detail/modules/epos/ParticleConversion.inl>
Import and extend the phys::units package.
Code constexpr get_nucleus_code(size_t const A, size_t const Z)
Creates the Code for a nucleus of type 10LZZZAAAI.
size_t constexpr get_nucleus_A(Code const)
Get the mass number A for nucleus.
std::string to_string(long double const value)
string representation of value.
size_t constexpr get_nucleus_Z(Code const)
Get the charge number Z for nucleus.
bool constexpr is_nucleus(Code const)
Checks if Code corresponds to a nucleus.
Interface to particle properties.