diff --git a/corsika/framework/core/Cascade.hpp b/corsika/framework/core/Cascade.hpp index b6990bda4f85c43696b4adccef64d5a71d5786c2..276a454bd66b0f018b46ca2707b9f8fce0ffe26b 100644 --- a/corsika/framework/core/Cascade.hpp +++ b/corsika/framework/core/Cascade.hpp @@ -12,15 +12,15 @@ #include <cmath> #include <limits> -#include <corsika/media/Environment.hpp> -#include <corsika/setup/SetupStack.hpp> -#include <corsika/setup/SetupTrajectory.hpp> +#include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/random/ExponentialDistribution.hpp> #include <corsika/framework/random/RNGManager.hpp> #include <corsika/framework/random/UniformRealDistribution.hpp> #include <corsika/framework/sequence/ProcessReturn.hpp> #include <corsika/framework/stack/SecondaryView.hpp> -#include <corsika/framework/core/PhysicalUnits.hpp> +#include <corsika/media/Environment.hpp> +#include <corsika/setup/SetupStack.hpp> +#include <corsika/setup/SetupTrajectory.hpp> /** * The cascade namespace assembles all objects needed to simulate full particles cascades. @@ -50,25 +50,23 @@ namespace corsika { * */ template <typename TTracking, typename TProcessList, typename TStack, - typename TStackView = corsika::setup::StackView> - class Cascade - { + typename TStackView = corsika::setup::StackView> + class Cascade { typedef typename TStack::ParticleType Particle; - typedef std::remove_pointer_t<decltype(((Particle*)nullptr)->GetNode())> VolumeTreeNode; + typedef std::remove_pointer_t<decltype(((Particle*)nullptr)->GetNode())> + VolumeTreeNode; typedef typename VolumeTreeNode::IModelProperties MediumInterface; public: - Cascade() = delete; Cascade(corsika::Environment<MediumInterface> const& env, TTracking& tr, - TProcessList& pl, TStack& stack): - fEnvironment(env), - fTracking(tr), - fProcessSequence(pl), - fStack(stack) - { } + TProcessList& pl, TStack& stack) + : fEnvironment(env) + , fTracking(tr) + , fProcessSequence(pl) + , fStack(stack) {} /** * The Init function is called before the actual cascade simulations. @@ -96,20 +94,19 @@ namespace corsika { void forceInteraction(); private: - void Step(Particle& vParticle); - auto decay(Particle& particle, decltype(std::declval<TStackView>().GetProjectile()) projectile); + auto decay(Particle& particle, + decltype(std::declval<TStackView>().GetProjectile()) projectile); - auto interaction(Particle& particle, decltype(std::declval<TStackView>().GetProjectile()) projectile) ; + auto interaction(Particle& particle, + decltype(std::declval<TStackView>().GetProjectile()) projectile); corsika::Environment<MediumInterface> const& fEnvironment; TTracking& fTracking; TProcessList& fProcessSequence; TStack& fStack; - corsika::RNG& fRNG = - corsika::RNGManager::GetInstance().GetRandomStream("cascade"); - + corsika::RNG& fRNG = corsika::RNGManager::GetInstance().GetRandomStream("cascade"); }; } // namespace corsika diff --git a/corsika/framework/core/ParticleProperties.hpp b/corsika/framework/core/ParticleProperties.hpp index 3bba1f509af3e6bc624739a3e42c15d81438b3d9..759224e76828c88b376153561c0a7b579c8e071d 100644 --- a/corsika/framework/core/ParticleProperties.hpp +++ b/corsika/framework/core/ParticleProperties.hpp @@ -99,7 +99,8 @@ namespace corsika::particles { } inline corsika::units::si::TimeType constexpr GetLifetime(Code const p) { - return particle::detail::lifetime[static_cast<CodeIntType>(p)] * corsika::units::si::second; + return particle::detail::lifetime[static_cast<CodeIntType>(p)] * + corsika::units::si::second; } inline bool constexpr IsHadron(Code const p) { @@ -157,9 +158,9 @@ namespace corsika::particles { /** * Get mass of nucleus **/ - inline corsika::units::si::HEPMassType constexpr GetNucleusMass(const int vA, const int vZ) { + inline corsika::units::si::HEPMassType constexpr GetNucleusMass(const int vA, + const int vZ) { return Proton::GetMass() * vZ + (vA - vZ) * Neutron::GetMass(); } } // namespace corsika - diff --git a/corsika/framework/core/PhysicalConstants.hpp b/corsika/framework/core/PhysicalConstants.hpp index 306f48ebd32830c7f11084dbc5f3de20a4ebca12..f47b917e6919762d7b1c73a950192c086e7afe4b 100644 --- a/corsika/framework/core/PhysicalConstants.hpp +++ b/corsika/framework/core/PhysicalConstants.hpp @@ -64,4 +64,3 @@ namespace corsika::units::constants { // etc. } // namespace corsika::units::constants - diff --git a/corsika/framework/core/PhysicalUnits.hpp b/corsika/framework/core/PhysicalUnits.hpp index ebbdbcb2e7b8e495d0d2b7ae0af0e70db24d6404..543b56a148e6e353e10a678336f751ce34c2921c 100644 --- a/corsika/framework/core/PhysicalUnits.hpp +++ b/corsika/framework/core/PhysicalUnits.hpp @@ -10,7 +10,7 @@ #include <corsika/framework/core/PhysicalConstants.hpp> -//FIXME: What package is this? +// FIXME: What package is this? #include <phys/units/io.hpp> #include <phys/units/quantity.hpp> diff --git a/corsika/framework/geometry/BaseVector.hpp b/corsika/framework/geometry/BaseVector.hpp index 97becb2d5e307d7432e3256a15305ed6e1ef3b91..2665e8c676758c30f819aa58727832ccbc99e1dd 100644 --- a/corsika/framework/geometry/BaseVector.hpp +++ b/corsika/framework/geometry/BaseVector.hpp @@ -13,36 +13,32 @@ namespace corsika { - /*! - * Common base class for Vector and Point. Currently it does basically nothing. - */ - /* - * FIXME Many potential issues: - * 1. does this class really need to be templated ? - * 2. copy constructor, assignment operator not implemented - * 3. this member pointer is quite scary... - */ - template <typename dim> - class BaseVector { - - public: - - /* - * FIXME Why to copy pQVector twice? - */ - BaseVector(CoordinateSystem const& pCS, QuantityVector<dim> pQVector): - qVector(pQVector), - cs(&pCS) - {} - - auto const& GetCoordinateSystem() const; - - - protected: - QuantityVector<dim> qVector; - CoordinateSystem const* cs; - - }; + /*! + * Common base class for Vector and Point. Currently it does basically nothing. + */ + /* + * FIXME Many potential issues: + * 1. does this class really need to be templated ? + * 2. copy constructor, assignment operator not implemented + * 3. this member pointer is quite scary... + */ + template <typename dim> + class BaseVector { + + public: + /* + * FIXME Why to copy pQVector twice? + */ + BaseVector(CoordinateSystem const& pCS, QuantityVector<dim> pQVector) + : qVector(pQVector) + , cs(&pCS) {} + + auto const& GetCoordinateSystem() const; + + protected: + QuantityVector<dim> qVector; + CoordinateSystem const* cs; + }; } // namespace corsika diff --git a/corsika/framework/geometry/CoordinateSystem.hpp b/corsika/framework/geometry/CoordinateSystem.hpp index 3b155fc4ab4385bde2965253ebb0890eecc7e26a..c58d05281688fed2a8ad8d11b3654d87ea08a64b 100644 --- a/corsika/framework/geometry/CoordinateSystem.hpp +++ b/corsika/framework/geometry/CoordinateSystem.hpp @@ -8,14 +8,13 @@ #pragma once +#include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/geometry/QuantityVector.hpp> #include <corsika/framework/utility/sgn.hpp> -#include <corsika/framework/core/PhysicalUnits.hpp> #include <Eigen/Dense> #include <stdexcept> - /* * FIXME Review this global typedef. */ @@ -26,7 +25,6 @@ namespace corsika { class RootCoordinateSystem; - template <typename T> class Vector; @@ -35,24 +33,21 @@ namespace corsika { */ using corsika::units::si::length_d; - class CoordinateSystem - { + class CoordinateSystem { CoordinateSystem const* reference = nullptr; EigenTransform transf; - CoordinateSystem(CoordinateSystem const& reference, EigenTransform const& transf): - reference(&reference), - transf(transf) - {} + CoordinateSystem(CoordinateSystem const& reference, EigenTransform const& transf) + : reference(&reference) + , transf(transf) {} CoordinateSystem() : // for creating the root CS transf(EigenTransform::Identity()) {} public: - - //FIXME missing test for self assignment + // FIXME missing test for self assignment inline CoordinateSystem& operator=(const CoordinateSystem& pCS); inline CoordinateSystem translate(QuantityVector<length_d> vector) const; @@ -64,7 +59,7 @@ namespace corsika { auto RotateToZ(Vector<TDim> vVec) const; template <typename TDim> - auto rotate(QuantityVector<TDim> axis, double angle) const ; + auto rotate(QuantityVector<TDim> axis, double angle) const; template <typename TDim> auto translateAndRotate(QuantityVector<phys::units::length_d> translation, @@ -75,16 +70,15 @@ namespace corsika { inline const EigenTransform& GetTransform() const; protected: - static CoordinateSystem CreateCS() { return CoordinateSystem(); } friend corsika::RootCoordinateSystem; /// this is the only class that can - /// create ONE unique root CS + /// create ONE unique root CS }; + EigenTransform getTransformation(CoordinateSystem const& c1, + CoordinateSystem const& c2); - EigenTransform getTransformation(CoordinateSystem const& c1, CoordinateSystem const& c2); - } // namespace corsika #include <corsika/detail/framework/geometry/CoordinateSystem.inl> diff --git a/corsika/framework/geometry/FourVector.hpp b/corsika/framework/geometry/FourVector.hpp index 2dcde2131310c31a1f6f6fc4b4b88b6798f38684..0c3e1b8d48b4182fc9a74e665f4e7428580b8b9d 100644 --- a/corsika/framework/geometry/FourVector.hpp +++ b/corsika/framework/geometry/FourVector.hpp @@ -8,10 +8,10 @@ #pragma once -#include <iostream> -#include <type_traits> #include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/geometry/Vector.hpp> +#include <iostream> +#include <type_traits> namespace corsika { @@ -34,11 +34,9 @@ namespace corsika { */ template <typename TimeType, typename SpaceVecType> - class FourVector - { + class FourVector { public: - using SpaceType = typename std::decay<SpaceVecType>::type::Quantity; //! check the types and the physical units here: @@ -51,13 +49,11 @@ namespace corsika { "(e.g. GeV) or [E/c]=[p]"); public: - FourVector() = default; - FourVector(const TimeType& eT, const SpaceVecType& eS): - fTimeLike(eT), - fSpaceLike(eS) - {} + FourVector(const TimeType& eT, const SpaceVecType& eS) + : fTimeLike(eT) + , fSpaceLike(eS) {} /* * FIXME: These Getters are mis-leading and does not favor @@ -68,21 +64,21 @@ namespace corsika { * * @return fTimeLike */ - TimeType GetTimeLikeComponent() const ; + TimeType GetTimeLikeComponent() const; /** * @brief * * @return fSpaceLike */ - SpaceVecType& GetSpaceLikeComponents() ; + SpaceVecType& GetSpaceLikeComponents(); /** * @brief * * @return fSpaceLike; */ - const SpaceVecType& GetSpaceLikeComponents() const ; + const SpaceVecType& GetSpaceLikeComponents() const; /** * @brief @@ -98,7 +94,6 @@ namespace corsika { */ SpaceType GetNorm() const; - /* * FIXME: a better alternative would be to define an enumeration * enum { SpaceLike =-1, TimeLike, LightLike } V4R_Category; @@ -118,7 +113,6 @@ namespace corsika { */ bool IsSpacelike() const; - FourVector& operator+=(const FourVector& b); FourVector& operator-=(const FourVector& b); @@ -135,11 +129,9 @@ namespace corsika { for this. You cannot mix different conventions due to unit-checking. */ - SpaceType operator*(const FourVector& b) ; - + SpaceType operator*(const FourVector& b); protected: - //! the data members TimeType fTimeLike; SpaceVecType fSpaceLike; @@ -161,46 +153,48 @@ namespace corsika { friend FourVector<typename std::decay<T>::type, typename std::decay<U>::type> operator/(const FourVector<T, U>&, const double); - private: + private: /** This function is automatically compiled to use of ignore the extra factor of "c" for the time-like quantity */ - auto GetTimeSquared() const ; - + auto GetTimeSquared() const; }; - - /** The math operator+ */ template <typename TimeType, typename SpaceVecType> - inline FourVector<typename std::decay<TimeType>::type, typename std::decay<SpaceVecType>::type> - operator+(const FourVector<TimeType, SpaceVecType>& a, const FourVector<TimeType, SpaceVecType>& b) ; + inline FourVector<typename std::decay<TimeType>::type, + typename std::decay<SpaceVecType>::type> + operator+(const FourVector<TimeType, SpaceVecType>& a, + const FourVector<TimeType, SpaceVecType>& b); /** The math operator- */ template <typename TimeType, typename SpaceVecType> - inline FourVector<typename std::decay<TimeType>::type, typename std::decay<SpaceVecType>::type> - operator-(const FourVector<TimeType, SpaceVecType>& a, const FourVector<TimeType, SpaceVecType>& b) ; + inline FourVector<typename std::decay<TimeType>::type, + typename std::decay<SpaceVecType>::type> + operator-(const FourVector<TimeType, SpaceVecType>& a, + const FourVector<TimeType, SpaceVecType>& b); /** The math operator* FIXME: Add overload to deal with multiplication by a scalar and 3-vectors */ 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) ; + inline FourVector<typename std::decay<TimeType>::type, + typename std::decay<SpaceVecType>::type> + operator*(const FourVector<TimeType, SpaceVecType>& a, const double b); /** The math operator/ */ 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) ; - + inline FourVector<typename std::decay<TimeType>::type, + typename std::decay<SpaceVecType>::type> + operator/(const FourVector<TimeType, SpaceVecType>& a, const double b); } // namespace corsika diff --git a/corsika/framework/geometry/Helix.hpp b/corsika/framework/geometry/Helix.hpp index 09f8672f9dafba8875f1b3f9223c6ecf9f6f0d70..9e261d5abff7410583cd7eb6ad929af650804507 100644 --- a/corsika/framework/geometry/Helix.hpp +++ b/corsika/framework/geometry/Helix.hpp @@ -38,9 +38,8 @@ namespace corsika { corsika::units::si::LengthType const radius; public: - - Helix(Point const& pR0, units::si::FrequencyType pOmegaC, - VelocityVec const& pvPar, VelocityVec const& pvPerp) + Helix(Point const& pR0, units::si::FrequencyType pOmegaC, VelocityVec const& pvPar, + VelocityVec const& pvPerp) : r0(pR0) , omegaC(pOmegaC) , vPar(pvPar) @@ -48,17 +47,16 @@ namespace corsika { , uPerp(vPerp.cross(vPar.normalized())) , radius(pvPar.norm() / abs(pOmegaC)) {} - inline Point GetPosition(units::si::TimeType t) const ; - - inline Point PositionFromArclength(units::si::LengthType l) const ; + inline Point GetPosition(units::si::TimeType t) const; - inline units::si::LengthType GetRadius() const ; + inline Point PositionFromArclength(units::si::LengthType l) const; - inline units::si::LengthType - ArcLength(units::si::TimeType t1, units::si::TimeType t2) const ; + inline units::si::LengthType GetRadius() const; - inline units::si::TimeType TimeFromArclength(units::si::LengthType l) const ; + inline units::si::LengthType ArcLength(units::si::TimeType t1, + units::si::TimeType t2) const; + inline units::si::TimeType TimeFromArclength(units::si::LengthType l) const; }; } // namespace corsika diff --git a/corsika/framework/geometry/Line.hpp b/corsika/framework/geometry/Line.hpp index f25a3d9e3699f924f6cba2821543cf5ba50d4bc3..d6eaa028b3981c0bd5a7bd0645a86b4e9b405633 100644 --- a/corsika/framework/geometry/Line.hpp +++ b/corsika/framework/geometry/Line.hpp @@ -32,23 +32,22 @@ namespace corsika { VelocityVec const v0; public: - Line(Point const& pR0, VelocityVec const& pV0) : r0(pR0) , v0(pV0) {} - inline Point GetPosition(units::si::TimeType t) const ; - - inline Point PositionFromArclength(units::si::LengthType l) const ; + inline Point GetPosition(units::si::TimeType t) const; - inline units::si::LengthType ArcLength(units::si::TimeType t1, units::si::TimeType t2) const ; + inline Point PositionFromArclength(units::si::LengthType l) const; - inline units::si::TimeType TimeFromArclength( units::si::LengthType t) const ; + inline units::si::LengthType ArcLength(units::si::TimeType t1, + units::si::TimeType t2) const; - inline const Point& GetR0() const ; + inline units::si::TimeType TimeFromArclength(units::si::LengthType t) const; - inline const VelocityVec& GetV0() const ; + inline const Point& GetR0() const; + inline const VelocityVec& GetV0() const; }; } // namespace corsika diff --git a/corsika/framework/geometry/Plane.hpp b/corsika/framework/geometry/Plane.hpp index fed4dab83983d44d94f940124893a2f8ef8b5df9..a2a72e42499ae57e94ad934d99bef697523d5794 100644 --- a/corsika/framework/geometry/Plane.hpp +++ b/corsika/framework/geometry/Plane.hpp @@ -8,9 +8,9 @@ #pragma once +#include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/geometry/Point.hpp> #include <corsika/framework/geometry/Vector.hpp> -#include <corsika/framework/core/PhysicalUnits.hpp> namespace corsika { @@ -22,23 +22,19 @@ namespace corsika { DimLessVec const fNormal; public: - Plane(Point const& vCenter, DimLessVec const& vNormal) : fCenter(vCenter) , fNormal(vNormal.normalized()) {} - bool IsAbove(Point const& vP) const ; + bool IsAbove(Point const& vP) const; - units::si::LengthType DistanceTo(corsika::Point const& vP) const ; + units::si::LengthType DistanceTo(corsika::Point const& vP) const; + Point const& GetCenter() const; - Point const& GetCenter() const ; - - DimLessVec const& GetNormal() const ; - + DimLessVec const& GetNormal() const; }; } // namespace corsika #include <corsika/detail/framework/geometry/Plane.inl> - diff --git a/corsika/framework/geometry/Point.hpp b/corsika/framework/geometry/Point.hpp index 22b9f75580c7a5d882096f87ccf5453c82730745..6105fb8b223c76362f5e5ebd0623d642fd9ede8c 100644 --- a/corsika/framework/geometry/Point.hpp +++ b/corsika/framework/geometry/Point.hpp @@ -8,14 +8,14 @@ #pragma once -#include <corsika/framework/geometry/QuantityVector.hpp> #include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/geometry/BaseVector.hpp> +#include <corsika/framework/geometry/QuantityVector.hpp> #include <corsika/framework/geometry/Vector.hpp> namespace corsika { - //FIXME: remove aliasing here + // FIXME: remove aliasing here using corsika::units::si::length_d; using corsika::units::si::LengthType; @@ -26,7 +26,6 @@ namespace corsika { class Point : public BaseVector<length_d> { public: - Point(CoordinateSystem const& pCS, QuantityVector<length_d> pQVector) : BaseVector<length_d>(pCS, pQVector) {} @@ -35,30 +34,29 @@ namespace corsika { // TODO: this should be private or protected, we don NOT want to expose numbers // without reference to outside: - inline auto GetCoordinates() const ; + inline auto GetCoordinates() const; - inline auto GetX() const ; + inline auto GetX() const; - inline auto GetY() const ; + inline auto GetY() const; - inline auto GetZ() const ; + inline auto GetZ() const; /// this always returns a QuantityVector as triple - inline auto GetCoordinates(CoordinateSystem const& pCS) const ; + inline auto GetCoordinates(CoordinateSystem const& pCS) const; /*! * transforms the Point into another CoordinateSystem by changing its * coordinates interally */ - inline void rebase(CoordinateSystem const& pCS) ; + inline void rebase(CoordinateSystem const& pCS); - inline Point operator+(Vector<length_d> const& pVec) const ; + inline Point operator+(Vector<length_d> const& pVec) const; /*! * returns the distance Vector between two points */ - inline Vector<length_d> operator-(Point const& pB) const ; - + inline Vector<length_d> operator-(Point const& pB) const; }; } // namespace corsika diff --git a/corsika/framework/geometry/QuantityVector.hpp b/corsika/framework/geometry/QuantityVector.hpp index e3195c34ec92f69876bd41dd84e47000be8f0c44..a104ecf654999761790fcfd98e39af276f4d71dd 100644 --- a/corsika/framework/geometry/QuantityVector.hpp +++ b/corsika/framework/geometry/QuantityVector.hpp @@ -10,9 +10,9 @@ #include <Eigen/Dense> +#include <corsika/framework/core/PhysicalUnits.hpp> #include <iostream> #include <utility> -#include <corsika/framework/core/PhysicalUnits.hpp> namespace corsika { @@ -46,46 +46,45 @@ namespace corsika { QuantityVector(Eigen::Vector3d pBareVector) : eVector(pBareVector) {} - auto operator[](size_t index) const ; + auto operator[](size_t index) const; - auto GetX() const ; + auto GetX() const; - auto GetY() const ; + auto GetY() const; - auto GetZ() const ; + auto GetZ() const; - auto norm() const ; + auto norm() const; - auto squaredNorm() const ; + auto squaredNorm() const; - auto operator+(QuantityVector<dim> const& pQVec) const ; + auto operator+(QuantityVector<dim> const& pQVec) const; - auto operator-(QuantityVector<dim> const& pQVec) const ; + auto operator-(QuantityVector<dim> const& pQVec) const; template <typename ScalarDim> - auto operator*(phys::units::quantity<ScalarDim, double> const p) const ; + auto operator*(phys::units::quantity<ScalarDim, double> const p) const; template <typename ScalarDim> - auto operator/(phys::units::quantity<ScalarDim, double> const p) const ; - - auto operator*(double const p) const ; + auto operator/(phys::units::quantity<ScalarDim, double> const p) const; - auto operator/(double const p) const ; + auto operator*(double const p) const; - auto& operator/=(double const p) ; + auto operator/(double const p) const; - auto& operator*=(double const p) ; + auto& operator/=(double const p); - auto& operator+=(QuantityVector<dim> const& pQVec) ; + auto& operator*=(double const p); - auto& operator-=(QuantityVector<dim> const& pQVec) ; + auto& operator+=(QuantityVector<dim> const& pQVec); - auto& operator-() const ; + auto& operator-=(QuantityVector<dim> const& pQVec); - auto normalized() const ; + auto& operator-() const; - auto operator==(QuantityVector<dim> const& p) const ; + auto normalized() const; + auto operator==(QuantityVector<dim> const& p) const; }; /* diff --git a/corsika/framework/geometry/RootCoordinateSystem.hpp b/corsika/framework/geometry/RootCoordinateSystem.hpp index f88c7a27076bb7f568b9961fbfb21d14c464cadc..3a78e16f54c95585e72799d4b7407172c31b8718 100644 --- a/corsika/framework/geometry/RootCoordinateSystem.hpp +++ b/corsika/framework/geometry/RootCoordinateSystem.hpp @@ -8,8 +8,8 @@ #pragma once -#include <corsika/framework/utility/Singleton.hpp> #include <corsika/framework/geometry/CoordinateSystem.hpp> +#include <corsika/framework/utility/Singleton.hpp> /*! * This is the only way to get a root-coordinate system, and it is a @@ -27,18 +27,11 @@ namespace corsika { RootCoordinateSystem() {} public: - corsika::CoordinateSystem& GetRootCoordinateSystem() - { - return fRootCS; - } - const corsika::CoordinateSystem& GetRootCoordinateSystem() const - { - return fRootCS; - } + corsika::CoordinateSystem& GetRootCoordinateSystem() { return fRootCS; } + const corsika::CoordinateSystem& GetRootCoordinateSystem() const { return fRootCS; } private: corsika::CoordinateSystem fRootCS; // THIS IS IT }; } // namespace corsika - diff --git a/corsika/framework/geometry/Sphere.hpp b/corsika/framework/geometry/Sphere.hpp index edbeae194bdb53f08a70b493ed6ec65d5422df3c..ecb98f3061bd30d973b21b1d76910029c451bdb0 100644 --- a/corsika/framework/geometry/Sphere.hpp +++ b/corsika/framework/geometry/Sphere.hpp @@ -24,10 +24,10 @@ namespace corsika { , fRadius(pRadius) {} //! returns true if the Point p is within the sphere - inline bool Contains(Point const& p) const override ; - + inline bool Contains(Point const& p) const override; + inline const Point& GetCenter() const; - + inline units::si::LengthType GetRadius() const; }; diff --git a/corsika/framework/geometry/Trajectory.hpp b/corsika/framework/geometry/Trajectory.hpp index 89a9490ad8ed117f9712d0dd0890d5f0aba0f672..7a76a89f32ff6cf4c5eb4e22f7b44147eb55cf74 100644 --- a/corsika/framework/geometry/Trajectory.hpp +++ b/corsika/framework/geometry/Trajectory.hpp @@ -92,18 +92,17 @@ namespace corsika { return GetVelocity(u).normalized(); } - Point GetPosition(double u) const ; + Point GetPosition(double u) const; - corsika::units::si::TimeType GetDuration() const ; + corsika::units::si::TimeType GetDuration() const; - corsika::units::si::LengthType GetLength() const ; + corsika::units::si::LengthType GetLength() const; - corsika::units::si::LengthType GetDistance(corsika::units::si::TimeType t) const ; + corsika::units::si::LengthType GetDistance(corsika::units::si::TimeType t) const; - void LimitEndTo(corsika::units::si::LengthType limit) ; - - auto NormalizedDirection() const ; + void LimitEndTo(corsika::units::si::LengthType limit); + auto NormalizedDirection() const; }; } // namespace corsika diff --git a/corsika/framework/geometry/Vector.hpp b/corsika/framework/geometry/Vector.hpp index d117e3fcca4d5dedae2dd1504ffc38823c6ead07..af8de9afbe107ae3434055093331139ae5c0527d 100644 --- a/corsika/framework/geometry/Vector.hpp +++ b/corsika/framework/geometry/Vector.hpp @@ -60,15 +60,15 @@ namespace corsika { */ auto norm() const; - auto GetNorm() const ; + auto GetNorm() const; /*! * returns the squared norm of the Vector. Before using this method, * think about whether norm() might be cheaper for your computation. */ - auto squaredNorm() const ; + auto squaredNorm() const; - auto GetSquaredNorm() const ; + auto GetSquaredNorm() const; /*! * returns a Vector \f$ \vec{v}_{\parallel} \f$ which is the parallel projection * of this vector \f$ \vec{v}_1 \f$ along another Vector \f$ \vec{v}_2 \f$ given by @@ -77,39 +77,39 @@ namespace corsika { * \f] */ template <typename dim2> - auto parallelProjectionOnto(Vector<dim2> const& pVec, CoordinateSystem const& pCS) const ; + auto parallelProjectionOnto(Vector<dim2> const& pVec, + CoordinateSystem const& pCS) const; template <typename dim2> - auto parallelProjectionOnto(Vector<dim2> const& pVec) const ; + auto parallelProjectionOnto(Vector<dim2> const& pVec) const; - auto operator+(Vector<dim> const& pVec) const ; + auto operator+(Vector<dim> const& pVec) const; - auto operator-(Vector<dim> const& pVec) const ; + auto operator-(Vector<dim> const& pVec) const; - auto& operator*=(double const p) ; + auto& operator*=(double const p); template <typename ScalarDim> - auto operator*(phys::units::quantity<ScalarDim, double> const p) const ; + auto operator*(phys::units::quantity<ScalarDim, double> const p) const; template <typename ScalarDim> - auto operator/(phys::units::quantity<ScalarDim, double> const p) const ; + auto operator/(phys::units::quantity<ScalarDim, double> const p) const; - auto operator*(double const p) const ; + auto operator*(double const p) const; - auto operator/(double const p) const ; + auto operator/(double const p) const; - auto& operator+=(Vector<dim> const& pVec) ; + auto& operator+=(Vector<dim> const& pVec); auto& operator-=(Vector<dim> const& pVec); - auto& operator-() const ; + auto& operator-() const; - auto normalized() const ; + auto normalized() const; template <typename dim2> - auto cross(Vector<dim2> pV) const ; + auto cross(Vector<dim2> pV) const; template <typename dim2> - auto dot(Vector<dim2> pV) const ; - + auto dot(Vector<dim2> pV) const; }; } // namespace corsika diff --git a/corsika/framework/geometry/Volume.hpp b/corsika/framework/geometry/Volume.hpp index d566e45c1706151a30e48516d10f0d6429ca4b0d..069ad7ef8f976d6c8e557c92962f3b3797d5d63b 100644 --- a/corsika/framework/geometry/Volume.hpp +++ b/corsika/framework/geometry/Volume.hpp @@ -22,4 +22,3 @@ namespace corsika { }; } // namespace corsika - diff --git a/corsika/framework/random/ExponentialDistribution.hpp b/corsika/framework/random/ExponentialDistribution.hpp index d0d08be73a1851f0ab216aca501f4ad4b18cdecc..b8433dcb1df3a044b5d6b15a3bd458e4475d8ba1 100644 --- a/corsika/framework/random/ExponentialDistribution.hpp +++ b/corsika/framework/random/ExponentialDistribution.hpp @@ -12,10 +12,10 @@ #include <random> namespace corsika { - //FIXME: This whole facility needs to re-designed. - //It is not parallel friendly neither polymorphic - //and the streaming management is prone to produce - //huge correlation between the streams + // FIXME: This whole facility needs to re-designed. + // It is not parallel friendly neither polymorphic + // and the streaming management is prone to produce + // huge correlation between the streams template <class TQuantity> class ExponentialDistribution { @@ -35,4 +35,3 @@ namespace corsika { }; } // namespace corsika - diff --git a/corsika/framework/random/RNGManager.hpp b/corsika/framework/random/RNGManager.hpp index 7fc2d327a8e3d5fe4f06910d5af2c67c5cfe0fe7..0c7e11b90d18e2498b8681113d0c9aced03e862f 100644 --- a/corsika/framework/random/RNGManager.hpp +++ b/corsika/framework/random/RNGManager.hpp @@ -8,10 +8,10 @@ #pragma once +#include <corsika/framework/utility/Singleton.hpp> #include <map> #include <random> #include <string> -#include <corsika/framework/utility/Singleton.hpp> /*! * With this class modules can register streams of random numbers. @@ -19,10 +19,10 @@ namespace corsika { - //FIXME: This while facility needs to re-designed. - //It is not parallel friendly neither polymorphic - //and the streaming management is prone to produce - //huge correlation between the streams + // FIXME: This while facility needs to re-designed. + // It is not parallel friendly neither polymorphic + // and the streaming management is prone to produce + // huge correlation between the streams using RNG = std::mt19937; //!< the actual RNG type that will be used @@ -34,7 +34,6 @@ namespace corsika { std::map<std::string, std::seed_seq> seeds; protected: - RNGManager() {} // why ? public: diff --git a/corsika/framework/random/UniformRealDistribution.hpp b/corsika/framework/random/UniformRealDistribution.hpp index ce112acc47de7e30758c6a9e3ee992406efd0cf1..affc72d756e0aeb813546ef2009b5662b2c5bd9d 100644 --- a/corsika/framework/random/UniformRealDistribution.hpp +++ b/corsika/framework/random/UniformRealDistribution.hpp @@ -13,10 +13,10 @@ namespace corsika { - //FIXME: This while facility needs to re-designed. - //It is not parallel friendly neither polymorphic - //and the streaming management is prone to produce - //huge correlation between the streams + // FIXME: This while facility needs to re-designed. + // It is not parallel friendly neither polymorphic + // and the streaming management is prone to produce + // huge correlation between the streams template <class TQuantity> class UniformRealDistribution { @@ -40,4 +40,3 @@ namespace corsika { }; } // namespace corsika - diff --git a/corsika/framework/sequence/BaseProcess.hpp b/corsika/framework/sequence/BaseProcess.hpp index a17b8faf6de7bf79dee88edb7cbc02f5236d58fc..41201d3cb195a850c98d219e7248403ea372d909 100644 --- a/corsika/framework/sequence/BaseProcess.hpp +++ b/corsika/framework/sequence/BaseProcess.hpp @@ -8,8 +8,8 @@ #pragma once -#include <type_traits> #include <corsika/framework/sequence/ProcessReturn.hpp> // for convenience +#include <type_traits> namespace corsika { @@ -48,4 +48,3 @@ namespace corsika { std::true_type is_process_impl(const BaseProcess<T>* impl); } // namespace corsika - diff --git a/corsika/framework/sequence/BoundaryCrossingProcess.hpp b/corsika/framework/sequence/BoundaryCrossingProcess.hpp index 057d156bcef5bcc6c35a7554527a96114cc6f5aa..b49e16fddd6df8d99d5896a90c5a2c9c795f2a23 100644 --- a/corsika/framework/sequence/BoundaryCrossingProcess.hpp +++ b/corsika/framework/sequence/BoundaryCrossingProcess.hpp @@ -8,8 +8,8 @@ #pragma once -#include <corsika/media/Environment.hpp> #include <corsika/framework/sequence/ProcessReturn.hpp> +#include <corsika/media/Environment.hpp> namespace corsika { @@ -36,5 +36,3 @@ namespace corsika { std::true_type is_process_impl(BoundaryCrossingProcess<T> const* impl); } // namespace corsika - - diff --git a/corsika/framework/sequence/ContinuousProcess.hpp b/corsika/framework/sequence/ContinuousProcess.hpp index ec20510db22763d8a606b61f25cd3b61c305de88..68e4a7f82b59565f6b1811481ac4cdf0550bceab 100644 --- a/corsika/framework/sequence/ContinuousProcess.hpp +++ b/corsika/framework/sequence/ContinuousProcess.hpp @@ -42,5 +42,3 @@ namespace corsika { std::true_type is_process_impl(const ContinuousProcess<T>* impl); } // namespace corsika - - diff --git a/corsika/framework/sequence/DecayProcess.hpp b/corsika/framework/sequence/DecayProcess.hpp index 5b238fda5b2814c72c6655f263e3c3af4bd299d7..dc6e1704040a06ee94ed059160b5813995e7ae03 100644 --- a/corsika/framework/sequence/DecayProcess.hpp +++ b/corsika/framework/sequence/DecayProcess.hpp @@ -10,8 +10,8 @@ #include <type_traits> -#include <corsika/setup/SetupTrajectory.hpp> #include <corsika/framework/core/PhysicalUnits.hpp> +#include <corsika/setup/SetupTrajectory.hpp> #include "corsika/framework/sequence/ProcessReturn.hpp" // for convenience namespace corsika { diff --git a/corsika/framework/sequence/InteractionProcess.hpp b/corsika/framework/sequence/InteractionProcess.hpp index 153364e303ff519828881a2e9280d456eb73c900..af79e598cbb8ffc81a142dee9c8f3e9fd158a389 100644 --- a/corsika/framework/sequence/InteractionProcess.hpp +++ b/corsika/framework/sequence/InteractionProcess.hpp @@ -10,9 +10,9 @@ #include <type_traits> -#include <corsika/setup/SetupTrajectory.hpp> #include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/sequence/ProcessReturn.hpp> // for convenience +#include <corsika/setup/SetupTrajectory.hpp> namespace corsika { @@ -50,4 +50,3 @@ namespace corsika { std::true_type is_process_impl(const InteractionProcess<T>* impl); } // namespace corsika - diff --git a/corsika/framework/sequence/ProcessReturn.hpp b/corsika/framework/sequence/ProcessReturn.hpp index e54877fab39f7a5bb1e43711fef10b9d01d97509..b86391ebd7908be14d50d9fb5ead7981527e0333 100644 --- a/corsika/framework/sequence/ProcessReturn.hpp +++ b/corsika/framework/sequence/ProcessReturn.hpp @@ -40,4 +40,3 @@ namespace corsika { } } // namespace corsika - diff --git a/corsika/framework/sequence/ProcessSequence.hpp b/corsika/framework/sequence/ProcessSequence.hpp index 4ef3effef8359888e5ffc2bac164f97441411ef5..a24bf087097aac47cc9c2cb7b94a22ef7ef0b037 100644 --- a/corsika/framework/sequence/ProcessSequence.hpp +++ b/corsika/framework/sequence/ProcessSequence.hpp @@ -9,8 +9,6 @@ #pragma once #include <cmath> -#include <limits> -#include <type_traits> #include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/sequence/BaseProcess.hpp> #include <corsika/framework/sequence/BoundaryCrossingProcess.hpp> @@ -20,6 +18,8 @@ #include <corsika/framework/sequence/ProcessReturn.hpp> #include <corsika/framework/sequence/SecondariesProcess.hpp> #include <corsika/framework/sequence/StackProcess.hpp> +#include <limits> +#include <type_traits> namespace corsika { @@ -75,10 +75,10 @@ namespace corsika { VTNType const& to); template <typename TParticle, typename TTrack> - EProcessReturn DoContinuous(TParticle& vP, TTrack& vT) ; + EProcessReturn DoContinuous(TParticle& vP, TTrack& vT); template <typename TSecondaries> - EProcessReturn DoSecondaries(TSecondaries& vS) ; + EProcessReturn DoSecondaries(TSecondaries& vS); /** The processes of type StackProcess do have an internal counter, @@ -88,7 +88,7 @@ namespace corsika { tested if either A_ or B_ are StackProcess and if they are due for execution. */ - bool CheckStep() ; + bool CheckStep(); /** Execute the StackProcess-es in the ProcessSequence @@ -97,16 +97,17 @@ namespace corsika { EProcessReturn DoStack(TStack& vS); template <typename TParticle, typename TTrack> - corsika::units::si::LengthType MaxStepLength(TParticle& vP, TTrack& vTrack) ; + corsika::units::si::LengthType MaxStepLength(TParticle& vP, TTrack& vTrack); template <typename TParticle> corsika::units::si::GrammageType GetTotalInteractionLength(TParticle& vP); template <typename TParticle> inline corsika::units::si::InverseGrammageType GetTotalInverseInteractionLength( - TParticle& vP) ; + TParticle& vP); template <typename TParticle> - inline corsika::units::si::InverseGrammageType GetInverseInteractionLength(TParticle& vP) ; + inline corsika::units::si::InverseGrammageType GetInverseInteractionLength( + TParticle& vP); template <typename TParticle, typename TSecondaries> EProcessReturn SelectInteraction( @@ -115,20 +116,20 @@ namespace corsika { corsika::units::si::InverseGrammageType& lambda_inv_count); template <typename TParticle> - corsika::units::si::TimeType GetTotalLifetime(TParticle& p) ; + corsika::units::si::TimeType GetTotalLifetime(TParticle& p); template <typename TParticle> - corsika::units::si::InverseTimeType GetTotalInverseLifetime(TParticle& p) ; + corsika::units::si::InverseTimeType GetTotalInverseLifetime(TParticle& p); template <typename TParticle> - corsika::units::si::InverseTimeType GetInverseLifetime(TParticle& p) ; + corsika::units::si::InverseTimeType GetInverseLifetime(TParticle& p); // select decay process template <typename TParticle, typename TSecondaries> EProcessReturn SelectDecay( TParticle& vP, TSecondaries& vS, [[maybe_unused]] corsika::units::si::InverseTimeType decay_select, - corsika::units::si::InverseTimeType& decay_inv_count) ; + corsika::units::si::InverseTimeType& decay_inv_count); void Init() { A.Init(); @@ -172,4 +173,4 @@ namespace corsika { } // namespace corsika -#include<corsika/detail/framework/sequence/ProcessSequence.inl> +#include <corsika/detail/framework/sequence/ProcessSequence.inl> diff --git a/corsika/framework/sequence/ProcessSignature.hpp b/corsika/framework/sequence/ProcessSignature.hpp index 56148548adb8b557c57d33731eaa4f6cd04914f1..346e8a33cc2bb3898c5cce5153cac573d4ee7bd0 100644 --- a/corsika/framework/sequence/ProcessSignature.hpp +++ b/corsika/framework/sequence/ProcessSignature.hpp @@ -24,4 +24,3 @@ } // FORCE_SIGNATURE(thisMustBeDefined, T::thisMustBeDefined, int(*)(void)); - diff --git a/corsika/framework/sequence/SecondariesProcess.hpp b/corsika/framework/sequence/SecondariesProcess.hpp index ecedb02e5a9126e5990b1f9a5985d5c0dd7b287c..a6a715f67313ccc059cd1550efd5360b5884f790 100644 --- a/corsika/framework/sequence/SecondariesProcess.hpp +++ b/corsika/framework/sequence/SecondariesProcess.hpp @@ -8,9 +8,9 @@ #pragma once -#include <corsika/setup/SetupTrajectory.hpp> #include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/sequence/ProcessReturn.hpp> // for convenience +#include <corsika/setup/SetupTrajectory.hpp> namespace corsika { @@ -37,4 +37,3 @@ namespace corsika { std::true_type is_process_impl(const SecondariesProcess<T>* impl); } // namespace corsika - diff --git a/corsika/framework/sequence/StackProcess.hpp b/corsika/framework/sequence/StackProcess.hpp index 6e503d68aa2ec734cdeb5227665983a123d74bae..a94d8f22cb260b3d44a633c8d5795a77daa0ad0d 100644 --- a/corsika/framework/sequence/StackProcess.hpp +++ b/corsika/framework/sequence/StackProcess.hpp @@ -8,9 +8,9 @@ #pragma once -#include <corsika/setup/SetupTrajectory.hpp> #include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/sequence/ProcessReturn.hpp> // for convenience +#include <corsika/setup/SetupTrajectory.hpp> namespace corsika { diff --git a/corsika/framework/stack/CombinedStack.hpp b/corsika/framework/stack/CombinedStack.hpp index 8bbe41e6d48e4f712b0d478767d1c7ebd9d28061..2751d8d973ce66dfd6594004d4165ee818834c75 100644 --- a/corsika/framework/stack/CombinedStack.hpp +++ b/corsika/framework/stack/CombinedStack.hpp @@ -37,7 +37,7 @@ namespace corsika { class CombinedParticleInterface : public ParticleInterfaceB<ParticleInterfaceA<StackIterator>> { - //FIXME: class has no ctors, assignment operators etc. + // FIXME: class has no ctors, assignment operators etc. // template<template <typename> typename _PI> // template <typename StackDataType, template <typename> typename ParticleInterface> @@ -70,17 +70,17 @@ namespace corsika { */ template <typename... Args1> - void SetParticleData(const std::tuple<Args1...> vA) ; + void SetParticleData(const std::tuple<Args1...> vA); template <typename... Args1, typename... Args2> - void SetParticleData(const std::tuple<Args1...> vA, const std::tuple<Args2...> vB) ; + void SetParticleData(const std::tuple<Args1...> vA, const std::tuple<Args2...> vB); template <typename... Args1> - void SetParticleData(PI_C& p, const std::tuple<Args1...> vA) ; + void SetParticleData(PI_C& p, const std::tuple<Args1...> vA); template <typename... Args1, typename... Args2> void SetParticleData(PI_C& p, const std::tuple<Args1...> vA, - const std::tuple<Args2...> vB) ; + const std::tuple<Args2...> vB); ///@} std::string as_string() const { @@ -90,19 +90,19 @@ namespace corsika { namespace detail { - /** - * @class CombinedStackImpl - * - * Memory implementation of a combined data stack. - * - * The two stack data user objects Stack1Impl and Stack2Impl are - * merged into one consistent Stack container object providing - * access to the combined number of data entries. - */ - template <typename Stack1Impl, typename Stack2Impl> - class CombinedStackImpl ; + /** + * @class CombinedStackImpl + * + * Memory implementation of a combined data stack. + * + * The two stack data user objects Stack1Impl and Stack2Impl are + * merged into one consistent Stack container object providing + * access to the combined number of data entries. + */ + template <typename Stack1Impl, typename Stack2Impl> + class CombinedStackImpl; -} // namespace detail + } // namespace detail /** * Helper template alias `CombinedStack` to construct new combined diff --git a/corsika/framework/stack/SecondaryView.hpp b/corsika/framework/stack/SecondaryView.hpp index a45a6d4fc3fbccd6dcc39f5687d26f6a01696d95..882310589fb997b3745cc26cbb59ab8d4e5eb9be 100644 --- a/corsika/framework/stack/SecondaryView.hpp +++ b/corsika/framework/stack/SecondaryView.hpp @@ -8,11 +8,11 @@ #pragma once -#include <stdexcept> -#include <vector> -#include <type_traits> #include <corsika/framework/stack/Stack.hpp> #include <corsika/framework/stack/StackIteratorInterface.hpp> +#include <stdexcept> +#include <type_traits> +#include <vector> namespace corsika { @@ -195,7 +195,7 @@ namespace corsika { * Method to add a new secondary particle on this SecondaryView */ template <typename... Args> - auto AddSecondary(const Args... v) ; + auto AddSecondary(const Args... v); protected: /** @@ -208,7 +208,7 @@ namespace corsika { * StackIterator::AddSecondary via ParticleBase */ template <typename... Args> - auto AddSecondary(StackIterator& proj, const Args... v) ; + auto AddSecondary(StackIterator& proj, const Args... v); /** * overwrite Stack::GetSize to return actual number of secondaries */ @@ -311,7 +311,7 @@ namespace corsika { * return next particle from stack, need to overwrtie Stack::GetNextParticle to get * right reference */ - inline void Delete(ParticleInterfaceType p) ; + inline void Delete(ParticleInterfaceType p); /** * check if this particle was already deleted * @@ -325,7 +325,7 @@ namespace corsika { /** * delete this particle */ - inline void DeleteLast() ; + inline void DeleteLast(); /** * Function to ultimatively remove the last entry from the stack, diff --git a/corsika/framework/stack/Stack.hpp b/corsika/framework/stack/Stack.hpp index 4f20d4a7e1da72236d81369030129a75478b6b25..02fe6d178d4a25247c18b7a141ddf4d425f70aca 100644 --- a/corsika/framework/stack/Stack.hpp +++ b/corsika/framework/stack/Stack.hpp @@ -14,8 +14,8 @@ #include <string> #include <vector> -#include <corsika/framework/utility/MetaProgramming.hpp> #include <corsika/framework/stack/SecondaryView.hpp> +#include <corsika/framework/utility/MetaProgramming.hpp> /** All classes around management of particles on a stack. @@ -72,7 +72,8 @@ namespace corsika { * if TStackData is a reference member we *HAVE* to initialize * it in the constructor, this is typically needed for SecondaryView */ - template <typename _ = StackDataType, typename = corsika::enable_if<std::is_reference<_>>> + template <typename _ = StackDataType, + typename = corsika::enable_if<std::is_reference<_>>> Stack(StackDataType vD) : fData(vD) {} @@ -409,5 +410,3 @@ namespace corsika { }; } // namespace corsika - - diff --git a/corsika/framework/stack/StackIteratorInterface.hpp b/corsika/framework/stack/StackIteratorInterface.hpp index d725862397ca3e382c60816229d4c71b3143f0f3..490f0857169f8c041f5b50837018c4c8fe5de799 100644 --- a/corsika/framework/stack/StackIteratorInterface.hpp +++ b/corsika/framework/stack/StackIteratorInterface.hpp @@ -68,9 +68,8 @@ namespace corsika { StackIteratorInterface<TStackData, TParticleInterface, StackType>> { public: - using ParticleInterfaceType = - ParticleInterface<corsika::StackIteratorInterface< - StackDataType, ParticleInterface, StackType>>; + using ParticleInterfaceType = ParticleInterface< + corsika::StackIteratorInterface<StackDataType, ParticleInterface, StackType>>; // friends are needed for access to protected methods friend class Stack<TStackData, @@ -356,4 +355,3 @@ namespace corsika { }; // end class ConstStackIterator } // namespace corsika - diff --git a/corsika/framework/utility/Bit.hpp b/corsika/framework/utility/Bit.hpp index 94faa5dc778348d19bae65bf7cb0ef9c202b0608..ba3fe2b00e7c379ad238ece979836521311560bc 100644 --- a/corsika/framework/utility/Bit.hpp +++ b/corsika/framework/utility/Bit.hpp @@ -89,4 +89,3 @@ namespace corsika { } } // namespace corsika - diff --git a/corsika/framework/utility/COMBoost.hpp b/corsika/framework/utility/COMBoost.hpp index 17e15352b8f82ff6ef3bdbcb02682465fdae3b17..e32143c4b9be6719f92bf0a3b85c302bfc81ff33 100644 --- a/corsika/framework/utility/COMBoost.hpp +++ b/corsika/framework/utility/COMBoost.hpp @@ -31,21 +31,20 @@ namespace corsika { public: //! construct a COMBoost given four-vector of prjectile and mass of target - COMBoost( - const corsika::FourVector< - corsika::units::si::HEPEnergyType, - corsika::Vector<corsika::units::si::hepmomentum_d>>& Pprojectile, - const corsika::units::si::HEPEnergyType massTarget); + COMBoost(const corsika::FourVector< + corsika::units::si::HEPEnergyType, + corsika::Vector<corsika::units::si::hepmomentum_d>>& Pprojectile, + const corsika::units::si::HEPEnergyType massTarget); inline auto const& GetRotationMatrix() const; //! transforms a 4-momentum from lab frame to the center-of-mass frame template <typename FourVector> - inline FourVector toCoM(const FourVector& p) const ; + inline FourVector toCoM(const FourVector& p) const; //! transforms a 4-momentum from the center-of-mass frame back to lab frame template <typename FourVector> - inline FourVector fromCoM(const FourVector& p) const ; + inline FourVector fromCoM(const FourVector& p) const; }; } // namespace corsika diff --git a/corsika/framework/utility/MetaProgramming.hpp b/corsika/framework/utility/MetaProgramming.hpp index 9bd9688b4f457fa0c88fd3fe745250110f233df3..d635991ec0e69ef33e1772d8d257de0ca46024e0 100644 --- a/corsika/framework/utility/MetaProgramming.hpp +++ b/corsika/framework/utility/MetaProgramming.hpp @@ -58,4 +58,3 @@ namespace corsika { template <class Trait> using disable_if = typename std::enable_if<(Trait::value == false)>::type; } // namespace corsika - diff --git a/corsika/framework/utility/Singleton.hpp b/corsika/framework/utility/Singleton.hpp index 801c3f5e59a68ab1ba457d1825d8de322f4a4cf4..04665157e822ad7b10c6729ff6e957fb1441878f 100644 --- a/corsika/framework/utility/Singleton.hpp +++ b/corsika/framework/utility/Singleton.hpp @@ -56,4 +56,3 @@ namespace corsika { }; } // namespace corsika - diff --git a/corsika/framework/utility/sgn.hpp b/corsika/framework/utility/sgn.hpp index e9e0f514d719f9b6387c203aa1b16dcc7ba9f879..70c1265d655f97eadd89871ccabd1ed6b3abf37a 100644 --- a/corsika/framework/utility/sgn.hpp +++ b/corsika/framework/utility/sgn.hpp @@ -18,4 +18,3 @@ namespace corsika { } } // namespace corsika - diff --git a/corsika/media/BaseExponential.hpp b/corsika/media/BaseExponential.hpp index 48fe5a520085e076dac7666574f7878867f11d58..87263d3ccc75a565845542d8d6225d2a13eadd32 100644 --- a/corsika/media/BaseExponential.hpp +++ b/corsika/media/BaseExponential.hpp @@ -8,11 +8,11 @@ #pragma once +#include <corsika/framework/core/ParticleProperties.hpp> +#include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/geometry/Line.hpp> #include <corsika/framework/geometry/Point.hpp> #include <corsika/framework/geometry/Trajectory.hpp> -#include <corsika/framework/core/ParticleProperties.hpp> -#include <corsika/framework/core/PhysicalUnits.hpp> #include <limits> @@ -23,27 +23,23 @@ namespace corsika { * (locally) flat exponential atmospheres. */ template <class TDerived> - class BaseExponential - { + class BaseExponential { public: - - BaseExponential(Point const& vP0, units::si::MassDensityType vRho, - units::si::LengthType vLambda): - fRho0(vRho), - fLambda(vLambda), - fInvLambda(1 / vLambda), - fP0(vP0) - {} + BaseExponential(Point const& vP0, units::si::MassDensityType vRho, + units::si::LengthType vLambda) + : fRho0(vRho) + , fLambda(vLambda) + , fInvLambda(1 / vLambda) + , fP0(vP0) {} protected: - units::si::MassDensityType const fRho0; units::si::LengthType const fLambda; units::si::InverseLengthType const fInvLambda; Point const fP0; - auto const& GetImplementation() const ; + auto const& GetImplementation() const; // clang-format off /** @@ -60,8 +56,7 @@ namespace corsika { */ // clang-format on units::si::GrammageType IntegratedGrammage( - Trajectory<Line> const& vLine, - units::si::LengthType vL, + Trajectory<Line> const& vLine, units::si::LengthType vL, Vector<units::si::dimensionless_d> const& vAxis) const; // clang-format off @@ -83,13 +78,10 @@ namespace corsika { */ // clang-format on units::si::LengthType ArclengthFromGrammage( - Trajectory<Line> const& vLine, - units::si::GrammageType vGrammage, + Trajectory<Line> const& vLine, units::si::GrammageType vGrammage, Vector<units::si::dimensionless_d> const& vAxis) const; - - }; -} // namespace corsika::environment +} // namespace corsika #include <corsika/detail/media/BaseExponential.inl> diff --git a/corsika/media/DensityFunction.hpp b/corsika/media/DensityFunction.hpp index 2105f521f8fb8693191b449994a3052a185a6143..ec2e4e9025ae67f1ffdbcc2175abe87c4ac886ac 100644 --- a/corsika/media/DensityFunction.hpp +++ b/corsika/media/DensityFunction.hpp @@ -8,30 +8,28 @@ #pragma once -#include <corsika/media/LinearApproximationIntegrator.hpp> #include <corsika/framework/geometry/Line.hpp> #include <corsika/framework/geometry/Point.hpp> #include <corsika/framework/geometry/Trajectory.hpp> +#include <corsika/media/LinearApproximationIntegrator.hpp> namespace corsika { - template <class TDerivableRho, template <typename> class TIntegrator = LinearApproximationIntegrator> - class DensityFunction: public TIntegrator<DensityFunction<TDerivableRho, TIntegrator>> - { + template <class TDerivableRho, + template <typename> class TIntegrator = LinearApproximationIntegrator> + class DensityFunction + : public TIntegrator<DensityFunction<TDerivableRho, TIntegrator>> { friend class TIntegrator<DensityFunction<TDerivableRho, TIntegrator>>; TDerivableRho fRho; //!< functor for density public: - DensityFunction(TDerivableRho rho) : fRho(rho) {} - corsika::units::si::MassDensityType EvaluateAt( - corsika::Point const& p) const { + corsika::units::si::MassDensityType EvaluateAt(corsika::Point const& p) const { return fRho(p); } }; -} // namespace corsika::environment - +} // namespace corsika diff --git a/corsika/media/Environment.hpp b/corsika/media/Environment.hpp index 9c909a631be0b22d784b1d01c15faf1ece6c2cff..6f30f2898e05f4c64446d9f15b0127a5a0d1c561 100644 --- a/corsika/media/Environment.hpp +++ b/corsika/media/Environment.hpp @@ -8,53 +8,47 @@ #pragma once -#include <corsika/media/Universe.hpp> -#include <corsika/media/IMediumModel.hpp> -#include <corsika/media/VolumeTreeNode.hpp> #include <corsika/framework/geometry/Point.hpp> #include <corsika/framework/geometry/RootCoordinateSystem.hpp> #include <corsika/framework/geometry/Sphere.hpp> +#include <corsika/media/IMediumModel.hpp> +#include <corsika/media/Universe.hpp> +#include <corsika/media/VolumeTreeNode.hpp> #include <limits> namespace corsika { template <typename IEnvironmentModel> - class Environment - { + class Environment { public: - using BaseNodeType = VolumeTreeNode<IEnvironmentModel>; + using BaseNodeType = VolumeTreeNode<IEnvironmentModel>; - Environment(): - fCoordinateSystem( - corsika::RootCoordinateSystem::GetInstance().GetRootCoordinateSystem()), - fUniverse( - std::make_unique<BaseNodeType>(std::make_unique<Universe>(fCoordinateSystem))) - {} + Environment() + : fCoordinateSystem( + corsika::RootCoordinateSystem::GetInstance().GetRootCoordinateSystem()) + , fUniverse(std::make_unique<BaseNodeType>( + std::make_unique<Universe>(fCoordinateSystem))) {} // using IEnvironmentModel = corsika::IEnvironmentModel; inline auto& GetUniverse(); - inline auto const& GetUniverse() const ; + inline auto const& GetUniverse() const; - inline auto const& GetCoordinateSystem() const ; + inline auto const& GetCoordinateSystem() const; // factory method for creation of VolumeTreeNodes template <class TVolumeType, typename... TVolumeArgs> static auto CreateNode(TVolumeArgs&&... args); - private: - corsika::CoordinateSystem const& fCoordinateSystem; typename BaseNodeType::VTNUPtr fUniverse; - }; // using SetupBaseNodeType = VolumeTreeNode<corsika::IEnvironmentModel>; // using SetupEnvironment = Environment<corsika::IEnvironmentModel>; -} // namespace corsika::environment - +} // namespace corsika #include <corsika/detail/media/Environment.inl> diff --git a/corsika/media/FlatExponential.hpp b/corsika/media/FlatExponential.hpp index ed066bbe9ce539447c38673724467b6f4d4becad..6e32918f89d720b1bac0f010fa0d39047ef19a19 100644 --- a/corsika/media/FlatExponential.hpp +++ b/corsika/media/FlatExponential.hpp @@ -8,44 +8,42 @@ #pragma once -#include <corsika/media/BaseExponential.hpp> -#include <corsika/media/NuclearComposition.hpp> +#include <corsika/framework/core/ParticleProperties.hpp> +#include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/geometry/Line.hpp> #include <corsika/framework/geometry/Point.hpp> #include <corsika/framework/geometry/Trajectory.hpp> -#include <corsika/framework/core/ParticleProperties.hpp> -#include <corsika/framework/core/PhysicalUnits.hpp> +#include <corsika/media/BaseExponential.hpp> +#include <corsika/media/NuclearComposition.hpp> namespace corsika { template <class T> - class FlatExponential : public BaseExponential<FlatExponential<T>>, public T - { + class FlatExponential : public BaseExponential<FlatExponential<T>>, public T { Vector<units::si::dimensionless_d> const fAxis; NuclearComposition const fNuclComp; using Base = BaseExponential<FlatExponential<T>>; public: - FlatExponential(Point const& vP0, Vector<units::si::dimensionless_d> const& vAxis, - units::si::MassDensityType vRho, units::si::LengthType vLambda, NuclearComposition vNuclComp): - Base(vP0, vRho, vLambda), - fAxis(vAxis), - fNuclComp(vNuclComp) - {} + units::si::MassDensityType vRho, units::si::LengthType vLambda, + NuclearComposition vNuclComp) + : Base(vP0, vRho, vLambda) + , fAxis(vAxis) + , fNuclComp(vNuclComp) {} units::si::MassDensityType GetMassDensity(Point const& vP) const override; - NuclearComposition const& GetNuclearComposition() const override ; + NuclearComposition const& GetNuclearComposition() const override; units::si::GrammageType IntegratedGrammage(Trajectory<Line> const& vLine, - units::si::LengthType vTo) const override ; + units::si::LengthType vTo) const override; - units::si::LengthType ArclengthFromGrammage( Trajectory<Line> const& vLine, - units::si::GrammageType vGrammage) const override ; + units::si::LengthType ArclengthFromGrammage( + Trajectory<Line> const& vLine, units::si::GrammageType vGrammage) const override; }; -} // namespace corsika::environment +} // namespace corsika #include <corsika/detail/media/FlatExponential.inl> diff --git a/corsika/media/HomogeneousMedium.hpp b/corsika/media/HomogeneousMedium.hpp index cde94452edeffdb3a4f6ffef7de0f76c8dcbfb96..213cac197f6f0a83f62c645213937d7af256cf58 100644 --- a/corsika/media/HomogeneousMedium.hpp +++ b/corsika/media/HomogeneousMedium.hpp @@ -8,13 +8,13 @@ #pragma once -#include <corsika/media/NuclearComposition.hpp> +#include <corsika/framework/core/ParticleProperties.hpp> +#include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/geometry/Line.hpp> #include <corsika/framework/geometry/Point.hpp> #include <corsika/framework/geometry/Trajectory.hpp> -#include <corsika/framework/core/ParticleProperties.hpp> #include <corsika/framework/random/RNGManager.hpp> -#include <corsika/framework/core/PhysicalUnits.hpp> +#include <corsika/media/NuclearComposition.hpp> #include <corsika/setup/SetupTrajectory.h> @@ -32,39 +32,30 @@ namespace corsika { NuclearComposition const fNuclComp; public: + HomogeneousMedium(corsika::units::si::MassDensityType pDensity, + NuclearComposition pNuclComp) + : fDensity(pDensity) + , fNuclComp(pNuclComp) {} - HomogeneousMedium(corsika::units::si::MassDensityType pDensity, NuclearComposition pNuclComp): - fDensity(pDensity), - fNuclComp(pNuclComp) - {} - - corsika::units::si::MassDensityType - GetMassDensity( corsika::Point const&) const override - { + corsika::units::si::MassDensityType GetMassDensity( + corsika::Point const&) const override { return fDensity; } - NuclearComposition const& - GetNuclearComposition() const override - { - return fNuclComp; - } + NuclearComposition const& GetNuclearComposition() const override { return fNuclComp; } - corsika::units::si::GrammageType - IntegratedGrammage( corsika::Trajectory<corsika::Line> const&, - corsika::units::si::LengthType pTo) const override - { + corsika::units::si::GrammageType IntegratedGrammage( + corsika::Trajectory<corsika::Line> const&, + corsika::units::si::LengthType pTo) const override { using namespace corsika::units::si; return pTo * fDensity; } - corsika::units::si::LengthType - ArclengthFromGrammage(corsika::Trajectory<corsika::Line> const&, - corsika::units::si::GrammageType pGrammage) const override - { + corsika::units::si::LengthType ArclengthFromGrammage( + corsika::Trajectory<corsika::Line> const&, + corsika::units::si::GrammageType pGrammage) const override { return pGrammage / fDensity; } }; -} // namespace corsika::environment - +} // namespace corsika diff --git a/corsika/media/IMediumModel.hpp b/corsika/media/IMediumModel.hpp index 1623ce225388179ee4b046c15a0d643f52aa15e7..e45928c98f716fbeb71eefe19b7c25676c103cec 100644 --- a/corsika/media/IMediumModel.hpp +++ b/corsika/media/IMediumModel.hpp @@ -8,22 +8,21 @@ #pragma once -#include <corsika/media/NuclearComposition.hpp> +#include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/geometry/Line.hpp> #include <corsika/framework/geometry/Point.hpp> #include <corsika/framework/geometry/Trajectory.hpp> -#include <corsika/framework/core/PhysicalUnits.hpp> +#include <corsika/media/NuclearComposition.hpp> namespace corsika { - class IMediumModel - { + class IMediumModel { public: virtual ~IMediumModel() = default; // LCOV_EXCL_LINE - virtual corsika::units::si::MassDensityType - GetMassDensity( corsika::Point const&) const = 0; + virtual corsika::units::si::MassDensityType GetMassDensity( + corsika::Point const&) const = 0; // todo: think about the mixin inheritance of the trajectory vs the BaseTrajectory // approach; for now, only lines are supported @@ -33,10 +32,9 @@ namespace corsika { virtual corsika::units::si::LengthType ArclengthFromGrammage( corsika::Trajectory<corsika::Line> const&, - corsika::units::si::GrammageType ) const = 0; + corsika::units::si::GrammageType) const = 0; virtual NuclearComposition const& GetNuclearComposition() const = 0; }; -} // namespace corsika::environment - +} // namespace corsika diff --git a/corsika/media/InhomogeneousMedium.hpp b/corsika/media/InhomogeneousMedium.hpp index a85016848f75e0ea18059db6605c03a04a708ffc..f0c5aeb827cb0bf9f05a31fee76146d82bde9626 100644 --- a/corsika/media/InhomogeneousMedium.hpp +++ b/corsika/media/InhomogeneousMedium.hpp @@ -8,65 +8,53 @@ #pragma once -#include <corsika/media/NuclearComposition.hpp> +#include <corsika/framework/core/ParticleProperties.hpp> +#include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/geometry/Line.hpp> #include <corsika/framework/geometry/Point.hpp> #include <corsika/framework/geometry/Trajectory.hpp> -#include <corsika/framework/core/ParticleProperties.hpp> #include <corsika/framework/random/RNGManager.hpp> -#include <corsika/framework/core/PhysicalUnits.hpp> +#include <corsika/media/NuclearComposition.hpp> /** * A general inhomogeneous medium. The mass density distribution TDensityFunction must be * a \f$C^2\f$-function. */ -namespace corsika -{ +namespace corsika { template <class T, class TDensityFunction> - class InhomogeneousMedium : public T - { + class InhomogeneousMedium : public T { NuclearComposition const fNuclComp; TDensityFunction const fDensityFunction; public: - /* * FIXME: should have traits here for ...Args */ template <typename... Args> - InhomogeneousMedium(NuclearComposition pNuclComp, Args&&... rhoArgs): - fNuclComp(pNuclComp), - fDensityFunction(rhoArgs...) - {} + InhomogeneousMedium(NuclearComposition pNuclComp, Args&&... rhoArgs) + : fNuclComp(pNuclComp) + , fDensityFunction(rhoArgs...) {} - corsika::units::si::MassDensityType - GetMassDensity(corsika::Point const& p) const override - { + corsika::units::si::MassDensityType GetMassDensity( + corsika::Point const& p) const override { return fDensityFunction.EvaluateAt(p); } - NuclearComposition const& GetNuclearComposition() const override - { - return fNuclComp; - } + NuclearComposition const& GetNuclearComposition() const override { return fNuclComp; } - corsika::units::si::GrammageType - IntegratedGrammage( corsika::Trajectory<corsika::Line> const& pLine, - corsika::units::si::LengthType pTo) const override - { + corsika::units::si::GrammageType IntegratedGrammage( + corsika::Trajectory<corsika::Line> const& pLine, + corsika::units::si::LengthType pTo) const override { return fDensityFunction.IntegrateGrammage(pLine, pTo); } - corsika::units::si::LengthType - ArclengthFromGrammage( corsika::Trajectory<corsika::Line> const& pLine, - corsika::units::si::GrammageType pGrammage) const override - { + corsika::units::si::LengthType ArclengthFromGrammage( + corsika::Trajectory<corsika::Line> const& pLine, + corsika::units::si::GrammageType pGrammage) const override { return fDensityFunction.ArclengthFromGrammage(pLine, pGrammage); } - }; -} // namespace corsika::environment - +} // namespace corsika diff --git a/corsika/media/LayeredSphericalAtmosphereBuilder.hpp b/corsika/media/LayeredSphericalAtmosphereBuilder.hpp index 13d1ce86a7e32877984e2d50d4e7f74ddffc5b58..196e0ecaa24a69692a3e8801c1569e24e1c06b37 100644 --- a/corsika/media/LayeredSphericalAtmosphereBuilder.hpp +++ b/corsika/media/LayeredSphericalAtmosphereBuilder.hpp @@ -8,12 +8,12 @@ #pragma once +#include <corsika/framework/core/PhysicalUnits.hpp> +#include <corsika/framework/geometry/Point.hpp> #include <corsika/media/Environment.hpp> #include <corsika/media/IMediumModel.hpp> #include <corsika/media/NuclearComposition.hpp> #include <corsika/media/VolumeTreeNode.hpp> -#include <corsika/framework/geometry/Point.hpp> -#include <corsika/framework/core/PhysicalUnits.hpp> #include <functional> #include <memory> @@ -23,16 +23,14 @@ namespace corsika { - class LayeredSphericalAtmosphereBuilder - { + class LayeredSphericalAtmosphereBuilder { std::unique_ptr<NuclearComposition> composition_; Point center_; units::si::LengthType previousRadius_{units::si::LengthType::zero()}; units::si::LengthType earthRadius_; std::tuple<TModelArgs...> const additionalModelArgs_; - std::stack<VolumeTreeNode<IMediumModel>::VTNUPtr> - layers_; // innermost layer first + std::stack<VolumeTreeNode<IMediumModel>::VTNUPtr> layers_; // innermost layer first void checkRadius(units::si::LengthType r) const { if (r <= previousRadius_) { @@ -41,7 +39,6 @@ namespace corsika { } public: - static auto constexpr earthRadius = 6'371'000 * units::si::meter; LayeredSphericalAtmosphereBuilder(corsika::Point center, @@ -154,9 +151,8 @@ namespace corsika { void assemble(Environment<IMediumModel>&); Environment<IMediumModel> assemble(); - }; -} // namespace corsika::environment +} // namespace corsika #include <corsika/detail/media/LayeredSphericalAtmosphereBuilder.inl> diff --git a/corsika/media/LinearApproximationIntegrator.hpp b/corsika/media/LinearApproximationIntegrator.hpp index 37f52f358bf43eeb38b78a394319f79c9d9467ea..f550b846d86bd2d667b4fbf2ffc0a79ecc33f151 100644 --- a/corsika/media/LinearApproximationIntegrator.hpp +++ b/corsika/media/LinearApproximationIntegrator.hpp @@ -15,24 +15,22 @@ namespace corsika { - template <class TDerived> - class LinearApproximationIntegrator - { + template <class TDerived> + class LinearApproximationIntegrator { - auto const& GetImplementation() const; + auto const& GetImplementation() const; public: + inline auto IntegrateGrammage(corsika::Trajectory<corsika::Line> const& line, + corsika::units::si::LengthType length) const; - inline auto IntegrateGrammage( corsika::Trajectory<corsika::Line> const& line, - corsika::units::si::LengthType length) const; - - inline auto ArclengthFromGrammage( corsika::Trajectory<corsika::Line> const& line, - corsika::units::si::GrammageType grammage) const ; + inline auto ArclengthFromGrammage(corsika::Trajectory<corsika::Line> const& line, + corsika::units::si::GrammageType grammage) const; inline auto MaximumLength(corsika::Trajectory<corsika::Line> const& line, - [[maybe_unused]] double relError) const ; + [[maybe_unused]] double relError) const; }; -} // namespace corsika::environment +} // namespace corsika #include <corsika/detail/media/LinearApproximationIntegrator.inl> diff --git a/corsika/media/NameModel.hpp b/corsika/media/NameModel.hpp index 5f6b9b24ff2aeeab02756ac3dbd0a7be06a23ebf..5963ed937a093e6cfb049440af420dc0c81cff02 100644 --- a/corsika/media/NameModel.hpp +++ b/corsika/media/NameModel.hpp @@ -19,4 +19,4 @@ namespace corsika { virtual ~NameModel() = default; }; -} // namespace corsika::environment +} // namespace corsika diff --git a/corsika/media/NuclearComposition.hpp b/corsika/media/NuclearComposition.hpp index 42de98fc043b2327edce0c50f11e1efa92e2008e..654e8f13a97c7f4105609c778c3d73d7269862eb 100644 --- a/corsika/media/NuclearComposition.hpp +++ b/corsika/media/NuclearComposition.hpp @@ -20,126 +20,120 @@ namespace corsika { - namespace nuc_comp::detail { - template <class AConstIterator, class BConstIterator> - class WeightProviderIterator - { - AConstIterator fAIter; - BConstIterator fBIter; - - public: - using value_type = double; - using iterator_category = std::input_iterator_tag; - using pointer = value_type*; - using reference = value_type&; - using difference_type = ptrdiff_t; - - WeightProviderIterator(AConstIterator a, BConstIterator b) - : fAIter(a) - , fBIter(b) {} - - value_type operator*() const { return ((*fAIter) * (*fBIter)).magnitude(); } - - WeightProviderIterator& operator++() { // prefix ++ - ++fAIter; - ++fBIter; - return *this; - } - - auto operator==(WeightProviderIterator other) { return fAIter == other.fAIter; } - - auto operator!=(WeightProviderIterator other) { return !(*this == other); } - }; - - }// namespace nuc_comp::detail - - class NuclearComposition - { - std::vector<float> const fNumberFractions; //!< relative fractions of number density - std::vector<corsika::Code> const fComponents; //!< particle codes of consitutents - - double const fAvgMassNumber; - - /* - * FIXME: smelling here... nested class why? ...done - * FIXME: promote it to namespace detail ... done - */ - - - public: - - NuclearComposition(std::vector<corsika::Code> pComponents, std::vector<float> pFractions): - fNumberFractions(pFractions), - fComponents(pComponents), - fAvgMassNumber( std::inner_product( - pComponents.cbegin(), pComponents.cend(), pFractions.cbegin(), 0., - std::plus<double>(), [](auto const compID, auto const fraction) -> double { - if (IsNucleus(compID)) { - return GetNucleusA(compID) * fraction; - } else { - return GetMass(compID) / - units::si::ConvertSIToHEP(units::constants::u) * fraction; - } - })) - { - assert(pComponents.size() == pFractions.size()); - auto const sumFractions = - std::accumulate(pFractions.cbegin(), pFractions.cend(), 0.f); - - if (!(0.999f < sumFractions && sumFractions < 1.001f)) { - throw std::runtime_error("element fractions do not add up to 1"); - } - } - - template <typename TFunction> - auto WeightedSum(TFunction func) const { - using ResultQuantity = decltype(func(*fComponents.cbegin())); - - auto const prod = [&](auto const compID, auto const fraction) { - return func(compID) * fraction; - }; - - if constexpr (phys::units::is_quantity_v<ResultQuantity>) { - return std::inner_product( - fComponents.cbegin(), fComponents.cend(), fNumberFractions.cbegin(), - ResultQuantity::zero(), // .zero() is defined for quantity types only - std::plus<ResultQuantity>(), prod); - } else { - return std::inner_product( - fComponents.cbegin(), fComponents.cend(), fNumberFractions.cbegin(), - ResultQuantity(0), // in other cases we have to use a bare 0 - std::plus<ResultQuantity>(), prod); - } - } - - auto size() const { return fNumberFractions.size(); } - - auto const& GetFractions() const { return fNumberFractions; } - auto const& GetComponents() const { return fComponents; } - auto const GetAverageMassNumber() const { return fAvgMassNumber; } - - template <class TRNG> - corsika::Code SampleTarget( - std::vector<corsika::units::si::CrossSectionType> const& sigma, - TRNG& randomStream) const { - using namespace corsika::units::si; - - assert(sigma.size() == fNumberFractions.size()); - - std::discrete_distribution channelDist( - nuc_comp::detail::WeightProviderIterator<decltype(fNumberFractions.begin()), - decltype(sigma.begin())>(fNumberFractions.begin(), - sigma.begin()), - nuc_comp::detail::WeightProviderIterator<decltype(fNumberFractions.begin()), - decltype(sigma.end())>(fNumberFractions.end(), - sigma.end())); - - auto const iChannel = channelDist(randomStream); - return fComponents[iChannel]; - } - }; - -} // namespace corsika::environment - + template <class AConstIterator, class BConstIterator> + class WeightProviderIterator { + AConstIterator fAIter; + BConstIterator fBIter; + + public: + using value_type = double; + using iterator_category = std::input_iterator_tag; + using pointer = value_type*; + using reference = value_type&; + using difference_type = ptrdiff_t; + + WeightProviderIterator(AConstIterator a, BConstIterator b) + : fAIter(a) + , fBIter(b) {} + + value_type operator*() const { return ((*fAIter) * (*fBIter)).magnitude(); } + + WeightProviderIterator& operator++() { // prefix ++ + ++fAIter; + ++fBIter; + return *this; + } + + auto operator==(WeightProviderIterator other) { return fAIter == other.fAIter; } + + auto operator!=(WeightProviderIterator other) { return !(*this == other); } + }; + + } // namespace nuc_comp::detail + + class NuclearComposition { + std::vector<float> const fNumberFractions; //!< relative fractions of number density + std::vector<corsika::Code> const fComponents; //!< particle codes of consitutents + + double const fAvgMassNumber; + + /* + * FIXME: smelling here... nested class why? ...done + * FIXME: promote it to namespace detail ... done + */ + + public: + NuclearComposition(std::vector<corsika::Code> pComponents, + std::vector<float> pFractions) + : fNumberFractions(pFractions) + , fComponents(pComponents) + , fAvgMassNumber(std::inner_product( + pComponents.cbegin(), pComponents.cend(), pFractions.cbegin(), 0., + std::plus<double>(), [](auto const compID, auto const fraction) -> double { + if (IsNucleus(compID)) { + return GetNucleusA(compID) * fraction; + } else { + return GetMass(compID) / + units::si::ConvertSIToHEP(units::constants::u) * fraction; + } + })) { + assert(pComponents.size() == pFractions.size()); + auto const sumFractions = + std::accumulate(pFractions.cbegin(), pFractions.cend(), 0.f); + + if (!(0.999f < sumFractions && sumFractions < 1.001f)) { + throw std::runtime_error("element fractions do not add up to 1"); + } + } + + template <typename TFunction> + auto WeightedSum(TFunction func) const { + using ResultQuantity = decltype(func(*fComponents.cbegin())); + + auto const prod = [&](auto const compID, auto const fraction) { + return func(compID) * fraction; + }; + + if constexpr (phys::units::is_quantity_v<ResultQuantity>) { + return std::inner_product( + fComponents.cbegin(), fComponents.cend(), fNumberFractions.cbegin(), + ResultQuantity::zero(), // .zero() is defined for quantity types only + std::plus<ResultQuantity>(), prod); + } else { + return std::inner_product( + fComponents.cbegin(), fComponents.cend(), fNumberFractions.cbegin(), + ResultQuantity(0), // in other cases we have to use a bare 0 + std::plus<ResultQuantity>(), prod); + } + } + + auto size() const { return fNumberFractions.size(); } + + auto const& GetFractions() const { return fNumberFractions; } + auto const& GetComponents() const { return fComponents; } + auto const GetAverageMassNumber() const { return fAvgMassNumber; } + + template <class TRNG> + corsika::Code SampleTarget( + std::vector<corsika::units::si::CrossSectionType> const& sigma, + TRNG& randomStream) const { + using namespace corsika::units::si; + + assert(sigma.size() == fNumberFractions.size()); + + std::discrete_distribution channelDist( + nuc_comp::detail::WeightProviderIterator<decltype(fNumberFractions.begin()), + decltype(sigma.begin())>( + fNumberFractions.begin(), sigma.begin()), + nuc_comp::detail::WeightProviderIterator<decltype(fNumberFractions.begin()), + decltype(sigma.end())>( + fNumberFractions.end(), sigma.end())); + + auto const iChannel = channelDist(randomStream); + return fComponents[iChannel]; + } + }; + +} // namespace corsika diff --git a/corsika/media/SlidingPlanarExponential.hpp b/corsika/media/SlidingPlanarExponential.hpp index 264fcf4d2d2cd840b50c6b0d55333bf9d01f755e..6cbab115714ff65c01fbaa63f768e018500d8705 100644 --- a/corsika/media/SlidingPlanarExponential.hpp +++ b/corsika/media/SlidingPlanarExponential.hpp @@ -8,55 +8,48 @@ #pragma once -#include <corsika/media/FlatExponential.hpp> -#include <corsika/media/NuclearComposition.hpp> +#include <corsika/framework/core/ParticleProperties.hpp> +#include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/geometry/Line.hpp> #include <corsika/framework/geometry/Point.hpp> #include <corsika/framework/geometry/Trajectory.hpp> -#include <corsika/framework/core/ParticleProperties.hpp> #include <corsika/framework/random/RNGManager.hpp> -#include <corsika/framework/core/PhysicalUnits.hpp> +#include <corsika/media/FlatExponential.hpp> +#include <corsika/media/NuclearComposition.hpp> namespace corsika { + template <class T> + class SlidingPlanarExponential : public BaseExponential<SlidingPlanarExponential<T>>, + public T { - template <class T> - class SlidingPlanarExponential : public BaseExponential<SlidingPlanarExponential<T>>, public T - { - - NuclearComposition const nuclComp_; - units::si::LengthType const referenceHeight_; - - using Base = BaseExponential<SlidingPlanarExponential<T>>; + NuclearComposition const nuclComp_; + units::si::LengthType const referenceHeight_; - public: + using Base = BaseExponential<SlidingPlanarExponential<T>>; - SlidingPlanarExponential(Point const& p0, - units::si::MassDensityType rho0, units::si::LengthType lambda, - NuclearComposition nuclComp, units::si::LengthType referenceHeight = units::si::LengthType::zero()): - Base(p0, rho0, lambda), - nuclComp_(nuclComp), - referenceHeight_(referenceHeight) - {} + public: + SlidingPlanarExponential( + Point const& p0, units::si::MassDensityType rho0, units::si::LengthType lambda, + NuclearComposition nuclComp, + units::si::LengthType referenceHeight = units::si::LengthType::zero()) + : Base(p0, rho0, lambda) + , nuclComp_(nuclComp) + , referenceHeight_(referenceHeight) {} - inline units::si::MassDensityType - GetMassDensity(Point const& p) const override ; + inline units::si::MassDensityType GetMassDensity(Point const& p) const override; - inline NuclearComposition const& - GetNuclearComposition() const override - { - return nuclComp_; - } + inline NuclearComposition const& GetNuclearComposition() const override { + return nuclComp_; + } - inline units::si::GrammageType - IntegratedGrammage( Trajectory<Line> const& line, - units::si::LengthType l) const override ; + inline units::si::GrammageType IntegratedGrammage( + Trajectory<Line> const& line, units::si::LengthType l) const override; - inline units::si::LengthType - ArclengthFromGrammage( Trajectory<Line> const& line, - units::si::GrammageType grammage) const override; - }; + inline units::si::LengthType ArclengthFromGrammage( + Trajectory<Line> const& line, units::si::GrammageType grammage) const override; + }; -} // namespace corsika::environment +} // namespace corsika #include <corsika/detail/media/SlidingPlanarExponential.inl> diff --git a/corsika/media/Universe.hpp b/corsika/media/Universe.hpp index fe61ba0feeb13530e5ccaca1b9666c36e8cc5103..112dfadc2aed02bf29bec1aa89c483a97cb839ba 100644 --- a/corsika/media/Universe.hpp +++ b/corsika/media/Universe.hpp @@ -15,12 +15,11 @@ namespace corsika { - struct Universe : public corsika::Sphere - { + struct Universe : public corsika::Sphere { inline Universe(corsika::CoordinateSystem const& pCS); inline bool Contains(corsika::Point const&) const override; }; -} +} // namespace corsika #include <corsika/detail/media/Universe.inl> diff --git a/corsika/media/VolumeTreeNode.hpp b/corsika/media/VolumeTreeNode.hpp index f280dba4077fea59d251b3a54aab6dfe5c782f85..a69cd6fb3a6475928c8ff4aeb656382d449e0312 100644 --- a/corsika/media/VolumeTreeNode.hpp +++ b/corsika/media/VolumeTreeNode.hpp @@ -8,8 +8,8 @@ #pragma once -#include <corsika/media/IMediumModel.hpp> #include <corsika/framework/geometry/Volume.hpp> +#include <corsika/media/IMediumModel.hpp> #include <memory> #include <vector> @@ -18,33 +18,29 @@ namespace corsika { class Empty {}; //<! intended for usage as default template argument template <typename TModelProperties = Empty> - class VolumeTreeNode - { + class VolumeTreeNode { public: - using IModelProperties = TModelProperties; using VTN_type = VolumeTreeNode<IModelProperties>; using VTNUPtr = std::unique_ptr<VolumeTreeNode<IModelProperties>>; using IMPSharedPtr = std::shared_ptr<IModelProperties>; using VolUPtr = std::unique_ptr<corsika::Volume>; - VolumeTreeNode(VolUPtr pVolume = nullptr): - fGeoVolume(std::move(pVolume)) - {} + VolumeTreeNode(VolUPtr pVolume = nullptr) + : fGeoVolume(std::move(pVolume)) {} //! convenience function equivalent to Volume::Contains inline bool Contains(corsika::Point const& p) const; - inline VolumeTreeNode<IModelProperties> const* - Excludes(corsika::Point const& p) const ; + inline VolumeTreeNode<IModelProperties> const* Excludes( + corsika::Point const& p) const; /** returns a pointer to the sub-VolumeTreeNode which is "responsible" for the given * \class Point \p p, or nullptr iff \p p is not contained in this volume. */ - inline VolumeTreeNode<IModelProperties> const* - GetContainingNode(corsika::Point const& p) const; - + inline VolumeTreeNode<IModelProperties> const* GetContainingNode( + corsika::Point const& p) const; /** * Traverses the VolumeTree pre- or post-order and calls the functor \p func for each @@ -52,11 +48,11 @@ namespace corsika { * func is ignored. */ template <typename TCallable, bool preorder = true> - inline void walk(TCallable func) ; + inline void walk(TCallable func); - inline void AddChild(VTNUPtr pChild) ; + inline void AddChild(VTNUPtr pChild); - inline void ExcludeOverlapWith(VTNUPtr const& pNode) ; + inline void ExcludeOverlapWith(VTNUPtr const& pNode); inline auto* GetParent() const { return fParentNode; }; @@ -83,7 +79,7 @@ namespace corsika { /* template <class MediumType, typename... Args> - static auto CreateMedium(Args&&... args) ; + static auto CreateMedium(Args&&... args); private: std::vector<VTNUPtr> fChildNodes; @@ -93,6 +89,6 @@ namespace corsika { IMPSharedPtr fModelProperties; }; -} // namespace corsika::environment +} // namespace corsika #include <corsika/detail/media/VolumeTreeNode.inl> diff --git a/corsika/modules/energy_loss/EnergyLoss.hpp b/corsika/modules/energy_loss/EnergyLoss.hpp index 126bbd47e99c2f29ad32717d05af3e9b46d2c3af..ea3682a8b452a1dde6a658384e384a3333249fc4 100644 --- a/corsika/modules/energy_loss/EnergyLoss.hpp +++ b/corsika/modules/energy_loss/EnergyLoss.hpp @@ -10,10 +10,10 @@ #pragma once +#include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/geometry/Point.hpp> #include <corsika/framework/geometry/Vector.hpp> #include <corsika/framework/sequence/ContinuousProcess.hpp> -#include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/setup/SetupStack.hpp> #include <corsika/setup/SetupTrajectory.hpp> @@ -73,7 +73,7 @@ namespace corsika::energy_loss { using namespace units::si; return 0.0001_g / square(1_cm); }); - + } // namespace corsika::energy_loss #include <corsika/detail/modules/energy_loss/EnergyLoss.inl> diff --git a/corsika/modules/null_model/NullModel.hpp b/corsika/modules/null_model/NullModel.hpp index dd754b734a099008ae227d3f77d432c28ffbe879..9a6fe250bc2015d6aaea940139103396f7b38146 100644 --- a/corsika/modules/null_model/NullModel.hpp +++ b/corsika/modules/null_model/NullModel.hpp @@ -10,8 +10,8 @@ #pragma once -#include <corsika/framework/sequence/BaseProcess.hpp> #include <corsika/framework/core/PhysicalUnits.hpp> +#include <corsika/framework/sequence/BaseProcess.hpp> namespace corsika::null_model { @@ -31,6 +31,6 @@ namespace corsika::null_model { corsika::units::si::LengthType MaxStepLength(Particle&, Track&) const; }; -} // namespace corsika::process::null_model +} // namespace corsika::null_model #include <corsika/detail/modules/null_model/NullModel.inl> diff --git a/corsika/modules/observation_plane/ObservationPlane.hpp b/corsika/modules/observation_plane/ObservationPlane.hpp index dc3410647ec1ca8f8605542a5d562c9760becf03..40bfd18966afd68fdc128fdab8672b5085525865 100644 --- a/corsika/modules/observation_plane/ObservationPlane.hpp +++ b/corsika/modules/observation_plane/ObservationPlane.hpp @@ -10,11 +10,11 @@ #pragma once +#include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/geometry/Plane.hpp> #include <corsika/framework/sequence/ContinuousProcess.hpp> #include <corsika/setup/SetupStack.hpp> #include <corsika/setup/SetupTrajectory.hpp> -#include <corsika/framework/core/PhysicalUnits.hpp> #include <fstream> @@ -44,6 +44,6 @@ namespace corsika::observation_plane { std::ofstream outputStream_; bool const deleteOnHit_; }; -} // namespace corsika::process::observation_plane +} // namespace corsika::observation_plane #include <corsika/detail/modules/observation_plane/ObservationPlane.inl> diff --git a/corsika/modules/pythia8/Decay.hpp b/corsika/modules/pythia8/Decay.hpp index d4b35c869be5865323ef784b88f99dfd582701fe..80e185dec31a2a2a05f78c3bf5b49b2ccca720b3 100644 --- a/corsika/modules/pythia8/Decay.hpp +++ b/corsika/modules/pythia8/Decay.hpp @@ -10,38 +10,37 @@ #pragma once -#include <corsika/framework/sequence/DecayProcess.hpp> #include <corsika/framework/core/ParticleProperties.hpp> +#include <corsika/framework/sequence/DecayProcess.hpp> #include <corsika/modules/pythia8/Pythia8.hpp> - namespace corsika::pythia8 { - typedef corsika::Vector<corsika::units::si::hepmomentum_d> MomentumVector; + typedef corsika::Vector<corsika::units::si::hepmomentum_d> MomentumVector; - class Decay : public corsika::DecayProcess<Decay> { - const std::vector<corsika::Code> fTrackedParticles; - int fCount = 0; + class Decay : public corsika::DecayProcess<Decay> { + const std::vector<corsika::Code> fTrackedParticles; + int fCount = 0; - public: - Decay(std::vector<corsika::Code>); - ~Decay(); - void Init(); + public: + Decay(std::vector<corsika::Code>); + ~Decay(); + void Init(); - void SetParticleListStable(const std::vector<corsika::Code>); - void SetUnstable(const corsika::Code); - void SetStable(const corsika::Code); + void SetParticleListStable(const std::vector<corsika::Code>); + void SetUnstable(const corsika::Code); + void SetStable(const corsika::Code); - template <typename TParticle> - corsika::units::si::TimeType GetLifetime(TParticle const&); + template <typename TParticle> + corsika::units::si::TimeType GetLifetime(TParticle const&); - template <typename TProjectile> - void DoDecay(TProjectile&); + template <typename TProjectile> + void DoDecay(TProjectile&); - private: - Pythia8::Pythia fPythia; - }; + private: + Pythia8::Pythia fPythia; + }; } // namespace corsika::pythia8 diff --git a/corsika/modules/pythia8/Interaction.hpp b/corsika/modules/pythia8/Interaction.hpp index ddc488d4a6d0e021daa0f3d0286d0f137bacf0d9..452ff29cc8226fda128692a3dad5abcea3a87d3f 100644 --- a/corsika/modules/pythia8/Interaction.hpp +++ b/corsika/modules/pythia8/Interaction.hpp @@ -10,11 +10,11 @@ #pragma once -#include <corsika/modules/pythia8/Pythia8.hpp> #include <corsika/framework/core/ParticleProperties.hpp> -#include <corsika/framework/sequence/InteractionProcess.hpp> -#include <corsika/framework/random/RNGManager.hpp> #include <corsika/framework/core/PhysicalUnits.hpp> +#include <corsika/framework/random/RNGManager.hpp> +#include <corsika/framework/sequence/InteractionProcess.hpp> +#include <corsika/modules/pythia8/Pythia8.hpp> #include <tuple> @@ -42,12 +42,10 @@ namespace corsika::pythia8 { } bool CanInteract(const corsika::Code); - void ConfigureLabFrameCollision(const corsika::Code, - const corsika::Code, + void ConfigureLabFrameCollision(const corsika::Code, const corsika::Code, const corsika::units::si::HEPEnergyType); std::tuple<corsika::units::si::CrossSectionType, corsika::units::si::CrossSectionType> - GetCrossSection(const corsika::Code BeamId, - const corsika::Code TargetId, + GetCrossSection(const corsika::Code BeamId, const corsika::Code TargetId, const corsika::units::si::HEPEnergyType CoMenergy); template <typename TParticle> @@ -62,8 +60,7 @@ namespace corsika::pythia8 { corsika::EProcessReturn DoInteraction(TProjectile&); private: - corsika::RNG& fRNG = - corsika::RNGManager::GetInstance().GetRandomStream("pythia"); + corsika::RNG& fRNG = corsika::RNGManager::GetInstance().GetRandomStream("pythia"); Pythia8::Pythia fPythia; Pythia8::SigmaTotal fSigma; const bool fInternalDecays = true; diff --git a/corsika/modules/pythia8/Random.hpp b/corsika/modules/pythia8/Random.hpp index b7294bcb4756cedcee6505a64b6b62206feaed44..7cb03e553d2a462455100d4087ca46b383d54f4c 100644 --- a/corsika/modules/pythia8/Random.hpp +++ b/corsika/modules/pythia8/Random.hpp @@ -16,16 +16,14 @@ namespace corsika::pythia8 { - class Random : public Pythia8::RndmEngine { - double flat(); + class Random : public Pythia8::RndmEngine { + double flat(); - private: - std::uniform_real_distribution<double> fDist; - corsika::RNG& fRNG = - corsika::RNGManager::GetInstance().GetRandomStream("pythia"); - }; + private: + std::uniform_real_distribution<double> fDist; + corsika::RNG& fRNG = corsika::RNGManager::GetInstance().GetRandomStream("pythia"); + }; } // namespace corsika::pythia8 - #include <corsika/detail/modules/pythia8/Random.inl> diff --git a/corsika/modules/sibyll/Decay.hpp b/corsika/modules/sibyll/Decay.hpp index 16e5d03363a1f939329302ce189e1637f429d897..a906d5027cf36b977985fc7a34eb0239550892a1 100644 --- a/corsika/modules/sibyll/Decay.hpp +++ b/corsika/modules/sibyll/Decay.hpp @@ -18,71 +18,68 @@ namespace corsika::sibyll { - class Decay : public corsika::DecayProcess<Decay> { - int fCount = 0; - bool handleAllDecays_ = true; + class Decay : public corsika::DecayProcess<Decay> { + int fCount = 0; + bool handleAllDecays_ = true; - public: - Decay(); - Decay(std::set< Code>); - ~Decay(); + public: + Decay(); + Decay(std::set<Code>); + ~Decay(); - void Init(); + void Init(); - void SetStable(const std::vector< Code>); - void SetUnstable(const std::vector< Code>); + void SetStable(const std::vector<Code>); + void SetUnstable(const std::vector<Code>); - void SetStable(const corsika::Code); - void SetUnstable(const corsika::Code); + void SetStable(const corsika::Code); + void SetUnstable(const corsika::Code); - // internally set all particles to decay/not to decay - void SetAllUnstable(); - void SetAllStable(); + // internally set all particles to decay/not to decay + void SetAllUnstable(); + void SetAllStable(); - // will this particle be stable in sibyll ? - bool IsStable(const corsika::Code); - // will this particle decay in sibyll ? - bool IsUnstable(const corsika::Code); - // set particle with input code to decay or not - void SetDecay(const Code, const bool); + // will this particle be stable in sibyll ? + bool IsStable(const corsika::Code); + // will this particle decay in sibyll ? + bool IsUnstable(const corsika::Code); + // set particle with input code to decay or not + void SetDecay(const Code, const bool); - - void PrintDecayConfig(const corsika::Code); - void PrintDecayConfig(); - void SetHadronsUnstable(); + void PrintDecayConfig(const corsika::Code); + void PrintDecayConfig(); + void SetHadronsUnstable(); - // is Sibyll::Decay set to handle the decay of this particle? - bool IsDecayHandled(const corsika::Code); + // is Sibyll::Decay set to handle the decay of this particle? + bool IsDecayHandled(const corsika::Code); - // is decay possible in principle? - bool CanHandleDecay(const corsika::Code); + // is decay possible in principle? + bool CanHandleDecay(const corsika::Code); - // set Sibyll::Decay to handle the decay of this particle! - void SetHandleDecay(const corsika::Code); - // set Sibyll::Decay to handle the decay of this list of particles! - void SetHandleDecay(const std::vector< Code>); - // set Sibyll::Decay to handle all particle decays - void SetHandleAllDecay(); + // set Sibyll::Decay to handle the decay of this particle! + void SetHandleDecay(const corsika::Code); + // set Sibyll::Decay to handle the decay of this list of particles! + void SetHandleDecay(const std::vector<Code>); + // set Sibyll::Decay to handle all particle decays + void SetHandleAllDecay(); - template <typename TParticle> - corsika::units::si::TimeType GetLifetime(TParticle const&) const; + template <typename TParticle> + corsika::units::si::TimeType GetLifetime(TParticle const&) const; - /** - In this function SIBYLL is called to produce to decay the input particle. - */ + /** + In this function SIBYLL is called to produce to decay the input particle. + */ - template <typename TSecondaryParticle> - void DoDecay(TSecondaryParticle&); + template <typename TSecondaryParticle> + void DoDecay(TSecondaryParticle&); - private: - // internal routines to set particles stable and unstable in the COMMON blocks in - // sibyll + private: + // internal routines to set particles stable and unstable in the COMMON blocks in + // sibyll - std::set< Code> handledDecays_; - }; + std::set<Code> handledDecays_; + }; } // namespace corsika::sibyll - #include <corsika/detail/modules/sibyll/Decay.inl> - diff --git a/corsika/modules/sibyll/Interaction.hpp b/corsika/modules/sibyll/Interaction.hpp index 981e4278c6a6998101362d70dcd304ab2334bc10..e60cb69e2b676b10a54bb18783bb38d86068bf2c 100644 --- a/corsika/modules/sibyll/Interaction.hpp +++ b/corsika/modules/sibyll/Interaction.hpp @@ -11,9 +11,9 @@ #include <corsika/modules/sibyll/Random.hpp> #include <corsika/framework/core/ParticleProperties.hpp> -#include <corsika/framework/sequence/InteractionProcess.hpp> -#include <corsika/framework/random/RNGManager.hpp> #include <corsika/framework/core/PhysicalUnits.hpp> +#include <corsika/framework/random/RNGManager.hpp> +#include <corsika/framework/sequence/InteractionProcess.hpp> #include <tuple> namespace corsika::sibyll { @@ -66,21 +66,16 @@ namespace corsika::sibyll { corsika::EProcessReturn DoInteraction(TProjectile&); private: - corsika::RNG& RNG_ = - corsika::RNGManager::GetInstance().GetRandomStream("s_rndm"); + corsika::RNG& RNG_ = corsika::RNGManager::GetInstance().GetRandomStream("s_rndm"); // FOR NOW keep trackedParticles private, could be configurable std::vector<corsika::Code> const trackedParticles_ = { - corsika::Code::PiPlus, corsika::Code::PiMinus, - corsika::Code::Pi0, corsika::Code::KMinus, - corsika::Code::KPlus, corsika::Code::K0Long, - corsika::Code::K0Short, corsika::Code::SigmaPlus, - corsika::Code::Sigma0, corsika::Code::Sigma0Bar, - corsika::Code::SigmaMinus, corsika::Code::Lambda0, - corsika::Code::Xi0, corsika::Code::XiMinus, - corsika::Code::OmegaMinus, corsika::Code::DPlus, - corsika::Code::DMinus, corsika::Code::D0, - corsika::Code::MuMinus, corsika::Code::MuPlus, - corsika::Code::D0Bar}; + corsika::Code::PiPlus, corsika::Code::PiMinus, corsika::Code::Pi0, + corsika::Code::KMinus, corsika::Code::KPlus, corsika::Code::K0Long, + corsika::Code::K0Short, corsika::Code::SigmaPlus, corsika::Code::Sigma0, + corsika::Code::Sigma0Bar, corsika::Code::SigmaMinus, corsika::Code::Lambda0, + corsika::Code::Xi0, corsika::Code::XiMinus, corsika::Code::OmegaMinus, + corsika::Code::DPlus, corsika::Code::DMinus, corsika::Code::D0, + corsika::Code::MuMinus, corsika::Code::MuPlus, corsika::Code::D0Bar}; const bool internalDecays_ = true; const corsika::units::si::HEPEnergyType minEnergyCoM_ = 10. * 1e9 * corsika::units::si::electronvolt; diff --git a/corsika/modules/sibyll/NuclearInteraction.hpp b/corsika/modules/sibyll/NuclearInteraction.hpp index 5ec3f1866c8a16e6a8edfb3f50acab921bb885c6..583bc89a9ed6898b330f0695cca8d69164e794ab 100644 --- a/corsika/modules/sibyll/NuclearInteraction.hpp +++ b/corsika/modules/sibyll/NuclearInteraction.hpp @@ -9,8 +9,8 @@ #pragma once #include <corsika/framework/core/ParticleProperties.hpp> -#include <corsika/framework/sequence/InteractionProcess.hpp> #include <corsika/framework/random/RNGManager.hpp> +#include <corsika/framework/sequence/InteractionProcess.hpp> namespace corsika::sibyll { @@ -32,7 +32,7 @@ namespace corsika::sibyll { ~NuclearInteraction(); void Init(); - + void InitializeNuclearCrossSections(); void PrintCrossSectionTable(corsika::Code); corsika::units::si::CrossSectionType ReadCrossSectionTable( @@ -61,8 +61,7 @@ namespace corsika::sibyll { TEnvironment const& environment_; corsika::sibyll::Interaction& hadronicInteraction_; std::map<corsika::Code, int> targetComponentsIndex_; - corsika::RNG& RNG_ = - corsika::RNGManager::GetInstance().GetRandomStream("s_rndm"); + corsika::RNG& RNG_ = corsika::RNGManager::GetInstance().GetRandomStream("s_rndm"); static constexpr unsigned int gNSample_ = 500; // number of samples in MC estimation of cross section static constexpr unsigned int gMaxNucleusAProjectile_ = 56; @@ -78,5 +77,4 @@ namespace corsika::sibyll { } // namespace corsika::sibyll - #include <corsika/detail/modules/sibyll/NuclearInteraction.inl> diff --git a/corsika/modules/sibyll/ParticleConversion.hpp b/corsika/modules/sibyll/ParticleConversion.hpp index 52bcb30942d5f687713e7f1eb1c9d720b2082889..fc27b648ae3f3335d40fa6d37921d52f0289f987 100644 --- a/corsika/modules/sibyll/ParticleConversion.hpp +++ b/corsika/modules/sibyll/ParticleConversion.hpp @@ -57,14 +57,10 @@ namespace corsika::sibyll { corsika2sibyllXStype[static_cast<corsika::CodeIntType>(pCode)]); } - bool constexpr CanInteract(corsika::Code pCode) { - return GetSibyllXSCode(pCode) > 0; - } + bool constexpr CanInteract(corsika::Code pCode) { return GetSibyllXSCode(pCode) > 0; } corsika::units::si::HEPMassType GetSibyllMass(corsika::Code const); } // namespace corsika::sibyll - - #include <corsika/detail/modules/sibyll/ParticleConversion.inl> diff --git a/corsika/modules/sibyll/Random.hpp b/corsika/modules/sibyll/Random.hpp index 1a53d7c109010974baa4d13abf343b6f729da1e7..cfa3b071e8c39061cc3c47ee1fbd66f8e12471e9 100644 --- a/corsika/modules/sibyll/Random.hpp +++ b/corsika/modules/sibyll/Random.hpp @@ -15,9 +15,9 @@ namespace sibyll { double rndm_interface() { static corsika::RNG& rng = - corsika::RNGManager::GetInstance().GetRandomStream("s_rndm"); + corsika::RNGManager::GetInstance().GetRandomStream("s_rndm"); std::uniform_real_distribution<double> dist; return dist(rng); } - -} + +} // namespace sibyll diff --git a/corsika/modules/sibyll/SibStack.hpp b/corsika/modules/sibyll/SibStack.hpp index d28fb66ab58e5078c3941409cdbdd826c51fea96..cbdf4fb8378ed6ccc09ac0b04a1723a534c5b157 100644 --- a/corsika/modules/sibyll/SibStack.hpp +++ b/corsika/modules/sibyll/SibStack.hpp @@ -8,11 +8,11 @@ #pragma once +#include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/geometry/RootCoordinateSystem.hpp> #include <corsika/framework/geometry/Vector.hpp> -#include <corsika/modules/sibyll/ParticleConversion.hpp> #include <corsika/framework/stack/Stack.hpp> -#include <corsika/framework/core/PhysicalUnits.hpp> +#include <corsika/modules/sibyll/ParticleConversion.hpp> #include <sibyll2.3d.hpp> @@ -131,8 +131,7 @@ namespace corsika::sibyll { void SetPID(const int v) { GetStackData().SetId(GetIndex(), v); } corsika::sibyll::SibyllCode GetPID() const { - return static_cast<corsika::sibyll::SibyllCode>( - GetStackData().GetId(GetIndex())); + return static_cast<corsika::sibyll::SibyllCode>(GetStackData().GetId(GetIndex())); } MomentumVector GetMomentum() const { return GetStackData().GetMomentum(GetIndex()); } diff --git a/corsika/modules/stack_inspector/StackInspector.hpp b/corsika/modules/stack_inspector/StackInspector.hpp index 91fd5271f0d189423297f0bd6eb3e830fd5c8bcc..b688da526a85c86e255844abd47eb193c7aa59b9 100644 --- a/corsika/modules/stack_inspector/StackInspector.hpp +++ b/corsika/modules/stack_inspector/StackInspector.hpp @@ -10,43 +10,43 @@ #pragma once +#include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/sequence/StackProcess.hpp> #include <corsika/setup/SetupTrajectory.hpp> -#include <corsika/framework/core/PhysicalUnits.hpp> #include <chrono> namespace corsika::stack_inspector { - template <typename TStack> - class StackInspector : public corsika::StackProcess<StackInspector<TStack>> { + template <typename TStack> + class StackInspector : public corsika::StackProcess<StackInspector<TStack>> { - typedef typename TStack::ParticleType Particle; + typedef typename TStack::ParticleType Particle; - using corsika::StackProcess<StackInspector<TStack>>::GetStep; + using corsika::StackProcess<StackInspector<TStack>>::GetStep; - public: - StackInspector(const int vNStep, const bool vReportStack, - const corsika::units::si::HEPEnergyType vE0); - ~StackInspector(); + public: + StackInspector(const int vNStep, const bool vReportStack, + const corsika::units::si::HEPEnergyType vE0); + ~StackInspector(); - void Init(); - EProcessReturn DoStack(const TStack&); + void Init(); + EProcessReturn DoStack(const TStack&); - /** - * To set a new E0, for example when a new shower event is started - */ - void SetE0(const corsika::units::si::HEPEnergyType vE0) { E0_ = vE0; } + /** + * To set a new E0, for example when a new shower event is started + */ + void SetE0(const corsika::units::si::HEPEnergyType vE0) { E0_ = vE0; } - private: - bool ReportStack_; - corsika::units::si::HEPEnergyType E0_; - const corsika::units::si::HEPEnergyType dE_threshold_ = std::invoke([]() { - using namespace units::si; - return 1_eV; - }); - decltype(std::chrono::system_clock::now()) StartTime_; - }; + private: + bool ReportStack_; + corsika::units::si::HEPEnergyType E0_; + const corsika::units::si::HEPEnergyType dE_threshold_ = std::invoke([]() { + using namespace units::si; + return 1_eV; + }); + decltype(std::chrono::system_clock::now()) StartTime_; + }; } // namespace corsika::stack_inspector diff --git a/corsika/modules/switch_process/SwitchProcess.hpp b/corsika/modules/switch_process/SwitchProcess.hpp index 3d083535342f86cf13ac1701e4f55a994d9b7767..13c2d4b35bb5237d97dc10a436e1202e262d34b4 100644 --- a/corsika/modules/switch_process/SwitchProcess.hpp +++ b/corsika/modules/switch_process/SwitchProcess.hpp @@ -10,10 +10,10 @@ #pragma once +#include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/sequence/InteractionProcess.hpp> #include <corsika/framework/sequence/ProcessSequence.hpp> #include <corsika/setup/SetupStack.hpp> -#include <corsika/framework/core/PhysicalUnits.hpp> namespace corsika::switch_process { @@ -103,4 +103,3 @@ namespace corsika::switch_process { } }; } // namespace corsika::switch_process - diff --git a/corsika/modules/urqmd/UrQMD.hpp b/corsika/modules/urqmd/UrQMD.hpp index 71abe44adfd72eafd26b28fbf60d683c9fe312fd..04c70b6c490508f97d97582a604d961d774f4242 100644 --- a/corsika/modules/urqmd/UrQMD.hpp +++ b/corsika/modules/urqmd/UrQMD.hpp @@ -11,10 +11,10 @@ #pragma once #include <corsika/framework/core/ParticleProperties.hpp> -#include <corsika/framework/sequence/InteractionProcess.hpp> +#include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/random/RNGManager.hpp> +#include <corsika/framework/sequence/InteractionProcess.hpp> #include <corsika/setup/SetupStack.hpp> -#include <corsika/framework/core/PhysicalUnits.hpp> #include <array> #include <utility> @@ -32,16 +32,14 @@ namespace corsika::urqmd { corsika::units::si::CrossSectionType GetCrossSection(TParticle const&, corsika::Code) const; - corsika::EProcessReturn DoInteraction( - corsika::setup::StackView::StackIterator&); + corsika::EProcessReturn DoInteraction(corsika::setup::StackView::StackIterator&); bool CanInteract(corsika::Code) const; private: static corsika::units::si::CrossSectionType GetCrossSection( corsika::Code, corsika::Code, corsika::units::si::HEPEnergyType, int); - corsika::RNG& fRNG = - corsika::RNGManager::GetInstance().GetRandomStream("UrQMD"); + corsika::RNG& fRNG = corsika::RNGManager::GetInstance().GetRandomStream("UrQMD"); std::uniform_int_distribution<int> fBooleanDist{0, 1}; }; diff --git a/corsika/setup/SetupEnvironment.hpp b/corsika/setup/SetupEnvironment.hpp index 37b9357b6465a8333e7a9a19a0c431747ae76a2f..4fc78db671e50530eb93bfa0fed55f3dc12f1300 100644 --- a/corsika/setup/SetupEnvironment.hpp +++ b/corsika/setup/SetupEnvironment.hpp @@ -15,5 +15,4 @@ namespace corsika::setup { using IEnvironmentModel = corsika::IMediumModel; using SetupEnvironment = corsika::Environment<IEnvironmentModel>; -} // namespace corsika - +} // namespace corsika::setup diff --git a/corsika/setup/SetupLogger.hpp b/corsika/setup/SetupLogger.hpp index 5bddc24d1d825c6a0d14eeda303cdcf04b017cbb..939c7d3596c4136257a4df27479943866b041ecb 100644 --- a/corsika/setup/SetupLogger.hpp +++ b/corsika/setup/SetupLogger.hpp @@ -11,4 +11,3 @@ #pragma once namespace corsika {} - diff --git a/corsika/setup/SetupStack.hpp b/corsika/setup/SetupStack.hpp index 1bcf0e730299895077b58facce8b5d0a734ca4af..b1ae3810381b86ab5fd96fa62b59ced5e295a3ca 100644 --- a/corsika/setup/SetupStack.hpp +++ b/corsika/setup/SetupStack.hpp @@ -15,8 +15,8 @@ #include <corsika/stack/NuclearStackExtension.hpp> // extension with geometry information for tracking -#include <corsika/media/Environment.hpp> #include <corsika/framework/stack/CombinedStack.hpp> +#include <corsika/media/Environment.hpp> #include <corsika/setup/SetupEnvironment.hpp> @@ -120,12 +120,12 @@ namespace corsika::setup { template <typename StackIter> using StackWithGeometryInterface = corsika::CombinedParticleInterface<ParticleDataStack::PIType, - SetupGeometryDataInterface, StackIter>; + SetupGeometryDataInterface, StackIter>; using StackWithGeometry = corsika::CombinedStack<typename ParticleDataStack::StackImpl, - GeometryData<setup::SetupEnvironment>, - StackWithGeometryInterface>; + GeometryData<setup::SetupEnvironment>, + StackWithGeometryInterface>; } // namespace detail @@ -186,9 +186,8 @@ namespace corsika::setup { actually needed. Keep an eye on this! */ #if defined(__clang__) - using StackView = - corsika::SecondaryView<typename corsika::Stack::StackImpl, - corsika::detail::StackWithGeometryInterface>; + using StackView = corsika::SecondaryView<typename corsika::Stack::StackImpl, + corsika::detail::StackWithGeometryInterface>; #elif defined(__GNUC__) || defined(__GNUG__) using StackView = corsika::MakeView<corsika::setup::Stack>::type; #endif @@ -201,5 +200,4 @@ namespace corsika::setup { using StackView = detail::TheStackView; -} // namespace corsika - +} // namespace corsika::setup diff --git a/corsika/setup/SetupTrajectory.hpp b/corsika/setup/SetupTrajectory.hpp index 5b84a140075503c2a068fafa46e3108213912c45..c3e839d01ed91c16c4c04a239f208dbaa8700d08 100644 --- a/corsika/setup/SetupTrajectory.hpp +++ b/corsika/setup/SetupTrajectory.hpp @@ -80,4 +80,3 @@ namespace corsika::setup { }; */ } // namespace corsika::setup - diff --git a/dependencies/sibyll/sibyll2.3d.cpp b/dependencies/sibyll/sibyll2.3d.cpp index 229ddad9c2341040966178a92e0a6f12888735d5..2b9eb6e9c17df3b05af4c41b4244df1073c3a304 100644 --- a/dependencies/sibyll/sibyll2.3d.cpp +++ b/dependencies/sibyll/sibyll2.3d.cpp @@ -13,7 +13,4 @@ int get_nwounded() { return s_chist_.nwd; } double get_sibyll_mass2(int& id) { return s_mass1_.am2[std::abs(id) - 1]; } -double s_rndm_(int&) { - return sibyll::rndm_interface(); -} - +double s_rndm_(int&) { return sibyll::rndm_interface(); } diff --git a/dependencies/sibyll/sibyll2.3d.hpp b/dependencies/sibyll/sibyll2.3d.hpp index 9d6b1942c97d39a6121f6c23e52335987d718332..3df0f7115d313cfaee9f8ef0aad91f88c5453536 100644 --- a/dependencies/sibyll/sibyll2.3d.hpp +++ b/dependencies/sibyll/sibyll2.3d.hpp @@ -28,14 +28,14 @@ extern "C" { typedef char s_name[6]; - /** - \struct s_plist_ - - SIBYLL particle stack (FORTRAN COMMON) - variables are: np : numer of particles on stack - p : 4momentum + mass of particles on stack - llist : id of particles on stack - **/ +/** + \struct s_plist_ + + SIBYLL particle stack (FORTRAN COMMON) + variables are: np : numer of particles on stack + p : 4momentum + mass of particles on stack + llist : id of particles on stack + **/ extern struct { double p[5][8000]; int llist[8000]; diff --git a/do-clang-format.py b/do-clang-format.py index e3406502846f41ffed9f73aba88e7d828851bb8a..c31f9dde45b87dd69d2303735d480415278f219c 100755 --- a/do-clang-format.py +++ b/do-clang-format.py @@ -20,15 +20,14 @@ args = parser.parse_args() filelist = [] if args.all: for dirpath, dirnames, filenames in os.walk("."): - doExclude = False - for exclude in ["ThirdParty", "PROPOSAL", "include", "build"]: - if exclude in dirpath: - doExclude = True - break - if doExclude: - continue + excl = False + excl_dirs = ["ThirdParty", "build", "externals"] + for excl_dir in excl_dirs: + if excl_dir in dirpath: + excl = True + if excl: continue for f in filenames: - if f.endswith(".h") or f.endswith(".cc") or f.endswith(".hpp") or f.endswith(".cpp") or f.endswith(".cxx"): + if f.endswith(".hpp") or f.endswith(".cpp"): filename = os.path.join(dirpath, f) if not os.path.islink(filename): filelist.append(filename) diff --git a/examples/boundary_example.cpp b/examples/boundary_example.cpp index 630d63f609b42ccebeab3f729a07897c4a62cc33..7c708abd244ed4a98cecc4bd5eae84f1defad18b 100644 --- a/examples/boundary_example.cpp +++ b/examples/boundary_example.cpp @@ -11,9 +11,9 @@ #include <corsika/framework/core/Cascade.hpp> #include <corsika/framework/core/PhysicalUnits.hpp> -#include <corsika/framework/sequence/ProcessSequence.hpp> -#include <corsika/framework/random/RNGManager.hpp> #include <corsika/framework/geometry/Sphere.hpp> +#include <corsika/framework/random/RNGManager.hpp> +#include <corsika/framework/sequence/ProcessSequence.hpp> #include <corsika/framework/utility/CorsikaFenv.hpp> #include <corsika/setup/SetupEnvironment.hpp> @@ -24,12 +24,12 @@ #include <corsika/media/HomogeneousMedium.hpp> #include <corsika/media/NuclearComposition.hpp> -#include <corsika/modules/tracking_line/TrackingLine.hpp> +#include <corsika/modules/particle_cut/ParticleCut.hpp> #include <corsika/modules/sibyll/Decay.hpp> #include <corsika/modules/sibyll/Interaction.hpp> #include <corsika/modules/sibyll/NuclearInteraction.hpp> #include <corsika/modules/track_writer/TrackWriter.hpp> -#include <corsika/modules/particle_cut/ParticleCut.hpp> +#include <corsika/modules/tracking_line/TrackingLine.hpp> #include <iostream> #include <limits> @@ -148,9 +148,8 @@ int main() { cout << "input momentum: " << plab.GetComponents() / 1_GeV << endl; Point pos(rootCS, 0_m, 0_m, 0_m); stack.AddParticle( - std::tuple<corsika::Code, units::si::HEPEnergyType, - corsika::MomentumVector, corsika::Point, units::si::TimeType>{ - beamCode, E0, plab, pos, 0_ns}); + std::tuple<corsika::Code, units::si::HEPEnergyType, corsika::MomentumVector, + corsika::Point, units::si::TimeType>{beamCode, E0, plab, pos, 0_ns}); } // define air shower object, run simulation diff --git a/examples/cascade_proton_example.cpp b/examples/cascade_proton_example.cpp index fc6c09c8f4fcad5ed5fee8524adc9c3a3403efd4..c325f2b4187da266f30cbb46ed1cc6798a16216d 100644 --- a/examples/cascade_proton_example.cpp +++ b/examples/cascade_proton_example.cpp @@ -17,14 +17,14 @@ #include <corsika/modules/energy_loss/EnergyLoss.hpp> #include <corsika/modules/particle_cut/ParticleCut.hpp> +#include <corsika/modules/pythia8/Decay.hpp> +#include <corsika/modules/pythia8/Interaction.hpp> #include <corsika/modules/sibyll/Decay.hpp> #include <corsika/modules/sibyll/Interaction.hpp> #include <corsika/modules/sibyll/NuclearInteraction.hpp> #include <corsika/modules/stack_inspector/StackInspector.hpp> #include <corsika/modules/track_writer/TrackWriter.hpp> #include <corsika/modules/tracking_line/TrackingLine.hpp> -#include <corsika/modules/pythia8/Interaction.hpp> -#include <corsika/modules/pythia8/Decay.hpp> #include <corsika/setup/SetupEnvironment.hpp> #include <corsika/setup/SetupStack.hpp> @@ -96,9 +96,8 @@ int main() { cout << "input momentum: " << plab.GetComponents() / 1_GeV << endl; Point pos(rootCS, 0_m, 0_m, 0_m); stack.AddParticle( - std::tuple<corsika::Code, units::si::HEPEnergyType, - corsika::MomentumVector, corsika::Point, units::si::TimeType>{ - beamCode, E0, plab, pos, 0_ns}); + std::tuple<corsika::Code, units::si::HEPEnergyType, corsika::MomentumVector, + corsika::Point, units::si::TimeType>{beamCode, E0, plab, pos, 0_ns}); } // setup processes, decays and interactions diff --git a/examples/geometry_example.cpp b/examples/geometry_example.cpp index 144a4fc7557dfdcd9b3efbf88c218f8654ccbbea..0c44131367a4350e1bb7f4977ab39ca1901a29b5 100644 --- a/examples/geometry_example.cpp +++ b/examples/geometry_example.cpp @@ -6,11 +6,11 @@ * the license. */ +#include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/geometry/Point.hpp> #include <corsika/framework/geometry/RootCoordinateSystem.hpp> #include <corsika/framework/geometry/Sphere.hpp> #include <corsika/framework/geometry/Vector.hpp> -#include <corsika/framework/core/PhysicalUnits.hpp> #include <cstdlib> #include <iostream> diff --git a/examples/helix_example.cpp b/examples/helix_example.cpp index 9498f5c40ae20c9e473a47eae79fc62501c43bb2..e79d9a205e5d0e004e3cc10d027a69df13b23f46 100644 --- a/examples/helix_example.cpp +++ b/examples/helix_example.cpp @@ -6,11 +6,11 @@ * the license. */ +#include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/geometry/Helix.hpp> #include <corsika/framework/geometry/Point.hpp> #include <corsika/framework/geometry/RootCoordinateSystem.hpp> #include <corsika/framework/geometry/Vector.hpp> -#include <corsika/framework/core/PhysicalUnits.hpp> #include <array> #include <cstdlib> diff --git a/examples/stack_example.cpp b/examples/stack_example.cpp index 45d0cb3842dae39ec1cb11b28bb439db9c2c49a8..6b32945c9a3a6833cac6ee2d6682b1eb3151a54a 100644 --- a/examples/stack_example.cpp +++ b/examples/stack_example.cpp @@ -25,8 +25,8 @@ void fill(corsika::super_stupid::SuperStupidStack& s) { corsika::RootCoordinateSystem::GetInstance().GetRootCoordinateSystem(); for (int i = 0; i < 11; ++i) { s.AddParticle( - std::tuple<corsika::Code, units::si::HEPEnergyType, - corsika::MomentumVector, corsika::Point, units::si::TimeType>{ + std::tuple<corsika::Code, units::si::HEPEnergyType, corsika::MomentumVector, + corsika::Point, units::si::TimeType>{ corsika::Code::Electron, 1.5_GeV * i, corsika::MomentumVector(rootCS, {0_GeV, 0_GeV, 1_GeV}), corsika::Point(rootCS, 0_m, 0_m, 0_m), 0_ns}); diff --git a/examples/stopping_power.cpp b/examples/stopping_power.cpp index 75f5665d6aa9a0e817f0337ab108521c9247e20d..746e98416522d9afe29bf92972da4b7167e3e951 100644 --- a/examples/stopping_power.cpp +++ b/examples/stopping_power.cpp @@ -10,8 +10,8 @@ #include <corsika/media/Environment.hpp> -#include <corsika/framework/geometry/Sphere.hpp> #include <corsika/framework/core/PhysicalUnits.hpp> +#include <corsika/framework/geometry/Sphere.hpp> #include <corsika/framework/utility/CorsikaFenv.hpp> #include <corsika/modules/energy_loss/EnergyLoss.hpp> @@ -74,9 +74,9 @@ int main() { cout << "input momentum: " << plab.GetComponents() / 1_GeV << endl; stack.AddParticle( - std::tuple<corsika::Code, units::si::HEPEnergyType, - corsika::MomentumVector, corsika::Point, units::si::TimeType>{ - beamCode, E0, plab, injectionPos, 0_ns}); + std::tuple<corsika::Code, units::si::HEPEnergyType, corsika::MomentumVector, + corsika::Point, units::si::TimeType>{beamCode, E0, plab, injectionPos, + 0_ns}); auto const p = stack.GetNextParticle(); HEPEnergyType dE = eLoss.TotalEnergyLoss(p, 1_g / square(1_cm)); diff --git a/examples/vertical_EAS.cpp b/examples/vertical_EAS.cpp index 948e47b6af5e54ae3d17929e74bc3ba6895c7c20..85b5c30dbf63d6f66e974c26c023e76562b7bb0d 100644 --- a/examples/vertical_EAS.cpp +++ b/examples/vertical_EAS.cpp @@ -109,9 +109,9 @@ int main() { std::cout << "input momentum: " << plab.GetComponents() / 1_GeV << std::endl; stack.AddParticle( - std::tuple<corsika::Code, units::si::HEPEnergyType, - corsika::MomentumVector, corsika::Point, units::si::TimeType>{ - beamCode, E0, plab, injectionPos, 0_ns}); + std::tuple<corsika::Code, units::si::HEPEnergyType, corsika::MomentumVector, + corsika::Point, units::si::TimeType>{beamCode, E0, plab, injectionPos, + 0_ns}); // } Line const line(injectionPos, plab.normalized() * 1_m * 1_Hz); @@ -158,9 +158,9 @@ int main() { const HEPEnergyType Efinal = cut.GetCutEnergy() + cut.GetInvEnergy() + cut.GetEmEnergy(); std::cout << "total cut energy (GeV): " << Efinal / 1_GeV << std::endl - << "relative difference (%): " << (Efinal / E0 - 1) * 100 << std::endl; + << "relative difference (%): " << (Efinal / E0 - 1) * 100 << std::endl; std::cout << "total dEdX energy (GeV): " << eLoss.GetTotal() / 1_GeV << std::endl - << "relative difference (%): " << eLoss.GetTotal() / E0 * 100 << std::endl; + << "relative difference (%): " << eLoss.GetTotal() / E0 * 100 << std::endl; std::ofstream finish("finished"); finish << "run completed without error" << std::endl; diff --git a/tests/framework/testCascade.hpp b/tests/framework/testCascade.hpp index 895a95820ea50a1d7def45465d1ecce9b7d5e99c..e44298adf37c9aaa416864f29fc6b73f5670ea1e 100644 --- a/tests/framework/testCascade.hpp +++ b/tests/framework/testCascade.hpp @@ -11,8 +11,7 @@ #include <corsika/media/Environment.hpp> #include <corsika/setup/SetupStack.hpp> -using TestEnvironmentType = - corsika::Environment<corsika::IMediumModel>; +using TestEnvironmentType = corsika::Environment<corsika::IMediumModel>; template <typename T> using SetupGeometryDataInterface = @@ -21,11 +20,11 @@ using SetupGeometryDataInterface = // combine particle data stack with geometry information for tracking template <typename StackIter> using StackWithGeometryInterface = - corsika::CombinedParticleInterface<corsika::setup::detail::ParticleDataStack::PIType, + corsika::CombinedParticleInterface<corsika::setup::detail::ParticleDataStack::PIType, SetupGeometryDataInterface, StackIter>; using TestCascadeStack = - corsika::CombinedStack<typename corsika::setup::detail::ParticleDataStack::StackImpl, + corsika::CombinedStack<typename corsika::setup::detail::ParticleDataStack::StackImpl, GeometryData<TestEnvironmentType>, StackWithGeometryInterface>; /* diff --git a/tests/modules/testNullModel.cpp b/tests/modules/testNullModel.cpp index 349f193470f7dd96286413afd14fe4354a91872e..b59cd90048f4085e39ca2536f1a434935ae5681b 100644 --- a/tests/modules/testNullModel.cpp +++ b/tests/modules/testNullModel.cpp @@ -30,26 +30,25 @@ TEST_CASE("NullModel", "[processes]") { auto const& dummyCS = corsika::RootCoordinateSystem::GetInstance().GetRootCoordinateSystem(); corsika::Point const origin(dummyCS, {0_m, 0_m, 0_m}); - corsika::Vector<SpeedType::dimension_type> v(dummyCS, 0_m / second, - 0_m / second, 1_m / second); + corsika::Vector<SpeedType::dimension_type> v(dummyCS, 0_m / second, 0_m / second, + 1_m / second); corsika::Line line(origin, v); corsika::Trajectory<corsika::Line> track(line, 10_s); setup::Stack stack; setup::Stack::ParticleType particle = stack.AddParticle( - std::tuple<Code, units::si::HEPEnergyType, - corsika::MomentumVector, corsika::Point, units::si::TimeType>{ + std::tuple<Code, units::si::HEPEnergyType, corsika::MomentumVector, corsika::Point, + units::si::TimeType>{ Code::Electron, 100_GeV, corsika::MomentumVector(dummyCS, {0_GeV, 0_GeV, -1_GeV}), corsika::Point(dummyCS, {0_m, 0_m, 10_km}), 0_ns}); - + SECTION("interface") { NullModel model(10_m); model.Init(); - [[maybe_unused]] const EProcessReturn ret = - model.DoContinuous(particle, track); + [[maybe_unused]] const EProcessReturn ret = model.DoContinuous(particle, track); LengthType const length = model.MaxStepLength(particle, track); CHECK((length / 10_m) == Approx(1)); diff --git a/tests/modules/testObservationPlane.cpp b/tests/modules/testObservationPlane.cpp index ba0733da78d7ae1c6042731b0b1c88746d71363e..f3f3d24b7337a5ce5f3591e6ef53116ffe4b0536 100644 --- a/tests/modules/testObservationPlane.cpp +++ b/tests/modules/testObservationPlane.cpp @@ -46,13 +46,12 @@ TEST_CASE("ContinuousProcess interface", "[proccesses][observation_plane]") { auto elab2plab = [](HEPEnergyType Elab, HEPMassType m) { return sqrt((Elab - m) * (Elab + m)); }; - stack.AddParticle( - std::tuple<Code, units::si::HEPEnergyType, corsika::MomentumVector, Point, - units::si::TimeType>{ - Code::NuMu, 1_GeV, - corsika::MomentumVector( - rootCS, {0_GeV, 0_GeV, -elab2plab(1_GeV, NuMu::GetMass())}), - Point(rootCS, {1_m, 1_m, 10_m}), 0_ns}); + stack.AddParticle(std::tuple<Code, units::si::HEPEnergyType, corsika::MomentumVector, + Point, units::si::TimeType>{ + Code::NuMu, 1_GeV, + corsika::MomentumVector(rootCS, + {0_GeV, 0_GeV, -elab2plab(1_GeV, NuMu::GetMass())}), + Point(rootCS, {1_m, 1_m, 10_m}), 0_ns}); } auto particle = stack.GetNextParticle(); diff --git a/tests/modules/testParticleCut.cpp b/tests/modules/testParticleCut.cpp index bc003a77988e37b29f0114aaac63f30f6908d5ce..b9e2cda7c88c50148d1681eb76613c5423e8ffeb 100644 --- a/tests/modules/testParticleCut.cpp +++ b/tests/modules/testParticleCut.cpp @@ -11,12 +11,12 @@ #include <corsika/modules/particle_cut/ParticleCut.hpp> -#include <corsika/media/Environment.hpp> +#include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/geometry/Point.hpp> #include <corsika/framework/geometry/RootCoordinateSystem.hpp> #include <corsika/framework/geometry/Vector.hpp> -#include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/utility/CorsikaFenv.hpp> +#include <corsika/media/Environment.hpp> #include <corsika/setup/SetupStack.hpp> @@ -51,8 +51,8 @@ TEST_CASE("ParticleCut", "[processes]") { // add primary particle to stack auto particle = stack.AddParticle( - std::tuple<corsika::Code, units::si::HEPEnergyType, - corsika::MomentumVector, corsika::Point, units::si::TimeType>{ + std::tuple<corsika::Code, units::si::HEPEnergyType, corsika::MomentumVector, + corsika::Point, units::si::TimeType>{ corsika::Code::Proton, Eabove, corsika::MomentumVector(rootCS, {0_GeV, 0_GeV, 0_GeV}), corsika::Point(rootCS, 0_m, 0_m, 0_m), 0_ns}); @@ -64,11 +64,11 @@ TEST_CASE("ParticleCut", "[processes]") { // add secondaries, all with energies above the threshold // only cut is by species for (auto proType : particleList) - projectile.AddSecondary(std::tuple<corsika::Code, units::si::HEPEnergyType, - corsika::MomentumVector, corsika::Point, - units::si::TimeType>{ - proType, Eabove, corsika::MomentumVector(rootCS, {0_GeV, 0_GeV, 0_GeV}), - corsika::Point(rootCS, 0_m, 0_m, 0_m), 0_ns}); + projectile.AddSecondary( + std::tuple<corsika::Code, units::si::HEPEnergyType, corsika::MomentumVector, + corsika::Point, units::si::TimeType>{ + proType, Eabove, corsika::MomentumVector(rootCS, {0_GeV, 0_GeV, 0_GeV}), + corsika::Point(rootCS, 0_m, 0_m, 0_m), 0_ns}); cut.DoSecondaries(view); @@ -80,8 +80,8 @@ TEST_CASE("ParticleCut", "[processes]") { // add primary particle to stack auto particle = stack.AddParticle( - std::tuple<corsika::Code, units::si::HEPEnergyType, - corsika::MomentumVector, corsika::Point, units::si::TimeType>{ + std::tuple<corsika::Code, units::si::HEPEnergyType, corsika::MomentumVector, + corsika::Point, units::si::TimeType>{ corsika::Code::Proton, Eabove, corsika::MomentumVector(rootCS, {0_GeV, 0_GeV, 0_GeV}), corsika::Point(rootCS, 0_m, 0_m, 0_m), 0_ns}); @@ -93,11 +93,11 @@ TEST_CASE("ParticleCut", "[processes]") { // add secondaries, all with energies below the threshold // only cut is by species for (auto proType : particleList) - projectile.AddSecondary(std::tuple<corsika::Code, units::si::HEPEnergyType, - corsika::MomentumVector, corsika::Point, - units::si::TimeType>{ - proType, Ebelow, corsika::MomentumVector(rootCS, {0_GeV, 0_GeV, 0_GeV}), - corsika::Point(rootCS, 0_m, 0_m, 0_m), 0_ns}); + projectile.AddSecondary( + std::tuple<corsika::Code, units::si::HEPEnergyType, corsika::MomentumVector, + corsika::Point, units::si::TimeType>{ + proType, Ebelow, corsika::MomentumVector(rootCS, {0_GeV, 0_GeV, 0_GeV}), + corsika::Point(rootCS, 0_m, 0_m, 0_m), 0_ns}); cut.DoSecondaries(view); diff --git a/tests/modules/testStackInspector.cpp b/tests/modules/testStackInspector.cpp index 640992f9f5a98522d6548f15f88a2e08b01daf37..a2353092d9bc48b66839926b19dba5410964745e 100644 --- a/tests/modules/testStackInspector.cpp +++ b/tests/modules/testStackInspector.cpp @@ -26,23 +26,20 @@ using namespace corsika; TEST_CASE("StackInspector", "[processes]") { - auto const& rootCS = - RootCoordinateSystem::GetInstance().GetRootCoordinateSystem(); + auto const& rootCS = RootCoordinateSystem::GetInstance().GetRootCoordinateSystem(); Point const origin(rootCS, {0_m, 0_m, 0_m}); - Vector<units::si::SpeedType::dimension_type> v(rootCS, 0_m / second, - 0_m / second, 1_m / second); + Vector<units::si::SpeedType::dimension_type> v(rootCS, 0_m / second, 0_m / second, + 1_m / second); Line line(origin, v); Trajectory<Line> track(line, 10_s); TestCascadeStack stack; stack.Clear(); HEPEnergyType E0 = 100_GeV; - stack.AddParticle( - std::tuple<corsika::Code, units::si::HEPEnergyType, - corsika::MomentumVector, Point, units::si::TimeType>{ - Code::Electron, E0, - corsika::MomentumVector(rootCS, {0_GeV, 0_GeV, -1_GeV}), - Point(rootCS, {0_m, 0_m, 10_km}), 0_ns}); + stack.AddParticle(std::tuple<corsika::Code, units::si::HEPEnergyType, + corsika::MomentumVector, Point, units::si::TimeType>{ + Code::Electron, E0, corsika::MomentumVector(rootCS, {0_GeV, 0_GeV, -1_GeV}), + Point(rootCS, {0_m, 0_m, 10_km}), 0_ns}); SECTION("interface") { diff --git a/tests/modules/testSwitchProcess.cpp b/tests/modules/testSwitchProcess.cpp index 0502bd3b9831993f6b2f3887665ff256837d1a3e..362abbc115199782ed1a8da6ef3e9a41e6c20a08 100644 --- a/tests/modules/testSwitchProcess.cpp +++ b/tests/modules/testSwitchProcess.cpp @@ -8,10 +8,10 @@ * the license. */ -#include <corsika/modules/switch_process/SwitchProcess.hpp> +#include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/stack/SecondaryView.hpp> #include <corsika/framework/stack/Stack.hpp> -#include <corsika/framework/core/PhysicalUnits.hpp> +#include <corsika/modules/switch_process/SwitchProcess.hpp> #include <catch2/catch.hpp> @@ -59,8 +59,7 @@ private: * */ template <typename StackIteratorInterface> -class TestParticleInterface - : public corsika::ParticleBase<StackIteratorInterface> { +class TestParticleInterface : public corsika::ParticleBase<StackIteratorInterface> { public: using corsika::ParticleBase<StackIteratorInterface>::GetStackData; diff --git a/tests/modules/testTrackingLine.cpp b/tests/modules/testTrackingLine.cpp index 1d6c8b8a20d89dc4969f77a288e8515e4141b1c8..0885e9fac1a6f28bcc177a6118f424443f8ef268 100644 --- a/tests/modules/testTrackingLine.cpp +++ b/tests/modules/testTrackingLine.cpp @@ -12,8 +12,8 @@ #include <testTrackingLineStack.hpp> // test-build, and include file is obtained from CMAKE_CURRENT_SOURCE_DIR -#include <corsika/media/Environment.hpp> #include <corsika/framework/core/ParticleProperties.hpp> +#include <corsika/media/Environment.hpp> #include <corsika/framework/geometry/Point.hpp> #include <corsika/framework/geometry/Sphere.hpp> @@ -72,13 +72,12 @@ TEST_CASE("TrackingLine") { TestTrackingLineStack stack; stack.AddParticle( - std::tuple<corsika::Code, units::si::HEPEnergyType, - corsika::MomentumVector, corsika::Point, units::si::TimeType>{ - corsika::Code::MuPlus, - 1_GeV, - {cs, {0_GeV, 0_GeV, 1_GeV}}, - {cs, {0_m, 0_m, 0_km}}, - 0_ns}); + std::tuple<corsika::Code, units::si::HEPEnergyType, corsika::MomentumVector, + corsika::Point, units::si::TimeType>{corsika::Code::MuPlus, + 1_GeV, + {cs, {0_GeV, 0_GeV, 1_GeV}}, + {cs, {0_m, 0_m, 0_km}}, + 0_ns}); auto p = stack.GetNextParticle(); p.SetNode(theMediumPtr); diff --git a/tests/modules/testTrackingLineStack.hpp b/tests/modules/testTrackingLineStack.hpp index 411178f5f670f08b3ad5020dbc60509a921dd01b..6e6ed16eb1668c773471ea3c4f999735fb7c938b 100644 --- a/tests/modules/testTrackingLineStack.hpp +++ b/tests/modules/testTrackingLineStack.hpp @@ -30,4 +30,3 @@ using StackWithGeometryInterface = using TestTrackingLineStack = corsika::CombinedStack<typename corsika::setup::detail::ParticleDataStack::StackImpl, GeometryData<TestEnvironmentType>, StackWithGeometryInterface>; - diff --git a/tests/stack/testNuclearStackExtension.cpp b/tests/stack/testNuclearStackExtension.cpp index 78ca286dc2bbebfdfcc175319c9dfb80154c586a..d38fa04f10c75eff12a052f67929cdffbc4bae1e 100644 --- a/tests/stack/testNuclearStackExtension.cpp +++ b/tests/stack/testNuclearStackExtension.cpp @@ -6,10 +6,10 @@ * the license. */ -#include <corsika/stack/NuclearStackExtension.hpp> -#include <corsika/stack/SuperStupidStack.hpp> #include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/geometry/RootCoordinateSystem.hpp> +#include <corsika/stack/NuclearStackExtension.hpp> +#include <corsika/stack/SuperStupidStack.hpp> using namespace corsika; using namespace corsika::nuclear_extension; diff --git a/tests/stack/testSuperStupidStack.cpp b/tests/stack/testSuperStupidStack.cpp index 8f6a1435b739a4d6483cb364d13eca17dbb234f7..6ff35b13814c51f76402ad597a8c59068a94ac4c 100644 --- a/tests/stack/testSuperStupidStack.cpp +++ b/tests/stack/testSuperStupidStack.cpp @@ -6,9 +6,9 @@ * the license. */ -#include <corsika/stack/SuperStupidStack.hpp> #include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/geometry/RootCoordinateSystem.hpp> +#include <corsika/stack/SuperStupidStack.hpp> using namespace corsika; using namespace corsika::units::si;