CORSIKA
@c8_version@
The framework to simulate particle cascades for astroparticle physics
ParticleConversion.hpp
1
/*
2
* (c) Copyright 2022 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 <sophia.hpp>
15
16
#include <string>
17
18
namespace
corsika::sophia
{
19
20
enum class
SophiaCode : int8_t;
21
using SophiaCodeIntType = std::underlying_type<SophiaCode>::type;
22
23
#include <corsika/modules/sophia/Generated.inc>
24
25
SophiaCode constexpr convertToSophia(Code const pCode) {
26
return
corsika2sophia[
static_cast<
CodeIntType
>
(pCode)];
27
}
28
29
Code constexpr convertFromSophia(SophiaCode
const
pCode) {
30
auto
const
s =
static_cast<
SophiaCodeIntType
>
(pCode);
31
auto
const
corsikaCode = sophia2corsika[s - minSophia];
32
if
(corsikaCode == Code::Unknown) {
33
throw
std::runtime_error(std::string(
"SOPHIA/CORSIKA conversion of "
)
34
.append(
std::to_string
(s))
35
.append(
" impossible"
));
36
}
37
return
corsikaCode;
38
}
39
40
int
constexpr convertToSophiaRaw(Code
const
code) {
41
return
static_cast<
int
>
(convertToSophia(code));
42
}
43
44
bool
constexpr canInteract(Code
const
pCode) {
45
return
(pCode == Code::Photon ?
true
:
false
);
46
}
47
48
HEPMassType getSophiaMass(Code
const
);
49
50
}
// namespace corsika::sophia
51
52
#include <corsika/detail/modules/sophia/ParticleConversion.inl>
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
ParticleProperties.hpp
Interface to particle properties.
corsika::sophia
Definition:
InteractionModel.hpp:18
corsika
modules
sophia
ParticleConversion.hpp
Generated by
1.8.13