IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 01d62b12 authored by ralfulrich's avatar ralfulrich
Browse files

clang-format

parent c498e9f1
No related branches found
No related tags found
1 merge request!22Resolve "Define best unit for mass: "eV" or "kg""
Pipeline #11 passed
......@@ -73,7 +73,6 @@ public:
private:
};
TEST_CASE("Cascade", "[Cascade]") {
tracking_line::TrackingLine<setup::Stack> tracking;
......@@ -92,8 +91,8 @@ TEST_CASE("Cascade", "[Cascade]") {
EnergyType E0 = 100_GeV;
particle.SetEnergy(E0);
particle.SetPosition(Point(rootCS, {0_m, 0_m, 10_km}));
particle.SetMomentum(
corsika::stack::super_stupid::MomentumVector(rootCS, {0*newton*second, 0*newton*second, -1*newton*second}));
particle.SetMomentum(corsika::stack::super_stupid::MomentumVector(
rootCS, {0 * newton * second, 0 * newton * second, -1 * newton * second}));
EAS.Init();
EAS.Run();
......
......@@ -26,7 +26,6 @@
#include <corsika/units/PhysicalConstants.h>
#include <corsika/units/PhysicalUnits.h>
/**
* @namespace particle
*
......
......@@ -55,10 +55,14 @@ TEST_CASE("ParticleProperties", "[Particles]") {
}
SECTION("Lifetimes") {
REQUIRE(GetLifetime(Code::Electron) == std::numeric_limits<double>::infinity() * corsika::units::si::second);
REQUIRE(GetLifetime(Code::DPlus) < GetLifetime(Code::Gamma));
//REQUIRE(GetLifetime(Code::RhoPlus)/corsika::units::si::second == (Approx(4.414566727909413e-24).epsilon(1e-3)));
//REQUIRE(GetLifetime(Code::SigmaMinusBar)/corsika::units::si::second == (Approx(8.018880848563575e-11).epsilon(1e-5)));
//REQUIRE(GetLifetime(Code::MuPlus)/corsika::units::si::second == (Approx(2.1970332555864364e-06).epsilon(1e-5)));
REQUIRE(GetLifetime(Code::Electron) ==
std::numeric_limits<double>::infinity() * corsika::units::si::second);
REQUIRE(GetLifetime(Code::DPlus) < GetLifetime(Code::Gamma));
// REQUIRE(GetLifetime(Code::RhoPlus)/corsika::units::si::second ==
// (Approx(4.414566727909413e-24).epsilon(1e-3)));
// REQUIRE(GetLifetime(Code::SigmaMinusBar)/corsika::units::si::second ==
// (Approx(8.018880848563575e-11).epsilon(1e-5)));
// REQUIRE(GetLifetime(Code::MuPlus)/corsika::units::si::second ==
// (Approx(2.1970332555864364e-06).epsilon(1e-5)));
}
}
......@@ -10,23 +10,22 @@
* @file PhysicalUnits
*
* Add new units and types we need
*
*
* Define _XeV literals, etc., allowing 10_GeV in the code.
*/
namespace corsika::units::hep {
using namespace phys::units;
using namespace phys::units::literals;
/// defining HEP energy, mass, momentum
using energy_hep_d = phys::units::energy_d;
using MassType = phys::units::quantity<energy_hep_d, double>;
using MomentumType = phys::units::quantity<energy_hep_d, double>;
using EnergyType = phys::units::quantity<energy_hep_d, double>;
} // end namespace corsika::units::si
} // namespace corsika::units::hep
namespace corsika::units::si {
using namespace phys::units;
......@@ -75,7 +74,6 @@ namespace phys {
QUANTITY_DEFINE_SCALING_LITERALS(barn, corsika::units::si::sigma_d,
magnitude(corsika::units::si::constants::barn))
QUANTITY_DEFINE_SCALING_LITERALS(meter, length_d,
magnitude(corsika::units::si::constants::meter))
......
......@@ -92,19 +92,17 @@ TEST_CASE("PhysicalUnits", "[Units]") {
REQUIRE(E3 == 180_GeV);
}
SECTION("Unit system conversion") {
const units::hep::MassType m_hep = 3_GeV;
const units::hep::MassType m_hep = 3_GeV;
REQUIRE(m_hep == 3_GeV); // hep::mass identical to si::energy
auto type_check = m_hep / units::si::constants::cSquared;
REQUIRE(dynamic_cast<units::si::MassType*>(&type_check)); // hep::mass*c2 is mass unit
const units::hep::EnergyType e_hep = 4_GeV;
REQUIRE(sqrt(m_hep*m_hep + e_hep*e_hep) == 5_GeV);
REQUIRE(sqrt(m_hep * m_hep + e_hep * e_hep) == 5_GeV);
}
SECTION("Special") {
......@@ -113,5 +111,4 @@ TEST_CASE("PhysicalUnits", "[Units]") {
REQUIRE(farAway > 100000_m);
REQUIRE_FALSE(farAway < 1e19 * meter);
}
}
......@@ -16,7 +16,6 @@
#include <corsika/setup/SetupTrajectory.h>
namespace corsika::process {
namespace stack_inspector {
......
#ifndef _include_corsika_processes_TrackinLine_h_
#define _include_corsika_processes_TrackinLine_h_
#include <corsika/geometry/Vector.h>
#include <corsika/geometry/Point.h>
#include <corsika/geometry/Vector.h>
#include <corsika/units/PhysicalUnits.h>
......@@ -28,7 +28,7 @@ namespace corsika::process {
}
};
} // namespace stack_inspector
} // namespace tracking_line
} // namespace corsika::process
......
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