diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 50a951202666c2b29a2a9c863f96a2841b9f6356..879e1ac58766a03b0afd06f012e3bb207c4e8db8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,6 +22,7 @@ build: - ls - pwd artifacts: + expire_in: 1 week paths: - build/test.log.gz when: on_failure diff --git a/COAST/CMakeLists.txt b/COAST/CMakeLists.txt index 2aae4eb262f78513a0bb5312a6c3e5b972c56bb1..7a8c67e39c09317ad1d6245e0f536d6503c0f924 100644 --- a/COAST/CMakeLists.txt +++ b/COAST/CMakeLists.txt @@ -45,7 +45,12 @@ target_include_directories ( PUBLIC $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include> $<INSTALL_INTERFACE:include/include> - SYSTEM + ) + +target_include_directories ( + COAST + SYSTEM + PUBLIC $ENV{COAST_DIR}/include ) diff --git a/COAST/COASTProcess.cc b/COAST/COASTProcess.cc index 3f4281b4d519eced3b2381a1be7bfaf396789441..bfbf8839dcf40551bddb1ddd3dff77c1e49ea38f 100644 --- a/COAST/COASTProcess.cc +++ b/COAST/COASTProcess.cc @@ -1,4 +1,5 @@ -/** + +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/COAST/COASTProcess.h b/COAST/COASTProcess.h index 686975e7f9e4adaeb192cd5f07ce92e79e8e1790..a5d7606c5f912b862cdee99dfe264cd89073f76b 100644 --- a/COAST/COASTProcess.h +++ b/COAST/COASTProcess.h @@ -1,3 +1,14 @@ + +/* + * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu + * + * See file AUTHORS for a list of contributors. + * + * This software is distributed under the terms of the GNU General Public + * Licence version 3 (GPL Version 3). See file LICENSE for a full version of + * the license. + */ + #ifndef _include_corsika_coast_coastprocess_h_ #define _include_corsika_coast_coastprocess_h_ diff --git a/COAST/COASTStack.h b/COAST/COASTStack.h index 936c6fa28cdd9255f53911b1153c0657fd003b38..66f669db801da633432e1b9273a8dce4a47f72fa 100644 --- a/COAST/COASTStack.h +++ b/COAST/COASTStack.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/COAST/COASTUserLib.cc b/COAST/COASTUserLib.cc index 57a9ab56838441d5114bde103da516cf3d54b10c..deb3d490dcba40e2b0e236428d5fb4b4fafbe06c 100644 --- a/COAST/COASTUserLib.cc +++ b/COAST/COASTUserLib.cc @@ -1,3 +1,14 @@ + +/* + * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu + * + * See file AUTHORS for a list of contributors. + * + * This software is distributed under the terms of the GNU General Public + * Licence version 3 (GPL Version 3). See file LICENSE for a full version of + * the license. + */ + #include <interface/CorsikaInterface.h> #include <corsika/coast/COASTProcess.h> diff --git a/COAST/ParticleConversion.cc b/COAST/ParticleConversion.cc index ddff698ae96ae6b86ec0745e260486a8620f0099..c0bc3dab50b8d805cd9cee8212c9a1bd06c67460 100644 --- a/COAST/ParticleConversion.cc +++ b/COAST/ParticleConversion.cc @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/COAST/ParticleConversion.h b/COAST/ParticleConversion.h index b8f99519539c751db17cf1d24ca3568ed8748a65..a1be8b46fb7158b70b4bb3f657342a7824e1fbbb 100644 --- a/COAST/ParticleConversion.h +++ b/COAST/ParticleConversion.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/COAST/README.md b/COAST/README.md index 215d5f10c3e772fedab9d81ff03e8bb325722f30..634854a199e9788ad6e5606fe2a53fdbde6522eb 100644 --- a/COAST/README.md +++ b/COAST/README.md @@ -1,7 +1,14 @@ +# COAST interface {#COASTinterface} + +With the COAST interface of CORSIKA 8 you can write a CORSIKA 8 +"process" class and link it to CORSIKA 7. This can be very powerful to +benchmark new CORSIKA 8 physics code in the context of "old" CORSIKA 7 +simulations. + This is based on corsika7/trunk/coast/CoastOptions/example with an -additional interface to CORSIKA8. +additional interface to CORSIKA 8. -This is an example for a "COAST user library" using CORSIKA8 +We provide a step-by-step example for a "COAST user library" using CORSIKA 8 technology. It explains the steps, how to use the COAST_USER_LIB option of CORSIKA together with CORSIKA8/COAST diff --git a/Documentation/Doxygen/Doxyfile.in b/Documentation/Doxygen/Doxyfile.in index 47bcf61eb06572fab45ea308f3bf9091bbae512f..dacef653aa17b38022d95ab19626356cc67010f0 100644 --- a/Documentation/Doxygen/Doxyfile.in +++ b/Documentation/Doxygen/Doxyfile.in @@ -8,12 +8,13 @@ EXCLUDE_PATTERNS = */ThirdParty/*/* GENERATE_HTML = YES GENERATE_LATEX = YES -FILE_PATTERNS = *.cc *.cpp *.cxx *.h *.dox *.inc +FILE_PATTERNS = *.cc *.cpp *.cxx *.h *.dox *.inc *.md EXTENSION_MAPPING = inc=C++ RECURSIVE = YES SOURCE_BROWSER = YES # INLINE_SOURCES +GENERATE_TREEVIEW = YES CLASS_DIAGRAMS = NO HAVE_DOT = YES diff --git a/Documentation/Examples/cascade_example.cc b/Documentation/Examples/cascade_example.cc index f18ff72efcf8db5c95cc370b8624229d65fccdc0..71078d46e74a2403cceca9f123208e01f535660a 100644 --- a/Documentation/Examples/cascade_example.cc +++ b/Documentation/Examples/cascade_example.cc @@ -1,4 +1,5 @@ -/** + +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. @@ -256,8 +257,6 @@ int main() { double theta = 0.; double phi = 0.; { - auto particle = stack.NewParticle(); - particle.SetPID(Code::Proton); HEPMomentumType P0 = sqrt(E0 * E0 - Proton::GetMass() * Proton::GetMass()); auto momentumComponents = [](double theta, double phi, HEPMomentumType ptot) { return std::make_tuple(ptot * sin(theta) * cos(phi), ptot * sin(theta) * sin(phi), @@ -268,11 +267,8 @@ int main() { auto plab = stack::super_stupid::MomentumVector(rootCS, {px, py, pz}); cout << "input angles: theta=" << theta << " phi=" << phi << endl; cout << "input momentum: " << plab.GetComponents() / 1_GeV << endl; - particle.SetEnergy(E0); - particle.SetMomentum(plab); - particle.SetTime(0_ns); - Point p(rootCS, 0_m, 0_m, 0_m); - particle.SetPosition(p); + Point pos(rootCS, 0_m, 0_m, 0_m); + stack.AddParticle(Code::Proton, E0, plab, pos, 0_ns); } // define air shower object, run simulation diff --git a/Documentation/Examples/geometry_example.cc b/Documentation/Examples/geometry_example.cc index cfd9fd8b0af8e36de289ba7dd8b4bd600677d3bf..9c589ee714f1b4e0b36d2987c7558899389027fc 100644 --- a/Documentation/Examples/geometry_example.cc +++ b/Documentation/Examples/geometry_example.cc @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Documentation/Examples/helix_example.cc b/Documentation/Examples/helix_example.cc index 068d25f1fc0fe6ea320eaa6d525a9679c006d2f5..ec73fc36c536fde7209d77842db8ff5278cf0b11 100644 --- a/Documentation/Examples/helix_example.cc +++ b/Documentation/Examples/helix_example.cc @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Documentation/Examples/logger_example.cc b/Documentation/Examples/logger_example.cc index 9d9b743c13caff6010b13a37e5a20aed02c58ed2..956f49127f44843042bc96fadbb7c2e1fbd8c1b9 100644 --- a/Documentation/Examples/logger_example.cc +++ b/Documentation/Examples/logger_example.cc @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Documentation/Examples/stack_example.cc b/Documentation/Examples/stack_example.cc index 33ebc230af244932375c904747b127b0b5c240ab..6f6dd03824da770253d2a2557e2c467c0ce7752c 100644 --- a/Documentation/Examples/stack_example.cc +++ b/Documentation/Examples/stack_example.cc @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. @@ -11,6 +11,10 @@ #include <corsika/particles/ParticleProperties.h> #include <corsika/stack/super_stupid/SuperStupidStack.h> + +#include <corsika/geometry/Point.h> +#include <corsika/geometry/RootCoordinateSystem.h> + #include <cassert> #include <iomanip> #include <iostream> @@ -20,10 +24,12 @@ using namespace corsika::stack; using namespace std; void fill(corsika::stack::super_stupid::SuperStupidStack& s) { + const geometry::CoordinateSystem& rootCS = + geometry::RootCoordinateSystem::GetInstance().GetRootCoordinateSystem(); for (int i = 0; i < 11; ++i) { - auto p = s.NewParticle(); - p.SetPID(corsika::particles::Code::Electron); - p.SetEnergy(1.5_GeV * i); + s.AddParticle(corsika::particles::Code::Electron, 1.5_GeV * i, + stack::super_stupid::MomentumVector(rootCS, {0_GeV, 0_GeV, 1_GeV}), + geometry::Point(rootCS, 0_m, 0_m, 0_m), 0_ns); } } diff --git a/Documentation/Examples/staticsequence_example.cc b/Documentation/Examples/staticsequence_example.cc index 0dfed040c85468501f02ce0cd07ac5a44dddcedb..5e881ebbe3e38ae028d2c263ff27bcc41b0490b5 100644 --- a/Documentation/Examples/staticsequence_example.cc +++ b/Documentation/Examples/staticsequence_example.cc @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Environment/Environment.h b/Environment/Environment.h index 1fc1e443b26c617acb56b5d4b9406dacaed87514..97931aeffe2fe557b0328f97bbea8712a5dffc7e 100644 --- a/Environment/Environment.h +++ b/Environment/Environment.h @@ -1,4 +1,5 @@ -/** + +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Environment/FlatAtmosphere/FlatAtmosphere.h b/Environment/FlatAtmosphere/FlatAtmosphere.h index 90582b3dfb00d2d85850b81455a2a4c0c061413b..6839def48c2f6fddfafd0beb5fd4ca46058ebd09 100644 --- a/Environment/FlatAtmosphere/FlatAtmosphere.h +++ b/Environment/FlatAtmosphere/FlatAtmosphere.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Environment/HomogeneousMedium.h b/Environment/HomogeneousMedium.h index d058f67c8550e41813513ccd40189c5a63c20974..e426314002fe3996ef375f88c6ae987e22d2c6ae 100644 --- a/Environment/HomogeneousMedium.h +++ b/Environment/HomogeneousMedium.h @@ -1,4 +1,5 @@ -/** + +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Environment/IMediumModel.h b/Environment/IMediumModel.h index 999874455fe9908da30a742e8ca2dcf62ea4c93c..84832eef0025c4a9c255d88857165bf3b9e0800c 100644 --- a/Environment/IMediumModel.h +++ b/Environment/IMediumModel.h @@ -1,4 +1,5 @@ -/** + +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Environment/NuclearComposition.h b/Environment/NuclearComposition.h index a96abd40220f3370b4e5bbfaaa0da65b72d7997e..40bf93ed40b3fedd90f4e1c2c50f24408e8b8894 100644 --- a/Environment/NuclearComposition.h +++ b/Environment/NuclearComposition.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Environment/VolumeTreeNode.h b/Environment/VolumeTreeNode.h index d92d77b398bd180d9d64dc5039f32e50ca9be487..3331c41bf5e060bb904f5a78f78485af0440d04b 100644 --- a/Environment/VolumeTreeNode.h +++ b/Environment/VolumeTreeNode.h @@ -1,4 +1,5 @@ -/** + +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Environment/testEnvironment.cc b/Environment/testEnvironment.cc index 8a8e9c13b5a899ad983d0e852379e5621c9f1489..5856818670ec1ddd8df187f624b8ca45e2e4e117 100644 --- a/Environment/testEnvironment.cc +++ b/Environment/testEnvironment.cc @@ -1,4 +1,5 @@ -/** + +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Cascade/CMakeLists.txt b/Framework/Cascade/CMakeLists.txt index 3e51de61808e63bce24247d1c43f2a05137dbc18..fe009b213773f8d7ad8efed087e073791515a7a2 100644 --- a/Framework/Cascade/CMakeLists.txt +++ b/Framework/Cascade/CMakeLists.txt @@ -59,4 +59,4 @@ target_link_libraries ( CORSIKAunits CORSIKAthirdparty # for catch2 ) -CORSIKA_ADD_TEST(testStackInterface) +CORSIKA_ADD_TEST(testCascade) diff --git a/Framework/Cascade/Cascade.h b/Framework/Cascade/Cascade.h index 024044aea5d6699dd311352f24ec91459a180845..3adaac2bc3cdb0b0fc23b4f1f986c4e9863a7f65 100644 --- a/Framework/Cascade/Cascade.h +++ b/Framework/Cascade/Cascade.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Cascade/Step.cc b/Framework/Cascade/Step.cc index 503bc80b1644ce66d60e9e80e9627c8d9c3daefa..ba29d2341a3863ec019e6001ad727c8901bee77d 100644 --- a/Framework/Cascade/Step.cc +++ b/Framework/Cascade/Step.cc @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Cascade/testCascade.cc b/Framework/Cascade/testCascade.cc index cd22f884089092dfdbc373d538168c346b6e35fd..7abf985ad612ba9f6fb23bae31615d2d392b5f93 100644 --- a/Framework/Cascade/testCascade.cc +++ b/Framework/Cascade/testCascade.cc @@ -1,4 +1,5 @@ -/** + +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. @@ -84,7 +85,7 @@ public: } template <typename Particle, typename T, typename Stack> - EProcessReturn DoContinuous(Particle& p, T&, Stack& s) { + EProcessReturn DoContinuous(Particle& p, T&, Stack&) { fCalls++; HEPEnergyType E = p.GetEnergy(); if (E < fEcrit) { @@ -92,13 +93,7 @@ public: fCount++; } else { p.SetEnergy(E / 2); - auto pnew = s.NewParticle(); - // s.Copy(p, pnew); fix that .... todo - pnew.SetPID(p.GetPID()); - pnew.SetTime(p.GetTime()); - pnew.SetEnergy(E / 2); - pnew.SetPosition(p.GetPosition()); - pnew.SetMomentum(p.GetMomentum()); + p.AddSecondary(p.GetPID(), E / 2, p.GetMomentum(), p.GetPosition(), p.GetTime()); } return EProcessReturn::eOk; } @@ -133,14 +128,11 @@ TEST_CASE("Cascade", "[Cascade]") { RootCoordinateSystem::GetInstance().GetRootCoordinateSystem(); stack.Clear(); - auto particle = stack.NewParticle(); HEPEnergyType E0 = 100_GeV; - particle.SetPID(particles::Code::Electron); - particle.SetEnergy(E0); - particle.SetPosition(Point(rootCS, {0_m, 0_m, 10_km})); - particle.SetMomentum( - corsika::stack::super_stupid::MomentumVector(rootCS, {0_GeV, 0_GeV, -1_GeV})); - particle.SetTime(0_ns); + stack.AddParticle( + particles::Code::Electron, E0, + corsika::stack::super_stupid::MomentumVector(rootCS, {0_GeV, 0_GeV, -1_GeV}), + Point(rootCS, {0_m, 0_m, 10_km}), 0_ns); EAS.Init(); EAS.Run(); diff --git a/Framework/Geometry/BaseTrajectory.h b/Framework/Geometry/BaseTrajectory.h index 5540fc89d62e240217b79346d86aa32b04004baf..8d13f97a3a96c46549f8a4b8a5baad8951e33353 100644 --- a/Framework/Geometry/BaseTrajectory.h +++ b/Framework/Geometry/BaseTrajectory.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Geometry/BaseVector.h b/Framework/Geometry/BaseVector.h index 7e3d8ef6112546940311b808fe3ca798b0988a79..c41d8edf205f84b2066f83a61a253130225ab207 100644 --- a/Framework/Geometry/BaseVector.h +++ b/Framework/Geometry/BaseVector.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Geometry/CoordinateSystem.cc b/Framework/Geometry/CoordinateSystem.cc index cdc465c60842fb99d2f73539dd657d63131ef251..35e2941678d970b1868626a252785055d4413be4 100644 --- a/Framework/Geometry/CoordinateSystem.cc +++ b/Framework/Geometry/CoordinateSystem.cc @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Geometry/CoordinateSystem.h b/Framework/Geometry/CoordinateSystem.h index 49deebc648bbca7a3fef5d7f8137c499c225f6fa..aaf226f3833b732488bcb457f76c0dbbd80049dc 100644 --- a/Framework/Geometry/CoordinateSystem.h +++ b/Framework/Geometry/CoordinateSystem.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Geometry/FourVector.h b/Framework/Geometry/FourVector.h index d3fe31f1838e64e052587f474baa2fdc259870bf..0a917a153d23a623f8d34881300a2ebccdc3ed6d 100644 --- a/Framework/Geometry/FourVector.h +++ b/Framework/Geometry/FourVector.h @@ -1,3 +1,14 @@ + +/* + * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu + * + * See file AUTHORS for a list of contributors. + * + * This software is distributed under the terms of the GNU General Public + * Licence version 3 (GPL Version 3). See file LICENSE for a full version of + * the license. + */ + #ifndef _include_corsika_framework_geometry_fourvector_h_ #define _include_corsika_framework_geometry_fourvector_h_ diff --git a/Framework/Geometry/Helix.h b/Framework/Geometry/Helix.h index 27e3575d37026e16ed401974788b80cb35b08bde..caf2c34d0009bb2e33ba0bcbf0babcdf7136ba41 100644 --- a/Framework/Geometry/Helix.h +++ b/Framework/Geometry/Helix.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Geometry/Line.h b/Framework/Geometry/Line.h index 1b45f535a9c01acaa0084a42ca3b532360fa9b59..ce795d8d9ffc918c9b6559278ee6a8cf58bdd282 100644 --- a/Framework/Geometry/Line.h +++ b/Framework/Geometry/Line.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Geometry/Point.h b/Framework/Geometry/Point.h index 74c4b6f8da208064103c1a23018cc208b58b1659..f05bd31d1ca628f1f32834a9e6d6300e6ef2578c 100644 --- a/Framework/Geometry/Point.h +++ b/Framework/Geometry/Point.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Geometry/QuantityVector.h b/Framework/Geometry/QuantityVector.h index e0893e52706312ee6ed8b58478ee4b6802ff6cf1..dafef96b6a36e40f7b64d26582b70496ddb6017c 100644 --- a/Framework/Geometry/QuantityVector.h +++ b/Framework/Geometry/QuantityVector.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Geometry/RootCoordinateSystem.h b/Framework/Geometry/RootCoordinateSystem.h index 422cbbd57a6dfec9cfd7ea2c8db79350c6847246..0e641b3a349e22173fd894e7bd005a8f71530a2b 100644 --- a/Framework/Geometry/RootCoordinateSystem.h +++ b/Framework/Geometry/RootCoordinateSystem.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Geometry/Sphere.h b/Framework/Geometry/Sphere.h index 3e5458b7e2328d062e61307f4c01589c8ee02f05..5a38820a3fecc600d6c2b55177ababc777b7c13c 100644 --- a/Framework/Geometry/Sphere.h +++ b/Framework/Geometry/Sphere.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Geometry/Trajectory.h b/Framework/Geometry/Trajectory.h index bcaa45fba325367048a2a7b93c6ddb0752428300..5be99e363ebe2b734510e36b2b8a21a5d86ecb38 100644 --- a/Framework/Geometry/Trajectory.h +++ b/Framework/Geometry/Trajectory.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Geometry/Vector.h b/Framework/Geometry/Vector.h index 712eece61380c75bd36dea77b17a5650690b79b5..5ac1f118b789b500ad26a23f840bda954b2c9800 100644 --- a/Framework/Geometry/Vector.h +++ b/Framework/Geometry/Vector.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Geometry/Volume.h b/Framework/Geometry/Volume.h index 988337856e801dd7e55639c5aebefd20e6734c31..c6c953d9511132e8663a25a3f05cbbd82b98916a 100644 --- a/Framework/Geometry/Volume.h +++ b/Framework/Geometry/Volume.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Geometry/testFourVector.cc b/Framework/Geometry/testFourVector.cc index 6d3d758cbf9a76be337ce8a6927d11f704604eb3..a4063f0ef9a9b7d3528142c2d06094e9e70c7755 100644 --- a/Framework/Geometry/testFourVector.cc +++ b/Framework/Geometry/testFourVector.cc @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Geometry/testGeometry.cc b/Framework/Geometry/testGeometry.cc index f2ac12e13c912bb36d1e5956190db9e450cb7ba9..0a6dbbdecdad0f49f5dc902f3997c5a0f37afd7c 100644 --- a/Framework/Geometry/testGeometry.cc +++ b/Framework/Geometry/testGeometry.cc @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Logging/BufferedSink.h b/Framework/Logging/BufferedSink.h index 2c0f7be9b721c7910724a25aca4d8488d54e2422..16844e013b0d2fb56247ce67292ca56a5ed13fa2 100644 --- a/Framework/Logging/BufferedSink.h +++ b/Framework/Logging/BufferedSink.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Logging/Logger.h b/Framework/Logging/Logger.h index 2639df8af6a573170c096d4f44b72e93bc593697..7b9adc8d5686a3bc8bb60f4429df9015872b706c 100644 --- a/Framework/Logging/Logger.h +++ b/Framework/Logging/Logger.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Logging/MessageOff.h b/Framework/Logging/MessageOff.h index 4bdf10d5af622b5fdc1b35316fa258be1322573e..91bd965cd5e9780ccea07d53a5e1c6ccee144283 100644 --- a/Framework/Logging/MessageOff.h +++ b/Framework/Logging/MessageOff.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Logging/MessageOn.h b/Framework/Logging/MessageOn.h index c7756150f03f521ee7b54f0385270face22edb6e..159eae68b8e5d3c088f341bf77decacb640ce555 100644 --- a/Framework/Logging/MessageOn.h +++ b/Framework/Logging/MessageOn.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Logging/NoSink.h b/Framework/Logging/NoSink.h index 6e2fe48ebf66b072031eab47c6a2370b38cd2a52..93a16d1a1e70a3e30c24ee1f22fcbe212983b8c8 100644 --- a/Framework/Logging/NoSink.h +++ b/Framework/Logging/NoSink.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Logging/Sink.h b/Framework/Logging/Sink.h index 74a42185e6be225da119f0812d653756ef30da4f..f88e3812f2437c2c47d1dde1204fcca0a32a079b 100644 --- a/Framework/Logging/Sink.h +++ b/Framework/Logging/Sink.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Logging/testLogging.cc b/Framework/Logging/testLogging.cc index 12a77b3cab504672438e0e6f7d4fe2383d35b8d6..56b44779c2cd7473f9740f30b0871572f40378e9 100644 --- a/Framework/Logging/testLogging.cc +++ b/Framework/Logging/testLogging.cc @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Particles/ParticleProperties.cc b/Framework/Particles/ParticleProperties.cc index 2fff766f5b2f05d7a3a5fe8cf16c923dbe68bc45..7df29e065beb35100afddb77a1e22ff70480eb01 100644 --- a/Framework/Particles/ParticleProperties.cc +++ b/Framework/Particles/ParticleProperties.cc @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Particles/ParticleProperties.h b/Framework/Particles/ParticleProperties.h index 959c27a6be0028c607d9114d4577adcd6e791c3c..fa3922d55c427c2758d4e1477b2bcc927b5c8aab 100644 --- a/Framework/Particles/ParticleProperties.h +++ b/Framework/Particles/ParticleProperties.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Particles/testParticles.cc b/Framework/Particles/testParticles.cc index bdd07d8370592da981e59672c8b7a50ef92df9e4..30cbbca868befbb4ae3ea6c5db558ab1038d5547 100644 --- a/Framework/Particles/testParticles.cc +++ b/Framework/Particles/testParticles.cc @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/ProcessSequence/BaseProcess.h b/Framework/ProcessSequence/BaseProcess.h index 03e04c9bdc22f4bf9deba36c6a1d2964e5e60798..8b4014478f5ebef33e4acd76f6b7315f2c1e5041 100644 --- a/Framework/ProcessSequence/BaseProcess.h +++ b/Framework/ProcessSequence/BaseProcess.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/ProcessSequence/ContinuousProcess.h b/Framework/ProcessSequence/ContinuousProcess.h index 19090b04e6867a62c47c6644cac2368e168484ef..9a3424a35d4637a9e21212a0909f2456f71b3597 100644 --- a/Framework/ProcessSequence/ContinuousProcess.h +++ b/Framework/ProcessSequence/ContinuousProcess.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/ProcessSequence/DecayProcess.h b/Framework/ProcessSequence/DecayProcess.h index 4cd83595e4a74e0a3f584e76434cae246767009b..82be572d6fc8e19260fa50a5267f1171c20e042b 100644 --- a/Framework/ProcessSequence/DecayProcess.h +++ b/Framework/ProcessSequence/DecayProcess.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/ProcessSequence/DiscreteProcess.h b/Framework/ProcessSequence/DiscreteProcess.h index 7ce50810f7fccbbbcb0c707d4124ec1ad03f0244..40b54453007855540a72910ab9da708201b17b88 100644 --- a/Framework/ProcessSequence/DiscreteProcess.h +++ b/Framework/ProcessSequence/DiscreteProcess.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/ProcessSequence/InteractionProcess.h b/Framework/ProcessSequence/InteractionProcess.h index ff0cabd08a311dc5574c44cedddf8205d8545b19..96472755376c4cf630f8ac92e92c5c08eb1c2f48 100644 --- a/Framework/ProcessSequence/InteractionProcess.h +++ b/Framework/ProcessSequence/InteractionProcess.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/ProcessSequence/ProcessReturn.h b/Framework/ProcessSequence/ProcessReturn.h index 215994b42fb74daaba3b382513d94e50a45d430b..94a69406ac42c9ec7caccb53e0e42493ec15fe32 100644 --- a/Framework/ProcessSequence/ProcessReturn.h +++ b/Framework/ProcessSequence/ProcessReturn.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/ProcessSequence/ProcessSequence.h b/Framework/ProcessSequence/ProcessSequence.h index 48eafee2839b1035bcff8019e9b94b366c4f3f21..4d4d3fbfdaff3d075f6cc613da78ece584ed7142 100644 --- a/Framework/ProcessSequence/ProcessSequence.h +++ b/Framework/ProcessSequence/ProcessSequence.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. @@ -63,10 +63,6 @@ namespace corsika::process { T1 A; // this is a reference, if possible T2 B; // this is a reference, if possible - // ProcessSequence(ProcessSequence<T1,T2>&& v) : A(v.A), B(v.B) {} - // ProcessSequence<T1,T2>& operator=(ProcessSequence<T1,T2>&& v) { A=v.A; B=v.B; - // return *this; } - ProcessSequence(T1 in_A, T2 in_B) : A(in_A) , B(in_B) {} diff --git a/Framework/ProcessSequence/ProcessSignature.h b/Framework/ProcessSequence/ProcessSignature.h index cb0081df416b19057f995065545f92d4f083f8a0..38503b87b49fcd900cc8d2b28f4872e9aeabc419 100644 --- a/Framework/ProcessSequence/ProcessSignature.h +++ b/Framework/ProcessSequence/ProcessSignature.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/ProcessSequence/testProcessSequence.cc b/Framework/ProcessSequence/testProcessSequence.cc index f46b917b537f452efa7897403beb85aa635bfb03..8fd46418ac838ca1af0f2beb3691bf599a40eb05 100644 --- a/Framework/ProcessSequence/testProcessSequence.cc +++ b/Framework/ProcessSequence/testProcessSequence.cc @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Random/ExponentialDistribution.h b/Framework/Random/ExponentialDistribution.h index 248d785a748651bdd3cd462e2541bbd07403d8d0..dc17b20997e9932aaedfc8f26eeec3c2d63a1392 100644 --- a/Framework/Random/ExponentialDistribution.h +++ b/Framework/Random/ExponentialDistribution.h @@ -1,4 +1,5 @@ -/** + +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Random/RNGManager.cc b/Framework/Random/RNGManager.cc index 3245e8bfd4b5557fcf0cda06f9a09cf15a4ca90e..c02f7a4329b52cd397ba78c404381430c6d030b1 100644 --- a/Framework/Random/RNGManager.cc +++ b/Framework/Random/RNGManager.cc @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Random/RNGManager.h b/Framework/Random/RNGManager.h index c440e7aaae0beb3ae745562fa4949eff5ff504ee..9637b4b8279a48169a523df687eab0146afada38 100644 --- a/Framework/Random/RNGManager.h +++ b/Framework/Random/RNGManager.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Random/UniformRealDistribution.h b/Framework/Random/UniformRealDistribution.h index fd501ab36b2d0e411a1a2fc256734f5ec0221932..1328377dc2d88114c447cd5a4558dfec21cdf112 100644 --- a/Framework/Random/UniformRealDistribution.h +++ b/Framework/Random/UniformRealDistribution.h @@ -1,4 +1,5 @@ -/** + +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Random/testRandom.cc b/Framework/Random/testRandom.cc index a8f8595512815574fd3abb0b9c29274a37ac22d4..c362d393fea3bc8bf4c4ad72949dd0c6a8d0bf86 100644 --- a/Framework/Random/testRandom.cc +++ b/Framework/Random/testRandom.cc @@ -1,4 +1,5 @@ -/** + +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/StackInterface/CMakeLists.txt b/Framework/StackInterface/CMakeLists.txt index c6106121bfbdb3e1f277c387f767938cd2e0f1af..6fce751dbccdeacfd2cdad6a98302208cfa77afa 100644 --- a/Framework/StackInterface/CMakeLists.txt +++ b/Framework/StackInterface/CMakeLists.txt @@ -1,7 +1,7 @@ set ( CORSIKAstackinterface_HEADERS Stack.h - StackIterator.h + StackIteratorInterface.h ParticleBase.h ) diff --git a/Framework/StackInterface/ParticleBase.h b/Framework/StackInterface/ParticleBase.h index 5ef6ca662de7a8b9e02dc5d2d17fd4daf0f89169..752164dc7e5b8cf2ad96bf245e80e40e583ce971 100644 --- a/Framework/StackInterface/ParticleBase.h +++ b/Framework/StackInterface/ParticleBase.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. @@ -16,11 +16,8 @@ class StackData; // forward decl namespace corsika::stack { - // template <typename> class PI;// : public ParticleBase<StackIteratorInterface> { - // template <typename, template <typename> typename> class Stack; // forward decl - /** - \class ParticleBase + @class ParticleBase The base class to define the readout of particle properties from a particle stack. Every stack must implement this readout via the @@ -31,29 +28,56 @@ namespace corsika::stack { class ParticleBase { public: - ParticleBase() {} + ParticleBase() = default; private: - ParticleBase(ParticleBase&); + // those copy constructors and assigments should never be implemented + ParticleBase(ParticleBase&) = delete; + ParticleBase operator=(ParticleBase&) = delete; + ParticleBase(ParticleBase&&) = delete; + ParticleBase operator=(ParticleBase&&) = delete; + ParticleBase(const ParticleBase&) = delete; + ParticleBase operator=(const ParticleBase&) = delete; public: - /// delete this particle on the stack. The corresponding iterator - /// will be invalidated by this operation + /** delete this particle on the stack. The corresponding iterator + * will be invalidated by this operation + */ void Delete() { GetIterator().GetStack().Delete(GetIterator()); } - // protected: // todo should be proteced, but don't now how to 'friend Stack' - /// Function to provide CRTP access to inheriting class (type) + /** + * Add a secondary particle based on *this on the stack @param + * args is a variadic list of input data that has to match the + * function description in the user defined ParticleInterface::AddSecondary(...) + */ + template <typename... Args> + StackIterator AddSecondary(const Args... args) { + return GetStack().AddSecondary(GetIterator(), args...); + } + + // protected: // todo should [MAY]be proteced, but don't now how to 'friend Stack' + // Function to provide CRTP access to inheriting class (type) + /** + * return the corresponding StackIterator for this particle + */ StackIterator& GetIterator() { return static_cast<StackIterator&>(*this); } const StackIterator& GetIterator() const { return static_cast<const StackIterator&>(*this); } protected: - /// access to underling stack data + /** @name Access to underlying stack data + @{ + */ auto& GetStackData() { return GetIterator().GetStackData(); } const auto& GetStackData() const { return GetIterator().GetStackData(); } + auto& GetStack() { return GetIterator().GetStack(); } + const auto& GetStack() const { return GetIterator().GetStack(); } + ///@} - /// return the index number of the underlying iterator object + /** + * return the index number of the underlying iterator object + */ int GetIndex() const { return GetIterator().GetIndex(); } }; diff --git a/Framework/StackInterface/Stack.dox b/Framework/StackInterface/Stack.dox new file mode 100644 index 0000000000000000000000000000000000000000..94aea67432730b83a11c29fe8c7fba54800ecb1e --- /dev/null +++ b/Framework/StackInterface/Stack.dox @@ -0,0 +1,20 @@ +/** + @page stack Description of particle stacks + + In the CORSIKA 8 framework particle data is always stored in + particle stacks. A particle is, thus, always a reference (iterator) + to an entry on a stack, e.g. + + \verbatim + ModelStack stack; + stack.begin(); // returns an iterator: StackIterator, ConstStackIterator + + *stack.begin(); // return a reference to ParticleInterfaceType, which is the class provided by the user to read/write particle properties + + \endverbatim + + All functionality and algorithms for stack data access is located in the namespace corsika::stack + + The minimal example of how to use this is shown in stack_example.cc + +*/ \ No newline at end of file diff --git a/Framework/StackInterface/Stack.h b/Framework/StackInterface/Stack.h index f47c15d3daf3071a8c71da1b81b71e575a620784..91d671f5fd83d44194343010c6c677490063ec71 100644 --- a/Framework/StackInterface/Stack.h +++ b/Framework/StackInterface/Stack.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. @@ -12,7 +12,9 @@ #ifndef _include_Stack_h__ #define _include_Stack_h__ -#include <corsika/stack/StackIterator.h> // include here, to help application programmres +#include <corsika/stack/StackIteratorInterface.h> + +#include <stdexcept> /** All classes around management of particles on a stack. @@ -20,8 +22,16 @@ namespace corsika::stack { + /** + This is just a forward declatation for the user-defined + ParticleInterface, which is one of the essential template + parameters for the Stack. + + Important: ParticleInterface must inherit from ParticleBase ! + */ + template <typename> - class PI; // forward decl + class ParticleInterface; // forward decl /** Interface definition of a Stack object. The Stack implements the @@ -29,15 +39,17 @@ namespace corsika::stack { loops etc. */ - template <typename StackData, template <typename> typename PI> + template <typename StackData, template <typename> typename ParticleInterface> class Stack : public StackData { public: - typedef Stack<StackData, PI> StackType; - typedef StackIteratorInterface<StackData, PI> StackIterator; - typedef const StackIterator ConstStackIterator; + typedef Stack<StackData, ParticleInterface> StackType; + typedef StackIteratorInterface<StackData, ParticleInterface> StackIterator; + typedef ConstStackIteratorInterface<StackData, ParticleInterface> ConstStackIterator; + // typedef const StackIterator ConstStackIterator; typedef typename StackIterator::ParticleInterfaceType ParticleType; - friend class StackIteratorInterface<StackData, PI>; + friend class StackIteratorInterface<StackData, ParticleInterface>; + friend class ConstStackIteratorInterface<StackData, ParticleInterface>; public: using StackData::GetCapacity; @@ -57,20 +69,30 @@ namespace corsika::stack { StackIterator end() { return StackIterator(*this, GetSize()); } StackIterator last() { return StackIterator(*this, GetSize() - 1); } - /// these are functions required by std containers and std loops + ConstStackIterator begin() const { return ConstStackIterator(*this, 0); } + ConstStackIterator end() const { return ConstStackIterator(*this, GetSize()); } + ConstStackIterator last() const { return ConstStackIterator(*this, GetSize() - 1); } + ConstStackIterator cbegin() const { return ConstStackIterator(*this, 0); } ConstStackIterator cend() const { return ConstStackIterator(*this, GetSize()); } ConstStackIterator clast() const { return ConstStackIterator(*this, GetSize() - 1); } /// increase stack size, create new particle at end of stack - StackIterator NewParticle() { + template <typename... Args> + StackIterator AddParticle(const Args... v) { + IncrementSize(); + return StackIterator(*this, GetSize() - 1, v...); + } + template <typename... Args> + StackIterator AddSecondary(StackIterator& parent, const Args... v) { IncrementSize(); - return StackIterator(*this, GetSize() - 1); + return StackIterator(*this, GetSize() - 1, parent, v...); } void Copy(StackIterator& a, StackIterator& b) { Copy(a.GetIndex(), b.GetIndex()); } /// delete this particle void Delete(StackIterator& p) { if (GetSize() == 0) { /*error*/ + throw std::runtime_error("Stack, cannot delete entry since size is zero"); } if (p.GetIndex() < GetSize() - 1) Copy(GetSize() - 1, p.GetIndex()); DeleteLast(); diff --git a/Framework/StackInterface/StackIterator.h b/Framework/StackInterface/StackIterator.h deleted file mode 100644 index 47424f60d09faab92b19cb51bfba0479c4fbe5d2..0000000000000000000000000000000000000000 --- a/Framework/StackInterface/StackIterator.h +++ /dev/null @@ -1,113 +0,0 @@ - -/** - * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu - * - * See file AUTHORS for a list of contributors. - * - * This software is distributed under the terms of the GNU General Public - * Licence version 3 (GPL Version 3). See file LICENSE for a full version of - * the license. - */ - -#ifndef _include_StackIterator_h__ -#define _include_StackIterator_h__ - -#include <corsika/stack/ParticleBase.h> - -class StackData; // forward decl - -namespace corsika::stack { - - template <typename StackData, template <typename> typename ParticleInterface> - class Stack; // forward decl - - /** - @class StackIterator - - The StackIterator is the main interface to iterator over - particles on a stack. At the same time StackIterator is a - Particle object by itself, thus there is no difference between - type and ref_type for convenience of the physicist. - - This allows to write code like - \verbatim - for (auto& p : theStack) { p.SetEnergy(newEnergy); } - \endverbatim - - The template argument Stack determines the type of Stack object - the data is stored in. A pointer to the Stack object is part of - the StackIterator. In addition to Stack the iterator only knows - the index fIndex in the Stack data. - - The template argument Particles acts as a policy to provide - readout function of Particle data from the stack. The Particle - class must know how to retrieve information from the Stack data - for a particle entry at any index fIndex. - */ - - template <typename StackData, template <typename> typename ParticleInterface> - class StackIteratorInterface - : public ParticleInterface<StackIteratorInterface<StackData, ParticleInterface> > { - - typedef Stack<StackData, ParticleInterface> StackType; - typedef ParticleInterface<StackIteratorInterface<StackData, ParticleInterface> > - ParticleInterfaceType; - - // friend class ParticleInterface<StackIterator<StackData>>; // to access GetStackData - friend class Stack<StackData, ParticleInterface>; // for access to GetIndex - friend class ParticleBase<StackIteratorInterface>; // for access to GetStackData - - private: - int fIndex = 0; - StackType* fData = 0; // todo is this problematic, when stacks are copied? - - public: - // StackIterator() : fData(0), fIndex(0) { } - StackIteratorInterface(StackType& data, const int index) - : fIndex(index) - , fData(&data) {} - - private: - StackIteratorInterface(const StackIteratorInterface& mit) - : fIndex(mit.fIndex) - , fData(mit.fData) {} - - public: - StackIteratorInterface& operator=(const StackIteratorInterface& mit) { - fIndex = mit.fIndex; - fData = mit.fData; - return *this; - } - - public: - StackIteratorInterface& operator++() { - ++fIndex; - return *this; - } - StackIteratorInterface operator++(int) { - StackIteratorInterface tmp(*this); - ++fIndex; - return tmp; - } - bool operator==(const StackIteratorInterface& rhs) { return fIndex == rhs.fIndex; } - bool operator!=(const StackIteratorInterface& rhs) { return fIndex != rhs.fIndex; } - - ParticleInterfaceType& operator*() { - return static_cast<ParticleInterfaceType&>(*this); - } - const ParticleInterfaceType& operator*() const { - return static_cast<const ParticleInterfaceType&>(*this); - } - - protected: - int GetIndex() const { return fIndex; } - StackType& GetStack() { return *fData; } - const StackType& GetStack() const { return *fData; } - StackData& GetStackData() { return fData->GetStackData(); } - const StackData& GetStackData() const { return fData->GetStackData(); } - - }; // end class StackIterator - -} // namespace corsika::stack - -#endif diff --git a/Framework/StackInterface/StackIteratorInterface.h b/Framework/StackInterface/StackIteratorInterface.h new file mode 100644 index 0000000000000000000000000000000000000000..7ac72c34bca96264fa9fed4e9906cecf882166db --- /dev/null +++ b/Framework/StackInterface/StackIteratorInterface.h @@ -0,0 +1,238 @@ + +/* + * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu + * + * See file AUTHORS for a list of contributors. + * + * This software is distributed under the terms of the GNU General Public + * Licence version 3 (GPL Version 3). See file LICENSE for a full version of + * the license. + */ + +#ifndef _include_StackIteratorinterface_h__ +#define _include_StackIteratorinterface_h__ + +#include <corsika/stack/ParticleBase.h> + +#include <type_traits> + +class StackData; // forward decl + +namespace corsika::stack { + + template <typename StackData, template <typename> typename ParticleInterface> + class Stack; // forward decl + + /** + @class StackIteratorInterface + + The StackIteratorInterface is the main interface to iterator over + particles on a stack. At the same time StackIteratorInterface is a + Particle object by itself, thus there is no difference between + type and ref_type for convenience of the physicist. + + This allows to write code like + \verbatim + for (auto& p : theStack) { p.SetEnergy(newEnergy); } + \endverbatim + + The template argument Stack determines the type of Stack object + the data is stored in. A pointer to the Stack object is part of + the StackIteratorInterface. In addition to Stack the iterator only knows + the index fIndex in the Stack data. + + The template argument Particles acts as a policy to provide + readout function of Particle data from the stack. The Particle + class must know how to retrieve information from the Stack data + for a particle entry at any index fIndex. + */ + + template <typename StackData, template <typename> typename ParticleInterface> + class StackIteratorInterface + : public ParticleInterface<StackIteratorInterface<StackData, ParticleInterface>> { + + typedef Stack<StackData, ParticleInterface> StackType; + /*typedef + typename std::conditional<std::is_const<StackData>::value, + const Stack<const StackData, ParticleInterface>&, + Stack<StackData, ParticleInterface>&>::type StackType;*/ + typedef ParticleInterface<StackIteratorInterface<StackData, ParticleInterface>> + ParticleInterfaceType; + + friend class Stack<StackData, ParticleInterface>; // for access to GetIndex + friend class ParticleBase<StackIteratorInterface>; // for access to GetStackData + + private: + int fIndex = 0; + StackType* fData = 0; // info: Particles and StackIterators become invalid when parent + // Stack is copied or deleted! + + // it is not allowed to create a "dangling" stack iterator + StackIteratorInterface() = delete; + + public: + /** iterator must always point to data, with an index: + @param data reference to the stack [rw] + @param index index on stack + */ + StackIteratorInterface(StackType& data, const int index) + : fIndex(index) + , fData(&data) {} + + /** constructor that also sets new values on particle data object + @param data reference to the stack [rw] + @param index index on stack + @param args variadic list of data to initialize stack entry, this must be + consistent with the definition of the user-provided + ParticleInterfaceType::SetParticleData(...) function + */ + template <typename... Args> + StackIteratorInterface(StackType& data, const int index, const Args... args) + : fIndex(index) + , fData(&data) { + (**this).SetParticleData(args...); + } + + /** constructor that also sets new values on particle data object, including reference + to parent particle + @param data reference to the stack [rw] + @param index index on stack + @param reference to parent particle [rw]. This can be used for thinning, particle + counting, history, etc. + @param args variadic list of data to initialize stack entry, this must be + consistent with the definition of the user-provided + ParticleInterfaceType::SetParticleData(...) function + */ + template <typename... Args> + StackIteratorInterface(StackType& data, const int index, + StackIteratorInterface& parent, const Args... args) + : fIndex(index) + , fData(&data) { + (**this).SetParticleData(*parent, args...); + } + + public: + /** @name Iterator interface + @{ + */ + StackIteratorInterface& operator++() { + ++fIndex; + return *this; + } + StackIteratorInterface operator++(int) { + StackIteratorInterface tmp(*this); + ++fIndex; + return tmp; + } + bool operator==(const StackIteratorInterface& rhs) { return fIndex == rhs.fIndex; } + bool operator!=(const StackIteratorInterface& rhs) { return fIndex != rhs.fIndex; } + /// Convert to value type + ParticleInterfaceType& operator*() { + return static_cast<ParticleInterfaceType&>(*this); + } + /// Convert to const value type + const ParticleInterfaceType& operator*() const { + return static_cast<const ParticleInterfaceType&>(*this); + } + ///@} + + protected: + /** @name Stack data access + */ + ///@{ + /// Get current particle index + inline int GetIndex() const { return fIndex; } + /// Get current particle Stack object + inline StackType& GetStack() { return *fData; } + /// Get current particle const Stack object + inline const StackType& GetStack() const { return *fData; } + /// Get current user particle StackData object + inline StackData& GetStackData() { return fData->GetStackData(); } + /// Get current const user particle StackData object + inline const StackData& GetStackData() const { return fData->GetStackData(); } + ///@} + }; // end class StackIterator + + /** + @class ConstStackIteratorInterface + + This is the iterator class for const-access to stack data + */ + + template <typename StackData, template <typename> typename ParticleInterface> + class ConstStackIteratorInterface + : public ParticleInterface< + ConstStackIteratorInterface<StackData, ParticleInterface>> { + + typedef Stack<StackData, ParticleInterface> StackType; + typedef ParticleInterface<ConstStackIteratorInterface<StackData, ParticleInterface>> + ParticleInterfaceType; + + friend class Stack<StackData, ParticleInterface>; // for access to GetIndex + friend class ParticleBase<ConstStackIteratorInterface>; // for access to GetStackData + + private: + int fIndex = 0; + const StackType* fData = 0; // info: Particles and StackIterators become invalid when + // parent Stack is copied or deleted! + + // we don't want to allow dangling iterators to exist + ConstStackIteratorInterface() = delete; + + public: + ConstStackIteratorInterface(const StackType& data, const int index) + : fIndex(index) + , fData(&data) {} + + /** + @class ConstStackIteratorInterface + + The const counterpart of StackIteratorInterface, which is used + for read-only iterator access on particle stack: + + \verbatim + for (const auto& p : theStack) { E += p.GetEnergy(); } + \endverbatim + + See documentation of StackIteratorInterface for more details. + */ + + public: + /** @name Iterator interface + */ + ///@{ + ConstStackIteratorInterface& operator++() { + ++fIndex; + return *this; + } + ConstStackIteratorInterface operator++(int) { + ConstStackIteratorInterface tmp(*this); + ++fIndex; + return tmp; + } + bool operator==(const ConstStackIteratorInterface& rhs) { + return fIndex == rhs.fIndex; + } + bool operator!=(const ConstStackIteratorInterface& rhs) { + return fIndex != rhs.fIndex; + } + + const ParticleInterfaceType& operator*() const { + return static_cast<const ParticleInterfaceType&>(*this); + } + ///@} + + protected: + /** @name Stack data access + Only the const versions for read-only access + */ + ///@{ + inline int GetIndex() const { return fIndex; } + inline const StackType& GetStack() const { return *fData; } + inline const StackData& GetStackData() const { return fData->GetStackData(); } + ///@} + }; // end class ConstStackIterator + +} // namespace corsika::stack + +#endif diff --git a/Framework/StackInterface/testStackInterface.cc b/Framework/StackInterface/testStackInterface.cc index 078a09407c713287c36c9a48d20e5e842a32bc09..cde5a76e2b72dc7563efbd554a3024c4d28fff9f 100644 --- a/Framework/StackInterface/testStackInterface.cc +++ b/Framework/StackInterface/testStackInterface.cc @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. @@ -23,7 +23,7 @@ using namespace corsika::stack; using namespace std; // definition of stack-data object -class StackOneData { +class TestStackData { public: // these functions are needed for the Stack interface @@ -57,22 +57,42 @@ private: // defintion of a stack-readout object, the iteractor dereference // operator will deliver access to these function template <typename StackIteratorInterface> -class ParticleInterface : public ParticleBase<StackIteratorInterface> { - // using ParticleBase<StackIteratorInterface>::Delete; +class TestParticleInterface : public ParticleBase<StackIteratorInterface> { + using ParticleBase<StackIteratorInterface>::GetStack; using ParticleBase<StackIteratorInterface>::GetStackData; using ParticleBase<StackIteratorInterface>::GetIndex; + using ParticleBase<StackIteratorInterface>::GetIterator; public: + // one version + StackIteratorInterface& AddSecondary(const double v) { + GetStack().AddParticle(v); + return GetIterator(); + } + // another version + void AddSecondary(const double v, const double p) { GetStack().AddParticle(v + p); } + + void SetParticleData(const double v) { SetData(v); } + void SetData(const double v) { GetStackData().SetData(GetIndex(), v); } double GetData() const { return GetStackData().GetData(GetIndex()); } }; +typedef Stack<TestStackData, TestParticleInterface> StackTest; +typedef StackTest::ParticleType Particle; + TEST_CASE("Stack", "[Stack]") { + // helper function for sum over stack data + auto sum = [](const StackTest& stack) { + double v = 0; + for (const auto& p : stack) v += p.GetData(); + return v; + }; + SECTION("StackInterface") { // construct a valid Stack object - typedef Stack<StackOneData, ParticleInterface> StackTest; StackTest s; s.Init(); s.Clear(); @@ -85,44 +105,55 @@ TEST_CASE("Stack", "[Stack]") { REQUIRE(s.GetSize() == 0); } - SECTION("write") { + SECTION("construct") { - // construct a valid Stack object - typedef Stack<StackOneData, ParticleInterface> StackTest; + // construct a valid, empty Stack object StackTest s; } - SECTION("read") { + SECTION("write and read") { - typedef Stack<StackOneData, ParticleInterface> StackTest; StackTest s; - s.NewParticle().SetData(9.9); - cout << "kk" << endl; - double v = 0; - for (auto& p : s) { - cout << typeid(p).name() << endl; - v += p.GetData(); - } - cout << "k222k" << endl; - + s.AddParticle(9.9); + const double v = sum(s); REQUIRE(v == 9.9); } - SECTION("delete_stack") { + SECTION("delete from stack") { - typedef Stack<StackOneData, ParticleInterface> StackTest; StackTest s; - auto p = s.NewParticle(); + REQUIRE(s.GetSize() == 0); + StackTest::StackIterator p = s.AddParticle(0.); // valid way to access particle data p.SetData(9.9); + REQUIRE(s.GetSize() == 1); s.Delete(p); + REQUIRE(s.GetSize() == 0); } - SECTION("delete_particle") { + SECTION("delete particle") { - typedef Stack<StackOneData, ParticleInterface> StackTest; StackTest s; - auto p = s.NewParticle(); - p.SetData(9.9); + REQUIRE(s.GetSize() == 0); + auto p = + s.AddParticle(9.9); // also valid way to access particle data, identical to above + REQUIRE(s.GetSize() == 1); p.Delete(); + REQUIRE(s.GetSize() == 0); + } + + SECTION("create secondaries") { + + StackTest s; + REQUIRE(s.GetSize() == 0); + auto iter = s.AddParticle(9.9); + Particle& p = *iter; // also this is valid to access particle data + REQUIRE(s.GetSize() == 1); + p.AddSecondary(4.4); + REQUIRE(s.GetSize() == 2); + p.AddSecondary(3.3, 2.2); + REQUIRE(s.GetSize() == 3); + double v = 0; + for (auto& p : s) { v += p.GetData(); } + REQUIRE(v == 9.9 + 4.4 + 3.3 + 2.2); } } diff --git a/Framework/Units/testUnits.cc b/Framework/Units/testUnits.cc index 43d8e94e10c5fe6351d1cb5071372eeda24e3ec0..e8f389a05818615475dd988cce1181f6bf66ba42 100644 --- a/Framework/Units/testUnits.cc +++ b/Framework/Units/testUnits.cc @@ -1,4 +1,5 @@ -/** + +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Utilities/Bit.h b/Framework/Utilities/Bit.h index e1387c5c7554b8e9cc9cace8356bb59790cf25f7..7306e76d8d7f979fe18974452cd67a25b75b99c7 100644 --- a/Framework/Utilities/Bit.h +++ b/Framework/Utilities/Bit.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Utilities/COMBoost.cc b/Framework/Utilities/COMBoost.cc index a9bd4115362de0685dd8bbcfd58cda9ff3064a2b..5d8b00857b66afb73c7cbbe922b65e87c57e767a 100644 --- a/Framework/Utilities/COMBoost.cc +++ b/Framework/Utilities/COMBoost.cc @@ -1,4 +1,5 @@ -/** + +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Utilities/COMBoost.h b/Framework/Utilities/COMBoost.h index e48de10ba1ea87f76a3a5d715495061c35c2efeb..eebc8358ad5f5891587c3ee9bda036e7c6b98784 100644 --- a/Framework/Utilities/COMBoost.h +++ b/Framework/Utilities/COMBoost.h @@ -1,4 +1,5 @@ -/** + +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Utilities/CorsikaFenv.h b/Framework/Utilities/CorsikaFenv.h index d8aa00b3f0987973c71af606d2d5dbd93304dfe4..e7df5953461aa4d98dab8fa917b8b20847a22ddd 100644 --- a/Framework/Utilities/CorsikaFenv.h +++ b/Framework/Utilities/CorsikaFenv.h @@ -1,4 +1,5 @@ -/** + +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. @@ -6,14 +7,6 @@ * This software is distributed under the terms of the GNU General Public * Licence version 3 (GPL Version 3). See file LICENSE for a full version of * the license. - * - * Provide portable or fallback versions of feenableexcept() and fedisableexcept() - * Exist by default in glibc since version 2.2, but not in the standard - * fenv.h / cfenv headers for C 99 or C++ 11 - * - * \author Lukas Nellen - * \date 14 Jan 2019 - * */ #ifndef CORSIKA_CORSIKAFENV_H diff --git a/Framework/Utilities/CorsikaFenvDefault.cc b/Framework/Utilities/CorsikaFenvDefault.cc index f51fe55dca288307ecd0a8d7a86419d7c03e1dc0..f1bb7732bfe111ca3c71018282ac346bacadeee2 100644 --- a/Framework/Utilities/CorsikaFenvDefault.cc +++ b/Framework/Utilities/CorsikaFenvDefault.cc @@ -1,4 +1,5 @@ -/** + +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. @@ -6,15 +7,6 @@ * This software is distributed under the terms of the GNU General Public * Licence version 3 (GPL Version 3). See file LICENSE for a full version of * the license. - * - * Versions of feenableexcept() and fedisableexcept() - * exist in fenv.h / cfenv headers for C 99 or C++ 11 - * Nothing needed. - * - * - * \author Lukas Nellen - * \date 14 Jan 2019 - * */ // do nothing, functions exist in system libraries diff --git a/Framework/Utilities/CorsikaFenvFallback.cc b/Framework/Utilities/CorsikaFenvFallback.cc index f3e2f00f26840838365b45fa7426930a8b818e6e..ed71c5b6c07096fe3d846fd82d5afa5c284e6599 100644 --- a/Framework/Utilities/CorsikaFenvFallback.cc +++ b/Framework/Utilities/CorsikaFenvFallback.cc @@ -1,4 +1,5 @@ -/** + +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. @@ -6,16 +7,6 @@ * This software is distributed under the terms of the GNU General Public * Licence version 3 (GPL Version 3). See file LICENSE for a full version of * the license. - * - * Provide fallback versions of feenableexcept() and fedisableexcept() - * Don't exist in the standard - * fenv.h / cfenv headers for C 99 or C++ 11 - * - * For platforms without implementation; do-nothing dummy. - * - * \author Lukas Nellen - * \date 14 Jan 2019 - * */ #include <corsika/utl/CorsikaFenv.h> diff --git a/Framework/Utilities/CorsikaFenvOSX.cc b/Framework/Utilities/CorsikaFenvOSX.cc index 1028c4b7e0988bb7ced605f71990c9c9f344fbbc..4495ebd1e823ad5a9a1b894d07c09ae8f842d068 100644 --- a/Framework/Utilities/CorsikaFenvOSX.cc +++ b/Framework/Utilities/CorsikaFenvOSX.cc @@ -1,3 +1,14 @@ + +/* + * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu + * + * See file AUTHORS for a list of contributors. + * + * This software is distributed under the terms of the GNU General Public + * Licence version 3 (GPL Version 3). See file LICENSE for a full version of + * the license. + */ + /** * Import public domain code * diff --git a/Framework/Utilities/Singleton.h b/Framework/Utilities/Singleton.h index 00faa2fd18ba76c3d3555507e141a8e79f802a87..3780cc99a1398833a77729e26eb11f9b089ba753 100644 --- a/Framework/Utilities/Singleton.h +++ b/Framework/Utilities/Singleton.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Utilities/testCOMBoost.cc b/Framework/Utilities/testCOMBoost.cc index 996da626138ebdd0ec7b989672f6161638729173..501db86435b535f14b47e6f072cbf885878e8293 100644 --- a/Framework/Utilities/testCOMBoost.cc +++ b/Framework/Utilities/testCOMBoost.cc @@ -1,4 +1,5 @@ -/** + +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Utilities/testCorsikaFenv.cc b/Framework/Utilities/testCorsikaFenv.cc index 6f76930c86c7d3ee22f5a155700af35de7959098..eb4885b9a233135356e8a047b1dc4c86861e25b4 100644 --- a/Framework/Utilities/testCorsikaFenv.cc +++ b/Framework/Utilities/testCorsikaFenv.cc @@ -1,4 +1,5 @@ -/** + +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Framework/Utilities/try_feenableexcept.cc b/Framework/Utilities/try_feenableexcept.cc index 1ee8ecc1eeb67c267578b74388d3054d12c16872..9ca52262c2903878a70e4090f031f8915b619265 100644 --- a/Framework/Utilities/try_feenableexcept.cc +++ b/Framework/Utilities/try_feenableexcept.cc @@ -1,4 +1,5 @@ -/** + +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. @@ -6,12 +7,6 @@ * This software is distributed under the terms of the GNU General Public * Licence version 3 (GPL Version 3). See file LICENSE for a full version of * the license. - * - * Test code for cmake to check if feenableexcept exists in cfenv - * - * \author Lukas Nellen - * \date 15 Jan 2019 - * */ #include <cfenv> diff --git a/Main/Environment.h b/Main/Environment.h index 90582b3dfb00d2d85850b81455a2a4c0c061413b..6839def48c2f6fddfafd0beb5fd4ca46058ebd09 100644 --- a/Main/Environment.h +++ b/Main/Environment.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Main/Stack.h b/Main/Stack.h index 90582b3dfb00d2d85850b81455a2a4c0c061413b..6839def48c2f6fddfafd0beb5fd4ca46058ebd09 100644 --- a/Main/Stack.h +++ b/Main/Stack.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Main/shower.cc b/Main/shower.cc index 10facda7435af5d9f6f1ab83223a25ad61c068b1..5ca8d4ab2532081c4654cd51e98b9bcdda9cc2f6 100644 --- a/Main/shower.cc +++ b/Main/shower.cc @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Processes/HadronicElasticModel/HadronicElasticModel.cc b/Processes/HadronicElasticModel/HadronicElasticModel.cc index b53a4e1aee0c85d64c0fcba4ce439219381cfcef..943195b681a117ac9b36a1968d78ab8a8ab87629 100644 --- a/Processes/HadronicElasticModel/HadronicElasticModel.cc +++ b/Processes/HadronicElasticModel/HadronicElasticModel.cc @@ -1,4 +1,5 @@ -/** + +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Processes/HadronicElasticModel/HadronicElasticModel.h b/Processes/HadronicElasticModel/HadronicElasticModel.h index 9899e4e4c8939e4ac0f26523ac604fbd019584ff..8ddc55fa0504dc0950c7b4cb751c47df61b4ecb0 100644 --- a/Processes/HadronicElasticModel/HadronicElasticModel.h +++ b/Processes/HadronicElasticModel/HadronicElasticModel.h @@ -1,4 +1,5 @@ -/** + +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Processes/NullModel/NullModel.cc b/Processes/NullModel/NullModel.cc index 4130bf0c4d5519408b272322dd45d60ee3b27b0e..09956e7c703468d635cf5e7770fc067c036b52b7 100644 --- a/Processes/NullModel/NullModel.cc +++ b/Processes/NullModel/NullModel.cc @@ -1,4 +1,5 @@ -/** + +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Processes/NullModel/NullModel.h b/Processes/NullModel/NullModel.h index 428069f12c5d8884470d9077a20d7703fd8faa8b..6222e290f53e3d2e5d193ad7597f2a086b9eb2ff 100644 --- a/Processes/NullModel/NullModel.h +++ b/Processes/NullModel/NullModel.h @@ -1,4 +1,5 @@ -/** + +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Processes/NullModel/testNullModel.cc b/Processes/NullModel/testNullModel.cc index 56d635d1fafbf1806ed0a940985040934aa6a31d..6bf7d99da7af02d8b0b4cd60b6f69628e28532e9 100644 --- a/Processes/NullModel/testNullModel.cc +++ b/Processes/NullModel/testNullModel.cc @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. @@ -21,6 +21,8 @@ #include <corsika/units/PhysicalUnits.h> +#include <corsika/stack/super_stupid/SuperStupidStack.h> + #include <corsika/setup/SetupStack.h> #include <corsika/setup/SetupTrajectory.h> @@ -30,16 +32,19 @@ using namespace corsika; TEST_CASE("NullModel", "[processes]") { - auto const& cs = + auto const& dummyCS = geometry::RootCoordinateSystem::GetInstance().GetRootCoordinateSystem(); - geometry::Point const origin(cs, {0_m, 0_m, 0_m}); + geometry::Point const origin(dummyCS, {0_m, 0_m, 0_m}); geometry::Vector<corsika::units::si::SpeedType::dimension_type> v( - cs, 0_m / second, 0_m / second, 1_m / second); + dummyCS, 0_m / second, 0_m / second, 1_m / second); geometry::Line line(origin, v); geometry::Trajectory<geometry::Line> track(line, 10_s); setup::Stack stack; - auto particle = stack.NewParticle(); + auto particle = stack.AddParticle( + particles::Code::Electron, 1.5_GeV, + stack::super_stupid::MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), + geometry::Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s); SECTION("interface") { diff --git a/Processes/Sibyll/Decay.h b/Processes/Sibyll/Decay.h index 217ed87fac7a4512a901fabaa995d81ff81ea5cd..3998cb791110b42668da128030043f7b63cf8e30 100644 --- a/Processes/Sibyll/Decay.h +++ b/Processes/Sibyll/Decay.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. @@ -163,24 +163,22 @@ namespace corsika::process { } template <typename Particle, typename Stack> - void DoDecay(Particle& p, Stack& s) { + void DoDecay(Particle& p, Stack&) { using corsika::geometry::Point; using namespace corsika::units::si; fCount++; SibStack ss; ss.Clear(); - // copy particle to sibyll stack - auto pin = ss.NewParticle(); const corsika::particles::Code pCode = p.GetPID(); - pin.SetPID(process::sibyll::ConvertToSibyllRaw(pCode)); - pin.SetEnergy(p.GetEnergy()); - pin.SetMomentum(p.GetMomentum()); - // setting particle mass with Corsika values, may be inconsistent with sibyll - // internal values - // TODO: #warning setting particle mass with Corsika values, may be inconsistent - // with sibyll internal values - pin.SetMass(corsika::particles::GetMass(pCode)); + // copy particle to sibyll stack + ss.AddParticle(process::sibyll::ConvertToSibyllRaw(pCode), p.GetEnergy(), + p.GetMomentum(), + // setting particle mass with Corsika values, may be inconsistent + // with sibyll internal values + // TODO: #warning setting particle mass with Corsika values, may be + // inconsistent with sibyll internal values + corsika::particles::GetMass(pCode)); // remember position Point const decayPoint = p.GetPosition(); TimeType const t0 = p.GetTime(); @@ -203,12 +201,8 @@ namespace corsika::process { // FOR NOW: skip particles that have decayed in Sibyll, move to iterator? if (psib.HasDecayed()) continue; // add to corsika stack - auto pnew = s.NewParticle(); - pnew.SetEnergy(psib.GetEnergy()); - pnew.SetPID(process::sibyll::ConvertFromSibyll(psib.GetPID())); - pnew.SetMomentum(psib.GetMomentum()); - pnew.SetPosition(decayPoint); - pnew.SetTime(t0); + p.AddSecondary(process::sibyll::ConvertFromSibyll(psib.GetPID()), + psib.GetEnergy(), psib.GetMomentum(), decayPoint, t0); } // empty sibyll stack ss.Clear(); diff --git a/Processes/Sibyll/Interaction.h b/Processes/Sibyll/Interaction.h index 288e724fe086c05adaa280a4fe385be3fdb3e27f..14ce4112e623bfc6ac77c9a85d8204fcb56f1200 100644 --- a/Processes/Sibyll/Interaction.h +++ b/Processes/Sibyll/Interaction.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. @@ -153,7 +153,7 @@ namespace corsika::process::sibyll { << weightedProdCrossSection / 1_mbarn << endl; // calculate interaction length in medium -#warning check interaction length units + //#warning check interaction length units GrammageType const int_length = avgTargetMassNumber * corsika::units::constants::u / weightedProdCrossSection; std::cout << "Interaction: " @@ -172,7 +172,7 @@ namespace corsika::process::sibyll { */ template <typename Particle, typename Stack> - corsika::process::EProcessReturn DoInteraction(Particle& p, Stack& s) { + corsika::process::EProcessReturn DoInteraction(Particle& p, Stack&) { using namespace corsika::units; using namespace corsika::utl; @@ -254,7 +254,7 @@ namespace corsika::process::sibyll { Here we read the cross section from the interaction model again, should be passed from GetInteractionLength if possible */ -#warning reading interaction cross section again, should not be necessary + //#warning reading interaction cross section again, should not be necessary auto const& compVec = mediumComposition.GetComponents(); std::vector<si::CrossSectionType> cross_section_of_components(compVec.size()); @@ -262,6 +262,8 @@ namespace corsika::process::sibyll { auto const targetId = compVec[i]; const auto [sigProd, nNuc] = GetCrossSection(corsikaBeamId, targetId, Ecm); cross_section_of_components[i] = sigProd; + int ideleteme = nNuc; // to avoid not used warning in array binding + ideleteme = ideleteme; // to avoid not used warning in array binding } const auto targetCode = currentNode->GetModelProperties().SampleTarget( @@ -326,12 +328,9 @@ namespace corsika::process::sibyll { auto const Plab = boost.fromCoM(FourVector(eCoM, pCoM)); // add to corsika stack - auto pnew = s.NewParticle(); - pnew.SetPID(process::sibyll::ConvertFromSibyll(psib.GetPID())); - pnew.SetEnergy(Plab.GetTimeLikeComponent()); - pnew.SetMomentum(Plab.GetSpaceLikeComponents()); - pnew.SetPosition(pOrig); - pnew.SetTime(tOrig); + auto pnew = p.AddSecondary(process::sibyll::ConvertFromSibyll(psib.GetPID()), + Plab.GetTimeLikeComponent(), + Plab.GetSpaceLikeComponents(), pOrig, tOrig); Plab_final += pnew.GetMomentum(); Elab_final += pnew.GetEnergy(); diff --git a/Processes/Sibyll/ParticleConversion.cc b/Processes/Sibyll/ParticleConversion.cc index 9925b97b9e90dba68dc38f46fd5ddb32e71c68c7..1410775bf384239ccfa5133bba674d2751e6596e 100644 --- a/Processes/Sibyll/ParticleConversion.cc +++ b/Processes/Sibyll/ParticleConversion.cc @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Processes/Sibyll/ParticleConversion.h b/Processes/Sibyll/ParticleConversion.h index 9bd417da2398d6eaec29b24d85242c1ad0d867ab..90e0b612c49fa312dfa1aabe95eb580ebb0df67e 100644 --- a/Processes/Sibyll/ParticleConversion.h +++ b/Processes/Sibyll/ParticleConversion.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Processes/Sibyll/SibStack.h b/Processes/Sibyll/SibStack.h index 83d902f5c2b030ed455afbbe38867fa8b50dbf3c..22b446c57c4c8febbeef1fe9312ea7810bd99e3b 100644 --- a/Processes/Sibyll/SibStack.h +++ b/Processes/Sibyll/SibStack.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. @@ -29,9 +29,7 @@ namespace corsika::process::sibyll { void Init(); void Clear() { s_plist_.np = 0; } - int GetSize() const { return s_plist_.np; } - int GetCapacity() const { return 8000; } void SetId(const int i, const int v) { s_plist_.llist[i] = v; } @@ -43,7 +41,6 @@ namespace corsika::process::sibyll { using namespace corsika::units::si; s_plist_.p[4][i] = v / 1_GeV; } - void SetMomentum(const int i, const MomentumVector& v) { using namespace corsika::units::si; auto tmp = v.GetComponents(); @@ -51,7 +48,6 @@ namespace corsika::process::sibyll { } int GetId(const int i) const { return s_plist_.llist[i]; } - corsika::units::si::HEPEnergyType GetEnergy(const int i) const { using namespace corsika::units::si; return s_plist_.p[3][i] * 1_GeV; @@ -60,7 +56,6 @@ namespace corsika::process::sibyll { using namespace corsika::units::si; return s_plist_.p[4][i] * 1_GeV; } - MomentumVector GetMomentum(const int i) const { using corsika::geometry::CoordinateSystem; using corsika::geometry::QuantityVector; @@ -93,6 +88,27 @@ namespace corsika::process::sibyll { using corsika::stack::ParticleBase<StackIteratorInterface>::GetIndex; public: + void SetParticleData(const int vID, // corsika::process::sibyll::SibyllCode vID, + const corsika::units::si::HEPEnergyType vE, + const MomentumVector& vP, + const corsika::units::si::HEPMassType vM) { + SetPID(vID); + SetEnergy(vE); + SetMomentum(vP); + SetMass(vM); + } + + void SetParticleData(ParticleInterface<StackIteratorInterface>& /*parent*/, + const int vID, // corsika::process::sibyll::SibyllCode vID, + const corsika::units::si::HEPEnergyType vE, + const MomentumVector& vP, + const corsika::units::si::HEPMassType vM) { + SetPID(vID); + SetEnergy(vE); + SetMomentum(vP); + SetMass(vM); + } + void SetEnergy(const corsika::units::si::HEPEnergyType v) { GetStackData().SetEnergy(GetIndex(), v); } diff --git a/Processes/Sibyll/sibyll2.3c.cc b/Processes/Sibyll/sibyll2.3c.cc index f614b596bdcb376fc138af70a1af6539852b54f0..61766ff1128564977ddf296387389fc7e24a20f0 100644 --- a/Processes/Sibyll/sibyll2.3c.cc +++ b/Processes/Sibyll/sibyll2.3c.cc @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Processes/Sibyll/sibyll2.3c.h b/Processes/Sibyll/sibyll2.3c.h index 104b55eb0bf2e6fc12277f6d62bf1adcf567acb4..1a731ab1353d252727506c4669bc86478dd0cf12 100644 --- a/Processes/Sibyll/sibyll2.3c.h +++ b/Processes/Sibyll/sibyll2.3c.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Processes/Sibyll/testSibyll.cc b/Processes/Sibyll/testSibyll.cc index 9b078fd087c16d6238837ce26783468640777054..9c6ba2ff6cbb08e391cb83b983104e9945d0b599 100644 --- a/Processes/Sibyll/testSibyll.cc +++ b/Processes/Sibyll/testSibyll.cc @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. @@ -116,7 +116,12 @@ TEST_CASE("SibyllInterface", "[processes]") { SECTION("InteractionInterface") { setup::Stack stack; - auto particle = stack.NewParticle(); + const HEPEnergyType E0 = 10_GeV; + HEPMomentumType P0 = + sqrt(E0 * E0 - particles::Proton::GetMass() * particles::Proton::GetMass()); + auto plab = stack::super_stupid::MomentumVector(cs, {0_GeV, 0_GeV, -P0}); + geometry::Point pos(cs, 0_m, 0_m, 0_m); + auto particle = stack.AddParticle(particles::Code::Proton, E0, plab, pos, 0_ns); Interaction model(env); @@ -130,19 +135,12 @@ TEST_CASE("SibyllInterface", "[processes]") { SECTION("DecayInterface") { setup::Stack stack; - auto particle = stack.NewParticle(); - { - const HEPEnergyType E0 = 10_GeV; - particle.SetPID(particles::Code::Proton); - HEPMomentumType P0 = - sqrt(E0 * E0 - particles::Proton::GetMass() * particles::Proton::GetMass()); - auto plab = stack::super_stupid::MomentumVector(cs, {0_GeV, 0_GeV, -P0}); - particle.SetEnergy(E0); - particle.SetMomentum(plab); - particle.SetTime(0_ns); - geometry::Point p(cs, 0_m, 0_m, 0_m); - particle.SetPosition(p); - } + const HEPEnergyType E0 = 10_GeV; + HEPMomentumType P0 = + sqrt(E0 * E0 - particles::Proton::GetMass() * particles::Proton::GetMass()); + auto plab = stack::super_stupid::MomentumVector(cs, {0_GeV, 0_GeV, -P0}); + geometry::Point pos(cs, 0_m, 0_m, 0_m); + auto particle = stack.AddParticle(particles::Code::Proton, E0, plab, pos, 0_ns); Decay model; diff --git a/Processes/StackInspector/StackInspector.cc b/Processes/StackInspector/StackInspector.cc index 184eae5b543b9779696ccbd5b45036ed95edcfe4..312fe40ec82dfd4f1faf12870e397ef4fbe794bc 100644 --- a/Processes/StackInspector/StackInspector.cc +++ b/Processes/StackInspector/StackInspector.cc @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Processes/StackInspector/StackInspector.h b/Processes/StackInspector/StackInspector.h index 6a14b4e6eb9578e8c283637c3afbaee71f97256b..8bb2ca45c498f7535aa6cae2761142ff8dabce74 100644 --- a/Processes/StackInspector/StackInspector.h +++ b/Processes/StackInspector/StackInspector.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Processes/StackInspector/testStackInspector.cc b/Processes/StackInspector/testStackInspector.cc index 5ff999c1d13721365f560cf5c9ba741907356651..784be88f99131372f528b264660e7db6f93d3625 100644 --- a/Processes/StackInspector/testStackInspector.cc +++ b/Processes/StackInspector/testStackInspector.cc @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. @@ -30,16 +30,19 @@ using namespace corsika; TEST_CASE("StackInspector", "[processes]") { - auto const& cs = + auto const& rootCS = geometry::RootCoordinateSystem::GetInstance().GetRootCoordinateSystem(); - geometry::Point const origin(cs, {0_m, 0_m, 0_m}); + geometry::Point const origin(rootCS, {0_m, 0_m, 0_m}); geometry::Vector<corsika::units::si::SpeedType::dimension_type> v( - cs, 0_m / second, 0_m / second, 1_m / second); + rootCS, 0_m / second, 0_m / second, 1_m / second); geometry::Line line(origin, v); geometry::Trajectory<geometry::Line> track(line, 10_s); setup::Stack stack; - auto particle = stack.NewParticle(); + auto particle = stack.AddParticle( + particles::Code::Electron, 10_GeV, + corsika::stack::super_stupid::MomentumVector(rootCS, {0_GeV, 0_GeV, -1_GeV}), + geometry::Point(rootCS, {0_m, 0_m, 10_km}), 0_ns); SECTION("interface") { diff --git a/Processes/TrackWriter/TrackWriter.cc b/Processes/TrackWriter/TrackWriter.cc index ffc67cde8a478486cca12670a7e0bb7838d130fa..65dec50ca0aab6d87d9471c99a1f32f788c5ddc6 100644 --- a/Processes/TrackWriter/TrackWriter.cc +++ b/Processes/TrackWriter/TrackWriter.cc @@ -1,4 +1,5 @@ -/** + +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Processes/TrackWriter/TrackWriter.h b/Processes/TrackWriter/TrackWriter.h index 10f2d574f355f72f46e9d681adcd853dac436c4c..c61d2a6c883882a7422539dd854e32af964852f5 100644 --- a/Processes/TrackWriter/TrackWriter.h +++ b/Processes/TrackWriter/TrackWriter.h @@ -1,4 +1,5 @@ -/** + +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Processes/TrackingLine/TrackingLine.h b/Processes/TrackingLine/TrackingLine.h index 31966195751d0a1dfaee6d61a60421a0f80d4676..b829814766625213c5ed115471a7b50b5ecaaf80 100644 --- a/Processes/TrackingLine/TrackingLine.h +++ b/Processes/TrackingLine/TrackingLine.h @@ -1,4 +1,5 @@ -/** + +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Processes/TrackingLine/testTrackingLine.cc b/Processes/TrackingLine/testTrackingLine.cc index 845d3268b619b919e2197298c13ea625bf8113d8..7dde7aec23efa39835a673305729f9b2f0782dbc 100644 --- a/Processes/TrackingLine/testTrackingLine.cc +++ b/Processes/TrackingLine/testTrackingLine.cc @@ -1,4 +1,5 @@ -/** + +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Setup/SetupEnvironment.h b/Setup/SetupEnvironment.h index c5de9d53c9e26d6f5afe88d9762ec88df3043a64..08780b73b38311412a11500adb9d37a67a6d4228 100644 --- a/Setup/SetupEnvironment.h +++ b/Setup/SetupEnvironment.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Setup/SetupLogger.h b/Setup/SetupLogger.h index 2760bc7623fd244f38647d03e956e06ba39e84cd..76148050fc5a7f5f5fa8a03a0d96d1b12e465777 100644 --- a/Setup/SetupLogger.h +++ b/Setup/SetupLogger.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Setup/SetupStack.h b/Setup/SetupStack.h index 053d485f9e2352112f8c3db9dddfeba6bee775bf..0ab05fffbf177b72a21880e5b2b2043a4aba448d 100644 --- a/Setup/SetupStack.h +++ b/Setup/SetupStack.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Setup/SetupTrajectory.h b/Setup/SetupTrajectory.h index de543484b5b7c496ffa0d11cec7c179fb9785281..0e93b3e4466eb98caa7ee3ccefd1edcf3946d104 100644 --- a/Setup/SetupTrajectory.h +++ b/Setup/SetupTrajectory.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Stack/DummyStack/DummyStack.h b/Stack/DummyStack/DummyStack.h index 63b84bf30e4c03a80de512a78c1cb0677d95f7b9..adcf494a57b1d46f13d09d9f39e153866b70ea04 100644 --- a/Stack/DummyStack/DummyStack.h +++ b/Stack/DummyStack/DummyStack.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Stack/DummyStack/SuperStupidStack.h b/Stack/DummyStack/SuperStupidStack.h index 47647e2c397ba8c7aab7ecda35cb05a700516176..3abbb3139abb243f5782241db711edf852d98424 100644 --- a/Stack/DummyStack/SuperStupidStack.h +++ b/Stack/DummyStack/SuperStupidStack.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. diff --git a/Stack/SuperStupidStack/SuperStupidStack.h b/Stack/SuperStupidStack/SuperStupidStack.h index 044ae32a1ae5adcabe5adaf9b5bc5b149d85aca1..c3d4e633685195682038dcca39af5d2475bea32c 100644 --- a/Stack/SuperStupidStack/SuperStupidStack.h +++ b/Stack/SuperStupidStack/SuperStupidStack.h @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. @@ -38,50 +38,78 @@ namespace corsika::stack { template <typename StackIteratorInterface> class ParticleInterface : public ParticleBase<StackIteratorInterface> { + using corsika::stack::ParticleBase<StackIteratorInterface>::GetStack; using corsika::stack::ParticleBase<StackIteratorInterface>::GetStackData; using corsika::stack::ParticleBase<StackIteratorInterface>::GetIndex; public: + /// the factory function, this is how to create a new particle: + /*void AddSecondary(const corsika::particles::Code vDataPID, + const corsika::units::si::HEPEnergyType vDataE, + const MomentumVector& vMomentum, + const corsika::geometry::Point& vPosition, + const corsika::units::si::TimeType vTime) { + GetStack().AddParticle(vDataPID, vDataE, vMomentum, vPosition, vTime); + }*/ + // + void SetParticleData(const corsika::particles::Code vDataPID, + const corsika::units::si::HEPEnergyType vDataE, + const MomentumVector& vMomentum, + const corsika::geometry::Point& vPosition, + const corsika::units::si::TimeType vTime) { + SetPID(vDataPID); + SetEnergy(vDataE); + SetMomentum(vMomentum); + SetPosition(vPosition); + SetTime(vTime); + } + + void SetParticleData(ParticleInterface<StackIteratorInterface>& /*parent*/, + const corsika::particles::Code vDataPID, + const corsika::units::si::HEPEnergyType vDataE, + const MomentumVector& vMomentum, + const corsika::geometry::Point& vPosition, + const corsika::units::si::TimeType vTime) { + SetPID(vDataPID); + SetEnergy(vDataE); + SetMomentum(vMomentum); + SetPosition(vPosition); + SetTime(vTime); + } + + /// individual setters void SetPID(const corsika::particles::Code id) { GetStackData().SetPID(GetIndex(), id); } - void SetEnergy(const corsika::units::si::HEPEnergyType& e) { GetStackData().SetEnergy(GetIndex(), e); } - void SetMomentum(const MomentumVector& v) { GetStackData().SetMomentum(GetIndex(), v); } - void SetPosition(const corsika::geometry::Point& v) { GetStackData().SetPosition(GetIndex(), v); } - void SetTime(const corsika::units::si::TimeType& v) { GetStackData().SetTime(GetIndex(), v); } + /// individual getters corsika::particles::Code GetPID() const { return GetStackData().GetPID(GetIndex()); } - corsika::units::si::HEPEnergyType GetEnergy() const { return GetStackData().GetEnergy(GetIndex()); } - MomentumVector GetMomentum() const { return GetStackData().GetMomentum(GetIndex()); } - corsika::geometry::Point GetPosition() const { return GetStackData().GetPosition(GetIndex()); } - corsika::units::si::TimeType GetTime() const { return GetStackData().GetTime(GetIndex()); } - corsika::geometry::Vector<corsika::units::si::dimensionless_d> GetDirection() const { return GetMomentum() / GetEnergy(); @@ -107,30 +135,22 @@ namespace corsika::stack { } int GetSize() const { return fDataPID.size(); } - int GetCapacity() const { return fDataPID.size(); } void SetPID(const int i, const corsika::particles::Code id) { fDataPID[i] = id; } - void SetEnergy(const int i, const corsika::units::si::HEPEnergyType e) { fDataE[i] = e; } void SetMomentum(const int i, const MomentumVector& v) { fMomentum[i] = v; } - void SetPosition(const int i, const corsika::geometry::Point& v) { fPosition[i] = v; } - void SetTime(const int i, const corsika::units::si::TimeType& v) { fTime[i] = v; } corsika::particles::Code GetPID(const int i) const { return fDataPID[i]; } - corsika::units::si::HEPEnergyType GetEnergy(const int i) const { return fDataE[i]; } - MomentumVector GetMomentum(const int i) const { return fMomentum[i]; } - corsika::geometry::Point GetPosition(const int i) const { return fPosition[i]; } - corsika::units::si::TimeType GetTime(const int i) const { return fTime[i]; } /** diff --git a/Stack/SuperStupidStack/testSuperStupidStack.cc b/Stack/SuperStupidStack/testSuperStupidStack.cc index dbb585a237d2ec201bd99449046046ea6afa7ecc..0e3628b46f6639e336a34cc8545f05b39fb98831 100644 --- a/Stack/SuperStupidStack/testSuperStupidStack.cc +++ b/Stack/SuperStupidStack/testSuperStupidStack.cc @@ -1,5 +1,5 @@ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. @@ -28,17 +28,15 @@ using namespace std; TEST_CASE("SuperStupidStack", "[stack]") { + geometry::CoordinateSystem& dummyCS = + geometry::RootCoordinateSystem::GetInstance().GetRootCoordinateSystem(); + SECTION("read+write") { SuperStupidStack s; - auto p = s.NewParticle(); - p.SetPID(particles::Code::Electron); - p.SetEnergy(1.5_GeV); - geometry::CoordinateSystem& dummyCS = - geometry::RootCoordinateSystem::GetInstance().GetRootCoordinateSystem(); - p.SetMomentum(MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV})); - p.SetPosition(Point(dummyCS, {1 * meter, 1 * meter, 1 * meter})); - p.SetTime(100_s); + s.AddParticle(particles::Code::Electron, 1.5_GeV, + MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), + Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s); // read REQUIRE(s.GetSize() == 1); @@ -54,7 +52,10 @@ TEST_CASE("SuperStupidStack", "[stack]") { SECTION("write+delete") { SuperStupidStack s; - for (int i = 0; i < 99; ++i) s.NewParticle(); + for (int i = 0; i < 99; ++i) + s.AddParticle(particles::Code::Electron, 1.5_GeV, + MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), + Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s); REQUIRE(s.GetSize() == 99); diff --git a/ThirdParty/ThirdParty.dox b/ThirdParty/ThirdParty.dox index a7e46398fad57d563726578dd734677320785c67..b15d9fdd7b1ec6adbde20778d377785d7c0a3ae4 100644 --- a/ThirdParty/ThirdParty.dox +++ b/ThirdParty/ThirdParty.dox @@ -1,5 +1,5 @@ /** -@page ThirdParty +@page ThirdParty Third party software @tableofcontents In the directory ThirdParty we provide simple dependencies. This diff --git a/corsika.dox b/corsika.dox index 2bcf4de1727cb9d80391d777fe781998a3ad9218..b84d0e9e2c815e38fa09cbad1200eb77f1c657b9 100644 --- a/corsika.dox +++ b/corsika.dox @@ -1,5 +1,6 @@ /** -@mainpage CORSIKA air shower simulations framework + +@mainpage CORSIKA 8 air shower simulations framework Documentation and reference guide for the CORSIKA8 (CORSIKA version 8) software framework for air shower simulations. CORSIKA8 is developed @@ -27,4 +28,5 @@ For more information, see also the <a href="https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/blob/master/README.md">central README.md file</a>. + */ diff --git a/do-copyright.py b/do-copyright.py index 6f3ea67284282c0635621e742dc56015e95ea0f5..10f60e389b1cfe27d476bb3f1936fc1c11cd57e1 100755 --- a/do-copyright.py +++ b/do-copyright.py @@ -3,7 +3,7 @@ import os.path text = """ -/** +/* * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors.