From b0f20e4bcf3db938e9e2ba1651c3e704f8cc95bc Mon Sep 17 00:00:00 2001 From: ralfulrich <ralf.ulrich@kit.edu> Date: Tue, 12 Feb 2019 16:16:04 +0100 Subject: [PATCH] clang --- Framework/StackInterface/Stack.h | 10 +- .../StackInterface/testStackInterface.cc | 3 +- Framework/Utilities/testCOMBoost.cc | 175 +++++++++--------- 3 files changed, 94 insertions(+), 94 deletions(-) diff --git a/Framework/StackInterface/Stack.h b/Framework/StackInterface/Stack.h index 4626ddb9a..828457348 100644 --- a/Framework/StackInterface/Stack.h +++ b/Framework/StackInterface/Stack.h @@ -67,7 +67,7 @@ namespace corsika::stack { delete; ///< since Stack can be very big, we don't want to copy it public: - //Stack() { Init(); } + // Stack() { Init(); } /** * if StackDataType is a reference member we *HAVE* to initialize @@ -76,8 +76,8 @@ namespace corsika::stack { template < typename _StackDataType = StackDataType, typename = std::enable_if<std::is_same<StackDataType, _StackDataType>::value && - std::is_reference<_StackDataType>::value, - void>> + std::is_reference<_StackDataType>::value, + void>> Stack(StackDataType vD) : fData(vD) {} @@ -89,8 +89,8 @@ namespace corsika::stack { template < typename... Args, typename _StackDataType = StackDataType, typename = std::enable_if<std::is_same<StackDataType, _StackDataType>::value && - !std::is_reference<_StackDataType>::value, - void >> + !std::is_reference<_StackDataType>::value, + void>> Stack(Args... args) : fData(args...) {} diff --git a/Framework/StackInterface/testStackInterface.cc b/Framework/StackInterface/testStackInterface.cc index 8acfa5aba..1fa07872f 100644 --- a/Framework/StackInterface/testStackInterface.cc +++ b/Framework/StackInterface/testStackInterface.cc @@ -96,7 +96,8 @@ TEST_CASE("Stack", "[Stack]") { StackTest s; REQUIRE(s.GetSize() == 0); auto iter = s.AddParticle(std::tuple{9.9}); - StackTest::ParticleInterfaceType& p = *iter; // also this is valid to access particle data + StackTest::ParticleInterfaceType& p = + *iter; // also this is valid to access particle data REQUIRE(s.GetSize() == 1); p.AddSecondary(std::tuple{4.4}); REQUIRE(s.GetSize() == 2); diff --git a/Framework/Utilities/testCOMBoost.cc b/Framework/Utilities/testCOMBoost.cc index 159f97a7e..da7cffefe 100644 --- a/Framework/Utilities/testCOMBoost.cc +++ b/Framework/Utilities/testCOMBoost.cc @@ -32,99 +32,98 @@ using corsika::units::constants::cSquared; double constexpr absMargin = 1e-6; CoordinateSystem const& rootCS = - RootCoordinateSystem::GetInstance().GetRootCoordinateSystem(); - - // helper function for energy-momentum - // relativistic energy - auto const energy = [](HEPMassType m, Vector<hepmomentum_d> const& p) { - return sqrt(m * m + p.squaredNorm()); - }; + RootCoordinateSystem::GetInstance().GetRootCoordinateSystem(); - // helper function for mandelstam-s - auto const s = [](HEPEnergyType E, QuantityVector<hepmomentum_d> const& p) { - return E * E - p.squaredNorm(); - }; +// helper function for energy-momentum +// relativistic energy +auto const energy = [](HEPMassType m, Vector<hepmomentum_d> const& p) { + return sqrt(m * m + p.squaredNorm()); +}; +// helper function for mandelstam-s +auto const s = [](HEPEnergyType E, QuantityVector<hepmomentum_d> const& p) { + return E * E - p.squaredNorm(); +}; TEST_CASE("rotation") { - // define projectile kinematics in lab frame - HEPMassType const projectileMass = 1_GeV; - HEPMassType const targetMass = 1.0e300_eV; - Vector<hepmomentum_d> pProjectileLab{rootCS, {0_GeV, 0_PeV, 1_GeV}}; - HEPEnergyType const eProjectileLab = energy(projectileMass, pProjectileLab); - const FourVector PprojLab(eProjectileLab, pProjectileLab); - - Eigen::Vector3d e1, e2, e3; - e1 << 1, 0, 0; - e2 << 0, 1, 0; - e3 << 0, 0, 1; + // define projectile kinematics in lab frame + HEPMassType const projectileMass = 1_GeV; + HEPMassType const targetMass = 1.0e300_eV; + Vector<hepmomentum_d> pProjectileLab{rootCS, {0_GeV, 0_PeV, 1_GeV}}; + HEPEnergyType const eProjectileLab = energy(projectileMass, pProjectileLab); + const FourVector PprojLab(eProjectileLab, pProjectileLab); + + Eigen::Vector3d e1, e2, e3; + e1 << 1, 0, 0; + e2 << 0, 1, 0; + e3 << 0, 0, 1; + + // define boost to com frame + SECTION("pos. z-axis") { + COMBoost boost({eProjectileLab, {rootCS, {0_GeV, 0_GeV, 1_GeV}}}, targetMass); + auto const& rot = boost.GetRotationMatrix(); + + CHECK((rot * e3 - e3).norm() == Approx(0).margin(absMargin)); + CHECK((rot * e1).norm() == Approx(1)); + CHECK((rot * e2).norm() == Approx(1)); + CHECK((rot * e3).norm() == Approx(1)); + CHECK(rot.determinant() == Approx(1)); + } - // define boost to com frame - SECTION("pos. z-axis") { - COMBoost boost({eProjectileLab, {rootCS, {0_GeV, 0_GeV, 1_GeV}}}, targetMass); - auto const& rot = boost.GetRotationMatrix(); - - CHECK((rot * e3 - e3).norm() == Approx(0).margin(absMargin)); - CHECK((rot * e1).norm() == Approx(1)); - CHECK((rot * e2).norm() == Approx(1)); - CHECK((rot * e3).norm() == Approx(1)); - CHECK(rot.determinant() == Approx(1)); - } - - SECTION("y-axis in upper half") { - COMBoost boost({eProjectileLab, {rootCS, {0_GeV, 1_GeV, 1_meV}}}, targetMass); - auto const& rot = boost.GetRotationMatrix(); - - CHECK((rot * e2 - e3).norm() == Approx(0).margin(absMargin)); - CHECK((rot * e1).norm() == Approx(1)); - CHECK((rot * e2).norm() == Approx(1)); - CHECK((rot * e3).norm() == Approx(1)); - CHECK(rot.determinant() == Approx(1)); - } - - SECTION("x-axis in upper half") { - COMBoost boost({eProjectileLab, {rootCS, {1_GeV, 0_GeV, 1_meV}}}, targetMass); - auto const& rot = boost.GetRotationMatrix(); - - CHECK((rot * e1 - e3).norm() == Approx(0).margin(absMargin)); - CHECK((rot * e1).norm() == Approx(1)); - CHECK((rot * e2).norm() == Approx(1)); - CHECK((rot * e3).norm() == Approx(1)); - CHECK(rot.determinant() == Approx(1)); - } - - SECTION("neg. z-axis") { - COMBoost boost({eProjectileLab, {rootCS, {0_GeV, 0_GeV, -1_GeV}}}, targetMass); - auto const& rot = boost.GetRotationMatrix(); - - CHECK((rot * (-e3) - e3).norm() == Approx(0).margin(absMargin)); - CHECK((rot * e1).norm() == Approx(1)); - CHECK((rot * e2).norm() == Approx(1)); - CHECK((rot * e3).norm() == Approx(1)); - CHECK(rot.determinant() == Approx(1)); - } - - SECTION("x-axis lower half") { - COMBoost boost({eProjectileLab, {rootCS, {1_GeV, 0_GeV, -1_meV}}}, targetMass); - auto const& rot = boost.GetRotationMatrix(); - - CHECK((rot * e1 - e3).norm() == Approx(0).margin(absMargin)); - CHECK((rot * e1).norm() == Approx(1)); - CHECK((rot * e2).norm() == Approx(1)); - CHECK((rot * e3).norm() == Approx(1)); - CHECK(rot.determinant() == Approx(1)); - } - - SECTION("y-axis lower half") { - COMBoost boost({eProjectileLab, {rootCS, {0_GeV, 1_GeV, -1_meV}}}, targetMass); - auto const& rot = boost.GetRotationMatrix(); - - CHECK((rot * e2 - e3).norm() == Approx(0).margin(absMargin)); - CHECK((rot * e1).norm() == Approx(1)); - CHECK((rot * e2).norm() == Approx(1)); - CHECK((rot * e3).norm() == Approx(1)); - CHECK(rot.determinant() == Approx(1)); - } + SECTION("y-axis in upper half") { + COMBoost boost({eProjectileLab, {rootCS, {0_GeV, 1_GeV, 1_meV}}}, targetMass); + auto const& rot = boost.GetRotationMatrix(); + + CHECK((rot * e2 - e3).norm() == Approx(0).margin(absMargin)); + CHECK((rot * e1).norm() == Approx(1)); + CHECK((rot * e2).norm() == Approx(1)); + CHECK((rot * e3).norm() == Approx(1)); + CHECK(rot.determinant() == Approx(1)); + } + + SECTION("x-axis in upper half") { + COMBoost boost({eProjectileLab, {rootCS, {1_GeV, 0_GeV, 1_meV}}}, targetMass); + auto const& rot = boost.GetRotationMatrix(); + + CHECK((rot * e1 - e3).norm() == Approx(0).margin(absMargin)); + CHECK((rot * e1).norm() == Approx(1)); + CHECK((rot * e2).norm() == Approx(1)); + CHECK((rot * e3).norm() == Approx(1)); + CHECK(rot.determinant() == Approx(1)); + } + + SECTION("neg. z-axis") { + COMBoost boost({eProjectileLab, {rootCS, {0_GeV, 0_GeV, -1_GeV}}}, targetMass); + auto const& rot = boost.GetRotationMatrix(); + + CHECK((rot * (-e3) - e3).norm() == Approx(0).margin(absMargin)); + CHECK((rot * e1).norm() == Approx(1)); + CHECK((rot * e2).norm() == Approx(1)); + CHECK((rot * e3).norm() == Approx(1)); + CHECK(rot.determinant() == Approx(1)); + } + + SECTION("x-axis lower half") { + COMBoost boost({eProjectileLab, {rootCS, {1_GeV, 0_GeV, -1_meV}}}, targetMass); + auto const& rot = boost.GetRotationMatrix(); + + CHECK((rot * e1 - e3).norm() == Approx(0).margin(absMargin)); + CHECK((rot * e1).norm() == Approx(1)); + CHECK((rot * e2).norm() == Approx(1)); + CHECK((rot * e3).norm() == Approx(1)); + CHECK(rot.determinant() == Approx(1)); + } + + SECTION("y-axis lower half") { + COMBoost boost({eProjectileLab, {rootCS, {0_GeV, 1_GeV, -1_meV}}}, targetMass); + auto const& rot = boost.GetRotationMatrix(); + + CHECK((rot * e2 - e3).norm() == Approx(0).margin(absMargin)); + CHECK((rot * e1).norm() == Approx(1)); + CHECK((rot * e2).norm() == Approx(1)); + CHECK((rot * e3).norm() == Approx(1)); + CHECK(rot.determinant() == Approx(1)); + } } TEST_CASE("boosts") { -- GitLab