IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 6f30d89b authored by Felix Riehn's avatar Felix Riehn Committed by ralfulrich
Browse files

added momentum and cross section quantity, unit and types

parent 81da08b8
No related branches found
No related tags found
No related merge requests found
...@@ -62,7 +62,7 @@ public: ...@@ -62,7 +62,7 @@ public:
sib_sigma_hnuc_(kBeam, kTarget, beamEnergy, prodCrossSection, dummy ); sib_sigma_hnuc_(kBeam, kTarget, beamEnergy, prodCrossSection, dummy );
std::cout << "ProcessSplit: " << "MinStep: sibyll return: " << prodCrossSection << std::endl; std::cout << "ProcessSplit: " << "MinStep: sibyll return: " << prodCrossSection << std::endl;
CrossSectionType sig = prodCrossSection / 1000. * barn; CrossSectionType sig = prodCrossSection * 1_mbarn;
std::cout << "ProcessSplit: " << "MinStep: CrossSection (mb): " << sig / 1_mbarn << std::endl; std::cout << "ProcessSplit: " << "MinStep: CrossSection (mb): " << sig / 1_mbarn << std::endl;
const MassType nucleon_mass = 0.93827_GeV / corsika::units::si::constants::cSquared; const MassType nucleon_mass = 0.93827_GeV / corsika::units::si::constants::cSquared;
......
...@@ -54,8 +54,9 @@ namespace corsika::units::si::constants { ...@@ -54,8 +54,9 @@ namespace corsika::units::si::constants {
// unified atomic mass unit // unified atomic mass unit
constexpr quantity<mass_d> u{Rep(1.6605402e-27L) * kilogram}; constexpr quantity<mass_d> u{Rep(1.6605402e-27L) * kilogram};
// barn // barn moved to PhysicalUnits
constexpr quantity<area_d> barn{Rep(1.e-28L) * meter * meter}; // constexpr quantity<area_d> barn{Rep(1.e-28L) * meter * meter};
// etc. // etc.
......
...@@ -63,7 +63,18 @@ namespace corsika::units::si { ...@@ -63,7 +63,18 @@ namespace corsika::units::si {
using EnergyType = phys::units::quantity<phys::units::energy_d, double>; using EnergyType = phys::units::quantity<phys::units::energy_d, double>;
using MassType = phys::units::quantity<phys::units::mass_d, double>; using MassType = phys::units::quantity<phys::units::mass_d, double>;
using CrossSectionType = phys::units::quantity<phys::units::area_d, double>; // defining momentum you suckers
// dimensions, i.e. composition in base SI dimensions
using momentum_d = phys::units::dimensions< 1, 1, -1 >;
// defining the unit of momentum, so far newton-meter, maybe go to HEP?
constexpr phys::units::quantity< momentum_d > newton_second { meter * kilogram / second };
// defining the type
using MomentumType = phys::units::quantity<momentum_d, double>;
// defining cross section
using sigma_d = phys::units::dimensions< 2, 0, 0 >;
constexpr phys::units::quantity< sigma_d > barn {Rep(1.e-28L) * meter * meter};
using CrossSectionType = phys::units::quantity<sigma_d, double>;
} // end namespace corsika::units::si } // end namespace corsika::units::si
......
...@@ -54,7 +54,7 @@ TEST_CASE("PhysicalUnits", "[Units]") { ...@@ -54,7 +54,7 @@ TEST_CASE("PhysicalUnits", "[Units]") {
REQUIRE(1_mol / 1_amol == Approx(1e18)); REQUIRE(1_mol / 1_amol == Approx(1e18));
REQUIRE(1_K / 1_zK == Approx(1e21)); REQUIRE(1_K / 1_zK == Approx(1e21));
REQUIRE(1_K / 1_yK == Approx(1e24)); REQUIRE(1_K / 1_yK == Approx(1e24));
// REQUIRE(1_barn / 1_mbarn == Approx(1e3)); REQUIRE(1_barn / 1_mbarn == Approx(1e3));
REQUIRE(1_A / 1_hA == Approx(1e-2)); REQUIRE(1_A / 1_hA == Approx(1e-2));
REQUIRE(1_m / 1_km == Approx(1e-3)); REQUIRE(1_m / 1_km == Approx(1e-3));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment