From 4de279f26c65b247ad20648bba344f17eaa037c0 Mon Sep 17 00:00:00 2001 From: ralfulrich <ralf.ulrich@kit.edu> Date: Sat, 1 Dec 2018 15:44:38 +0100 Subject: [PATCH] fixed remaining rebase errors --- Framework/Units/PhysicalUnits.h | 83 +++++++------------ Stack/SuperStupidStack/SuperStupidStack.h | 9 +- .../SuperStupidStack/testSuperStupidStack.cc | 2 +- 3 files changed, 37 insertions(+), 57 deletions(-) diff --git a/Framework/Units/PhysicalUnits.h b/Framework/Units/PhysicalUnits.h index 16b77a5df..f1a1b845a 100644 --- a/Framework/Units/PhysicalUnits.h +++ b/Framework/Units/PhysicalUnits.h @@ -9,43 +9,25 @@ /** * @file PhysicalUnits * - * Define _XeV literals, alowing 10_GeV in the code. + * Define new units and unit-types */ -namespace phys { - namespace units { - namespace literals { - QUANTITY_DEFINE_SCALING_LITERALS(eV, energy_d, - magnitude(corsika::units::si::constants::eV)); - - // phys::units::quantity<energy_d/mass_d> Joule2Kg = c2; // 1_Joule / 1_kg; - - } // namespace literals - } // namespace units -} - - - - -namespace phys { - namespace units { - namespace literals { - QUANTITY_DEFINE_SCALING_LITERALS(meter, length_d, - magnitude(corsika::units::si::constants::meter)) - - // phys::units::quantity<energy_d/mass_d> Joule2Kg = c2; // 1_Joule / 1_kg; - - } // namespace literals - } // namespace units -} - - - namespace corsika::units::si { using namespace phys::units; using namespace phys::units::literals; // namespace literals = phys::units::literals; + + /// 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 cross section + using sigma_d = phys::units::dimensions<2, 0, 0>; + constexpr phys::units::quantity<sigma_d> barn{Rep(1.e-28L) * meter * meter}; + + /// add the unit-types using LengthType = phys::units::quantity<phys::units::length_d, double>; using TimeType = phys::units::quantity<phys::units::time_interval_d, double>; using SpeedType = phys::units::quantity<phys::units::speed_d, double>; @@ -53,46 +35,43 @@ namespace corsika::units::si { using ElectricChargeType = phys::units::quantity<phys::units::electric_charge_d, double>; using EnergyType = phys::units::quantity<phys::units::energy_d, double>; - using MassType = phys::units::quantity<phys::units::mass_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 MassType = phys::units::quantity<phys::units::mass_d, double>; 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 + + +/** + * @file PhysicalUnits + * + * Define _XeV literals, alowing 10_GeV in the code. + * Define _meter literal + * Define _barn literal + * Define _newton_second literal for SI momenta + */ + namespace phys { namespace units { namespace literals { + QUANTITY_DEFINE_SCALING_LITERALS(eV, energy_d, + magnitude(corsika::units::si::constants::eV)) + QUANTITY_DEFINE_SCALING_LITERALS(barn, corsika::units::si::sigma_d, magnitude(corsika::units::si::constants::barn)) // phys::units::quantity<energy_d/mass_d> Joule2Kg = c2; // 1_Joule / 1_kg; - } // namespace literals - } // namespace units -} + QUANTITY_DEFINE_SCALING_LITERALS(meter, length_d, + magnitude(corsika::units::si::constants::meter)) -namespace phys { - namespace units { - namespace literals { QUANTITY_DEFINE_SCALING_LITERALS(newton_second, corsika::units::si::momentum_d, magnitude(corsika::units::si::newton_second)) - // phys::units::quantity<energy_d/mass_d> Joule2Kg = c2; // 1_Joule / 1_kg; - } // namespace literals } // namespace units -} +} // namespace phys // we want to call the operator<< without namespace... I think using namespace phys::units::io; diff --git a/Stack/SuperStupidStack/SuperStupidStack.h b/Stack/SuperStupidStack/SuperStupidStack.h index 816a8c5ba..2b03c5443 100644 --- a/Stack/SuperStupidStack/SuperStupidStack.h +++ b/Stack/SuperStupidStack/SuperStupidStack.h @@ -33,12 +33,13 @@ namespace corsika::stack { using corsika::units::si::second; using corsika::units::si::meter; using corsika::units::si::joule; + using corsika::units::si::newton_second; using corsika::units::si::energy_d; + using corsika::units::si::momentum_d; using corsika::geometry::Point; using corsika::geometry::Vector; -#warning replace this with a proper momentum vector: - typedef Vector<energy_d> MomentumVector; // should be momentum_d !!! + typedef Vector<momentum_d> MomentumVector; /** * Example of a particle object on the stack. @@ -123,7 +124,7 @@ namespace corsika::stack { #warning this here makes no sense: see issue #48 auto const dummyCS = corsika::geometry::CoordinateSystem::CreateRootCS(); fMomentum.push_back(MomentumVector(dummyCS, - {0 * joule, 0 * joule, 0 * joule})); + {0 * newton_second, 0 * newton_second, 0 * newton_second})); fPosition.push_back(Point(dummyCS, {0 * meter, 0 * meter, 0 * meter})); fTime.push_back(0 * second); @@ -143,7 +144,7 @@ namespace corsika::stack { std::vector<Code> fDataPID; std::vector<EnergyType> fDataE; - std::vector<Vector<corsika::units::si::energy_d>> fMomentum; // should be Momentum !!!! + std::vector<MomentumVector> fMomentum; std::vector<Point> fPosition; std::vector<TimeType> fTime; diff --git a/Stack/SuperStupidStack/testSuperStupidStack.cc b/Stack/SuperStupidStack/testSuperStupidStack.cc index 93f0a095a..bc0814b2e 100644 --- a/Stack/SuperStupidStack/testSuperStupidStack.cc +++ b/Stack/SuperStupidStack/testSuperStupidStack.cc @@ -36,7 +36,7 @@ TEST_CASE("SuperStupidStack", "[stack]") { p.SetPID(corsika::particles::Code::Electron); p.SetEnergy(1.5_GeV); auto const dummyCS = corsika::geometry::CoordinateSystem::CreateRootCS(); - p.SetMomentum(MomentumVector(dummyCS, {1 * joule, 1 * joule, 1 * joule})); + p.SetMomentum(MomentumVector(dummyCS, {1 * newton_second, 1 * newton_second, 1 * newton_second})); p.SetPosition(Point(dummyCS, {1 * meter, 1 * meter, 1 * meter})); p.SetTime(100_s); -- GitLab