CORSIKA
@c8_version@
The framework to simulate particle cascades for astroparticle physics
ParticleConversion.hpp
1
/*
2
* (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu
3
*
4
* This software is distributed under the terms of the GNU General Public
5
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
6
* the license.
7
*/
8
9
#pragma once
10
11
#include <
corsika/framework/core/ParticleProperties.hpp
>
12
#include <
corsika/framework/core/PhysicalUnits.hpp
>
13
14
#include <sibyll2.3d.hpp>
15
16
#include <string>
17
18
namespace
corsika::sibyll
{
19
20
enum class
SibyllCode : int8_t;
21
using SibyllCodeIntType = std::underlying_type<SibyllCode>::type;
22
26
enum class SibyllXSClass : int8_t {
27
CannotInteract = 0,
28
Baryon = 1,
29
Pion = 2,
30
Kaon = 3,
31
};
32
using
SibyllXSClassIntType = std::underlying_type<SibyllXSClass>::type;
33
34
#include <corsika/modules/sibyll/Generated.inc>
35
36
SibyllCode constexpr convertToSibyll(Code
const
pCode) {
37
return
corsika2sibyll[
static_cast<
CodeIntType
>
(pCode)];
38
}
39
40
Code constexpr convertFromSibyll(SibyllCode
const
pCode) {
41
auto
const
s =
static_cast<
SibyllCodeIntType
>
(pCode);
42
auto
const
corsikaCode = sibyll2corsika[s - minSibyll];
43
if
(corsikaCode == Code::Unknown) {
44
throw
std::runtime_error(std::string(
"SIBYLL/CORSIKA conversion of "
)
45
.append(
std::to_string
(s))
46
.append(
" impossible"
));
47
}
48
return
corsikaCode;
49
}
50
51
int
constexpr convertToSibyllRaw(Code
const
code) {
52
return
static_cast<
int
>
(convertToSibyll(code));
53
}
54
55
int
constexpr getSibyllXSCode(Code
const
code) {
56
if
(
is_nucleus
(code))
57
return
static_cast<
SibyllXSClassIntType
>
(SibyllXSClass::CannotInteract);
58
return
static_cast<
SibyllXSClassIntType
>
(
59
corsika2sibyllXStype[
static_cast<
CodeIntType
>
(code)]);
60
}
61
62
bool
constexpr canInteract(Code
const
pCode) {
return
getSibyllXSCode(pCode) > 0; }
63
64
HEPMassType getSibyllMass(Code
const
);
65
66
}
// namespace corsika::sibyll
67
68
#include <corsika/detail/modules/sibyll/ParticleConversion.inl>
corsika::sibyll
Definition:
Decay.hpp:17
PhysicalUnits.hpp
Import and extend the phys::units package.
phys::units::to_string
std::string to_string(long double const value)
string representation of value.
Definition:
quantity_io.hpp:219
corsika::is_nucleus
bool constexpr is_nucleus(Code const)
Checks if Code corresponds to a nucleus.
ParticleProperties.hpp
Interface to particle properties.
corsika
modules
sibyll
ParticleConversion.hpp
Generated by
1.8.13