CORSIKA  @c8_version@
The framework to simulate particle cascades for astroparticle physics
EnergyMomentumOperations.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 
9 #pragma once
10 
12 #include <corsika/framework/core/PhysicalGeometry.hpp>
14 
21 namespace corsika {
22 
23  namespace detail {
24  using HEPEnergyTypeSqr = decltype(1_GeV * 1_GeV);
25  }
26 
34  auto constexpr calculate_mass_sqr(HEPEnergyType const E, HEPMomentumType const p) {
35  return (E - p) * (E + p);
36  }
37 
46  return sqrt(calculate_mass_sqr(E, p));
47  }
48 
56  auto constexpr calculate_momentum_sqr(HEPEnergyType const E, HEPMassType const m) {
57  return (E - m) * (E + m);
58  }
59 
68  return sqrt(calculate_momentum_sqr(E, m));
69  }
70 
79  HEPMassType const m) {
80  return p * p + m * m;
81  }
82 
91  HEPMassType const m) {
92  return sqrt(calculate_total_energy_sqr(p, m));
93  }
94 
103  HEPMassType const m) {
104  return calculate_total_energy(p, m) - m;
105  }
106 
114  HEPEnergyType constexpr calculate_lab_energy(detail::HEPEnergyTypeSqr sqrtS_sqr,
115  HEPMassType const m_proj,
116  HEPMassType const m_targ) {
117  return (sqrtS_sqr - static_pow<2>(m_proj) - static_pow<2>(m_targ)) / (2 * m_targ);
118  }
119 
128  HEPMassType const m_proj,
129  HEPMassType const m_targ) {
130  return sqrt(2 * Elab * m_targ + static_pow<2>(m_proj) + static_pow<2>(m_targ));
131  }
132 
133 } // namespace corsika
auto constexpr calculate_total_energy_sqr(HEPMomentumType const p, HEPMassType const m)
HEPEnergyType constexpr calculate_com_energy(HEPEnergyType Elab, HEPMassType const m_proj, HEPMassType const m_targ)
Import and extend the phys::units package.
HEPEnergyType constexpr calculate_mass(HEPEnergyType const E, HEPMomentumType const p)
auto constexpr calculate_mass_sqr(HEPEnergyType const E, HEPMomentumType const p)
HEPEnergyType constexpr calculate_momentum(HEPEnergyType const E, HEPMassType const m)
HEPEnergyType constexpr calculate_lab_energy(detail::HEPEnergyTypeSqr sqrtS_sqr, HEPMassType const m_proj, HEPMassType const m_targ)
`, since they are used everywhere as integral part of the framework.
auto constexpr calculate_momentum_sqr(HEPEnergyType const E, HEPMassType const m)
Constants are defined with static units, based on the package (namespace) phys::units, imported in PhysicsUnits.hpp.
detail::Root< D, 2, X > constexpr sqrt(quantity< D, X > const &x)
square root.
Definition: quantity.hpp:678
HEPEnergyType constexpr calculate_total_energy(HEPMomentumType const p, HEPMassType const m)
HEPEnergyType constexpr calculate_kinetic_energy(HEPMomentumType const p, HEPMassType const m)