diff --git a/Documentation/Examples/cascade_example.cc b/Documentation/Examples/cascade_example.cc index 2ca239e5b1acbf60a72e3c356dbfb11f08fc3a2d..e978949c558c81ddf751d7094797c6205d2a3206 100644 --- a/Documentation/Examples/cascade_example.cc +++ b/Documentation/Examples/cascade_example.cc @@ -229,7 +229,7 @@ int main() { // setup processes, decays and interactions tracking_line::TrackingLine<setup::Stack> tracking(env); stack_inspector::StackInspector<setup::Stack> p0(true); - + corsika::random::RNGManager::GetInstance().RegisterRandomStream("s_rndm"); corsika::process::sibyll::Interaction sibyll(env); corsika::process::sibyll::Decay decay; diff --git a/Environment/Environment.h b/Environment/Environment.h index 1ab22e03877300d00c3270d17b01a4a378671db5..1fc1e443b26c617acb56b5d4b9406dacaed87514 100644 --- a/Environment/Environment.h +++ b/Environment/Environment.h @@ -21,7 +21,7 @@ namespace corsika::environment { using BaseNodeType = VolumeTreeNode<corsika::setup::IEnvironmentModel>; - + struct Universe : public corsika::geometry::Sphere { Universe(corsika::geometry::CoordinateSystem const& pCS) : corsika::geometry::Sphere( diff --git a/Environment/IMediumModel.h b/Environment/IMediumModel.h index 4278a79a3afc6a5b22be9c1dbc787add9126fe15..cdfb30cd65a5e8d2a1cfc7f4157d9a88d564cb3b 100644 --- a/Environment/IMediumModel.h +++ b/Environment/IMediumModel.h @@ -16,8 +16,8 @@ #include <corsika/geometry/Line.h> #include <corsika/geometry/Point.h> #include <corsika/geometry/Trajectory.h> -#include <random> #include <corsika/units/PhysicalUnits.h> +#include <random> namespace corsika::environment { @@ -39,18 +39,19 @@ namespace corsika::environment { corsika::units::si::GrammageType) const = 0; virtual NuclearComposition const& GetNuclearComposition() const = 0; - + template <class TRNG> corsika::particles::Code SampleTarget( - std::vector<corsika::units::si::CrossSectionType> const& sigma, TRNG& randomStream) const { + std::vector<corsika::units::si::CrossSectionType> const& sigma, + TRNG& randomStream) const { using namespace corsika::units::si; - + auto const& nuclComp = GetNuclearComposition(); auto const& fractions = nuclComp.GetFractions(); assert(sigma.size() == fractions.size()); - + std::vector<float> weights(fractions.size()); - + for (size_t i = 0; i < fractions.size(); ++i) { std::cout << "HomogeneousMedium: fraction: " << fractions[i] << std::endl; weights[i] = fractions[i] * sigma[i].magnitude(); diff --git a/Environment/NuclearComposition.h b/Environment/NuclearComposition.h index 3bc1101a4246dbe46a53b0ddb1fffb3c912171cd..3678b1305bb6b0e2bb29dae4ac18917afd0fa5fc 100644 --- a/Environment/NuclearComposition.h +++ b/Environment/NuclearComposition.h @@ -13,9 +13,9 @@ #define _include_NuclearComposition_h #include <corsika/particles/ParticleProperties.h> +#include <cassert> #include <numeric> #include <stdexcept> -#include <cassert> #include <vector> namespace corsika::environment { @@ -29,7 +29,7 @@ namespace corsika::environment { std::vector<float> pFractions) : fNumberFractions(pFractions) , fComponents(pComponents) { - + assert(pComponents.size() == pFractions.size()); auto const sumFractions = std::accumulate(pFractions.cbegin(), pFractions.cend(), 0.f); diff --git a/Framework/Cascade/Cascade.h b/Framework/Cascade/Cascade.h index 999894f70efbaa015c5b7b82ed4cb234dc8f55fc..024044aea5d6699dd311352f24ec91459a180845 100644 --- a/Framework/Cascade/Cascade.h +++ b/Framework/Cascade/Cascade.h @@ -56,7 +56,7 @@ namespace corsika::cascade { } } -private: + private: void Step(Particle& particle) { using namespace corsika::units::si; diff --git a/Framework/Geometry/FourVector.h b/Framework/Geometry/FourVector.h index 8d2b0945270c24d6acbcb90bd992121b3da87e08..bb848758a28fdec59889e50efbeb058c92be5232 100644 --- a/Framework/Geometry/FourVector.h +++ b/Framework/Geometry/FourVector.h @@ -43,11 +43,9 @@ namespace corsika::geometry { "(e.g. GeV) or [E/c]=[p]"); public: - - FourVector(const TimeType& eT, const SpaceVecType& eS) + FourVector(const TimeType& eT, const SpaceVecType& eS) : fTimeLike(eT) - , fSpaceLike(eS) { - } + , fSpaceLike(eS) {} TimeType GetTime() { return fTimeLike; } @@ -137,21 +135,25 @@ namespace corsika::geometry { /// the friends: math operators template <typename T, typename U> - friend FourVector<typename std::decay<T>::type, typename std::decay<U>::type> operator+(const FourVector<T, U>&, const FourVector<T, U>&); + friend FourVector<typename std::decay<T>::type, typename std::decay<U>::type> + operator+(const FourVector<T, U>&, const FourVector<T, U>&); template <typename T, typename U> - friend FourVector<typename std::decay<T>::type, typename std::decay<U>::type> operator-(const FourVector<T, U>&, const FourVector<T, U>&); + friend FourVector<typename std::decay<T>::type, typename std::decay<U>::type> + operator-(const FourVector<T, U>&, const FourVector<T, U>&); template <typename T, typename U> - friend FourVector<typename std::decay<T>::type, typename std::decay<U>::type> operator*(const FourVector<T, U>&, const double); + friend FourVector<typename std::decay<T>::type, typename std::decay<U>::type> + operator*(const FourVector<T, U>&, const double); template <typename T, typename U> - friend FourVector<typename std::decay<T>::type, typename std::decay<U>::type> operator/(const FourVector<T, U>&, const double); + friend FourVector<typename std::decay<T>::type, typename std::decay<U>::type> + operator/(const FourVector<T, U>&, const double); }; /** The math operator+ - */ + */ template <typename TimeType, typename SpaceVecType> inline FourVector<typename std::decay<TimeType>::type, typename std::decay<SpaceVecType>::type> @@ -161,7 +163,7 @@ namespace corsika::geometry { typename std::decay<SpaceVecType>::type>( a.fTimeLike + b.fTimeLike, a.fSpaceLike + b.fSpaceLike); } - + /** The math operator- */ @@ -181,11 +183,10 @@ namespace corsika::geometry { template <typename TimeType, typename SpaceVecType> inline FourVector<typename std::decay<TimeType>::type, typename std::decay<SpaceVecType>::type> - operator*(const FourVector<TimeType, SpaceVecType>& a, - const double b) { + operator*(const FourVector<TimeType, SpaceVecType>& a, const double b) { return FourVector<typename std::decay<TimeType>::type, - typename std::decay<SpaceVecType>::type>( - a.fTimeLike * b, a.fSpaceLike * b); + typename std::decay<SpaceVecType>::type>(a.fTimeLike * b, + a.fSpaceLike * b); } /** @@ -194,11 +195,10 @@ namespace corsika::geometry { template <typename TimeType, typename SpaceVecType> inline FourVector<typename std::decay<TimeType>::type, typename std::decay<SpaceVecType>::type> - operator/(const FourVector<TimeType, SpaceVecType>& a, - const double b) { + operator/(const FourVector<TimeType, SpaceVecType>& a, const double b) { return FourVector<typename std::decay<TimeType>::type, - typename std::decay<SpaceVecType>::type>( - a.fTimeLike / b, a.fSpaceLike / b); + typename std::decay<SpaceVecType>::type>(a.fTimeLike / b, + a.fSpaceLike / b); } } // namespace corsika::geometry diff --git a/Framework/Geometry/testFourVector.cc b/Framework/Geometry/testFourVector.cc index b018830796ab1b7b33302dd7d8b4e97a00725599..994cd6791def8ab246ef70ee7f505b19c8ffa1b6 100644 --- a/Framework/Geometry/testFourVector.cc +++ b/Framework/Geometry/testFourVector.cc @@ -162,7 +162,7 @@ TEST_CASE("four vectors") { it merely provides the physical/mathematical wrapper around the data. */ - + SECTION("Use as wrapper") { TimeType T = 10_m / corsika::units::constants::c; @@ -171,22 +171,23 @@ TEST_CASE("four vectors") { const TimeType T_c = 10_m / corsika::units::constants::c; const Vector<length_d> P_c(rootCS, {10_m, 5_m, 5_m}); - //FourVector<TimeType&, Vector<length_d>&> p0(T_c, P_c); // this does not compile, and it shoudn't! + // FourVector<TimeType&, Vector<length_d>&> p0(T_c, P_c); // this does not compile, + // and it shoudn't! FourVector<TimeType&, Vector<length_d>&> p1(T, P); FourVector<const TimeType&, const Vector<length_d>&> p2(T, P); FourVector<const TimeType&, const Vector<length_d>&> p3(T_c, P_c); - + std::cout << type_id_with_cvr<decltype(p1)>().pretty_name() << std::endl; std::cout << type_id_with_cvr<decltype(p2)>().pretty_name() << std::endl; std::cout << type_id_with_cvr<decltype(p3)>().pretty_name() << std::endl; p1 *= 10; - //p2 *= 10; // this does not compile, and it shoudn't ! - //p3 *= 10; // this does not compile, and it shoudn't !! - + // p2 *= 10; // this does not compile, and it shoudn't ! + // p3 *= 10; // this does not compile, and it shoudn't !! + const double check = 10 * 10 - 10 * 10 - 5 * 5 - 5 * 5; // for dummies... - REQUIRE(p1.GetNormSqr()/(1_m * 1_m) == Approx(10.*10. * check)); - REQUIRE(p2.GetNorm()/1_m == Approx(10*sqrt(abs(check)))); - REQUIRE(p3.GetNorm()/1_m == Approx(sqrt(abs(check)))); + REQUIRE(p1.GetNormSqr() / (1_m * 1_m) == Approx(10. * 10. * check)); + REQUIRE(p2.GetNorm() / 1_m == Approx(10 * sqrt(abs(check)))); + REQUIRE(p3.GetNorm() / 1_m == Approx(sqrt(abs(check)))); } } diff --git a/Framework/Units/PhysicalUnits.h b/Framework/Units/PhysicalUnits.h index aa34bc8bdaf9f67a6c3629d88688cc24157d3f20..eff077af38644180888c02fa0c5d6eafaf1cf455 100644 --- a/Framework/Units/PhysicalUnits.h +++ b/Framework/Units/PhysicalUnits.h @@ -95,14 +95,6 @@ namespace phys { QUANTITY_DEFINE_SCALING_LITERALS(barn, corsika::units::si::sigma_d, magnitude(corsika::units::constants::barn)) - /** - * add additional literals missing in the original library: - * - */ - - QUANTITY_DEFINE_SCALING_LITERALS(gram, mass_d, 1e-3) - - } // namespace literals } // namespace units } // namespace phys diff --git a/Processes/Sibyll/Decay.h b/Processes/Sibyll/Decay.h index c45f3dd46cb7b67c7d7da79295b43952a05bac00..217ed87fac7a4512a901fabaa995d81ff81ea5cd 100644 --- a/Processes/Sibyll/Decay.h +++ b/Processes/Sibyll/Decay.h @@ -167,11 +167,6 @@ namespace corsika::process { using corsika::geometry::Point; using namespace corsika::units::si; - // TODO: this should be done in a central, common place. Not here.. -#ifndef CORSIKA_OSX - feenableexcept(FE_INVALID); -#endif - fCount++; SibStack ss; ss.Clear(); @@ -217,11 +212,6 @@ namespace corsika::process { } // empty sibyll stack ss.Clear(); - - // TODO: this should be done in a central, common place. Not here.. -#ifndef CORSIKA_OSX - fedisableexcept(FE_INVALID); -#endif } }; } // namespace sibyll