diff --git a/Documentation/Examples/geometry_example.cc b/Documentation/Examples/geometry_example.cc index a8ae9c51bbdfe0dfb1d398fd6c4d980e2e918603..9c459db161a116047b87e1ffd18e00c753fef374 100644 --- a/Documentation/Examples/geometry_example.cc +++ b/Documentation/Examples/geometry_example.cc @@ -1,62 +1,66 @@ -#include <fwk/Vector.h> -#include <fwk/Sphere.h> -#include <fwk/Point.h> -#include <fwk/CoordinateSystem.h> -#include <fwk/PhysicalUnits.h> +#include <corsika/geometry/CoordinateSystem.h> +#include <corsika/geometry/Point.h> +#include <corsika/geometry/Sphere.h> +#include <corsika/geometry/Vector.h> +#include <corsika/units/PhysicalUnits.h> +#include <cstdlib> #include <iostream> #include <typeinfo> -#include <cstdlib> -using namespace fwk; -using namespace fwk::literals; // support unit literals like 5_m; - -int main() -{ - // define the root coordinate system - CoordinateSystem root; - - // another CS defined by a translation relative to the root CS - CoordinateSystem cs2 = root.translate({0_m, 0_m, 1_m}); - - // rotations are possible, too; parameters are axis vector and angle - CoordinateSystem cs3 = root.rotate({1_m, 0_m, 0_m}, 90 * degree_angle); - - // now let's define some geometrical objects: - Point const p1(root, {0_m, 0_m, 0_m}); // the origin of the root CS - Point const p2(cs2, {0_m, 0_m, 0_m}); // the origin of cs2 - - Vector<fwk::length_d> const diff = p2 - p1; // the distance between the points, basically the translation vector given above - auto const norm = diff.squaredNorm(); // squared length with the right dimension - - // print the components of the vector as given in the different CS - std::cout << "p2-p1 components in root: " << diff.GetComponents(root) << std::endl; - std::cout << "p2-p1 components in cs2: " << diff.GetComponents(cs2) << std::endl; // by definition invariant under translations - std::cout << "p2-p1 components in cs3: " << diff.GetComponents(cs3) << std::endl; // but not under rotations - std::cout << "p2-p1 norm^2: " << norm << std::endl; - - Sphere s(p1, 10_m); // define a sphere around a point with a radius - std::cout << "p1 inside s: " << s.isInside(p2) << std::endl; - - Sphere s2(p1, 3_um); // another sphere - std::cout << "p1 inside s2: " << s2.isInside(p2) << std::endl; - - - // let's try parallel projections: - auto const v1 = Vector<fwk::length_d>(root, {1_m, 1_m, 0_m}); - auto const v2 = Vector<fwk::length_d>(root, {1_m, 0_m, 0_m}); - - auto const v3 = v1.parallelProjectionOnto(v2); - - // cross product - auto const cross = v1.cross(v2).normalized(); // normalized() returns dimensionless, normalized vectors - - // if a CS is not given as parameter for getComponents(), the components - // in the "home" CS are returned - std::cout << "v1: " << v1.GetComponents() << std::endl; - std::cout << "v2: " <<v2.GetComponents() << std::endl; - std::cout << "parallel projection of v1 onto v2: " << v3.GetComponents() << std::endl; - std::cout << "normalized cross product of v1 x v2" << cross.GetComponents() << std::endl; - - return EXIT_SUCCESS; +using namespace corsika::geometry; +using namespace corsika::units; + +int main() { + // define the root coordinate system + CoordinateSystem root; + + // another CS defined by a translation relative to the root CS + CoordinateSystem cs2 = root.translate({0_m, 0_m, 1_m}); + + // rotations are possible, too; parameters are axis vector and angle + CoordinateSystem cs3 = root.rotate({1_m, 0_m, 0_m}, 90 * degree_angle); + + // now let's define some geometrical objects: + Point const p1(root, {0_m, 0_m, 0_m}); // the origin of the root CS + Point const p2(cs2, {0_m, 0_m, 0_m}); // the origin of cs2 + + Vector<length_d> const diff = + p2 - + p1; // the distance between the points, basically the translation vector given above + auto const norm = diff.squaredNorm(); // squared length with the right dimension + + // print the components of the vector as given in the different CS + std::cout << "p2-p1 components in root: " << diff.GetComponents(root) << std::endl; + std::cout << "p2-p1 components in cs2: " << diff.GetComponents(cs2) + << std::endl; // by definition invariant under translations + std::cout << "p2-p1 components in cs3: " << diff.GetComponents(cs3) + << std::endl; // but not under rotations + std::cout << "p2-p1 norm^2: " << norm << std::endl; + + Sphere s(p1, 10_m); // define a sphere around a point with a radius + std::cout << "p1 inside s: " << s.isInside(p2) << std::endl; + + Sphere s2(p1, 3_um); // another sphere + std::cout << "p1 inside s2: " << s2.isInside(p2) << std::endl; + + // let's try parallel projections: + auto const v1 = Vector<length_d>(root, {1_m, 1_m, 0_m}); + auto const v2 = Vector<length_d>(root, {1_m, 0_m, 0_m}); + + auto const v3 = v1.parallelProjectionOnto(v2); + + // cross product + auto const cross = + v1.cross(v2).normalized(); // normalized() returns dimensionless, normalized vectors + + // if a CS is not given as parameter for getComponents(), the components + // in the "home" CS are returned + std::cout << "v1: " << v1.GetComponents() << std::endl; + std::cout << "v2: " << v2.GetComponents() << std::endl; + std::cout << "parallel projection of v1 onto v2: " << v3.GetComponents() << std::endl; + std::cout << "normalized cross product of v1 x v2" << cross.GetComponents() + << std::endl; + + return EXIT_SUCCESS; } diff --git a/Documentation/Examples/helix_example.cc b/Documentation/Examples/helix_example.cc index 4d6ccfe8c93612e8765d9caf4163f068afd11132..5caf35a43cf7d7a225161c02c4ecacf6a35475f5 100644 --- a/Documentation/Examples/helix_example.cc +++ b/Documentation/Examples/helix_example.cc @@ -1,25 +1,25 @@ -#include <fwk/CoordinateSystem.h> -#include <fwk/Helix.h> -#include <fwk/PhysicalUnits.h> -#include <fwk/Point.h> -#include <fwk/Vector.h> - +#include <corsika/geometry/CoordinateSystem.h> +#include <corsika/geometry/Helix.h> +#include <corsika/geometry/Point.h> +#include <corsika/geometry/Vector.h> +#include <corsika/units/PhysicalUnits.h> #include <array> #include <cstdlib> #include <iostream> -using namespace fwk; -using namespace fwk::literals; // support unit literals like 5_m; +using namespace corsika::geometry; +using namespace corsika::units; int main() { - fwk::CoordinateSystem root; - fwk::Point const r0(root, {0_m, 0_m, 0_m}); + CoordinateSystem root; + + Point const r0(root, {0_m, 0_m, 0_m}); auto const omegaC = 2 * M_PI * 1_Hz; - fwk::Vector<speed_d> vPar(root, {0_m / second, 0_m / second, 10_cm / second}); - fwk::Vector<speed_d> vPerp(root, {1_m / second, 0_m / second, 0_m / second}); + Vector<speed_d> vPar(root, {0_m / second, 0_m / second, 10_cm / second}); + Vector<speed_d> vPerp(root, {1_m / second, 0_m / second, 0_m / second}); - fwk::Helix h(r0, omegaC, vPar, vPerp); + Helix h(r0, omegaC, vPar, vPerp); auto constexpr t0 = 0_s; auto constexpr t1 = 1_s; diff --git a/Documentation/Examples/logger_example.cc b/Documentation/Examples/logger_example.cc index 219358ab25e12468d623d5407e30fcf01bf98fb0..fdb8e4a06e446413a908b37941e83c545d2df5b4 100644 --- a/Documentation/Examples/logger_example.cc +++ b/Documentation/Examples/logger_example.cc @@ -1,12 +1,12 @@ -#include <fwk/Logger.h> - +#include <corsika/logging/Logger.h> +#include <boost/format.hpp> #include <string> #include <iostream> #include <fstream> -#include <boost/format.hpp> using namespace std; +using namespace corsika::logging; int main() @@ -14,10 +14,10 @@ main() { cout << "writing to \"another.log\"" << endl; ofstream logfile("another.log"); - fwk::sink::SinkStream unbuffered_sink(logfile); - fwk::sink::BufferedSinkStream sink(logfile, fwk::sink::StdBuffer(10000)); - fwk::Logger<fwk::MessageOn, fwk::sink::BufferedSinkStream> info("\033[32m", "info", sink); - fwk::Logger<fwk::MessageOn, fwk::sink::BufferedSinkStream> err("\033[31m", "error", sink); + sink::SinkStream unbuffered_sink(logfile); + sink::BufferedSinkStream sink(logfile, sink::StdBuffer(10000)); + Logger<MessageOn, sink::BufferedSinkStream> info("\033[32m", "info", sink); + Logger<MessageOn, sink::BufferedSinkStream> err("\033[31m", "error", sink); //logger<ostream,messageconst,StdBuffer> info(std::cout, StdBuffer(10000)); /* @@ -33,8 +33,8 @@ main() } { - fwk::sink::NoSink off; - fwk::Logger<fwk::MessageOff> info("", "", off); + sink::NoSink off; + Logger<MessageOff> info("", "", off); for (int i=0; i<100000; ++i) { LOG(info, "irgendwas", string("and more"), boost::format("error: %i message: %s. done."), i, "stupido", "a-number:", 8.99, "ENDE" ); diff --git a/Documentation/Examples/stack_example.cc b/Documentation/Examples/stack_example.cc index a1f1c0e7c7ff7cc564d40c5a70c510bafa2bae0e..8f65dbe7e751ab144d45217c4277af38f16566f3 100644 --- a/Documentation/Examples/stack_example.cc +++ b/Documentation/Examples/stack_example.cc @@ -1,24 +1,27 @@ -#include <fwk/ParticleProperties.h> -#include <stack/super_stupid/SuperStupidStack.h> - +#include <corsika/stack/super_stupid/SuperStupidStack.h> +#include <corsika/particles/ParticleProperties.h> #include <iomanip> #include <iostream> using namespace std; -using namespace fwk::literals; -// using namespace fwk::io; +// using namespace corsika::literals; +// using namespace corsika::io; + +using namespace corsika::units; +using namespace corsika::stack; + -void fill(stack::super_stupid::SuperStupidStack& s) { +void fill(corsika::stack::super_stupid::SuperStupidStack& s) { for (int i = 0; i < 11; ++i) { auto p = s.NewParticle(); - p.SetId(fwk::particle::Code::Electron); + p.SetId(corsika::particles::Code::Electron); p.SetEnergy(1.5_GeV * i); } } -void read(stack::super_stupid::SuperStupidStack& s) { +void read(corsika::stack::super_stupid::SuperStupidStack& s) { cout << "found Stack with " << s.GetSize() << " particles. " << endl; - fwk::quantity<fwk::energy_d> Etot; + EnergyType Etot; for (auto p : s) { Etot += p.GetEnergy(); cout << "particle: " << p.GetId() << " with " << p.GetEnergy() / 1_GeV << " GeV" @@ -28,7 +31,7 @@ void read(stack::super_stupid::SuperStupidStack& s) { } int main() { - stack::super_stupid::SuperStupidStack s; + corsika::stack::super_stupid::SuperStupidStack s; fill(s); read(s); return 0; diff --git a/Documentation/Examples/staticsequence_example.cc b/Documentation/Examples/staticsequence_example.cc index c8bfe54d61d216baddb9a5ec9d2199cacae369f7..a28150c23d3057a7a10bc94fcb3aeb17d812dd70 100644 --- a/Documentation/Examples/staticsequence_example.cc +++ b/Documentation/Examples/staticsequence_example.cc @@ -1,99 +1,83 @@ -#include <iostream> -#include <iomanip> #include <array> +#include <iomanip> +#include <iostream> -#include <ProcessSequence/ProcessSequence.h> +#include <corsika/process/ProcessSequence.h> using namespace std; +using namespace corsika::process; - -class Process1 : public processes::Base <Process1> -{ +class Process1 : public corsika::process::BaseProcess<Process1> { public: Process1() {} - template<typename D> void DoContinuous(D& d) const { - for (int i=0; i<10; ++i) d.p[i] += 1; + template <typename D> + void DoContinuous(D& d) const { + for (int i = 0; i < 10; ++i) d.p[i] += 1; } }; -class Process2 : public processes::Base <Process2> -{ +class Process2 : public corsika::process::BaseProcess<Process2> { public: Process2() {} - - template<typename D> inline void DoContinuous(D& d) const { - //for (int i=0; i<10; ++i) d.p[i] *= 2; + + template <typename D> + inline void DoContinuous(D& d) const { + // for (int i=0; i<10; ++i) d.p[i] *= 2; } }; -class Process3 : public processes::Base <Process3> -{ +class Process3 : public BaseProcess<Process3> { public: - //Process3(const int v) :fV(v) {} + // Process3(const int v) :fV(v) {} Process3() {} - - template<typename D> inline void DoContinuous(D& d) const { - //for (int i=0; i<10; ++i) d.p[i] += fV; + + template <typename D> + inline void DoContinuous(D& d) const { + // for (int i=0; i<10; ++i) d.p[i] += fV; } - + private: - //int fV; + // int fV; }; -class Process4 : public processes::Base <Process4> -{ +class Process4 : public BaseProcess<Process4> { public: - //Process4(const int v) : fV(v) {} - Process4() {} - template<typename D> inline void DoContinuous(D& d) const { - //for (int i=0; i<10; ++i) d.p[i] /= fV; + // Process4(const int v) : fV(v) {} + Process4() {} + template <typename D> + inline void DoContinuous(D& d) const { + // for (int i=0; i<10; ++i) d.p[i] /= fV; } - + private: - //int fV; + // int fV; }; - class Data { public: std::array<double, 10> p{{0.}}; }; - - -void -modular() -{ +void modular() { Data d0; - + Process1 m1; Process2 m2; Process3 m3; Process4 m4; - - const auto sequence = m1 + m2 + m3 + m4; - + + const auto sequence = m1 + m2 + m3 + m4; + const int n = 100000000; - for (int i=0; i<n; ++i) { - sequence.DoContinuous(d0); - } - + for (int i = 0; i < n; ++i) { sequence.DoContinuous(d0); } + double s = 0; - for (int i=0; i<10; ++i) { - s += d0.p[i]; - } - + for (int i = 0; i < 10; ++i) { s += d0.p[i]; } + cout << scientific << " v=" << s << " n=" << n << endl; } - - - -int -main() -{ +int main() { modular(); return 0; } - - diff --git a/Framework/Geometry/BaseVector.h b/Framework/Geometry/BaseVector.h index 2ed634df665cc4e2a32d1b038c50867c8c398e48..f2079e91cc953b34499c2146da68c4cf88dfed8d 100644 --- a/Framework/Geometry/BaseVector.h +++ b/Framework/Geometry/BaseVector.h @@ -1,29 +1,27 @@ #ifndef _include_BASEVECTOR_H_ #define _include_BASEVECTOR_H_ -#include <fwk/QuantityVector.h> -#include <fwk/CoordinateSystem.h> +#include <corsika/geometry/CoordinateSystem.h> +#include <corsika/geometry/QuantityVector.h> -namespace fwk { +namespace corsika::geometry { -/*! - * Common base class for Vector and Point. Currently it does basically nothing. - */ + /*! + * Common base class for Vector and Point. Currently it does basically nothing. + */ -template <typename dim> -class BaseVector -{ -protected: + template <typename dim> + class BaseVector { + protected: QuantityVector<dim> qVector; CoordinateSystem const* cs; - -public: - BaseVector(CoordinateSystem const& pCS, QuantityVector<dim> pQVector) : - qVector(pQVector), cs(&pCS) - { - } -}; -} // end namesapce - + public: + BaseVector(CoordinateSystem const& pCS, QuantityVector<dim> pQVector) + : qVector(pQVector) + , cs(&pCS) {} + }; + +} // namespace corsika::geometry + #endif diff --git a/Framework/Geometry/CMakeLists.txt b/Framework/Geometry/CMakeLists.txt index 61abfdc6294c81d83dbd7fb42ad2c36fd9b37b08..c55295c897dcf0253293b3342d5042aa77cc8e26 100644 --- a/Framework/Geometry/CMakeLists.txt +++ b/Framework/Geometry/CMakeLists.txt @@ -17,7 +17,7 @@ set ( set ( GEOMETRY_NAMESPACE - fwk + corsika/geometry ) add_library (CORSIKAgeometry STATIC ${GEOMETRY_SOURCES}) diff --git a/Framework/Geometry/CoordinateSystem.cc b/Framework/Geometry/CoordinateSystem.cc index 2763ae2046d518c6c3e3a6ae0b4a2a6d595408ac..db0dea292aa5757f636c374da7d2c8155e34287f 100644 --- a/Framework/Geometry/CoordinateSystem.cc +++ b/Framework/Geometry/CoordinateSystem.cc @@ -1,6 +1,6 @@ -#include <fwk/CoordinateSystem.h> +#include <corsika/geometry/CoordinateSystem.h> -using namespace fwk; +using namespace corsika::geometry; EigenTransform CoordinateSystem::GetTransformation(CoordinateSystem const& c1, CoordinateSystem const& c2) { diff --git a/Framework/Geometry/CoordinateSystem.h b/Framework/Geometry/CoordinateSystem.h index 20348ffe73cbc320555ddf02c50b2e9099b30a31..695ae50232efbdfa63e15580941ae2315daf7513 100644 --- a/Framework/Geometry/CoordinateSystem.h +++ b/Framework/Geometry/CoordinateSystem.h @@ -1,16 +1,17 @@ #ifndef _include_COORDINATESYSTEM_H_ #define _include_COORDINATESYSTEM_H_ -#include <fwk/PhysicalUnits.h> -#include <fwk/QuantityVector.h> - +#include <corsika/geometry/QuantityVector.h> +#include <corsika/units/PhysicalUnits.h> #include <Eigen/Dense> typedef Eigen::Transform<double, 3, Eigen::Affine> EigenTransform; typedef Eigen::Translation<double, 3> EigenTranslation; -namespace fwk { +namespace corsika::geometry { + using corsika::units::length_d; + class CoordinateSystem { CoordinateSystem const* reference = nullptr; EigenTransform transf; @@ -33,7 +34,7 @@ namespace fwk { return *this; } - auto translate(QuantityVector<phys::units::length_d> vector) const { + auto translate(QuantityVector<length_d> vector) const { EigenTransform const translation{EigenTranslation(vector.eVector)}; return CoordinateSystem(*this, translation); @@ -58,6 +59,6 @@ namespace fwk { auto const& GetTransform() const { return transf; } }; -} // namespace fwk +} // namespace corsika #endif diff --git a/Framework/Geometry/Helix.h b/Framework/Geometry/Helix.h index 38ba50c5cb4aa2beac1f59b1daafd9d19d2317f1..fe123e26f0869b5c008db2a223c2486a193d944f 100644 --- a/Framework/Geometry/Helix.h +++ b/Framework/Geometry/Helix.h @@ -1,28 +1,32 @@ #ifndef _include_HELIX_H_ #define _include_HELIX_H_ -#include <fwk/Point.h> -#include <fwk/Vector.h> - -#include <fwk/PhysicalUnits.h> - +#include <corsika/geometry/Point.h> +#include <corsika/geometry/Vector.h> +#include <corsika/units/PhysicalUnits.h> #include <cmath> -namespace fwk { +namespace corsika::geometry { + using corsika::units::SpeedType; + using corsika::units::TimeType; + using corsika::units::FrequencyType; + using corsika::units::quantity; + using corsika::units::frequency_d; + class Helix // TODO: inherit from to-be-implemented "Trajectory" { - using SpeedVec = Vector<Speed::dimension_type>; + using SpeedVec = Vector<SpeedType::dimension_type>; Point const r0; - Frequency const omegaC; + FrequencyType const omegaC; SpeedVec const vPar; SpeedVec vPerp, uPerp; - Length const radius; + LengthType const radius; public: - Helix(Point const& pR0, phys::units::quantity<phys::units::frequency_d> pOmegaC, + Helix(Point const& pR0, quantity<frequency_d> pOmegaC, SpeedVec const& pvPar, SpeedVec const& pvPerp) : r0(pR0) , omegaC(pOmegaC) @@ -31,7 +35,7 @@ namespace fwk { , uPerp(vPerp.cross(vPar.normalized())) , radius(pvPar.norm() / abs(pOmegaC)) {} - auto GetPosition(Time t) const { + auto GetPosition(TimeType t) const { return r0 + vPar * t + (vPerp * (cos(omegaC * t) - 1) + uPerp * sin(omegaC * t)) / omegaC; } @@ -39,6 +43,6 @@ namespace fwk { auto GetRadius() const { return radius; } }; -} // namespace fwk +} // namespace corsika #endif diff --git a/Framework/Geometry/LineTrajectory.h b/Framework/Geometry/LineTrajectory.h index 3313eb8c9de494941693357aee08a468a71d5c8a..1e899269b71eeb180d10dd7bd4121a2de8a50fea 100644 --- a/Framework/Geometry/LineTrajectory.h +++ b/Framework/Geometry/LineTrajectory.h @@ -1,11 +1,11 @@ #ifndef _include_LINETRAJECTORY_H #define _include_LINETRAJECTORY_H -#include <fwk/Point.h> -#include <fwk/Vector.h> +#include <corsika/Point.h> +#include <corsika/Vector.h> #include <Units/PhysicalUnits.h> -namesapce fwk { +namesapce corsika { class LineTrajectory // TODO: inherit from Trajectory { diff --git a/Framework/Geometry/Point.h b/Framework/Geometry/Point.h index 47f5e954d0f50938148b1048063e4300ae594c29..8de3e1bd237b07c645670d11766354e979a0ce67 100644 --- a/Framework/Geometry/Point.h +++ b/Framework/Geometry/Point.h @@ -1,14 +1,16 @@ #ifndef _include_POINT_H_ #define _include_POINT_H_ -#include <fwk/BaseVector.h> -#include <fwk/QuantityVector.h> -#include <fwk/Vector.h> +#include <corsika/geometry/BaseVector.h> +#include <corsika/geometry/QuantityVector.h> +#include <corsika/geometry/Vector.h> +#include <corsika/units/PhysicalUnits.h> -#include <fwk/PhysicalUnits.h> - -namespace fwk { +namespace corsika::geometry { + using corsika::units::LengthType; + using corsika::units::length_d; + /*! * A Point represents a point in position space. It is defined by its * coordinates with respect to some CoordinateSystem. @@ -18,7 +20,7 @@ namespace fwk { Point(CoordinateSystem const& pCS, QuantityVector<phys::units::length_d> pQVector) : BaseVector<phys::units::length_d>(pCS, pQVector) {} - Point(CoordinateSystem const& cs, Length x, Length y, Length z) + Point(CoordinateSystem const& cs, LengthType x, LengthType y, LengthType z) : BaseVector<phys::units::length_d>(cs, {x, y, z}) {} auto GetCoordinates() const { return BaseVector<phys::units::length_d>::qVector; } @@ -58,6 +60,6 @@ namespace fwk { } }; -} // namespace fwk +} // namespace corsika #endif diff --git a/Framework/Geometry/QuantityVector.h b/Framework/Geometry/QuantityVector.h index 0694f0d196a2f47237b5a2de10532978178c3d11..c5af419ee4df97ec731a7fb0c95123fc2c843de5 100644 --- a/Framework/Geometry/QuantityVector.h +++ b/Framework/Geometry/QuantityVector.h @@ -1,14 +1,14 @@ #ifndef _include_QUANTITYVECTOR_H_ #define _include_QUANTITYVECTOR_H_ -#include <fwk/PhysicalUnits.h> +#include <corsika/units/PhysicalUnits.h> #include <Eigen/Dense> #include <iostream> #include <utility> -namespace fwk { +namespace corsika { /*! * A QuantityVector is a three-component container based on Eigen::Vector3d @@ -103,10 +103,10 @@ namespace fwk { auto normalized() const { return (*this) * (1 / norm()); } }; -} // end namespace fwk +} // end namespace corsika template <typename dim> -auto& operator<<(std::ostream& os, fwk::QuantityVector<dim> qv) { +auto& operator<<(std::ostream& os, corsika::QuantityVector<dim> qv) { using Quantity = phys::units::quantity<dim, double>; os << '(' << qv.eVector(0) << ' ' << qv.eVector(1) << ' ' << qv.eVector(2) << ") " diff --git a/Framework/Geometry/Sphere.h b/Framework/Geometry/Sphere.h index 39d3dcb426f3b28ce95f377a6cb99022c6314bb7..552dfde6f1341a7c0bbfb3903e27c8fbab5e1e05 100644 --- a/Framework/Geometry/Sphere.h +++ b/Framework/Geometry/Sphere.h @@ -1,17 +1,17 @@ #ifndef _include_SPHERE_H_ #define _include_SPHERE_H_ -#include <fwk/PhysicalUnits.h> -#include <fwk/Point.h> +#include <corsika/geometry/Point.h> +#include <corsika/units/PhysicalUnits.h> -namespace fwk { +namespace corsika::geometry { class Sphere { Point center; - Length const radius; + LengthType const radius; public: - Sphere(Point const& pCenter, Length const pRadius) + Sphere(Point const& pCenter, LengthType const pRadius) : center(pCenter) , radius(pRadius) {} @@ -20,6 +20,6 @@ namespace fwk { } }; -} // namespace fwk +} // namespace corsika::geometry #endif diff --git a/Framework/Geometry/Vector.h b/Framework/Geometry/Vector.h index f7191230ca844350c1ed46e142a1e94cbd2c7595..e8be6bea15b0ae60e5183e6a1d30a69bc65d44fa 100644 --- a/Framework/Geometry/Vector.h +++ b/Framework/Geometry/Vector.h @@ -1,10 +1,10 @@ #ifndef _include_VECTOR_H_ #define _include_VECTOR_H_ -#include <fwk/BaseVector.h> -#include <fwk/QuantityVector.h> +#include <corsika/geometry/BaseVector.h> +#include <corsika/geometry/QuantityVector.h> -#include <fwk/PhysicalUnits.h> +#include <corsika/units/PhysicalUnits.h> /*! * A Vector represents a 3-vector in Euclidean space. It is defined by components @@ -16,7 +16,7 @@ * part only and invariant under translations. */ -namespace fwk { +namespace corsika::geometry { template <typename dim> class Vector : public BaseVector<dim> { @@ -172,6 +172,6 @@ namespace fwk { } }; -} // namespace fwk +} // namespace corsika #endif diff --git a/Framework/Geometry/testGeometry.cc b/Framework/Geometry/testGeometry.cc index 7de635c6ce8d6597a7969718186c5bea93d7f5b0..a2f5181dc6f837b8608563541c3b6cca80b29248 100644 --- a/Framework/Geometry/testGeometry.cc +++ b/Framework/Geometry/testGeometry.cc @@ -2,7 +2,7 @@ // cpp file #include <catch2/catch.hpp> -#include <fwk/PhysicalUnits.h> +#include <corsika/units/PhysicalUnits.h> using namespace phys::units; using namespace phys::units::literals; diff --git a/Framework/Logging/BufferedSink.h b/Framework/Logging/BufferedSink.h index 86e7db4b32f02cc8f17b537aa19eda4ddeae2ae9..c082cad63f99b3c7947f015f34a2dcc6a89e4f5f 100644 --- a/Framework/Logging/BufferedSink.h +++ b/Framework/Logging/BufferedSink.h @@ -1,7 +1,7 @@ #ifndef _include_BufferedSink_h_ #define _include_BufferedSink_h_ -namespace fwk { +namespace corsika::logging { namespace sink { diff --git a/Framework/Logging/CMakeLists.txt b/Framework/Logging/CMakeLists.txt index 7486c499adc255b6d027d1752b8c53542e4efd6c..d7af35a8fb5f5fb7baa743262ed9491392cc7816 100644 --- a/Framework/Logging/CMakeLists.txt +++ b/Framework/Logging/CMakeLists.txt @@ -4,7 +4,7 @@ add_library (CORSIKAlogging INTERFACE) # namespace of library -> location of header files set ( CORSIKAlogging_NAMESPACE - fwk + corsika/logging ) # header files of this library diff --git a/Framework/Logging/Logger.h b/Framework/Logging/Logger.h index b01a617ace8b259a51c040ef7bf0e3e1c8d0dda6..351282b59cc0e8a5b2182a80ef237eef8e89e2c7 100644 --- a/Framework/Logging/Logger.h +++ b/Framework/Logging/Logger.h @@ -14,18 +14,18 @@ #include <boost/format.hpp> -#include <fwk/MessageOn.h> -#include <fwk/MessageOff.h> -#include <fwk/Sink.h> -#include <fwk/NoSink.h> -#include <fwk/BufferedSink.h> +#include <corsika/logging/MessageOn.h> +#include <corsika/logging/MessageOff.h> +#include <corsika/logging/Sink.h> +#include <corsika/logging/NoSink.h> +#include <corsika/logging/BufferedSink.h> using namespace std; using namespace boost; -namespace fwk { +namespace corsika::logging { /** diff --git a/Framework/Logging/MessageOff.h b/Framework/Logging/MessageOff.h index d54b675b684208dff030f20d06aa37336a731dd8..87b49ef5e825c94e547906e60f82fb1c437f8235 100644 --- a/Framework/Logging/MessageOff.h +++ b/Framework/Logging/MessageOff.h @@ -1,7 +1,7 @@ #ifndef _include_MessageOff_h_ #define _include_MessageOff_h_ -namespace fwk { +namespace corsika::logging { /** Helper class to ignore all arguments to MessagesOn::Message and diff --git a/Framework/Logging/MessageOn.h b/Framework/Logging/MessageOn.h index d53ec05c8682879de0f081ecf04d2a153453f350..bcab9845cfb4856622593576b789ea68a71051b3 100644 --- a/Framework/Logging/MessageOn.h +++ b/Framework/Logging/MessageOn.h @@ -2,7 +2,7 @@ #define _include_MessageOn_h_ -namespace fwk { +namespace corsika::logging { /** Helper class to convert all input arguments of MessageOn::Message diff --git a/Framework/Logging/NoSink.h b/Framework/Logging/NoSink.h index c5932499aa893042999da6d0961e0e7c6b4dc486..96cebd60936c2025f959c74843f23ade204cf7ee 100644 --- a/Framework/Logging/NoSink.h +++ b/Framework/Logging/NoSink.h @@ -1,7 +1,7 @@ #ifndef _include_NoSink_h_ #define _include_NoSink_h_ -namespace fwk { +namespace corsika::logging { namespace sink { diff --git a/Framework/Logging/Sink.h b/Framework/Logging/Sink.h index 7950f05b9ede6696929beff72149e459b4efd0c1..5b6c64b0add00b84d2c74912865df11e75452590 100644 --- a/Framework/Logging/Sink.h +++ b/Framework/Logging/Sink.h @@ -1,7 +1,7 @@ #ifndef _include_Sink_h_ #define _include_Sink_h_ -namespace fwk { +namespace corsika::logging { /** a sink for the logger must implement the two functions diff --git a/Framework/Logging/testLogging.cc b/Framework/Logging/testLogging.cc index f4113483629bf5660c45ca3624886b7964b099f2..d28c46de441f66801367ef39f1f103ac3997b057 100644 --- a/Framework/Logging/testLogging.cc +++ b/Framework/Logging/testLogging.cc @@ -1,19 +1,13 @@ -#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file +#include <corsika/logging/Logger.h> + +#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one + // cpp file #include <catch2/catch.hpp> -#include <fwk/Logger.h> +TEST_CASE("Logging", "[Logging]") { + SECTION("sectionOne") {} -TEST_CASE( "Logging", "[Logging]" ) -{ - SECTION( "sectionOne" ) - { - } - - SECTION( "sectionTwo" ) - { - } + SECTION("sectionTwo") {} - SECTION( "sectionThree" ) - { - } + SECTION("sectionThree") {} } diff --git a/Framework/Particles/CMakeLists.txt b/Framework/Particles/CMakeLists.txt index 7602fe9ff871ccae04dbe3a87f9fdb76561ff0a4..b7e2b58afca6ee46f33df5952bae4407e5243b88 100644 --- a/Framework/Particles/CMakeLists.txt +++ b/Framework/Particles/CMakeLists.txt @@ -22,7 +22,7 @@ set ( set ( PARTICLE_NAMESPACE - fwk + corsika/particles ) add_library (CORSIKAparticles INTERFACE) @@ -35,7 +35,7 @@ CORSIKA_COPY_HEADERS_TO_NAMESPACE (CORSIKAparticles ${PARTICLE_NAMESPACE} ${PART # this is not needed for the build to succeed! ....... add_custom_command ( OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/GeneratedParticleProperties.inc - COMMAND ${CMAKE_COMMAND} -E create_symlink ${PROJECT_BINARY_DIR}/include/fwk/GeneratedParticleProperties.inc ${CMAKE_CURRENT_SOURCE_DIR}/GeneratedParticleProperties.inc + COMMAND ${CMAKE_COMMAND} -E create_symlink ${PROJECT_BINARY_DIR}/include/corsika/GeneratedParticleProperties.inc ${CMAKE_CURRENT_SOURCE_DIR}/GeneratedParticleProperties.inc COMMENT "Generate link in source-dir: ${CMAKE_CURRENT_SOURCE_DIR}/GeneratedParticleProperties.inc" ) add_custom_target (SourceDirLink DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/GeneratedParticleProperties.inc) @@ -54,7 +54,7 @@ install ( FILES ${PARTICLE_HEADERS} DESTINATION - include/Particles + include/${PARTICLE_NAMESPACE} ) # -------------------- diff --git a/Framework/Particles/ParticleProperties.h b/Framework/Particles/ParticleProperties.h index c9acdb44cbac3f0457adeb8daf067d1f9defddb9..7df92b661d891cf252cbef52205e1818e71a834d 100644 --- a/Framework/Particles/ParticleProperties.h +++ b/Framework/Particles/ParticleProperties.h @@ -11,59 +11,50 @@ #include <cstdint> #include <iostream> -#include <fwk/GeneratedParticleProperties.inc> +#include <corsika/units/PhysicalUnits.h> +#include <corsika/particles/GeneratedParticleProperties.inc> -namespace fwk { +/** + * @namespace particle + * + * The properties of all elementary particles is stored here. The data + * is taken from the Pythia ParticleData.xml file. + * + */ + +namespace corsika::particles { /** - * @namespace particle - * - * The properties of all elementary particles is stored here. The data - * is taken from the Pythia ParticleData.xml file. + * @function GetMass * + * return mass of particle */ + auto constexpr GetMass(Code const p) { return masses[static_cast<uint8_t const>(p)]; } - namespace particle { + auto constexpr GetPDG(Code const p) { return pdg_codes[static_cast<uint8_t const>(p)]; } - /** - * @function GetMass - * - * return mass of particle - */ - auto constexpr GetMass(Code const p) { - return masses[static_cast<uint8_t const>(p)]; - } + auto constexpr GetElectricChargeNumber(Code const p) { + return electric_charge[static_cast<uint8_t const>(p)] / 3; + } - auto constexpr GetPDG(Code const p) { - return pdg_codes[static_cast<uint8_t const>(p)]; - } + auto constexpr GetElectricCharge(Code const p) { + return GetElectricChargeNumber(p) * (corsika::units::constants::e); + } - auto constexpr GetElectricChargeNumber(Code const p) { - return electric_charge[static_cast<uint8_t const>(p)] / 3; - } + auto const GetName(Code const p) { return names[static_cast<uint8_t const>(p)]; } - auto constexpr GetElectricCharge(Code const p) { - return GetElectricChargeNumber(p) * (fwk::constants::e); - } + namespace io { - auto const GetName(Code const p) { - return names[static_cast<uint8_t const>(p)]; + std::ostream& operator<<(std::ostream& stream, Code const p) { + stream << GetName(p); + return stream; } - namespace io { - - std::ostream& operator<<(std::ostream& stream, Code const p) { - stream << GetName(p); - return stream; - } - - } // namespace io - - } // namespace particle + } // namespace io -} // namespace fwk +} // namespace corsika::particles // to inject the operator<< into the root namespace -using namespace fwk::particle::io; +using namespace corsika::particles::io; #endif diff --git a/Framework/Particles/pdxml_reader.py b/Framework/Particles/pdxml_reader.py index 9a5e5220f621c21b324601f900e7144a584625c1..46958ea055785689515d4cb6aa6a127dbe125a7d 100755 --- a/Framework/Particles/pdxml_reader.py +++ b/Framework/Particles/pdxml_reader.py @@ -278,7 +278,7 @@ def gen_classes(pythia_db): string += " public:\n" string += " static Code GetCode() { return Type; }\n" string += " static quantity<energy_d> GetMass() { return masses[TypeIndex]; }\n" - string += " static quantity<electric_charge_d> GetCharge() { return fwk::constants::e*electric_charge[TypeIndex]/3; }\n" + string += " static quantity<electric_charge_d> GetCharge() { return corsika::units::constants::e*electric_charge[TypeIndex]/3; }\n" string += " static int GetChargeNumber() { return electric_charge[TypeIndex]/3; }\n" string += " static std::string GetName() { return names[TypeIndex]; }\n" string += " static Code GetAntiParticle() { return AntiType; }\n" @@ -299,13 +299,18 @@ def inc_start(): string = "" string += "#ifndef _include_GeneratedParticleDataTable_h_\n" string += "#define _include_GeneratedParticleDataTable_h_\n\n" - string += "#include <fwk/PhysicalUnits.h>\n" + string += "#include <corsika/units/PhysicalUnits.h>\n" + string += "#include <corsika/units/PhysicalConstants.h>\n" string += "#include <array>\n" string += "#include <cstdint>\n" # string += "#include <iostream>\n\n" - string += "namespace fwk { \n\n" - string += "using namespace literals; \n" - string += "namespace particle { \n\n" + string += "namespace corsika { \n\n" +# string += "using namespace literals; \n" + string += "namespace particles { \n\n" + string += "using corsika::units::energy_d;\n" + string += "using corsika::units::electric_charge_d;\n" + string += "using corsika::units::quantity;\n" + string += "using corsika::units::operator\"\"_GeV;\n" string += "typedef int16_t PDGCode;\n\n" return string diff --git a/Framework/Particles/testParticles.cc b/Framework/Particles/testParticles.cc index a48858b991f01e9623ee2884819c6706c98011af..616973145e7119fa48e08e71d85d25c13d0d809e 100644 --- a/Framework/Particles/testParticles.cc +++ b/Framework/Particles/testParticles.cc @@ -1,13 +1,13 @@ + +#include <corsika/units/PhysicalUnits.h> +#include <corsika/particles/ParticleProperties.h> + #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one // cpp file #include <catch2/catch.hpp> -#include <fwk/PhysicalUnits.h> - -#include <fwk/ParticleProperties.h> - -using namespace fwk::literals; -using namespace fwk::particle; +using namespace corsika::units; +using namespace corsika::particles; TEST_CASE("Particles", "[Particles]") { @@ -16,9 +16,9 @@ TEST_CASE("Particles", "[Particles]") { SECTION("Data") { REQUIRE(Electron::GetMass() / 0.511_MeV == Approx(1)); REQUIRE(Electron::GetMass() / GetMass(Code::Electron) == Approx(1)); - REQUIRE(Electron::GetCharge() / fwk::constants::e == Approx(-1)); - REQUIRE(Positron::GetCharge() / fwk::constants::e == Approx(+1)); - REQUIRE(GetElectricCharge(Positron::GetAntiParticle()) / fwk::constants::e == + REQUIRE(Electron::GetCharge() / constants::e == Approx(-1)); + REQUIRE(Positron::GetCharge() / constants::e == Approx(+1)); + REQUIRE(GetElectricCharge(Positron::GetAntiParticle()) / constants::e == Approx(-1)); REQUIRE(Electron::GetName() == "e-"); } diff --git a/Framework/ProcessSequence/CMakeLists.txt b/Framework/ProcessSequence/CMakeLists.txt index 966af83432bb3b662c9d83fae9be3111547b3382..dd84758450610555e4fc2fc0d62f701b5306df24 100644 --- a/Framework/ProcessSequence/CMakeLists.txt +++ b/Framework/ProcessSequence/CMakeLists.txt @@ -1,10 +1,51 @@ add_library (CORSIKAprocesssequence INTERFACE) -target_include_directories (CORSIKAprocesssequence INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/Framework> - $<INSTALL_INTERFACE:include/Framework> - ) +# namespace of library -> location of header files +set ( + CORSIKAprocesssequence_NAMESPACE + corsika/process + ) -install (FILES ProcessSequence.h - DESTINATION include/ProcessSequence) +# header files of this library +set ( + CORSIKAprocesssequence_HEADERS + ProcessSequence.h + ) +CORSIKA_COPY_HEADERS_TO_NAMESPACE (CORSIKAprocesssequence ${CORSIKAprocesssequence_NAMESPACE} ${CORSIKAprocesssequence_HEADERS}) + +# include directive for upstream code +target_include_directories ( + CORSIKAprocesssequence + INTERFACE + $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include> + $<INSTALL_INTERFACE:include/> + ) + +# install library +install ( + FILES ${CORSIKAprocesssequence_HEADERS} + DESTINATION include/${CORSIKAprocesssequence_NAMESPACE} + ) + +# ---------------- +# code unit testing +#add_executable ( +# testLogging +# testLogging.cc +# ) + +#target_link_libraries ( +# testLogging +# CORSIKAprocesssequence +# CORSIKAthirdparty # for catch2 +# ) + +#add_test ( +# NAME testLogging +# COMMAND testLogging +# ) + + + diff --git a/Framework/ProcessSequence/ProcessSequence.h b/Framework/ProcessSequence/ProcessSequence.h index 967f6f347aacfd6789465417fa995ba7687f4402..621b7bb04cf38b97f34e6bc32d1f61ae1cf9710b 100644 --- a/Framework/ProcessSequence/ProcessSequence.h +++ b/Framework/ProcessSequence/ProcessSequence.h @@ -3,26 +3,21 @@ #include <iostream> #include <typeinfo> -using namespace std; -namespace processes { +namespace corsika::process { /** - /class Base - + /class BaseProcess + The structural base type of a process object in a ProcessSequence. Both, the ProcessSequence and all its elements - are of type Base<T> + are of type BaseProcess<T> */ - + template <typename derived> - struct Base - { - const derived& GetRef() const - { - return static_cast<const derived&>(*this); - } + struct BaseProcess { + const derived& GetRef() const { return static_cast<const derived&>(*this); } }; /** @@ -30,55 +25,57 @@ namespace processes { A compile time static list of processes. The compiler will generate a new type based on template logic containing all the - elements. + elements. - \comment Using CRTP pattern, https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern + \comment Using CRTP pattern, + https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */ template <typename T1, typename T2> - class ProcessSequence : public Base <ProcessSequence<T1,T2> > - { + class ProcessSequence : public BaseProcess<ProcessSequence<T1, T2> > { public: const T1& A; const T2& B; - + ProcessSequence(const T1& in_A, const T2& in_B) - : A(in_A) - , B(in_B) - { } - - template<typename D> - inline void DoContinuous(D& d) const { A.DoContinuous(d); B.DoContinuous(d); } // add trajectory - - template<typename D> - inline double MinStepLength(D& d) const { return min(A.MinStepLength(d), B.MinStepLength(d)); } - - //template<typename D> - //inline Trajectory Transport(D& d, double& length) const { A.Transport(d, length); B.Transport(d, length); } - - template<typename D> - inline void DoDiscrete(D& d) const { A.DoDiscrete(d); B.DoDiscrete(d); } - + : A(in_A) + , B(in_B) {} + + template <typename D> + inline void DoContinuous(D& d) const { + A.DoContinuous(d); + B.DoContinuous(d); + } // add trajectory + + template <typename D> + inline double MinStepLength(D& d) const { + return min(A.MinStepLength(d), B.MinStepLength(d)); + } + + // template<typename D> + // inline Trajectory Transport(D& d, double& length) const { A.Transport(d, length); + // B.Transport(d, length); } + + template <typename D> + inline void DoDiscrete(D& d) const { + A.DoDiscrete(d); + B.DoDiscrete(d); + } }; - - template <typename T1, typename T2> - inline - const ProcessSequence<T1,T2> - operator+ (const Base<T1>& A, const Base<T2>& B) - { - return ProcessSequence<T1,T2>( A.GetRef(), B.GetRef() ); + inline const ProcessSequence<T1, T2> operator+(const BaseProcess<T1>& A, + const BaseProcess<T2>& B) { + return ProcessSequence<T1, T2>(A.GetRef(), B.GetRef()); } - - + /* template <typename T1> struct depth_lhs { static const int num = 0; }; - + // terminating condition @@ -89,29 +86,26 @@ namespace processes { static const int num = 1 + depth_lhs<T1>::num; }; */ - - - /* template <typename T1> struct mat_ptrs { static const int num = 0; - + inline static void get_ptrs(const Process** ptrs, const T1& X) { ptrs[0] = reinterpret_cast<const Process*>(&X); } }; - - + + template <typename T1, typename T2> struct mat_ptrs< Sequence<T1,T2> > { static const int num = 1 + mat_ptrs<T1>::num; - + inline static void get_ptrs(const Process** in_ptrs, const Sequence<T1,T2>& X) { @@ -122,7 +116,7 @@ namespace processes { } }; */ - + /* template<typename T1, typename T2> const Process& @@ -148,7 +142,6 @@ namespace processes { } */ -} // end namespace - -#endif +} // namespace corsika::process +#endif diff --git a/Framework/StackInterface/CMakeLists.txt b/Framework/StackInterface/CMakeLists.txt index 9c3ab779ae5b339725daf2e64bbfe4934bc4127e..45a3ebb4de10a1cb739932805c6f4db15153fc8c 100644 --- a/Framework/StackInterface/CMakeLists.txt +++ b/Framework/StackInterface/CMakeLists.txt @@ -6,7 +6,7 @@ set ( set ( CORSIKAstackinterface_NAMESPACE - fwk + corsika/stack ) add_library ( diff --git a/Framework/StackInterface/Stack.h b/Framework/StackInterface/Stack.h index 14627ba2f4a7e4ca7d929dd1be9c471d220c0be7..42187c1aeec22b455edc2194b311e05e01dd9d4e 100644 --- a/Framework/StackInterface/Stack.h +++ b/Framework/StackInterface/Stack.h @@ -1,13 +1,13 @@ #ifndef _include_Stack_h__ #define _include_Stack_h__ -#include <fwk/StackIterator.h> // to help application programmres +#include <corsika/stack/StackIterator.h> // include here, to help application programmres /** All classes around management of particles on a stack. */ -namespace stack { +namespace corsika::stack { /** Interface definition of a Stack object. The Stack implements the @@ -51,6 +51,6 @@ namespace stack { void DeleteLast() { DecrementSize(); } }; -} // namespace stack +} // namespace corsika::stack #endif diff --git a/Framework/StackInterface/StackIterator.h b/Framework/StackInterface/StackIterator.h index ae8b924c6396429c5bb8d9d3484bf7eae265a9fb..d7491867b9ef8b3f69c6fd2ebe463f778cc73726 100644 --- a/Framework/StackInterface/StackIterator.h +++ b/Framework/StackInterface/StackIterator.h @@ -4,7 +4,7 @@ #include <iomanip> #include <iostream> -namespace stack { +namespace corsika::stack { // forward decl. template <class Stack, class Particle> diff --git a/Framework/Units/CMakeLists.txt b/Framework/Units/CMakeLists.txt index d0818953175fa1edc576fccf1475a01c795c0ba9..7948859e264449cb29bda5c3b1f141a86dbd2d65 100644 --- a/Framework/Units/CMakeLists.txt +++ b/Framework/Units/CMakeLists.txt @@ -1,7 +1,7 @@ add_library (CORSIKAunits INTERFACE) -set (CORSIKAunits_NAMESPACE fwk) +set (CORSIKAunits_NAMESPACE corsika/units) set ( CORSIKAunits_HEADERS PhysicalUnits.h diff --git a/Framework/Units/PhysicalConstants.h b/Framework/Units/PhysicalConstants.h index a4e8b0ce6e644734a3dbeb627c568a458d6ffdfb..e8be8197745f6cfa183986d5a4906cbd4c9dc1c5 100644 --- a/Framework/Units/PhysicalConstants.h +++ b/Framework/Units/PhysicalConstants.h @@ -25,16 +25,16 @@ #ifndef INCLUDE_PHYSICAL_CONSTANTS_H #define INCLUDE_PHYSICAL_CONSTANTS_H -#include "phys/units/quantity.hpp" +#include <phys/units/quantity.hpp> -namespace phys { - namespace units { - namespace constants { +namespace corsika::units::constants { - // acceleration of free-fall, standard - constexpr quantity<acceleration_d> g_sub_n{Rep(9.80665L) * meter / square(second)}; + using namespace phys::units; + + // acceleration of free-fall, standard + constexpr phys::units::quantity<phys::units::acceleration_d> g_sub_n{phys::units::Rep(9.80665L) * phys::units::meter / phys::units::square(phys::units::second)}; // Avogadro constant constexpr quantity<dimensions<0, 0, 0, 0, 0, -1> > N_sub_A{Rep(6.02214199e+23L) / @@ -56,20 +56,8 @@ namespace phys { // etc. - } // namespace constants - - } // namespace units - -} // namespace phys - -namespace fwk { - - // using namespace phys; - using namespace phys::units; - - namespace constants = phys::units::constants; -} // namespace fwk +} // namespace corsika #endif // PHYS_UNITS_PHYSICAL_CONSTANTS_HPP_INCLUDED diff --git a/Framework/Units/PhysicalUnits.h b/Framework/Units/PhysicalUnits.h index 3403cafac6765c630ea3a7d64041a59d6f0c3fd4..71858e36174dcb6868cb30286343930c95cc1d21 100644 --- a/Framework/Units/PhysicalUnits.h +++ b/Framework/Units/PhysicalUnits.h @@ -1,7 +1,7 @@ #ifndef _include_PhysicalUnits_h_ #define _include_PhysicalUnits_h_ -#include <fwk/PhysicalConstants.h> +#include <corsika/units/PhysicalConstants.h> #include <phys/units/io.hpp> #include <phys/units/quantity.hpp> @@ -15,26 +15,26 @@ namespace phys { namespace units { namespace literals { - QUANTITY_DEFINE_SCALING_LITERALS(eV, energy_d, magnitude(constants::eV)) + QUANTITY_DEFINE_SCALING_LITERALS(eV, energy_d, magnitude(corsika::units::constants::eV)) } } // namespace units } // namespace phys -namespace fwk { +namespace corsika::units { + using namespace phys::units; - //namespace literals = phys::units::literals; + using namespace phys::units::literals; + //namespace literals = phys::units::literals; - //namespace quantity { - using Length = phys::units::quantity<phys::units::length_d, double>; - using Time = phys::units::quantity<phys::units::time_interval_d, double>; - using Speed = phys::units::quantity<phys::units::speed_d, double>; - using Frequency = phys::units::quantity<phys::units::frequency_d, double>; - using ElectricCharge = phys::units::quantity<phys::units::electric_charge_d, double>; - using Energy = phys::units::quantity<phys::units::energy_d, double>; - //} // namespace quantity - -} // end namespace fwk + using LengthType = phys::units::quantity<phys::units::length_d, double>; + using TimeType = phys::units::quantity<phys::units::time_interval_d, double>; + using SpeedType = phys::units::quantity<phys::units::speed_d, double>; + using FrequencyType = phys::units::quantity<phys::units::frequency_d, double>; + using ElectricChargeType = phys::units::quantity<phys::units::electric_charge_d, double>; + using EnergyType = phys::units::quantity<phys::units::energy_d, double>; + +} // end namespace corsika::units // we want to call the operator<< without namespace... I think using namespace phys::units::io; diff --git a/Framework/Units/testUnits.cc b/Framework/Units/testUnits.cc index a1f52e15d39ee493fe16732deb01352caf32d1bb..080aabe8c9a08b38bcb89f9055b4a9951705254c 100644 --- a/Framework/Units/testUnits.cc +++ b/Framework/Units/testUnits.cc @@ -2,12 +2,11 @@ // cpp file #include <catch2/catch.hpp> -#include <fwk/PhysicalUnits.h> +#include <corsika/units/PhysicalUnits.h> #include <array> -using namespace fwk; -using namespace fwk::literals; +using namespace corsika::units; TEST_CASE("PhysicalUnits", "[Units]") { @@ -20,16 +19,16 @@ TEST_CASE("PhysicalUnits", "[Units]") { auto E1 = 10_GeV; REQUIRE(E1 == 10_GeV); - fwk::Length l1 = 10_nm; + LengthType l1 = 10_nm; - fwk::Length arr0[5]; + LengthType arr0[5]; arr0[0] = 5_m; - fwk::Length arr1[2] = {{1_mm}, {2_cm}}; + LengthType arr1[2] = {{1_mm}, {2_cm}}; - std::array<fwk::Energy, 4> arr2; // empty array + std::array<EnergyType, 4> arr2; // empty array - std::array<fwk::Energy, 4> arr3 = {1_GeV, 1_eV, 5_MeV}; + std::array<EnergyType, 4> arr3 = {1_GeV, 1_eV, 5_MeV}; } SECTION("Powers in literal units") { @@ -61,7 +60,7 @@ TEST_CASE("PhysicalUnits", "[Units]") { } SECTION("Formulas") { - const fwk::Energy E2 = 20_GeV * 2; + const EnergyType E2 = 20_GeV * 2; REQUIRE(E2 == 40_GeV); const double lgE = log10(E2 / 1_GeV); diff --git a/Processes/NullModel/CMakeLists.txt b/Processes/NullModel/CMakeLists.txt index e4c6a649e4bc67d922fbd2b11695a894eeb1ac1e..ff8b026d993b5ccf9f98c2352a571c9e4dd3e018 100644 --- a/Processes/NullModel/CMakeLists.txt +++ b/Processes/NullModel/CMakeLists.txt @@ -11,7 +11,7 @@ set ( set ( MODEL_NAMESPACE - process/null_model + corsika/process/null_model ) add_library (ProcessNullModel STATIC ${MODEL_SOURCES}) diff --git a/Processes/NullModel/NullModel.cc b/Processes/NullModel/NullModel.cc index 8863c12931f86291252154150ada64a2b76613f4..4da71dc16066f65af4623db7a45338ac9c8fde0c 100644 --- a/Processes/NullModel/NullModel.cc +++ b/Processes/NullModel/NullModel.cc @@ -1,6 +1,6 @@ -#include <process/null_model/NullModel.h> +#include <corsika/process/null_model/NullModel.h> -using namespace process::null_model; +using namespace corsika::process::null_model; NullModel::NullModel() {} diff --git a/Processes/NullModel/NullModel.h b/Processes/NullModel/NullModel.h index bd33c4f53a7c79900403d5a1f7597c59658b5944..6cbee61a82285986a49726a40417472446fe7650 100644 --- a/Processes/NullModel/NullModel.h +++ b/Processes/NullModel/NullModel.h @@ -1,7 +1,7 @@ #ifndef _Physics_NullModel_NullModel_h_ #define _Physics_NullModel_NullModel_h_ -namespace process { +namespace corsika::process { namespace null_model { diff --git a/Processes/NullModel/testNullModel.cc b/Processes/NullModel/testNullModel.cc index b8afb99f40348b0b2419730f3929fcbbbd117ca6..469f35c3467b0d315d879ba99f12211748e177d1 100644 --- a/Processes/NullModel/testNullModel.cc +++ b/Processes/NullModel/testNullModel.cc @@ -2,7 +2,7 @@ // cpp file #include <catch2/catch.hpp> -#include <fwk/PhysicalUnits.h> +#include <corsika/units/PhysicalUnits.h> TEST_CASE("NullModel", "[processes]") { diff --git a/Processes/Sibyll/CMakeLists.txt b/Processes/Sibyll/CMakeLists.txt index 1232eb8204e24defa4a080ff722d582083421332..041fdb8c34e8947d9ecc10b19961b7a2a653519b 100644 --- a/Processes/Sibyll/CMakeLists.txt +++ b/Processes/Sibyll/CMakeLists.txt @@ -11,7 +11,7 @@ set ( set ( MODEL_NAMESPACE - process/sibyll + corsika/process/sibyll ) add_library (ProcessSibyll STATIC ${MODEL_SOURCES}) diff --git a/Processes/Sibyll/ParticleConversion.cc b/Processes/Sibyll/ParticleConversion.cc index 15d4613919eca687b69c9045eccfa3332bac53ce..2e8cbdfa81e9c23e45625aa183eb6ef90d9e91ab 100644 --- a/Processes/Sibyll/ParticleConversion.cc +++ b/Processes/Sibyll/ParticleConversion.cc @@ -1,7 +1,7 @@ -#include <process/sibyll/ParticleConversion.h> -#include <fwk/ParticleProperties.h> +#include <corsika/process/sibyll/ParticleConversion.h> +#include <corsika/particles/ParticleProperties.h> -using namespace process::sibyll; +using namespace corsika::process::sibyll; //const std::map<sibyll::PID, ParticleProperties::InternalParticleCode> // process::sibyll::Sibyll2Corsika = { diff --git a/Processes/Sibyll/ParticleConversion.h b/Processes/Sibyll/ParticleConversion.h index 84ddd44aa30def8e385af5c19a7761824a21a150..500ad53e4137460c11aef0b0326f38c565fcdc41 100644 --- a/Processes/Sibyll/ParticleConversion.h +++ b/Processes/Sibyll/ParticleConversion.h @@ -1,11 +1,11 @@ #ifndef _include_processes_sibyll_particles_h_ #define _include_processes_sibyll_particles_h_ -#include <fwk/ParticleProperties.h> +#include <corsika/particles/ParticleProperties.h> #include <map> -namespace process { +namespace corsika::process { namespace sibyll { @@ -100,16 +100,16 @@ namespace process { VOID = 0, }; - static const std::map<sibyll::PID, fwk::particle::Code> Sibyll2Corsika = { - {PID::E_MINUS, fwk::particle::Code::Electron}, - {PID::E_PLUS, fwk::particle::Code::Positron}, - {PID::NU_E, fwk::particle::Code::NuE}, - {PID::NU_E_BAR, fwk::particle::Code::NuEBar}, - {PID::MU_MINUS, fwk::particle::Code::MuMinus}, - {PID::MU_PLUS, fwk::particle::Code::MuPlus}, - {PID::NU_MU, fwk::particle::Code::NuMu}, - {PID::NU_MU_BAR, fwk::particle::Code::NuMuBar}, - {PID::TAU_MINUS, fwk::particle::Code::TauMinus}, + static const std::map<sibyll::PID, corsika::particles::Code> Sibyll2Corsika = { + {PID::E_MINUS, corsika::particles::Code::Electron}, + {PID::E_PLUS, corsika::particles::Code::Positron}, + {PID::NU_E, corsika::particles::Code::NuE}, + {PID::NU_E_BAR, corsika::particles::Code::NuEBar}, + {PID::MU_MINUS, corsika::particles::Code::MuMinus}, + {PID::MU_PLUS, corsika::particles::Code::MuPlus}, + {PID::NU_MU, corsika::particles::Code::NuMu}, + {PID::NU_MU_BAR, corsika::particles::Code::NuMuBar}, + {PID::TAU_MINUS, corsika::particles::Code::TauMinus}, /* TAU_PLUS = 90, NU_TAU = 92, diff --git a/Processes/Sibyll/testSibyll.cc b/Processes/Sibyll/testSibyll.cc index c055cdfe667593d1c2d1e0e380ae3f2fbabc2486..4c5bed4df1b42c351587569ed5a0b192f19f1f2d 100644 --- a/Processes/Sibyll/testSibyll.cc +++ b/Processes/Sibyll/testSibyll.cc @@ -1,21 +1,24 @@ + +#include <corsika/particles/ParticleProperties.h> +#include <corsika/process/sibyll/ParticleConversion.h> +#include <corsika/units/PhysicalUnits.h> + #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one // cpp file #include <catch2/catch.hpp> -#include <fwk/ParticleProperties.h> -#include <fwk/PhysicalUnits.h> -#include <process/sibyll/ParticleConversion.h> - -using namespace process::sibyll; +using namespace corsika; TEST_CASE("Sibyll", "[processes]") { SECTION("ParticleConversion") { - REQUIRE(fwk::particle::Electron::GetCode() == Sibyll2Corsika.at(PID::E_MINUS)); + REQUIRE(corsika::particles::Electron::GetCode() == + process::sibyll::Sibyll2Corsika.at(process::sibyll::PID::E_MINUS)); } SECTION("Data") { - REQUIRE(fwk::particle::GetName(Sibyll2Corsika.at(PID::E_PLUS)) == "e+"); + REQUIRE(corsika::particles::GetName(process::sibyll::Sibyll2Corsika.at( + process::sibyll::PID::E_PLUS)) == "e+"); } SECTION("bla") {} diff --git a/Stack/SuperStupidStack/CMakeLists.txt b/Stack/SuperStupidStack/CMakeLists.txt index d14642dbd861b7ab9982c8b7394f719f8c5f2c53..6b00c993c4c712a4a2107ebd1539d21431da1752 100644 --- a/Stack/SuperStupidStack/CMakeLists.txt +++ b/Stack/SuperStupidStack/CMakeLists.txt @@ -1,6 +1,6 @@ set (SuperStupidStack_HEADERS SuperStupidStack.h) -set (SuperStupidStack_NAMESPACE stack/super_stupid) +set (SuperStupidStack_NAMESPACE corsika/stack/super_stupid) add_library (SuperStupidStack INTERFACE) diff --git a/Stack/SuperStupidStack/SuperStupidStack.h b/Stack/SuperStupidStack/SuperStupidStack.h index ab6d65e98cc93859a01a5154784950cf8b59dc3d..a2d7aa38084655b25782d153f4835a666baa3eda 100644 --- a/Stack/SuperStupidStack/SuperStupidStack.h +++ b/Stack/SuperStupidStack/SuperStupidStack.h @@ -4,16 +4,18 @@ #include <string> #include <vector> -#include <fwk/ParticleProperties.h> -#include <fwk/PhysicalUnits.h> -#include <fwk/Stack.h> +#include <corsika/stack/Stack.h> +#include <corsika/particles/ParticleProperties.h> +#include <corsika/units/PhysicalUnits.h> -using namespace fwk::literals; - -namespace stack { +namespace corsika::stack { namespace super_stupid { + using corsika::units::EnergyType; + using corsika::particles::Code; + using corsika::units::operator""_GeV;//literals; + /** * Example of a particle object on the stack. */ @@ -25,11 +27,11 @@ namespace stack { using StackIteratorInfo<_Stack, ParticleRead>::GetStack; public: - void SetId(const fwk::particle::Code id) { GetStack().SetId(GetIndex(), id); } - void SetEnergy(const fwk::Energy& e) { GetStack().SetEnergy(GetIndex(), e); } + void SetId(const Code id) { GetStack().SetId(GetIndex(), id); } + void SetEnergy(const EnergyType& e) { GetStack().SetEnergy(GetIndex(), e); } - fwk::particle::Code GetId() const { return GetStack().GetId(GetIndex()); } - const fwk::Energy& GetEnergy() const { return GetStack().GetEnergy(GetIndex()); } + Code GetId() const { return GetStack().GetId(GetIndex()); } + const EnergyType& GetEnergy() const { return GetStack().GetEnergy(GetIndex()); } }; /** @@ -48,11 +50,11 @@ namespace stack { int GetSize() const { return fDataId.size(); } int GetCapacity() const { return fDataId.size(); } - void SetId(const int i, const fwk::particle::Code id) { fDataId[i] = id; } - void SetEnergy(const int i, const fwk::Energy& e) { fDataE[i] = e; } + void SetId(const int i, const Code id) { fDataId[i] = id; } + void SetEnergy(const int i, const EnergyType& e) { fDataE[i] = e; } - const fwk::particle::Code GetId(const int i) const { return fDataId[i]; } - const fwk::Energy& GetEnergy(const int i) const { return fDataE[i]; } + const Code GetId(const int i) const { return fDataId[i]; } + const EnergyType& GetEnergy(const int i) const { return fDataE[i]; } /** * Function to copy particle at location i2 in stack to i1 @@ -65,7 +67,7 @@ namespace stack { protected: void IncrementSize() { fDataE.push_back(0_GeV); - fDataId.push_back(fwk::particle::Code::unknown); + fDataId.push_back(Code::unknown); } void DecrementSize() { if (fDataE.size() > 0) { @@ -77,8 +79,8 @@ namespace stack { private: /// the actual memory to store particle data - std::vector<fwk::particle::Code> fDataId; - std::vector<fwk::Energy> fDataE; + std::vector<Code> fDataId; + std::vector<EnergyType> fDataE; }; // end class SuperStupidStackImpl @@ -88,6 +90,7 @@ namespace stack { } // namespace super_stupid -} // namespace stack +} // namespace corsika::stack + #endif diff --git a/ThirdParty/eigen-eigen-b3f3d4950030.tar b/ThirdParty/eigen-eigen-b3f3d4950030.tar new file mode 100644 index 0000000000000000000000000000000000000000..4c050d1cc7e51abd98fc0c03b81b350c87b2b5f3 Binary files /dev/null and b/ThirdParty/eigen-eigen-b3f3d4950030.tar differ