CORSIKA8  0.0.0
The framework to simulate particle cascades for astroparticle physics
ParticleProperties.hpp
Go to the documentation of this file.
1 /*
2  * (c) Copyright 2020 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 
15 #pragma once
16 
17 #include <array>
18 #include <cstdint>
19 #include <cmath>
20 #include <iosfwd>
21 #include <string_view>
22 #include <type_traits>
23 #include <unordered_map>
24 
26 
27 namespace corsika {
28 
62  enum class Code : int16_t;
63 
65  enum class PDGCode : int32_t;
66 
67  using CodeIntType = std::underlying_type<Code>::type;
68  using PDGCodeType = std::underlying_type<PDGCode>::type;
69 
70  // forward declarations to be used in GeneratedParticleProperties
71  int16_t constexpr get_charge_number(Code const);
72  ElectricChargeType constexpr get_charge(Code const);
73  HEPMassType constexpr get_mass(Code const);
75  Code const);
76  void constexpr set_kinetic_energy_threshold(
78  Code const, HEPEnergyType const);
79 
81  inline void set_kinetic_energy_threshold(std::pair<Code const, HEPEnergyType const> p) {
82  set_kinetic_energy_threshold(p.first, p.second);
83  }
84  inline void set_kinetic_energy_thresholds(
85  std::unordered_map<Code const, HEPEnergyType const> const& eCuts) {
86  for (auto v : eCuts) set_kinetic_energy_threshold(v);
87  }
88 
90  PDGCode constexpr get_PDG(Code const);
91  PDGCode constexpr get_PDG(unsigned int A, unsigned int Z);
92 
93  std::string_view constexpr get_name(Code const);
94  TimeType constexpr get_lifetime(Code const);
95 
97  bool constexpr is_nucleus(Code const);
98  bool constexpr is_hadron(Code const);
99  bool constexpr is_em(Code const);
100  bool constexpr is_muon(Code const);
101  bool constexpr is_neutrino(Code const);
102  int constexpr get_nucleus_A(
103  Code const);
104  int constexpr get_nucleus_Z(
105  Code const);
106 
108  HEPMassType get_nucleus_mass(unsigned int const, unsigned int const);
109 
111  Code convert_from_PDG(PDGCode const);
112 
113  std::initializer_list<Code> constexpr get_all_particles();
114 
116  std::ostream& operator<<(std::ostream&, corsika::Code);
117 
120 } // namespace corsika
121 
122 // data arrays, etc., as generated automatically
123 #include <corsika/framework/core/GeneratedParticleProperties.inc>
124 
125 #include <corsika/detail/framework/core/ParticleProperties.inl>
126 
127 // constants in namespaces-like static classes, generated automatically
128 #include <corsika/framework/core/GeneratedParticleClasses.inc>
TimeType constexpr get_lifetime(Code const)
lifetime
bool constexpr is_em(Code const)
true iff particle is electron, positron or photon
int32_t std::underlying_type< Code >::type CodeIntType
The Code enum is the actual place to define CORSIKA 8 particle codes.
Import and extend the phys::units package.
int constexpr get_nucleus_A(Code const)
returns A for hard-coded nucleus, otherwise 0
int constexpr get_nucleus_Z(Code const)
returns Z for hard-coded nucleus, otherwise 0
HEPMassType get_nucleus_mass(unsigned int const, unsigned int const)
returns mass of (A,Z) nucleus, disregarding binding energy
std::string_view constexpr get_name(Code const)
name of the particle as string
std::ostream & operator<<(std::ostream &, corsika::Code)
the output stream operator for human-readable particle codes
class "quantity" is the heart of the library.
Definition: quantity.hpp:54
Code convert_from_PDG(PDGCode const)
convert PDG code to CORSIKA 8 internal code
bool constexpr is_hadron(Code const)
true iff particle is hadron
bool constexpr is_muon(Code const)
true iff particle is mu+ or mu-
The cascade namespace assembles all objects needed to simulate full particles cascades.
void constexpr set_kinetic_energy_threshold(Code const, HEPEnergyType const)
set kinetic energy threshold below which the particle is discarded
ElectricChargeType constexpr get_charge(Code const)
electric charge
int16_t constexpr get_charge_number(Code const)
electric charge in units of e
bool constexpr is_nucleus(Code const)
true iff the particle is a hard-coded nucleus or Code::Nucleus
bool constexpr is_neutrino(Code const)
true iff particle is (anti-) neutrino
HEPMassType constexpr get_mass(Code const)
mass
PDGCode constexpr get_PDG(Code const)
Particle code according to PDG, "Monte Carlo Particle Numbering Scheme".
HEPEnergyType constexpr get_kinetic_energy_threshold(Code const)
get kinetic energy threshold below which the particle is discarded, by default set to zero ...