diff --git a/Documentation/Examples/cascade_example.cc b/Documentation/Examples/cascade_example.cc index 2490cd34494a1238aff0698a2ec2ac70b4028f11..5fe5e5bc734e9aec37b816dc5f36b63982f359e2 100644 --- a/Documentation/Examples/cascade_example.cc +++ b/Documentation/Examples/cascade_example.cc @@ -62,7 +62,7 @@ public: sib_sigma_hnuc_(kBeam, kTarget, beamEnergy, prodCrossSection, dummy ); 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; const MassType nucleon_mass = 0.93827_GeV / corsika::units::si::constants::cSquared; diff --git a/Framework/Units/PhysicalConstants.h b/Framework/Units/PhysicalConstants.h index c3d5824e8a1c82fba366b9409add9b543cad8b60..65a98e482f7727af4176ded2c2b84339e6fcdf6e 100644 --- a/Framework/Units/PhysicalConstants.h +++ b/Framework/Units/PhysicalConstants.h @@ -54,8 +54,9 @@ namespace corsika::units::si::constants { // unified atomic mass unit constexpr quantity<mass_d> u{Rep(1.6605402e-27L) * kilogram}; - // barn - constexpr quantity<area_d> barn{Rep(1.e-28L) * meter * meter}; + // barn moved to PhysicalUnits + // constexpr quantity<area_d> barn{Rep(1.e-28L) * meter * meter}; + // etc. diff --git a/Framework/Units/PhysicalUnits.h b/Framework/Units/PhysicalUnits.h index 9060037e37486045a8bae8fd133a875ed521e108..be06ec192261140748f503cceeb7ee6f63c4c4ea 100644 --- a/Framework/Units/PhysicalUnits.h +++ b/Framework/Units/PhysicalUnits.h @@ -63,7 +63,18 @@ namespace corsika::units::si { using EnergyType = phys::units::quantity<phys::units::energy_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 diff --git a/Framework/Units/testUnits.cc b/Framework/Units/testUnits.cc index fc844c10860c006466b73d6b2619ece646bb139b..eeed886296ce988fef2e0f87d84d691513dbfad5 100644 --- a/Framework/Units/testUnits.cc +++ b/Framework/Units/testUnits.cc @@ -54,7 +54,7 @@ TEST_CASE("PhysicalUnits", "[Units]") { REQUIRE(1_mol / 1_amol == Approx(1e18)); REQUIRE(1_K / 1_zK == Approx(1e21)); 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_m / 1_km == Approx(1e-3));