CORSIKA  @c8_version@
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 
85  enum class Code : int32_t;
86 
92  enum class PDGCode : int32_t;
93 
97  typedef std::underlying_type<Code>::type CodeIntType;
98 
102  typedef std::underlying_type<PDGCode>::type PDGCodeIntType;
103 } // namespace corsika
104 
105 // data arrays, etc., as generated automatically
106 #include <corsika/framework/core/GeneratedParticleProperties.inc>
107 
108 namespace corsika {
109 
110  // forward declarations to be used in GeneratedParticleProperties
111  struct full_name {};
112 
113  int16_t constexpr get_charge_number(Code const);
114  ElectricChargeType constexpr get_charge(Code const);
115  HEPMassType constexpr get_mass(Code const);
116 
125 
130 
139 
143  void set_energy_production_threshold(Code const, HEPEnergyType const);
144 
146  PDGCode constexpr get_PDG(Code const);
147  PDGCode constexpr get_PDG(unsigned int const A, unsigned int const Z);
148  std::string_view constexpr get_name(Code const);
149  std::string get_name(Code,
150  full_name);
151  TimeType constexpr get_lifetime(Code const);
152 
153  bool constexpr is_hadron(Code const);
154  bool constexpr is_em(Code const);
155  bool constexpr is_muon(Code const);
156  bool constexpr is_neutrino(Code const);
157  bool constexpr is_charged(Code const);
158 
164  Code constexpr get_nucleus_code(size_t const A, size_t const Z);
165 
172  bool constexpr is_nucleus(Code const);
173 
179  size_t constexpr get_nucleus_A(
180  Code const);
181 
187  size_t constexpr get_nucleus_Z(
188  Code const);
189 
195  HEPMassType constexpr get_nucleus_mass(Code const code);
196 
202  HEPMassType constexpr get_nucleus_mass(unsigned int const A, unsigned int const Z);
203 
210  inline std::string get_nucleus_name(Code const code);
211 
217  Code convert_from_PDG(PDGCode const);
218 
224  std::initializer_list<Code> constexpr get_all_particles();
225 
233  std::ostream& operator<<(std::ostream&, corsika::Code);
234 
237 } // namespace corsika
238 
239 #include <corsika/detail/framework/core/ParticleProperties.inl>
240 
241 // constants in namespaces-like static classes, generated automatically
242 #include <corsika/framework/core/GeneratedParticleClasses.inc>
TimeType constexpr get_lifetime(Code const)
lifetime
bool constexpr is_em(Code const)
true if particle is electron, positron or photon
void set_kinetic_energy_propagation_threshold(Code const, HEPEnergyType const)
Set the kinetic energy propagation threshold object.
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.
void set_energy_production_threshold(Code const, HEPEnergyType const)
Set the particle production energy threshold in total energies.
std::initializer_list< Code > constexpr get_all_particles()
Returns list of all non-nuclei particles.
std::string_view constexpr get_name(Code const)
name of the particle as string
std::ostream & operator<<(std::ostream &, corsika::Code)
Code output operator.
size_t constexpr get_nucleus_A(Code const)
Get the mass number A for nucleus.
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 if particle is hadron
bool constexpr is_muon(Code const)
true if particle is mu+ or mu-
`, since they are used everywhere as integral part of the framework.
HEPEnergyType get_kinetic_energy_propagation_threshold(Code const)
Get the kinetic energy propagation threshold.
HEPEnergyType get_energy_production_threshold(Code const)
Get the particle production energy threshold.
tag class for get_name()
size_t constexpr get_nucleus_Z(Code const)
Get the charge number Z for nucleus.
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)
Checks if Code corresponds to a nucleus.
bool constexpr is_charged(Code const)
true if particle is charged
HEPMassType constexpr get_nucleus_mass(Code const code)
Calculates the mass of nucleus.
bool constexpr is_neutrino(Code const)
true if 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".
std::string get_nucleus_name(Code const code)
Get the nucleus name.