From 5aad5074473b851caa7f2f1d176486fd5f362648 Mon Sep 17 00:00:00 2001 From: ralfulrich <ralf.ulrich@kit.edu> Date: Mon, 21 Dec 2020 15:51:53 +0100 Subject: [PATCH] interaction counter --- .../detail/framework/analytics/ClassTimer.inl | 48 +++-- corsika/detail/framework/core/Cascade.inl | 165 ++++++----------- .../detail/framework/geometry/BaseVector.inl | 4 +- .../framework/geometry/CoordinateSystem.inl | 10 +- .../detail/framework/geometry/FourVector.inl | 5 +- corsika/detail/framework/geometry/Helix.inl | 4 +- corsika/detail/framework/geometry/Plane.inl | 4 +- corsika/detail/framework/geometry/Point.inl | 4 +- .../framework/geometry/QuantityVector.inl | 4 +- .../detail/framework/geometry/Trajectory.inl | 4 +- .../detail/framework/random/RNGManager.inl | 22 +-- .../detail/framework/stack/CombinedStack.inl | 171 +++++++++--------- .../detail/framework/stack/SecondaryView.inl | 3 +- corsika/detail/framework/utility/COMBoost.inl | 4 +- .../detail/framework/utility/CorsikaData.inl | 1 - .../framework/utility/CorsikaFenvFallback.inl | 4 +- .../framework/utility/CorsikaFenvOSX.inl | 8 + corsika/detail/media/BaseExponential.inl | 4 +- corsika/detail/media/Environment.inl | 11 +- corsika/detail/media/FlatExponential.inl | 2 - corsika/detail/media/InhomogeneousMedium.inl | 2 +- .../LayeredSphericalAtmosphereBuilder.hpp | 10 +- .../LayeredSphericalAtmosphereBuilder.inl | 2 - .../media/LinearApproximationIntegrator.inl | 2 - .../detail/media/SlidingPlanarExponential.inl | 4 +- corsika/detail/media/Universe.inl | 2 - corsika/detail/media/VolumeTreeNode.inl | 4 +- .../detail/modules/HadronicElasticModel.inl | 17 +- corsika/detail/modules/ObservationPlane.inl | 4 +- corsika/detail/modules/ParticleCut.inl | 4 +- corsika/detail/modules/StackInspector.inl | 4 +- corsika/detail/modules/TrackWriter.inl | 7 +- corsika/detail/modules/TrackingLine.inl | 4 +- .../modules/energy_loss/BetheBlochPDG.inl | 4 +- corsika/detail/modules/pythia8/Decay.inl | 4 +- .../detail/modules/pythia8/Interaction.inl | 4 +- corsika/detail/modules/pythia8/Random.inl | 4 +- .../detail/modules/qgsjetII/Interaction.inl | 40 ++-- .../modules/qgsjetII/ParticleConversion.inl | 2 - .../detail/modules/qgsjetII/QGSJetIIStack.inl | 12 +- .../detail/modules/qgsjetII/qgsjet-II-04.inl | 2 - corsika/detail/modules/urqmd/UrQMD.inl | 4 +- corsika/detail/setup/SetupEnvironment.inl | 9 +- corsika/detail/setup/SetupStack.hpp | 14 +- corsika/detail/setup/SetupStack.inl | 8 + corsika/detail/stack/SuperStupidStack.inl | 57 +++--- corsika/framework/analytics/ClassTimer.hpp | 28 ++- corsika/framework/analytics/FunctionTimer.hpp | 14 +- corsika/framework/analytics/Timer.hpp | 3 +- corsika/framework/core/ParticleProperties.hpp | 2 +- corsika/framework/core/PhysicalGeometry.hpp | 3 +- corsika/framework/geometry/BaseVector.hpp | 6 +- .../framework/geometry/CoordinateSystem.hpp | 8 +- corsika/framework/geometry/Line.hpp | 2 +- .../framework/geometry/PhysicalGeometry.hpp | 3 +- corsika/framework/geometry/QuantityVector.hpp | 2 +- corsika/framework/geometry/Sphere.hpp | 2 +- corsika/framework/geometry/Trajectory.hpp | 1 - .../process/BoundaryCrossingProcess.hpp | 10 +- corsika/framework/process/NullModel.hpp | 2 +- corsika/framework/process/ProcessReturn.hpp | 2 +- corsika/framework/process/ProcessSequence.hpp | 9 +- .../process/SwitchProcessSequence.hpp | 2 +- .../random/ExponentialDistribution.hpp | 45 ++--- corsika/framework/random/RNGManager.hpp | 98 +++++----- .../random/UniformRealDistribution.hpp | 62 +++---- corsika/framework/stack/ParticleBase.hpp | 39 ++-- corsika/framework/stack/SecondaryView.hpp | 65 ++++--- corsika/framework/stack/Stack.hpp | 2 +- .../stack/StackIteratorInterface.hpp | 18 +- corsika/framework/utility/COMBoost.hpp | 1 - corsika/framework/utility/CorsikaFenv.hpp | 12 +- .../framework/utility/SaveBoostHistogram.hpp | 1 - corsika/framework/utility/Singleton.hpp | 8 +- corsika/media/Environment.hpp | 3 +- corsika/media/HomogeneousMedium.hpp | 2 +- corsika/media/IMagneticFieldModel.hpp | 6 +- .../LayeredSphericalAtmosphereBuilder.hpp | 2 +- corsika/media/MediumProperties.hpp | 2 +- corsika/media/NuclearComposition.hpp | 2 +- corsika/media/WeightProvider.hpp | 4 +- corsika/modules/StackInspector.hpp | 2 +- corsika/modules/energy_loss/BetheBlochPDG.hpp | 3 +- corsika/modules/pythia8/Interaction.hpp | 3 +- corsika/modules/pythia8/Random.hpp | 3 +- .../modules/qgsjetII/ParticleConversion.hpp | 9 +- corsika/modules/urqmd/UrQMD.hpp | 3 +- corsika/setup/SetupEnvironment.hpp | 1 - corsika/setup/SetupStack.hpp | 1 - corsika/stack/DummyStack.hpp | 4 +- corsika/stack/GeometryNodeStackExtension.hpp | 80 +++----- corsika/stack/NuclearStackExtension.hpp | 50 ++--- corsika/stack/SuperStupidStack.hpp | 10 +- corsika/stack/history/Event.hpp | 3 +- examples/boundary_example.cpp | 17 +- examples/helix_example.cpp | 4 +- examples/stopping_power.cpp | 3 +- tests/common/PhysicalUnitsCatch2.hpp | 4 +- tests/common/SetupEnvironment.hpp | 8 + tests/common/SetupTestEnvironment.hpp | 8 + tests/common/SetupTestStack.hpp | 16 +- tests/framework/CMakeLists.txt | 7 + tests/framework/testCOMBoost.cpp | 18 +- tests/framework/testCascade.cpp | 1 - tests/framework/testClassTimer.cpp | 3 +- tests/framework/testCorsikaFenv.cpp | 11 +- tests/framework/testParticles.cpp | 8 +- tests/framework/testProcessSequence.cpp | 10 +- tests/framework/testRandom.cpp | 2 - tests/framework/testUnits.cpp | 2 +- tests/media/testEnvironment.cpp | 1 - tests/media/testMagneticField.cpp | 2 - tests/media/testMedium.cpp | 1 - tests/modules/CMakeLists.txt | 3 +- tests/modules/testInteractionCounter.cpp | 21 +-- tests/modules/testParticleCut.cpp | 9 +- tests/modules/testSibyll.cpp | 6 +- tests/modules/testStackInspector.cpp | 11 +- tests/modules/testSwitchProcess.cpp | 3 +- tests/stack/testDummyStack.cpp | 5 +- tests/stack/testHistoryView.cpp | 63 +++---- tests/stack/testNuclearStackExtension.cpp | 78 ++++---- tests/stack/testSuperStupidStack.cpp | 15 +- 123 files changed, 800 insertions(+), 895 deletions(-) diff --git a/corsika/detail/framework/analytics/ClassTimer.inl b/corsika/detail/framework/analytics/ClassTimer.inl index 3d60bef3c..dca6fb5ce 100644 --- a/corsika/detail/framework/analytics/ClassTimer.inl +++ b/corsika/detail/framework/analytics/ClassTimer.inl @@ -29,23 +29,29 @@ namespace corsika { template <typename TClass, typename TRet, typename... TArgs, TRet (TClass::*TFuncPtr)(TArgs...), typename TTimer> TRet ClassTimer<TRet (TClass::*)(TArgs...), TFuncPtr, TTimer>::call(TArgs... args) { - this->start_ = ClassTimerImpl<TClass,TTimer>::clock_type::now(); + this->start_ = ClassTimerImpl<TClass, TTimer>::clock_type::now(); auto tmp = (this->obj_.*TFuncPtr)(std::forward<TArgs>(args)...); - this->timeDiff_ = std::chrono::duration_cast<typename ClassTimerImpl<TClass,TTimer>::duration_type>(ClassTimerImpl<TClass,TTimer>::clock_type::now() - this->start_); + this->timeDiff_ = std::chrono::duration_cast< + typename ClassTimerImpl<TClass, TTimer>::duration_type>( + ClassTimerImpl<TClass, TTimer>::clock_type::now() - this->start_); return tmp; } // Specialisation 1 - template <typename TClass, typename... TArgs, void (TClass::*TFuncPtr)(TArgs...), typename TTimer> + template <typename TClass, typename... TArgs, void (TClass::*TFuncPtr)(TArgs...), + typename TTimer> ClassTimer<void (TClass::*)(TArgs...), TFuncPtr, TTimer>::ClassTimer(TClass& obj) - : ClassTimerImpl<TClass,TTimer>(obj) {} + : ClassTimerImpl<TClass, TTimer>(obj) {} - template <typename TClass, typename... TArgs, void (TClass::*TFuncPtr)(TArgs...), typename TTimer> + template <typename TClass, typename... TArgs, void (TClass::*TFuncPtr)(TArgs...), + typename TTimer> void ClassTimer<void (TClass::*)(TArgs...), TFuncPtr, TTimer>::call(TArgs... args) { - this->start_ = ClassTimerImpl<TClass,TTimer>::clock_type::now(); + this->start_ = ClassTimerImpl<TClass, TTimer>::clock_type::now(); (this->obj_.*TFuncPtr)(std::forward<TArgs>(args)...); - this->timeDiff_ = std::chrono::duration_cast<typename ClassTimerImpl<TClass,TTimer>::duration_type>(ClassTimerImpl<TClass,TTimer>::clock_type::now() - this->start_); + this->timeDiff_ = std::chrono::duration_cast< + typename ClassTimerImpl<TClass, TTimer>::duration_type>( + ClassTimerImpl<TClass, TTimer>::clock_type::now() - this->start_); return; } @@ -54,27 +60,35 @@ namespace corsika { template <typename TClass, typename TRet, typename... TArgs, TRet (TClass::*TFuncPtr)(TArgs...) const, typename TTimer> ClassTimer<TRet (TClass::*)(TArgs...) const, TFuncPtr, TTimer>::ClassTimer(TClass& obj) - : ClassTimerImpl<TClass,TTimer>(obj) {} + : ClassTimerImpl<TClass, TTimer>(obj) {} template <typename TClass, typename TRet, typename... TArgs, TRet (TClass::*TFuncPtr)(TArgs...) const, typename TTimer> - TRet ClassTimer<TRet (TClass::*)(TArgs...) const, TFuncPtr, TTimer>::call(TArgs... args) { - this->start_ = ClassTimerImpl<TClass,TTimer>::clock_type::now(); + TRet ClassTimer<TRet (TClass::*)(TArgs...) const, TFuncPtr, TTimer>::call( + TArgs... args) { + this->start_ = ClassTimerImpl<TClass, TTimer>::clock_type::now(); auto tmp = (this->obj_.*TFuncPtr)(std::forward<TArgs>(args)...); - this->timeDiff_ = std::chrono::duration_cast<typename ClassTimerImpl<TClass,TTimer>::duration_type>(ClassTimerImpl<TClass,TTimer>::clock_type::now() - this->start_); + this->timeDiff_ = std::chrono::duration_cast< + typename ClassTimerImpl<TClass, TTimer>::duration_type>( + ClassTimerImpl<TClass, TTimer>::clock_type::now() - this->start_); return tmp; } /// Specialisation 3 - template <typename TClass, typename... TArgs, void (TClass::*TFuncPtr)(TArgs...) const, typename TTimer> + template <typename TClass, typename... TArgs, void (TClass::*TFuncPtr)(TArgs...) const, + typename TTimer> ClassTimer<void (TClass::*)(TArgs...) const, TFuncPtr, TTimer>::ClassTimer(TClass& obj) - : ClassTimerImpl<TClass,TTimer>(obj) {} + : ClassTimerImpl<TClass, TTimer>(obj) {} - template <typename TClass, typename... TArgs, void (TClass::*TFuncPtr)(TArgs...) const, typename TTimer> - void ClassTimer<void (TClass::*)(TArgs...) const, TFuncPtr, TTimer>::call(TArgs... args) { - this->start_ = ClassTimerImpl<TClass,TTimer>::clock_type::now(); + template <typename TClass, typename... TArgs, void (TClass::*TFuncPtr)(TArgs...) const, + typename TTimer> + void ClassTimer<void (TClass::*)(TArgs...) const, TFuncPtr, TTimer>::call( + TArgs... args) { + this->start_ = ClassTimerImpl<TClass, TTimer>::clock_type::now(); (this->obj_.*TFuncPtr)(std::forward<TArgs>(args)...); - this->timeDiff_ = std::chrono::duration_cast<typename ClassTimerImpl<TClass,TTimer>::duration_type>(ClassTimerImpl<TClass,TTimer>::clock_type::now() - this->start_); + this->timeDiff_ = std::chrono::duration_cast< + typename ClassTimerImpl<TClass, TTimer>::duration_type>( + ClassTimerImpl<TClass, TTimer>::clock_type::now() - this->start_); return; } diff --git a/corsika/detail/framework/core/Cascade.inl b/corsika/detail/framework/core/Cascade.inl index 9a53644f2..2d68f8c10 100644 --- a/corsika/detail/framework/core/Cascade.inl +++ b/corsika/detail/framework/core/Cascade.inl @@ -1,7 +1,5 @@ /* - * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu - * - * See file AUTHORS for a list of contributors. + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * * 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 @@ -27,34 +25,25 @@ #include <limits> #include <type_traits> -namespace corsika -{ +namespace corsika { - template <typename TTracking, - typename TProcessList, - typename TStack, + template <typename TTracking, typename TProcessList, typename TStack, typename TStackView> - void Cascade<TTracking, TProcessList, TStack, TStackView>::setNodes() - { - std::for_each(stack_.begin(), stack_.end(), [&](auto &p) { - auto const *numericalNode - = environment_.getUniverse()->getContainingNode(p.getPosition()); + void Cascade<TTracking, TProcessList, TStack, TStackView>::setNodes() { + std::for_each(stack_.begin(), stack_.end(), [&](auto& p) { + auto const* numericalNode = + environment_.getUniverse()->getContainingNode(p.getPosition()); p.setNode(numericalNode); }); } - template <typename TTracking, - typename TProcessList, - typename TStack, + template <typename TTracking, typename TProcessList, typename TStack, typename TStackView> - void Cascade<TTracking, TProcessList, TStack, TStackView>::run() - { + void Cascade<TTracking, TProcessList, TStack, TStackView>::run() { setNodes(); // put each particle on stack in correct environment volume - while (!stack_.isEmpty()) - { - while (!stack_.isEmpty()) - { + while (!stack_.isEmpty()) { + while (!stack_.isEmpty()) { CORSIKA_LOG_TRACE("Stack: {}", stack_.asString()); count_++; @@ -64,10 +53,7 @@ namespace corsika "============== next particle : count={}, pid={}, " ", stack entries={}" ", stack deleted={}", - count_, - pNext.getPID(), - stack_.getEntries(), - stack_.getErased()); + count_, pNext.getPID(), stack_.getEntries(), stack_.getErased()); step(pNext); sequence_.doStack(stack_); @@ -78,12 +64,9 @@ namespace corsika } } - template <typename TTracking, - typename TProcessList, - typename TStack, + template <typename TTracking, typename TProcessList, typename TStack, typename TStackView> - void Cascade<TTracking, TProcessList, TStack, TStackView>::forceInteraction() - { + void Cascade<TTracking, TProcessList, TStack, TStackView>::forceInteraction() { CORSIKA_LOG_TRACE("forced interaction!"); auto vParticle = stack_.getNextParticle(); TStackView secondaries(vParticle); @@ -92,20 +75,17 @@ namespace corsika vParticle.erase(); // primary particle is done } - template <typename TTracking, - typename TProcessList, - typename TStack, + template <typename TTracking, typename TProcessList, typename TStack, typename TStackView> - void Cascade<TTracking, TProcessList, TStack, TStackView>::step(Particle &vParticle) - { + void Cascade<TTracking, TProcessList, TStack, TStackView>::step(Particle& vParticle) { // determine geometric tracking auto [step, geomMaxLength, nextVol] = tracking_.getTrack(vParticle); - [[maybe_unused]] auto const &dummy_nextVol = nextVol; + [[maybe_unused]] auto const& dummy_nextVol = nextVol; // determine combined total interaction length (inverse) - InverseGrammageType const total_inv_lambda - = sequence_.getInverseInteractionLength(vParticle); + InverseGrammageType const total_inv_lambda = + sequence_.getInverseInteractionLength(vParticle); // sample random exponential step length in grammage corsika::ExponentialDistribution expDist(1 / total_inv_lambda); @@ -117,17 +97,17 @@ namespace corsika double((1. / total_inv_lambda) / 1_g * 1_cm * 1_cm), double(next_interact / 1_g * 1_cm * 1_cm)); - auto const *currentLogicalNode = vParticle.getNode(); + auto const* currentLogicalNode = vParticle.getNode(); // assert that particle stays outside void Universe if it has no // model properties set - assert(currentLogicalNode != &*environment_.getUniverse() - || environment_.getUniverse()->hasModelProperties()); + assert(currentLogicalNode != &*environment_.getUniverse() || + environment_.getUniverse()->hasModelProperties()); // convert next_step from grammage to length - LengthType const distance_interact - = currentLogicalNode->getModelProperties().getArclengthFromGrammage( - step, next_interact); + LengthType const distance_interact = + currentLogicalNode->getModelProperties().getArclengthFromGrammage(step, + next_interact); // determine the maximum geometric step length LengthType const distance_max = sequence_.getMaxStepLength(vParticle, step); @@ -142,16 +122,15 @@ namespace corsika CORSIKA_LOG_DEBUG( "total_lifetime={} s" ", next_decay={} s", - (1 / total_inv_lifetime) / 1_s, - next_decay / 1_s); + (1 / total_inv_lifetime) / 1_s, next_decay / 1_s); // convert next_decay from time to length [m] - LengthType const distance_decay = next_decay * vParticle.getMomentum().getNorm() - / vParticle.getEnergy() * constants::c; + LengthType const distance_decay = next_decay * vParticle.getMomentum().getNorm() / + vParticle.getEnergy() * constants::c; // take minimum of geometry, interaction, decay for next step - auto const min_distance - = std::min({distance_interact, distance_decay, distance_max, geomMaxLength}); + auto const min_distance = + std::min({distance_interact, distance_decay, distance_max, geomMaxLength}); CORSIKA_LOG_DEBUG("transport particle by : {} m", min_distance / 1_m); @@ -164,21 +143,17 @@ namespace corsika step.getLimitEndTo(min_distance); // apply all continuous processes on particle + track - if (sequence_.doContinuous(vParticle, step) == ProcessReturn::ParticleAbsorbed) - { + if (sequence_.doContinuous(vParticle, step) == ProcessReturn::ParticleAbsorbed) { CORSIKA_LOG_DEBUG("Cascade: delete absorbed particle PID={} E={} GeV", - vParticle.getPID(), - vParticle.getEnergy() / 1_GeV); - if (!vParticle.isErased()) - vParticle.erase(); + vParticle.getPID(), vParticle.getEnergy() / 1_GeV); + if (!vParticle.isErased()) vParticle.erase(); return; } CORSIKA_LOG_DEBUG("sth. happening before geometric limit ? {}", ((min_distance < geomMaxLength) ? "yes" : "no")); - if (min_distance < geomMaxLength) - { // interaction to happen within geometric limit + if (min_distance < geomMaxLength) { // interaction to happen within geometric limit // check whether decay or interaction limits this step the // outcome of decay or interaction MAY be a) new particles in @@ -187,8 +162,7 @@ namespace corsika TStackView secondaries(vParticle); - if (min_distance != distance_max) - { + if (min_distance != distance_max) { /* Create SecondaryView object on Stack. The data container remains untouched and identical, and 'projectil' is identical @@ -201,44 +175,36 @@ namespace corsika [[maybe_unused]] auto projectile = secondaries.getProjectile(); - if (min_distance == distance_interact) - { + if (min_distance == distance_interact) { interaction(secondaries); - } - else - { + } else { assert(min_distance == distance_decay); decay(secondaries); // make sure particle actually did decay if it should have done so - if (secondaries.getSize() == 1 - && projectile.getPID() == secondaries.getNextParticle().getPID()) + if (secondaries.getSize() == 1 && + projectile.getPID() == secondaries.getNextParticle().getPID()) throw std::runtime_error(fmt::format("Particle {} decays into itself!", get_name(projectile.getPID()))); } sequence_.doSecondaries(secondaries); vParticle.erase(); - } - else - { // step-length limitation within volume + } else { // step-length limitation within volume CORSIKA_LOG_DEBUG("step-length limitation"); } [[maybe_unused]] auto const assertion = [&] { - auto const *numericalNodeAfterStep - = environment_.getUniverse()->getContainingNode(vParticle.getPosition()); + auto const* numericalNodeAfterStep = + environment_.getUniverse()->getContainingNode(vParticle.getPosition()); CORSIKA_LOG_TRACE( "Geometry check: numericalNodeAfterStep={} currentLogicalNode={}", - fmt::ptr(numericalNodeAfterStep), - fmt::ptr(currentLogicalNode)); + fmt::ptr(numericalNodeAfterStep), fmt::ptr(currentLogicalNode)); return numericalNodeAfterStep == currentLogicalNode; }; assert(assertion()); // numerical and logical nodes don't match - } - else - { // boundary crossing, step is limited by volume boundary + } else { // boundary crossing, step is limited by volume boundary vParticle.setNode(nextVol); /* doBoundary may delete the particle (or not) @@ -254,13 +220,10 @@ namespace corsika } } - template <typename TTracking, - typename TProcessList, - typename TStack, + template <typename TTracking, typename TProcessList, typename TStack, typename TStackView> - ProcessReturn - Cascade<TTracking, TProcessList, TStack, TStackView>::decay(TStackView &view) - { + ProcessReturn Cascade<TTracking, TProcessList, TStack, TStackView>::decay( + TStackView& view) { CORSIKA_LOG_DEBUG("decay"); InverseTimeType const actual_decay_time = sequence_.getInverseLifetime(view.parent()); @@ -268,51 +231,39 @@ namespace corsika const auto sample_process = uniDist(rng_); auto const returnCode = sequence_.selectDecay(view, sample_process); - if (returnCode != ProcessReturn::Decayed) - { + if (returnCode != ProcessReturn::Decayed) { CORSIKA_LOG_WARN("Particle did not decay!"); } setEventType(view, history::EventType::Decay); return returnCode; } - template <typename TTracking, - typename TProcessList, - typename TStack, + template <typename TTracking, typename TProcessList, typename TStack, typename TStackView> - ProcessReturn - Cascade<TTracking, TProcessList, TStack, TStackView>::interaction(TStackView &view) - { + ProcessReturn Cascade<TTracking, TProcessList, TStack, TStackView>::interaction( + TStackView& view) { CORSIKA_LOG_DEBUG("collide"); - InverseGrammageType const current_inv_length - = sequence_.getInverseInteractionLength(view.parent()); + InverseGrammageType const current_inv_length = + sequence_.getInverseInteractionLength(view.parent()); corsika::UniformRealDistribution<InverseGrammageType> uniDist(current_inv_length); const auto sample_process = uniDist(rng_); auto const returnCode = sequence_.selectInteraction(view, sample_process); - if (returnCode != ProcessReturn::Interacted) - { + if (returnCode != ProcessReturn::Interacted) { CORSIKA_LOG_WARN("Particle did not interace!"); } setEventType(view, history::EventType::Interaction); return returnCode; } - template <typename TTracking, - typename TProcessList, - typename TStack, + template <typename TTracking, typename TProcessList, typename TStack, typename TStackView> void Cascade<TTracking, TProcessList, TStack, TStackView>::setEventType( - TStackView &view, [[maybe_unused]] history::EventType eventType) - { - if constexpr (TStackView::has_event) - { - for (auto &&sec : view) - { - sec.getEvent()->setEventType(eventType); - } + TStackView& view, [[maybe_unused]] history::EventType eventType) { + if constexpr (TStackView::has_event) { + for (auto&& sec : view) { sec.getEvent()->setEventType(eventType); } } } diff --git a/corsika/detail/framework/geometry/BaseVector.inl b/corsika/detail/framework/geometry/BaseVector.inl index e5bd52b19..50ec4b03b 100644 --- a/corsika/detail/framework/geometry/BaseVector.inl +++ b/corsika/detail/framework/geometry/BaseVector.inl @@ -1,7 +1,5 @@ /* - * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu - * - * See file AUTHORS for a list of contributors. + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * * 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 diff --git a/corsika/detail/framework/geometry/CoordinateSystem.inl b/corsika/detail/framework/geometry/CoordinateSystem.inl index 8a1b9e2e8..efcf716d3 100644 --- a/corsika/detail/framework/geometry/CoordinateSystem.inl +++ b/corsika/detail/framework/geometry/CoordinateSystem.inl @@ -1,7 +1,5 @@ /* - * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu - * - * See file AUTHORS for a list of contributors. + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * * 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 @@ -43,16 +41,14 @@ namespace corsika { // traverse pFrom a = &pFrom; - while (a != b && a) { - a = a->getReferenceCS().get(); - } + while (a != b && a) { a = a->getReferenceCS().get(); } if (a == b) break; b = b->getReferenceCS().get(); } - if (a!=b || a == nullptr) { + if (a != b || a == nullptr) { throw std::runtime_error("no connection between coordinate systems found!"); } diff --git a/corsika/detail/framework/geometry/FourVector.inl b/corsika/detail/framework/geometry/FourVector.inl index 8823f2132..6c0a039e5 100644 --- a/corsika/detail/framework/geometry/FourVector.inl +++ b/corsika/detail/framework/geometry/FourVector.inl @@ -114,12 +114,11 @@ namespace corsika { } template <typename TTimeType, typename TSpaceVecType> - inline std::ostream& operator<<(std::ostream& os, - corsika::FourVector<TTimeType, TSpaceVecType> const qv) { + inline std::ostream& operator<<( + std::ostream& os, corsika::FourVector<TTimeType, TSpaceVecType> const qv) { os << '(' << qv.timeLike_ << ", " << qv.spaceLike_ << ") "; return os; } - } // namespace corsika diff --git a/corsika/detail/framework/geometry/Helix.inl b/corsika/detail/framework/geometry/Helix.inl index fe740cf8e..c20a8f21f 100644 --- a/corsika/detail/framework/geometry/Helix.inl +++ b/corsika/detail/framework/geometry/Helix.inl @@ -1,7 +1,5 @@ /* - * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu - * - * See file AUTHORS for a list of contributors. + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * * 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 diff --git a/corsika/detail/framework/geometry/Plane.inl b/corsika/detail/framework/geometry/Plane.inl index f35e23e17..e158e04d3 100644 --- a/corsika/detail/framework/geometry/Plane.inl +++ b/corsika/detail/framework/geometry/Plane.inl @@ -1,7 +1,5 @@ /* - * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu - * - * See file AUTHORS for a list of contributors. + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * * 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 diff --git a/corsika/detail/framework/geometry/Point.inl b/corsika/detail/framework/geometry/Point.inl index 8b8416858..6c550c1ce 100644 --- a/corsika/detail/framework/geometry/Point.inl +++ b/corsika/detail/framework/geometry/Point.inl @@ -1,7 +1,5 @@ /* - * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu - * - * See file AUTHORS for a list of contributors. + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * * 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 diff --git a/corsika/detail/framework/geometry/QuantityVector.inl b/corsika/detail/framework/geometry/QuantityVector.inl index 3b5118abe..151b35dae 100644 --- a/corsika/detail/framework/geometry/QuantityVector.inl +++ b/corsika/detail/framework/geometry/QuantityVector.inl @@ -1,7 +1,5 @@ /* - * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu - * - * See file AUTHORS for a list of contributors. + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * * 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 diff --git a/corsika/detail/framework/geometry/Trajectory.inl b/corsika/detail/framework/geometry/Trajectory.inl index a43010c19..fd8aa4f5c 100644 --- a/corsika/detail/framework/geometry/Trajectory.inl +++ b/corsika/detail/framework/geometry/Trajectory.inl @@ -1,7 +1,5 @@ /* - * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu - * - * See file AUTHORS for a list of contributors. + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * * 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 diff --git a/corsika/detail/framework/random/RNGManager.inl b/corsika/detail/framework/random/RNGManager.inl index 8ddcb851f..575ab43b7 100644 --- a/corsika/detail/framework/random/RNGManager.inl +++ b/corsika/detail/framework/random/RNGManager.inl @@ -1,7 +1,5 @@ /* - * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu - * - * See file AUTHORS for a list of contributors. + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * * 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 @@ -22,20 +20,19 @@ namespace corsika { rngs_[pStreamName] = std::move(rng); } - inline RNGManager::prng_type& RNGManager::getRandomStream(string_type const& pStreamName) { - if (isRegistered(pStreamName)) { - return rngs_.at(pStreamName); - } else { // this stream name is not in the map - throw std::runtime_error("'" + pStreamName + "' is not a registered stream."); - } - } - + inline RNGManager::prng_type& RNGManager::getRandomStream( + string_type const& pStreamName) { + if (isRegistered(pStreamName)) { + return rngs_.at(pStreamName); + } else { // this stream name is not in the map + throw std::runtime_error("'" + pStreamName + "' is not a registered stream."); + } + } inline bool RNGManager::isRegistered(string_type const& pStreamName) const { return rngs_.count(pStreamName) > 0; } - inline std::stringstream RNGManager::dumpState() const { std::stringstream buffer; for (auto const& [streamName, rng] : rngs_) { @@ -61,5 +58,4 @@ namespace corsika { } } - } // namespace corsika diff --git a/corsika/detail/framework/stack/CombinedStack.inl b/corsika/detail/framework/stack/CombinedStack.inl index ffc816b93..4ead3b9b8 100644 --- a/corsika/detail/framework/stack/CombinedStack.inl +++ b/corsika/detail/framework/stack/CombinedStack.inl @@ -8,7 +8,6 @@ #pragma once - #include <corsika/framework/logging/Logging.hpp> #include <corsika/framework/core/ParticleProperties.hpp> #include <corsika/framework/stack/Stack.hpp> @@ -16,87 +15,97 @@ namespace corsika { - template <template <typename> class TParticleInterfaceA, - template <typename> class TParticleInterfaceB, typename TStackIterator> - template <typename... TArgs1> - inline void CombinedParticleInterface<TParticleInterfaceA, TParticleInterfaceB, TStackIterator>::setParticleData(std::tuple<TArgs1...> const vA) { - pi_a_type::setParticleData(vA); - pi_b_type::setParticleData(); - } - - template <template <typename> class TParticleInterfaceA, - template <typename> class TParticleInterfaceB, typename TStackIterator> - template <typename... TArgs1, typename... TArgs2> - inline void CombinedParticleInterface<TParticleInterfaceA, TParticleInterfaceB, TStackIterator>::setParticleData(std::tuple<TArgs1...> const vA, std::tuple<TArgs2...> const vB) { - pi_a_type::setParticleData(vA); - pi_b_type::setParticleData(vB); - } - - template <template <typename> class TParticleInterfaceA, - template <typename> class TParticleInterfaceB, typename TStackIterator> - template <typename... TArgs1> - inline void CombinedParticleInterface<TParticleInterfaceA, TParticleInterfaceB, TStackIterator>::setParticleData(pi_a_type& p, std::tuple<TArgs1...> const vA) { - // static_assert(MT<I>::has_not, "error"); - pi_a_type::setParticleData(static_cast<pi_a_type&>(p), vA); // original stack - pi_b_type::setParticleData(static_cast<pi_b_type&>(p)); // addon stack - } - - template <template <typename> class TParticleInterfaceA, - template <typename> class TParticleInterfaceB,typename TStackIterator> - template <typename... TArgs1, typename... TArgs2> - inline void CombinedParticleInterface<TParticleInterfaceA, TParticleInterfaceB, TStackIterator>::setParticleData(pi_c_type& p, std::tuple<TArgs1...> const vA, - std::tuple<TArgs2...> const vB) { - - pi_a_type::setParticleData(static_cast<pi_a_type&>(p), vA); - pi_b_type::setParticleData(static_cast<pi_b_type&>(p), vB); - } - - ///@} - template <template <typename> class TParticleInterfaceA, - template <typename> class TParticleInterfaceB, typename TStackIterator> - inline std::string CombinedParticleInterface<TParticleInterfaceA, TParticleInterfaceB, TStackIterator>::asString() const { - return fmt::format("[[{}][{}]]", pi_a_type::asString(), pi_b_type::asString()); + template <template <typename> class TParticleInterfaceA, + template <typename> class TParticleInterfaceB, typename TStackIterator> + template <typename... TArgs1> + inline void CombinedParticleInterface< + TParticleInterfaceA, TParticleInterfaceB, + TStackIterator>::setParticleData(std::tuple<TArgs1...> const vA) { + pi_a_type::setParticleData(vA); + pi_b_type::setParticleData(); + } + + template <template <typename> class TParticleInterfaceA, + template <typename> class TParticleInterfaceB, typename TStackIterator> + template <typename... TArgs1, typename... TArgs2> + inline void CombinedParticleInterface< + TParticleInterfaceA, TParticleInterfaceB, + TStackIterator>::setParticleData(std::tuple<TArgs1...> const vA, + std::tuple<TArgs2...> const vB) { + pi_a_type::setParticleData(vA); + pi_b_type::setParticleData(vB); + } + + template <template <typename> class TParticleInterfaceA, + template <typename> class TParticleInterfaceB, typename TStackIterator> + template <typename... TArgs1> + inline void CombinedParticleInterface< + TParticleInterfaceA, TParticleInterfaceB, + TStackIterator>::setParticleData(pi_a_type& p, std::tuple<TArgs1...> const vA) { + // static_assert(MT<I>::has_not, "error"); + pi_a_type::setParticleData(static_cast<pi_a_type&>(p), vA); // original stack + pi_b_type::setParticleData(static_cast<pi_b_type&>(p)); // addon stack + } + + template <template <typename> class TParticleInterfaceA, + template <typename> class TParticleInterfaceB, typename TStackIterator> + template <typename... TArgs1, typename... TArgs2> + inline void CombinedParticleInterface< + TParticleInterfaceA, TParticleInterfaceB, + TStackIterator>::setParticleData(pi_c_type& p, std::tuple<TArgs1...> const vA, + std::tuple<TArgs2...> const vB) { + + pi_a_type::setParticleData(static_cast<pi_a_type&>(p), vA); + pi_b_type::setParticleData(static_cast<pi_b_type&>(p), vB); + } + + ///@} + template <template <typename> class TParticleInterfaceA, + template <typename> class TParticleInterfaceB, typename TStackIterator> + inline std::string CombinedParticleInterface<TParticleInterfaceA, TParticleInterfaceB, + TStackIterator>::asString() const { + return fmt::format("[[{}][{}]]", pi_a_type::asString(), pi_b_type::asString()); + } + + template <typename Stack1Impl, typename Stack2Impl> + inline void CombinedStackImpl<Stack1Impl, Stack2Impl>::clear() { + Stack1Impl::clear(); + Stack2Impl::clear(); + } + template <typename Stack1Impl, typename Stack2Impl> + inline void CombinedStackImpl<Stack1Impl, Stack2Impl>::copy(const unsigned int i1, + const unsigned int i2) { + if (i1 >= getSize() || i2 >= getSize()) { + std::ostringstream err; + err << "CombinedStack: trying to access data beyond size of stack!"; + throw std::runtime_error(err.str()); } - - - template <typename Stack1Impl, typename Stack2Impl> - inline void CombinedStackImpl< Stack1Impl, Stack2Impl>::clear() { - Stack1Impl::clear(); - Stack2Impl::clear(); - } - template <typename Stack1Impl, typename Stack2Impl> - inline void CombinedStackImpl< Stack1Impl, Stack2Impl>::copy(const unsigned int i1, const unsigned int i2) { - if (i1 >= getSize() || i2 >= getSize()) { - std::ostringstream err; - err << "CombinedStack: trying to access data beyond size of stack!"; - throw std::runtime_error(err.str()); - } - Stack1Impl::copy(i1, i2); - Stack2Impl::copy(i1, i2); - } - - template <typename Stack1Impl, typename Stack2Impl> - inline void CombinedStackImpl< Stack1Impl, Stack2Impl>::swap(const unsigned int i1, const unsigned int i2) { - if (i1 >= getSize() || i2 >= getSize()) { - std::ostringstream err; - err << "CombinedStack: trying to access data beyond size of stack!"; - throw std::runtime_error(err.str()); - } - Stack1Impl::swap(i1, i2); - Stack2Impl::swap(i1, i2); + Stack1Impl::copy(i1, i2); + Stack2Impl::copy(i1, i2); + } + + template <typename Stack1Impl, typename Stack2Impl> + inline void CombinedStackImpl<Stack1Impl, Stack2Impl>::swap(const unsigned int i1, + const unsigned int i2) { + if (i1 >= getSize() || i2 >= getSize()) { + std::ostringstream err; + err << "CombinedStack: trying to access data beyond size of stack!"; + throw std::runtime_error(err.str()); } - - template <typename Stack1Impl, typename Stack2Impl> - inline void CombinedStackImpl< Stack1Impl, Stack2Impl>::incrementSize() { - Stack1Impl::incrementSize(); - Stack2Impl::incrementSize(); - } - - template <typename Stack1Impl, typename Stack2Impl> - inline void CombinedStackImpl< Stack1Impl, Stack2Impl>::decrementSize() { - Stack1Impl::decrementSize(); - Stack2Impl::decrementSize(); - } - + Stack1Impl::swap(i1, i2); + Stack2Impl::swap(i1, i2); + } + + template <typename Stack1Impl, typename Stack2Impl> + inline void CombinedStackImpl<Stack1Impl, Stack2Impl>::incrementSize() { + Stack1Impl::incrementSize(); + Stack2Impl::incrementSize(); + } + + template <typename Stack1Impl, typename Stack2Impl> + inline void CombinedStackImpl<Stack1Impl, Stack2Impl>::decrementSize() { + Stack1Impl::decrementSize(); + Stack2Impl::decrementSize(); + } } // namespace corsika diff --git a/corsika/detail/framework/stack/SecondaryView.inl b/corsika/detail/framework/stack/SecondaryView.inl index d5db7472a..5e22a8fef 100644 --- a/corsika/detail/framework/stack/SecondaryView.inl +++ b/corsika/detail/framework/stack/SecondaryView.inl @@ -1,10 +1,11 @@ /* - * (c) copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * * 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. */ + #pragma once #include <corsika/framework/stack/Stack.hpp> diff --git a/corsika/detail/framework/utility/COMBoost.inl b/corsika/detail/framework/utility/COMBoost.inl index 60201a398..ed6a9c1be 100644 --- a/corsika/detail/framework/utility/COMBoost.inl +++ b/corsika/detail/framework/utility/COMBoost.inl @@ -1,7 +1,5 @@ /* - * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu - * - * See file AUTHORS for a list of contributors. + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * * 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 diff --git a/corsika/detail/framework/utility/CorsikaData.inl b/corsika/detail/framework/utility/CorsikaData.inl index 0d67b57c8..80a1b77ca 100644 --- a/corsika/detail/framework/utility/CorsikaData.inl +++ b/corsika/detail/framework/utility/CorsikaData.inl @@ -7,7 +7,6 @@ */ #pragma once - #include <cstdlib> #include <stdexcept> #include <string> diff --git a/corsika/detail/framework/utility/CorsikaFenvFallback.inl b/corsika/detail/framework/utility/CorsikaFenvFallback.inl index 4fb6e1c65..ba0dd888a 100644 --- a/corsika/detail/framework/utility/CorsikaFenvFallback.inl +++ b/corsika/detail/framework/utility/CorsikaFenvFallback.inl @@ -1,7 +1,5 @@ /* - * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu - * - * See file AUTHORS for a list of contributors. + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * * 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 diff --git a/corsika/detail/framework/utility/CorsikaFenvOSX.inl b/corsika/detail/framework/utility/CorsikaFenvOSX.inl index 2b7049e47..06b17451c 100644 --- a/corsika/detail/framework/utility/CorsikaFenvOSX.inl +++ b/corsika/detail/framework/utility/CorsikaFenvOSX.inl @@ -1,3 +1,11 @@ +/* + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu + * + * 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/corsika/detail/media/BaseExponential.inl b/corsika/detail/media/BaseExponential.inl index c55847cc5..b8482d02e 100644 --- a/corsika/detail/media/BaseExponential.inl +++ b/corsika/detail/media/BaseExponential.inl @@ -1,7 +1,5 @@ /* - * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu - * - * See file AUTHORS for a list of contributors. + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * * 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 diff --git a/corsika/detail/media/Environment.inl b/corsika/detail/media/Environment.inl index 855cc0b3b..792182a9e 100644 --- a/corsika/detail/media/Environment.inl +++ b/corsika/detail/media/Environment.inl @@ -1,8 +1,6 @@ /* * (c) Copyright 2020 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. @@ -21,12 +19,14 @@ namespace corsika { std::make_unique<Universe>(coordinateSystem_))) {} template <typename IEnvironmentModel> - typename Environment<IEnvironmentModel>::BaseNodeType::VTNUPtr& Environment<IEnvironmentModel>::getUniverse() { + typename Environment<IEnvironmentModel>::BaseNodeType::VTNUPtr& + Environment<IEnvironmentModel>::getUniverse() { return universe_; } template <typename IEnvironmentModel> - typename Environment<IEnvironmentModel>::BaseNodeType::VTNUPtr const& Environment<IEnvironmentModel>::getUniverse() const { + typename Environment<IEnvironmentModel>::BaseNodeType::VTNUPtr const& + Environment<IEnvironmentModel>::getUniverse() const { return universe_; } @@ -38,7 +38,8 @@ namespace corsika { // factory method for creation of VolumeTreeNodes template <typename IEnvironmentModel> template <class TVolumeType, typename... TVolumeArgs> - std::unique_ptr< VolumeTreeNode<IEnvironmentModel> > Environment<IEnvironmentModel>::createNode(TVolumeArgs&&... args) { + std::unique_ptr<VolumeTreeNode<IEnvironmentModel> > + Environment<IEnvironmentModel>::createNode(TVolumeArgs&&... args) { static_assert(std::is_base_of_v<IVolume, TVolumeType>, "unusable type provided, needs to be derived from " "\"Volume\""); diff --git a/corsika/detail/media/FlatExponential.inl b/corsika/detail/media/FlatExponential.inl index 0835551c9..e3b50839a 100644 --- a/corsika/detail/media/FlatExponential.inl +++ b/corsika/detail/media/FlatExponential.inl @@ -1,8 +1,6 @@ /* * (c) Copyright 2020 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. diff --git a/corsika/detail/media/InhomogeneousMedium.inl b/corsika/detail/media/InhomogeneousMedium.inl index 94e7e13a1..33b9066c2 100644 --- a/corsika/detail/media/InhomogeneousMedium.inl +++ b/corsika/detail/media/InhomogeneousMedium.inl @@ -21,7 +21,7 @@ namespace corsika { InhomogeneousMedium<T, TDensityFunction>::InhomogeneousMedium( NuclearComposition const& nuclComp, TArgs&&... rhoTArgs) : nuclComp_(nuclComp) - , densityFunction_(rhoTArgs...){} + , densityFunction_(rhoTArgs...) {} template <typename T, typename TDensityFunction> MassDensityType InhomogeneousMedium<T, TDensityFunction>::getMassDensity( diff --git a/corsika/detail/media/LayeredSphericalAtmosphereBuilder.hpp b/corsika/detail/media/LayeredSphericalAtmosphereBuilder.hpp index 0bf88ff67..6d288ee5a 100644 --- a/corsika/detail/media/LayeredSphericalAtmosphereBuilder.hpp +++ b/corsika/detail/media/LayeredSphericalAtmosphereBuilder.hpp @@ -1,3 +1,11 @@ +/* + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu + * + * 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. + */ + #pragma once namespace corsika { @@ -17,4 +25,4 @@ namespace corsika { } // namespace detail -} +} // namespace corsika diff --git a/corsika/detail/media/LayeredSphericalAtmosphereBuilder.inl b/corsika/detail/media/LayeredSphericalAtmosphereBuilder.inl index 2ffaecefc..f8421ab06 100644 --- a/corsika/detail/media/LayeredSphericalAtmosphereBuilder.inl +++ b/corsika/detail/media/LayeredSphericalAtmosphereBuilder.inl @@ -1,8 +1,6 @@ /* * (c) Copyright 2020 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. diff --git a/corsika/detail/media/LinearApproximationIntegrator.inl b/corsika/detail/media/LinearApproximationIntegrator.inl index a3420dcc4..7d526ba03 100644 --- a/corsika/detail/media/LinearApproximationIntegrator.inl +++ b/corsika/detail/media/LinearApproximationIntegrator.inl @@ -1,8 +1,6 @@ /* * (c) Copyright 2020 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. diff --git a/corsika/detail/media/SlidingPlanarExponential.inl b/corsika/detail/media/SlidingPlanarExponential.inl index 05e8749c8..ad5ab5e0f 100644 --- a/corsika/detail/media/SlidingPlanarExponential.inl +++ b/corsika/detail/media/SlidingPlanarExponential.inl @@ -1,7 +1,5 @@ /* - * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu - * - * See file AUTHORS for a list of contributors. + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * * 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 diff --git a/corsika/detail/media/Universe.inl b/corsika/detail/media/Universe.inl index 09c4c101d..6a2bdd6e9 100644 --- a/corsika/detail/media/Universe.inl +++ b/corsika/detail/media/Universe.inl @@ -1,8 +1,6 @@ /* * (c) Copyright 2020 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. diff --git a/corsika/detail/media/VolumeTreeNode.inl b/corsika/detail/media/VolumeTreeNode.inl index 409d393f2..491cd3aa9 100644 --- a/corsika/detail/media/VolumeTreeNode.inl +++ b/corsika/detail/media/VolumeTreeNode.inl @@ -1,7 +1,5 @@ /* - * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu - * - * See file AUTHORS for a list of contributors. + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * * 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 diff --git a/corsika/detail/modules/HadronicElasticModel.inl b/corsika/detail/modules/HadronicElasticModel.inl index ed3009ef4..73e29cf13 100644 --- a/corsika/detail/modules/HadronicElasticModel.inl +++ b/corsika/detail/modules/HadronicElasticModel.inl @@ -1,7 +1,5 @@ /* - * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu - * - * See file AUTHORS for a list of contributors. + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * * 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 @@ -138,9 +136,9 @@ namespace corsika::hadronic_elastic_model { }(); std::cout << "HadronicElasticInteraction: s = " << s * constants::invGeVsq - << " GeV²; absT = " << absT * constants::invGeVsq - << " GeV² (max./GeV² = " << 4 * constants::invGeVsq * projectileMomentumSquaredNorm - << ')' << std::endl; + << " GeV²; absT = " << absT * constants::invGeVsq << " GeV² (max./GeV² = " + << 4 * constants::invGeVsq * projectileMomentumSquaredNorm << ')' + << std::endl; auto const theta = 2 * asin(sqrt(absT / (4 * pProjectileCoMSqNorm))); auto const phi = phiDist(fRNG); @@ -166,7 +164,8 @@ namespace corsika::hadronic_elastic_model { HadronicElasticInteraction::inveV2 HadronicElasticInteraction::B(eV2 s) const { auto constexpr b_p = 2.3; auto const result = - (2 * b_p + 2 * b_p + 4 * pow(s * constants::invGeVsq, gfEpsilon) - 4.2) * constants::invGeVsq; + (2 * b_p + 2 * b_p + 4 * pow(s * constants::invGeVsq, gfEpsilon) - 4.2) * + constants::invGeVsq; std::cout << "B(" << s << ") = " << result / invGeVsq << " GeV¯²" << std::endl; return result; } @@ -174,8 +173,8 @@ namespace corsika::hadronic_elastic_model { CrossSectionType HadronicElasticInteraction::CrossSection( SquaredHEPEnergyType s) const { // assuming every target behaves like a proton, fX and fY are universal - CrossSectionType const sigmaTotal = - fX * pow(s * constants::invGeVsq, gfEpsilon) + fY * pow(s * constants::invGeVsq, -gfEta); + CrossSectionType const sigmaTotal = fX * pow(s * constants::invGeVsq, gfEpsilon) + + fY * pow(s * constants::invGeVsq, -gfEta); // according to Schuler & Sjöstrand, PRD 49, 2257 (1994) // (we ignore rho because rho^2 is just ~2 %) diff --git a/corsika/detail/modules/ObservationPlane.inl b/corsika/detail/modules/ObservationPlane.inl index cbe582c8b..4229207f4 100644 --- a/corsika/detail/modules/ObservationPlane.inl +++ b/corsika/detail/modules/ObservationPlane.inl @@ -1,7 +1,5 @@ /* - * (c) Copyright 2019 CORSIKA Project, corsika-project@lists.kit.edu - * - * See file AUTHORS for a list of contributors. + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * * 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 diff --git a/corsika/detail/modules/ParticleCut.inl b/corsika/detail/modules/ParticleCut.inl index 3890b4510..0b4aa3f6a 100644 --- a/corsika/detail/modules/ParticleCut.inl +++ b/corsika/detail/modules/ParticleCut.inl @@ -1,7 +1,5 @@ /* - * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu - * - * See file AUTHORS for a list of contributors. + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * * 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 diff --git a/corsika/detail/modules/StackInspector.inl b/corsika/detail/modules/StackInspector.inl index 5ddedeb1c..8c28f1ee3 100644 --- a/corsika/detail/modules/StackInspector.inl +++ b/corsika/detail/modules/StackInspector.inl @@ -1,7 +1,5 @@ /* - * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu - * - * See file AUTHORS for a list of contributors. + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * * 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 diff --git a/corsika/detail/modules/TrackWriter.inl b/corsika/detail/modules/TrackWriter.inl index d22ea176b..548407528 100644 --- a/corsika/detail/modules/TrackWriter.inl +++ b/corsika/detail/modules/TrackWriter.inl @@ -1,7 +1,5 @@ /* - * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu - * - * See file AUTHORS for a list of contributors. + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * * 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 @@ -32,8 +30,7 @@ namespace corsika::track_writer { } template <typename TParticle, typename TTrack> - ProcessReturn TrackWriter::doContinuous(const TParticle& vP, - const TTrack& vT) { + ProcessReturn TrackWriter::doContinuous(const TParticle& vP, const TTrack& vT) { auto const start = vT.getPosition(0).getCoordinates(); auto const delta = vT.getPosition(1).getCoordinates() - start; auto const pdg = static_cast<int>(get_PDG(vP.getPID())); diff --git a/corsika/detail/modules/TrackingLine.inl b/corsika/detail/modules/TrackingLine.inl index 6f0f32304..290aa55a6 100644 --- a/corsika/detail/modules/TrackingLine.inl +++ b/corsika/detail/modules/TrackingLine.inl @@ -1,7 +1,5 @@ /* - * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu - * - * See file AUTHORS for a list of contributors. + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * * 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 diff --git a/corsika/detail/modules/energy_loss/BetheBlochPDG.inl b/corsika/detail/modules/energy_loss/BetheBlochPDG.inl index 9ba0107a9..197fd3453 100644 --- a/corsika/detail/modules/energy_loss/BetheBlochPDG.inl +++ b/corsika/detail/modules/energy_loss/BetheBlochPDG.inl @@ -1,7 +1,5 @@ /* - * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu - * - * See file AUTHORS for a list of contributors. + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * * 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 diff --git a/corsika/detail/modules/pythia8/Decay.inl b/corsika/detail/modules/pythia8/Decay.inl index c39909159..2e639d2b8 100644 --- a/corsika/detail/modules/pythia8/Decay.inl +++ b/corsika/detail/modules/pythia8/Decay.inl @@ -1,7 +1,5 @@ /* - * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu - * - * See file AUTHORS for a list of contributors. + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * * 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 diff --git a/corsika/detail/modules/pythia8/Interaction.inl b/corsika/detail/modules/pythia8/Interaction.inl index 90a134eb3..687f40c37 100644 --- a/corsika/detail/modules/pythia8/Interaction.inl +++ b/corsika/detail/modules/pythia8/Interaction.inl @@ -1,7 +1,5 @@ /* - * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu - * - * See file AUTHORS for a list of contributors. + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * * 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 diff --git a/corsika/detail/modules/pythia8/Random.inl b/corsika/detail/modules/pythia8/Random.inl index cfd19bb19..980052613 100644 --- a/corsika/detail/modules/pythia8/Random.inl +++ b/corsika/detail/modules/pythia8/Random.inl @@ -1,7 +1,5 @@ /* - * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu - * - * See file AUTHORS for a list of contributors. + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * * 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 diff --git a/corsika/detail/modules/qgsjetII/Interaction.inl b/corsika/detail/modules/qgsjetII/Interaction.inl index 7a9287276..be20e4995 100644 --- a/corsika/detail/modules/qgsjetII/Interaction.inl +++ b/corsika/detail/modules/qgsjetII/Interaction.inl @@ -1,8 +1,6 @@ /* * (c) Copyright 2020 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. @@ -52,8 +50,7 @@ namespace corsika::qgsjetII { std::cout << "QgsjetII::Interaction n=" << count_ << std::endl; } - CrossSectionType Interaction::getCrossSection(const Code beamId, - const Code targetId, + CrossSectionType Interaction::getCrossSection(const Code beamId, const Code targetId, const HEPEnergyType Elab, const unsigned int Abeam, const unsigned int targetA) const { @@ -61,7 +58,8 @@ namespace corsika::qgsjetII { if (corsika::qgsjetII::canInteract(beamId)) { - int const iBeam = static_cast<QgsjetIIXSClassIntType>(corsika::qgsjetII::getQgsjetIIXSCode(beamId)); + int const iBeam = static_cast<QgsjetIIXSClassIntType>( + corsika::qgsjetII::getQgsjetIIXSCode(beamId)); int iTarget = 1; if (is_nucleus(targetId)) { iTarget = targetA; @@ -165,7 +163,7 @@ namespace corsika::qgsjetII { if (corsika::qgsjetII::canInteract(corsikaBeamId)) { - CoordinateSystemPtr const& rootCS = get_root_CoordinateSystem(); + CoordinateSystemPtr const& rootCS = get_root_CoordinateSystem(); // position and time of interaction, not used in QgsjetII Point pOrig = vP.getPosition(); @@ -222,8 +220,7 @@ namespace corsika::qgsjetII { std::cout << "Interaction: target selected: " << targetCode << std::endl; int targetQgsCode = -1; - if (is_nucleus(targetCode)) - targetQgsCode = get_nucleus_A(targetCode); + if (is_nucleus(targetCode)) targetQgsCode = get_nucleus_A(targetCode); if (targetCode == Code::Proton) targetQgsCode = 1; std::cout << "Interaction: target qgsjetII code/A: " << targetQgsCode << std::endl; if (targetQgsCode > maxMassNumber_ || targetQgsCode < 1) @@ -271,7 +268,7 @@ namespace corsika::qgsjetII { // CoM frame definition in QgsjetII projectile: +z auto const& originalCS = projectileMomentumLab.getCoordinateSystem(); CoordinateSystemPtr const zAxisFrame = - make_rotationToZ(originalCS, projectileMomentumLab); + make_rotationToZ(originalCS, projectileMomentumLab); // fragments QGSJetIIFragmentsStack qfs; @@ -283,20 +280,19 @@ namespace corsika::qgsjetII { case 1: { // proton/neutron idFragm = Code::Proton; - auto momentum = Vector( - zAxisFrame, QuantityVector<hepmomentum_d>{ - 0.0_GeV, 0.0_GeV, - sqrt((projectileEnergyLab + Proton::mass) * - (projectileEnergyLab - Proton::mass))}); + auto momentum = + Vector(zAxisFrame, QuantityVector<hepmomentum_d>{ + 0.0_GeV, 0.0_GeV, + sqrt((projectileEnergyLab + Proton::mass) * + (projectileEnergyLab - Proton::mass))}); auto const energy = sqrt(momentum.getSquaredNorm() + square(get_mass(idFragm))); momentum.rebase(originalCS); // transform back into standard lab frame std::cout << "secondary fragment> id=" << idFragm << " p=" << momentum.getComponents() << std::endl; - auto pnew = vP.addSecondary( - std::make_tuple(idFragm, energy, momentum, pOrig, - tOrig)); + auto pnew = + vP.addSecondary(std::make_tuple(idFragm, energy, momentum, pOrig, tOrig)); Plab_final += pnew.getMomentum(); Elab_final += pnew.getEnergy(); } break; @@ -329,8 +325,7 @@ namespace corsika::qgsjetII { << " p=" << momentum.getComponents() << " A=" << A << " Z=" << Z << std::endl; auto pnew = vP.addSecondary( - std::make_tuple( - idFragm, energy, momentum, pOrig, tOrig, A, Z)); + std::make_tuple(idFragm, energy, momentum, pOrig, tOrig, A, Z)); Plab_final += pnew.getMomentum(); Elab_final += pnew.getEnergy(); } @@ -347,10 +342,9 @@ namespace corsika::qgsjetII { std::cout << "secondary fragment> id=" << corsika::qgsjetII::convertFromQgsjetII(psec.getPID()) << " p=" << momentum.getComponents() << std::endl; - auto pnew = - vP.addSecondary(std::make_tuple( - corsika::qgsjetII::convertFromQgsjetII(psec.getPID()), energy, momentum, - pOrig, tOrig)); + auto pnew = vP.addSecondary( + std::make_tuple(corsika::qgsjetII::convertFromQgsjetII(psec.getPID()), energy, + momentum, pOrig, tOrig)); Plab_final += pnew.getMomentum(); Elab_final += pnew.getEnergy(); } diff --git a/corsika/detail/modules/qgsjetII/ParticleConversion.inl b/corsika/detail/modules/qgsjetII/ParticleConversion.inl index 3f11c6ad6..291bc7b87 100644 --- a/corsika/detail/modules/qgsjetII/ParticleConversion.inl +++ b/corsika/detail/modules/qgsjetII/ParticleConversion.inl @@ -1,8 +1,6 @@ /* * (c) Copyright 2020 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. diff --git a/corsika/detail/modules/qgsjetII/QGSJetIIStack.inl b/corsika/detail/modules/qgsjetII/QGSJetIIStack.inl index 8405888cc..60f86fb48 100644 --- a/corsika/detail/modules/qgsjetII/QGSJetIIStack.inl +++ b/corsika/detail/modules/qgsjetII/QGSJetIIStack.inl @@ -1,3 +1,11 @@ +/* + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu + * + * 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. + */ + #pragma once namespace corsika::qgsjetII { @@ -28,8 +36,8 @@ namespace corsika::qgsjetII { HEPEnergyType QGSJetIIStackData::getEnergy(const int i) const { return qgarr14_.esp[i][0] * 1_GeV; } - MomentumVector QGSJetIIStackData::getMomentum( - const unsigned int i, const CoordinateSystemPtr& CS) const { + MomentumVector QGSJetIIStackData::getMomentum(const unsigned int i, + const CoordinateSystemPtr& CS) const { QuantityVector<hepmomentum_d> components = {qgarr14_.esp[i][2] * 1_GeV, qgarr14_.esp[i][3] * 1_GeV, qgarr14_.esp[i][1] * 1_GeV}; diff --git a/corsika/detail/modules/qgsjetII/qgsjet-II-04.inl b/corsika/detail/modules/qgsjetII/qgsjet-II-04.inl index 4efc95632..130ac0173 100644 --- a/corsika/detail/modules/qgsjetII/qgsjet-II-04.inl +++ b/corsika/detail/modules/qgsjetII/qgsjet-II-04.inl @@ -1,8 +1,6 @@ /* * (c) Copyright 2020 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. diff --git a/corsika/detail/modules/urqmd/UrQMD.inl b/corsika/detail/modules/urqmd/UrQMD.inl index 56e78d7dd..f76772168 100644 --- a/corsika/detail/modules/urqmd/UrQMD.inl +++ b/corsika/detail/modules/urqmd/UrQMD.inl @@ -1,7 +1,5 @@ /* - * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu - * - * See file AUTHORS for a list of contributors. + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * * 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 diff --git a/corsika/detail/setup/SetupEnvironment.inl b/corsika/detail/setup/SetupEnvironment.inl index f78bc6313..39b129bd1 100644 --- a/corsika/detail/setup/SetupEnvironment.inl +++ b/corsika/detail/setup/SetupEnvironment.inl @@ -1,7 +1,14 @@ +/* + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu + * + * 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. + */ + #pragma once #include <corsika/framework/geometry/Point.hpp> #include <corsika/framework/geometry/CoordinateSystem.hpp> #include <limits> - diff --git a/corsika/detail/setup/SetupStack.hpp b/corsika/detail/setup/SetupStack.hpp index 7b5b3c3c5..d31e940f6 100644 --- a/corsika/detail/setup/SetupStack.hpp +++ b/corsika/detail/setup/SetupStack.hpp @@ -1,3 +1,11 @@ +/* + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu + * + * 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. + */ + #pragma once #include <corsika/framework/stack/CombinedStack.hpp> @@ -29,7 +37,7 @@ namespace corsika { using StackWithGeometry = CombinedStack< typename nuclear_stack::ParticleDataStack::stack_implementation_type, - node::GeometryData<setup::Environment>, StackWithGeometryInterface>; + node::GeometryData<setup::Environment>, StackWithGeometryInterface>; // ------------------------------------------ // Add [optional] history data to stack, too: @@ -37,8 +45,8 @@ namespace corsika { // combine dummy stack with geometry information for tracking template <typename TStackIter> using StackWithHistoryInterface = - CombinedParticleInterface<StackWithGeometry::pi_type, history::HistoryEventDataInterface, - TStackIter>; + CombinedParticleInterface<StackWithGeometry::pi_type, + history::HistoryEventDataInterface, TStackIter>; using StackWithHistory = CombinedStack<typename StackWithGeometry::stack_implementation_type, diff --git a/corsika/detail/setup/SetupStack.inl b/corsika/detail/setup/SetupStack.inl index e69de29bb..4181d1eb8 100644 --- a/corsika/detail/setup/SetupStack.inl +++ b/corsika/detail/setup/SetupStack.inl @@ -0,0 +1,8 @@ +/* + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu + * + * 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. + */ + diff --git a/corsika/detail/stack/SuperStupidStack.inl b/corsika/detail/stack/SuperStupidStack.inl index 6b003d5de..4aa688837 100644 --- a/corsika/detail/stack/SuperStupidStack.inl +++ b/corsika/detail/stack/SuperStupidStack.inl @@ -22,29 +22,30 @@ namespace corsika::simple_stack { -template <typename StackIteratorInterface> -void ParticleInterface<StackIteratorInterface>::setParticleData(std::tuple<corsika::Code, HEPEnergyType, MomentumVector, - corsika::Point, TimeType> const& v) { -this->setPID(std::get<0>(v)); -this->setEnergy(std::get<1>(v)); -this->setMomentum(std::get<2>(v)); -this->setPosition(std::get<3>(v)); -this->setTime(std::get<4>(v)); -} - - -template <typename StackIteratorInterface> -void ParticleInterface<StackIteratorInterface>::setParticleData(ParticleInterface<StackIteratorInterface> const&, - std::tuple<corsika::Code, HEPEnergyType, MomentumVector, - corsika::Point, TimeType> const& v) { -this->setPID(std::get<0>(v)); -this->setEnergy(std::get<1>(v)); -this->setMomentum(std::get<2>(v)); -this->setPosition(std::get<3>(v)); -this->setTime(std::get<4>(v)); -} - -inline void SuperStupidStackImpl::clear() { + template <typename StackIteratorInterface> + void ParticleInterface<StackIteratorInterface>::setParticleData( + std::tuple<corsika::Code, HEPEnergyType, MomentumVector, corsika::Point, + TimeType> const& v) { + this->setPID(std::get<0>(v)); + this->setEnergy(std::get<1>(v)); + this->setMomentum(std::get<2>(v)); + this->setPosition(std::get<3>(v)); + this->setTime(std::get<4>(v)); + } + + template <typename StackIteratorInterface> + void ParticleInterface<StackIteratorInterface>::setParticleData( + ParticleInterface<StackIteratorInterface> const&, + std::tuple<corsika::Code, HEPEnergyType, MomentumVector, corsika::Point, + TimeType> const& v) { + this->setPID(std::get<0>(v)); + this->setEnergy(std::get<1>(v)); + this->setMomentum(std::get<2>(v)); + this->setPosition(std::get<3>(v)); + this->setTime(std::get<4>(v)); + } + + inline void SuperStupidStackImpl::clear() { dataPID_.clear(); dataE_.clear(); momentum_.clear(); @@ -52,7 +53,7 @@ inline void SuperStupidStackImpl::clear() { time_.clear(); } -inline void SuperStupidStackImpl::copy(size_t i1, size_t i2) { + inline void SuperStupidStackImpl::copy(size_t i1, size_t i2) { dataPID_[i2] = dataPID_[i1]; dataE_[i2] = dataE_[i1]; momentum_[i2] = momentum_[i1]; @@ -60,7 +61,7 @@ inline void SuperStupidStackImpl::copy(size_t i1, size_t i2) { time_[i2] = time_[i1]; } -inline void SuperStupidStackImpl::swap(size_t i1, size_t i2) { + inline void SuperStupidStackImpl::swap(size_t i1, size_t i2) { std::swap(dataPID_[i2], dataPID_[i1]); std::swap(dataE_[i2], dataE_[i1]); std::swap(momentum_[i2], momentum_[i1]); @@ -68,8 +69,7 @@ inline void SuperStupidStackImpl::swap(size_t i1, size_t i2) { std::swap(time_[i2], time_[i1]); } - -inline void SuperStupidStackImpl::incrementSize() { + inline void SuperStupidStackImpl::incrementSize() { using corsika::Code; using corsika::Point; @@ -85,7 +85,7 @@ inline void SuperStupidStackImpl::incrementSize() { time_.push_back(0 * second); } -inline void SuperStupidStackImpl::decrementSize() { + inline void SuperStupidStackImpl::decrementSize() { if (dataE_.size() > 0) { dataPID_.pop_back(); dataE_.pop_back(); @@ -95,5 +95,4 @@ inline void SuperStupidStackImpl::decrementSize() { } } - } // namespace corsika::simple_stack diff --git a/corsika/framework/analytics/ClassTimer.hpp b/corsika/framework/analytics/ClassTimer.hpp index 7958f6f81..5fed5b778 100644 --- a/corsika/framework/analytics/ClassTimer.hpp +++ b/corsika/framework/analytics/ClassTimer.hpp @@ -22,10 +22,14 @@ namespace corsika { template <class TClass, typename TTimer> - class ClassTimerImpl : public TTimer{ - static_assert(is_timer_v<TTimer>, "TTimer is not a timer!"); // Better https://en.cppreference.com/w/cpp/language/constraints but not available in C++17 - - protected: + class ClassTimerImpl : public TTimer { + static_assert( + is_timer_v<TTimer>, + "TTimer is not a timer!"); // Better + // https://en.cppreference.com/w/cpp/language/constraints + // but not available in C++17 + + protected: /// Reference to the class object on which the function should be called TClass& obj_; @@ -39,7 +43,9 @@ namespace corsika { * @tparam TClassFunc Type of the member function pointer that should be wrapped * @tparam TFunc Actual function of the type defined in TClass */ - template <typename TClassFunc, TClassFunc TFunc, typename TTimer = Timer<std::chrono::high_resolution_clock, std::chrono::microseconds>> + template <typename TClassFunc, TClassFunc TFunc, + typename TTimer = + Timer<std::chrono::high_resolution_clock, std::chrono::microseconds>> class ClassTimer; /// Measure the runtime of a single class function @@ -57,7 +63,8 @@ namespace corsika { */ template <typename TClass, typename TRet, typename... TArgs, TRet (TClass::*TFuncPtr)(TArgs...), typename TTimer> - class ClassTimer<TRet (TClass::*)(TArgs...), TFuncPtr, TTimer> : public ClassTimerImpl<TClass, TTimer> { + class ClassTimer<TRet (TClass::*)(TArgs...), TFuncPtr, TTimer> + : public ClassTimerImpl<TClass, TTimer> { private: public: ClassTimer(TClass& obj); @@ -74,8 +81,10 @@ namespace corsika { }; /// Specialisation for member functions without return value - template <typename TClass, typename... TArgs, void (TClass::*TFuncPtr)(TArgs...), typename TTimer> - class ClassTimer<void (TClass::*)(TArgs...), TFuncPtr, TTimer> : public ClassTimerImpl<TClass, TTimer> { + template <typename TClass, typename... TArgs, void (TClass::*TFuncPtr)(TArgs...), + typename TTimer> + class ClassTimer<void (TClass::*)(TArgs...), TFuncPtr, TTimer> + : public ClassTimerImpl<TClass, TTimer> { public: ClassTimer(TClass& obj); @@ -94,7 +103,8 @@ namespace corsika { }; /// Specialisation for const member functions without return value - template <typename TClass, typename... TArgs, void (TClass::*TFuncPtr)(TArgs...) const, typename TTimer> + template <typename TClass, typename... TArgs, void (TClass::*TFuncPtr)(TArgs...) const, + typename TTimer> class ClassTimer<void (TClass::*)(TArgs...) const, TFuncPtr, TTimer> : public ClassTimerImpl<TClass, TTimer> { public: diff --git a/corsika/framework/analytics/FunctionTimer.hpp b/corsika/framework/analytics/FunctionTimer.hpp index 2a3f5d89a..b5aaae5c4 100644 --- a/corsika/framework/analytics/FunctionTimer.hpp +++ b/corsika/framework/analytics/FunctionTimer.hpp @@ -24,9 +24,14 @@ namespace corsika { * @tparam TDuration type of std::duration to measure the elapsed time, default is * microseconds */ - template <typename TFunc, class TTimer = Timer<std::chrono::high_resolution_clock, std::chrono::microseconds>> - class FunctionTimer : public TTimer{ - static_assert(is_timer_v<TTimer>, "TTimer is not a timer!"); // Better https://en.cppreference.com/w/cpp/language/constraints but not available in C++17 + template <typename TFunc, class TTimer = Timer<std::chrono::high_resolution_clock, + std::chrono::microseconds>> + class FunctionTimer : public TTimer { + static_assert( + is_timer_v<TTimer>, + "TTimer is not a timer!"); // Better + // https://en.cppreference.com/w/cpp/language/constraints + // but not available in C++17 public: /** Constructs the wrapper with the given functionpointer * @param f Function or functor whose runtime should be measured @@ -46,8 +51,7 @@ namespace corsika { template <typename... TArgs> auto operator()(TArgs&&... args) -> std::invoke_result_t<TFunc, TArgs...>; - - private: + private: TFunc function_; }; diff --git a/corsika/framework/analytics/Timer.hpp b/corsika/framework/analytics/Timer.hpp index d3040c98b..4df67f488 100644 --- a/corsika/framework/analytics/Timer.hpp +++ b/corsika/framework/analytics/Timer.hpp @@ -56,6 +56,7 @@ namespace corsika { std::true_type is_timer_impl(Timer<T, U> const volatile&); template <typename T> - inline constexpr bool is_timer_v = std::is_same_v< decltype(is_timer_impl(std::declval<T&>())), std::true_type>; + inline constexpr bool is_timer_v = + std::is_same_v<decltype(is_timer_impl(std::declval<T&>())), std::true_type>; } // namespace corsika \ No newline at end of file diff --git a/corsika/framework/core/ParticleProperties.hpp b/corsika/framework/core/ParticleProperties.hpp index adac5d0e1..bec9a2700 100644 --- a/corsika/framework/core/ParticleProperties.hpp +++ b/corsika/framework/core/ParticleProperties.hpp @@ -49,7 +49,7 @@ namespace corsika { //! Particle code according to PDG, "Monte Carlo Particle Numbering Scheme" PDGCode constexpr get_PDG(Code); std::string_view constexpr get_name(Code); //!< name of the particle as string - TimeType constexpr get_lifetime(Code); //!< lifetime + TimeType constexpr get_lifetime(Code); //!< lifetime //! true iff the particle is a hard-coded nucleus or Code::Nucleus bool constexpr is_nucleus(Code); diff --git a/corsika/framework/core/PhysicalGeometry.hpp b/corsika/framework/core/PhysicalGeometry.hpp index fb1645786..36b897f75 100644 --- a/corsika/framework/core/PhysicalGeometry.hpp +++ b/corsika/framework/core/PhysicalGeometry.hpp @@ -20,7 +20,6 @@ namespace corsika { - typedef Vector<hepmomentum_d> MomentumVector; - + typedef Vector<hepmomentum_d> MomentumVector; } // namespace corsika diff --git a/corsika/framework/geometry/BaseVector.hpp b/corsika/framework/geometry/BaseVector.hpp index 5569149c6..b094f6d43 100644 --- a/corsika/framework/geometry/BaseVector.hpp +++ b/corsika/framework/geometry/BaseVector.hpp @@ -31,19 +31,19 @@ namespace corsika { , cs_(pCS) {} BaseVector() = delete; // we only want to creat initialized - // objects + // objects BaseVector(BaseVector const&) = default; BaseVector(BaseVector&& a) = default; BaseVector& operator=(BaseVector const&) = default; ~BaseVector() = default; CoordinateSystemPtr getCoordinateSystem() const; - void setCoordinateSystem(CoordinateSystemPtr const& cs) { cs_ = cs; } + void setCoordinateSystem(CoordinateSystemPtr const& cs) { cs_ = cs; } protected: QuantityVector<TDimension> const& getQuantityVector() const; QuantityVector<TDimension>& getQuantityVector(); - void setQuantityVector(QuantityVector<TDimension> const& v) { quantityVector_=v; } + void setQuantityVector(QuantityVector<TDimension> const& v) { quantityVector_ = v; } private: QuantityVector<TDimension> quantityVector_; diff --git a/corsika/framework/geometry/CoordinateSystem.hpp b/corsika/framework/geometry/CoordinateSystem.hpp index bf4f5ab85..31f57d395 100644 --- a/corsika/framework/geometry/CoordinateSystem.hpp +++ b/corsika/framework/geometry/CoordinateSystem.hpp @@ -35,7 +35,7 @@ namespace corsika { using CoordinateSystemPtr = std::shared_ptr<CoordinateSystem const>; /// this is the only way to create ONE unique root CS - static CoordinateSystemPtr& get_root_CoordinateSystem(); + static CoordinateSystemPtr& get_root_CoordinateSystem(); /** * Creates new CoordinateSystemPtr by translation along \a vector @@ -44,7 +44,8 @@ namespace corsika { QuantityVector<length_d> const& vector); /** - * creates a new CoordinateSystem in which vVec points in direction of the new z-axis, \a vVec + * creates a new CoordinateSystem in which vVec points in direction of the new z-axis, + * \a vVec */ template <typename TDim> inline CoordinateSystemPtr make_rotationToZ(CoordinateSystemPtr const& cs, @@ -59,7 +60,8 @@ namespace corsika { double const angle); /** - * creates a new CoordinateSystem, translated by \a translation and rotated around \a axis by \a angle. + * creates a new CoordinateSystem, translated by \a translation and rotated around \a + * axis by \a angle. */ template <typename TDim> inline CoordinateSystemPtr make_translationAndRotation( diff --git a/corsika/framework/geometry/Line.hpp b/corsika/framework/geometry/Line.hpp index 3e1e18564..ea99139db 100644 --- a/corsika/framework/geometry/Line.hpp +++ b/corsika/framework/geometry/Line.hpp @@ -18,7 +18,7 @@ namespace corsika { * Describes a straight line in space * */ - + class Line { ///! \toto move this to PhysicalUnits diff --git a/corsika/framework/geometry/PhysicalGeometry.hpp b/corsika/framework/geometry/PhysicalGeometry.hpp index fb1645786..36b897f75 100644 --- a/corsika/framework/geometry/PhysicalGeometry.hpp +++ b/corsika/framework/geometry/PhysicalGeometry.hpp @@ -20,7 +20,6 @@ namespace corsika { - typedef Vector<hepmomentum_d> MomentumVector; - + typedef Vector<hepmomentum_d> MomentumVector; } // namespace corsika diff --git a/corsika/framework/geometry/QuantityVector.hpp b/corsika/framework/geometry/QuantityVector.hpp index 5b0c1ba2a..c8787712c 100644 --- a/corsika/framework/geometry/QuantityVector.hpp +++ b/corsika/framework/geometry/QuantityVector.hpp @@ -17,7 +17,7 @@ n/* namespace corsika { class CoordinateSystem; // fwd decl - class Point; // fwd decl + class Point; // fwd decl template <typename T> class Vector; // fwd decl diff --git a/corsika/framework/geometry/Sphere.hpp b/corsika/framework/geometry/Sphere.hpp index e014dd86d..0cf5e66d7 100644 --- a/corsika/framework/geometry/Sphere.hpp +++ b/corsika/framework/geometry/Sphere.hpp @@ -18,7 +18,7 @@ namespace corsika { * Describes a sphere in space * **/ - + class Sphere : public IVolume { public: diff --git a/corsika/framework/geometry/Trajectory.hpp b/corsika/framework/geometry/Trajectory.hpp index 9aa7b917d..9f5ef956f 100644 --- a/corsika/framework/geometry/Trajectory.hpp +++ b/corsika/framework/geometry/Trajectory.hpp @@ -39,7 +39,6 @@ namespace corsika { private: TimeType timeLength_; - }; } // namespace corsika diff --git a/corsika/framework/process/BoundaryCrossingProcess.hpp b/corsika/framework/process/BoundaryCrossingProcess.hpp index 97a265445..8d56350ab 100644 --- a/corsika/framework/process/BoundaryCrossingProcess.hpp +++ b/corsika/framework/process/BoundaryCrossingProcess.hpp @@ -27,10 +27,9 @@ namespace corsika { template <typename TDerived> class BoundaryCrossingProcess : public BaseProcess<TDerived> { - /* static_assert(std::is_invocable_v<decltype(&TDerived<>::doBoundaryCrossing), TDerived&, - passepartout>, - "BoundaryCrossingProcess needs doBoundaryCrossing(TParticle, " - "TParticle::node_type, TParticle::node_type)");*/ + /* static_assert(std::is_invocable_v<decltype(&TDerived<>::doBoundaryCrossing), + TDerived&, passepartout>, "BoundaryCrossingProcess needs + doBoundaryCrossing(TParticle, " "TParticle::node_type, TParticle::node_type)");*/ public: /** @@ -38,7 +37,8 @@ namespace corsika { * \p from and \p to. */ template <typename TParticle> - ProcessReturn doBoundaryCrossing(TParticle&, typename TParticle::node_type const& from, + ProcessReturn doBoundaryCrossing(TParticle&, + typename TParticle::node_type const& from, typename TParticle::node_type const& to); }; diff --git a/corsika/framework/process/NullModel.hpp b/corsika/framework/process/NullModel.hpp index 2f0949b09..0e4746f31 100644 --- a/corsika/framework/process/NullModel.hpp +++ b/corsika/framework/process/NullModel.hpp @@ -15,7 +15,7 @@ namespace corsika { /** * Process that does nothing */ - + class NullModel : public BaseProcess<NullModel> { public: diff --git a/corsika/framework/process/ProcessReturn.hpp b/corsika/framework/process/ProcessReturn.hpp index 072a1855b..fab4f628d 100644 --- a/corsika/framework/process/ProcessReturn.hpp +++ b/corsika/framework/process/ProcessReturn.hpp @@ -14,7 +14,7 @@ n/* namespace corsika { - /** + /** since in a process sequence many status updates can accumulate for a single particle, this enum should define only bit-flags that can be accumulated easily with "|=" diff --git a/corsika/framework/process/ProcessSequence.hpp b/corsika/framework/process/ProcessSequence.hpp index 057730b95..be499bf8b 100644 --- a/corsika/framework/process/ProcessSequence.hpp +++ b/corsika/framework/process/ProcessSequence.hpp @@ -85,13 +85,14 @@ namespace corsika { * * \param in_A process/list A * \param in_A process/list B - **/ + **/ ProcessSequence(TProcess1 in_A, TProcess2 in_B) : A_(in_A) , B_(in_B) {} template <typename TParticle> - ProcessReturn doBoundaryCrossing(TParticle& particle, typename TParticle::node_type const& from, + ProcessReturn doBoundaryCrossing(TParticle& particle, + typename TParticle::node_type const& from, typename TParticle::node_type const& to); template <typename TParticle, typename TTrack> @@ -117,7 +118,7 @@ namespace corsika { inline void doStack(TStack& stack); template <typename TParticle, typename TTrack> - inline LengthType getMaxStepLength(TParticle& particle, TTrack& vTrack); + inline LengthType getMaxStepLength(TParticle& particle, TTrack& vTrack); template <typename TParticle> inline GrammageType getInteractionLength(TParticle&& particle) { @@ -182,7 +183,7 @@ namespace corsika { vA, make_sequence(std::forward<TProcesses>(vBs)...)); } - /** + /** * Factory function to create ProcessSequence * * specialization for two input objects (no paramter pack in vB). diff --git a/corsika/framework/process/SwitchProcessSequence.hpp b/corsika/framework/process/SwitchProcessSequence.hpp index 469d14c46..fab65b86e 100644 --- a/corsika/framework/process/SwitchProcessSequence.hpp +++ b/corsika/framework/process/SwitchProcessSequence.hpp @@ -111,7 +111,7 @@ namespace corsika { * \param in_A process branch A * \param in_A process branch B * \param sel functor to swtich between branch A and B - **/ + **/ SwitchProcessSequence(TProcess1 in_A, TProcess2 in_B, TSelect sel) : select_(sel) , A_(in_A) diff --git a/corsika/framework/random/ExponentialDistribution.hpp b/corsika/framework/random/ExponentialDistribution.hpp index 51e34ce45..77b351941 100644 --- a/corsika/framework/random/ExponentialDistribution.hpp +++ b/corsika/framework/random/ExponentialDistribution.hpp @@ -20,23 +20,21 @@ namespace corsika { typedef std::exponential_distribution<real_type> distribution_type; public: - typedef Quantity value_type; - ExponentialDistribution()=delete; + ExponentialDistribution() = delete; ExponentialDistribution(value_type const& beta) : beta_(beta) {} - ExponentialDistribution(ExponentialDistribution<value_type>const& other): - beta_(other.getBeta()) - {} + ExponentialDistribution(ExponentialDistribution<value_type> const& other) + : beta_(other.getBeta()) {} - ExponentialDistribution<value_type>& - operator=(ExponentialDistribution<value_type>const& other){ - if( this == &other) return *this; - beta_ = other.getBeta(); - return *this; + ExponentialDistribution<value_type>& operator=( + ExponentialDistribution<value_type> const& other) { + if (this == &other) return *this; + beta_ = other.getBeta(); + return *this; } /** @@ -46,9 +44,7 @@ namespace corsika { * @post * @return value_type */ - value_type getBeta() const { - return beta_; - } + value_type getBeta() const { return beta_; } /** * @fn void setBeta(value_type) @@ -58,27 +54,24 @@ namespace corsika { * @post * @param vBeta */ - void setBeta(value_type const& beta) { - beta_ = beta; - } + void setBeta(value_type const& beta) { beta_ = beta; } - /** + /** * @fn value_type operator ()(Generator&) - * @brief Generate a random number distributed like \f[ \beta e^{-X}\f] - * - * @pre - * @post - * @tparam Generator - * @param g - * @return - */ + * @brief Generate a random number distributed like \f[ \beta e^{-X}\f] + * + * @pre + * @post + * @tparam Generator + * @param g + * @return + */ template <class Generator> value_type operator()(Generator& g) { return beta_ * dist_(g); } private: - distribution_type dist_{1.}; value_type beta_; }; diff --git a/corsika/framework/random/RNGManager.hpp b/corsika/framework/random/RNGManager.hpp index adea23378..775d62570 100644 --- a/corsika/framework/random/RNGManager.hpp +++ b/corsika/framework/random/RNGManager.hpp @@ -16,7 +16,6 @@ #include <corsika/framework/utility/Singleton.hpp> #include <corsika/framework/logging/Logging.hpp> - /*! * With this class modules can register streams of random numbers. */ @@ -28,17 +27,15 @@ namespace corsika { friend class corsika::Singleton<RNGManager>; public: - - typedef std::mt19937_64 prng_type; - typedef std::uint64_t seed_type; - typedef std::string string_type; - typedef std::map<std::string, prng_type> streams_type; + typedef std::mt19937_64 prng_type; + typedef std::uint64_t seed_type; + typedef std::string string_type; + typedef std::map<std::string, prng_type> streams_type; typedef std::map<std::string, std::seed_seq> seeds_type; + RNGManager(RNGManager const&) = default; - RNGManager( RNGManager const& ) = default; - - RNGManager& operator=(RNGManager const& ) = delete; + RNGManager& operator=(RNGManager const&) = delete; /*! * This function is to be called by a module requiring a random-number @@ -46,7 +43,7 @@ namespace corsika { * * \throws sth. when stream \a pModuleName is already registered */ - inline void registerRandomStream(string_type const& streamName); + inline void registerRandomStream(string_type const& streamName); /*! * returns the pre-stored stream of given name \a pStreamName if @@ -74,7 +71,8 @@ namespace corsika { /** * Set seeds for all currently registered streams. */ - inline void seedAll(void); //!< seed all currently registered streams with "real" randomness + inline void seedAll( + void); //!< seed all currently registered streams with "real" randomness /** * @fn const streams_type getRngs&()const @@ -84,57 +82,47 @@ namespace corsika { * @post * @return RNGManager::streams_type */ - inline const streams_type& getRngs() const { - return rngs_; - } - - /** - * @fn const seeds_type getSeeds&()const - * @brief Constant access to the seeds. - * - * @pre - * @post - * @return RNGManager::seeds_type - */ - inline const seeds_type& getSeeds() const { - return seeds_; - } - - /** - * @fn streams_type Rngs() - * @brief Non-constant access to the streams. - * - * @pre - * @post - * @return RNGManager::streams_type& - */ - inline streams_type Rngs() { - return rngs_; - } - - /** - * @fn seeds_type Seeds&() - * @brief Non-constant access to seeds. - * - * @pre - * @post - * @return RNGManager::seeds_type& - */ - inline seeds_type& Seeds() { - return seeds_; - } + inline const streams_type& getRngs() const { return rngs_; } - protected: + /** + * @fn const seeds_type getSeeds&()const + * @brief Constant access to the seeds. + * + * @pre + * @post + * @return RNGManager::seeds_type + */ + inline const seeds_type& getSeeds() const { return seeds_; } - RNGManager()=default; + /** + * @fn streams_type Rngs() + * @brief Non-constant access to the streams. + * + * @pre + * @post + * @return RNGManager::streams_type& + */ + inline streams_type Rngs() { return rngs_; } - private: + /** + * @fn seeds_type Seeds&() + * @brief Non-constant access to seeds. + * + * @pre + * @post + * @return RNGManager::seeds_type& + */ + inline seeds_type& Seeds() { return seeds_; } + protected: + RNGManager() = default; + + private: streams_type rngs_; - seeds_type seeds_; + seeds_type seeds_; }; - typedef typename RNGManager::prng_type default_prng_type; + typedef typename RNGManager::prng_type default_prng_type; } // namespace corsika diff --git a/corsika/framework/random/UniformRealDistribution.hpp b/corsika/framework/random/UniformRealDistribution.hpp index 620e72ecd..781a23717 100644 --- a/corsika/framework/random/UniformRealDistribution.hpp +++ b/corsika/framework/random/UniformRealDistribution.hpp @@ -13,39 +13,36 @@ namespace corsika { - template <typename Quantity> class UniformRealDistribution { typedef typename Quantity::value_type real_type; - typedef std::uniform_real_distribution<real_type> distribution_type; + typedef std::uniform_real_distribution<real_type> distribution_type; public: - - typedef Quantity value_type; + typedef Quantity value_type; UniformRealDistribution() = delete; UniformRealDistribution(Quantity const& b) - : min_{value_type(phys::units::detail::magnitude_tag, 0)} - , max_(b) {} - - UniformRealDistribution(value_type const& pmin, value_type const& pmax) - : min_(pmin) - , max_(pmax) {} - - UniformRealDistribution(UniformRealDistribution<value_type> const& other): - min_(other.getMin()) - , max_(other.getMax()) - {} - - inline UniformRealDistribution<value_type>& - operator=(UniformRealDistribution<value_type> const& other){ - if( this == &other) return *this; - min_ = other.getMin(); - max_ = other.getMax(); - return *this; - } + : min_{value_type(phys::units::detail::magnitude_tag, 0)} + , max_(b) {} + + UniformRealDistribution(value_type const& pmin, value_type const& pmax) + : min_(pmin) + , max_(pmax) {} + + UniformRealDistribution(UniformRealDistribution<value_type> const& other) + : min_(other.getMin()) + , max_(other.getMax()) {} + + inline UniformRealDistribution<value_type>& operator=( + UniformRealDistribution<value_type> const& other) { + if (this == &other) return *this; + min_ = other.getMin(); + max_ = other.getMax(); + return *this; + } /** * @fn quantity_type getMax()const @@ -55,9 +52,7 @@ namespace corsika { * @post * @return quantity_type */ - inline value_type getMax() const { - return max_; - } + inline value_type getMax() const { return max_; } /** * @fn void setMax(quantity_type) @@ -67,9 +62,7 @@ namespace corsika { * @post * @param vMax */ - inline void setMax(value_type const& pmax) { - max_ = pmax; - } + inline void setMax(value_type const& pmax) { max_ = pmax; } /** * @fn quantity_type getMin()const @@ -79,9 +72,7 @@ namespace corsika { * @post * @return */ - inline value_type getMin() const { - return min_; - } + inline value_type getMin() const { return min_; } /** * @fn void setMin(quantity_type) @@ -91,12 +82,10 @@ namespace corsika { * @post * @param vMin */ - inline void setMin(value_type const& pmin) { - min_ = pmin; - } + inline void setMin(value_type const& pmin) { min_ = pmin; } /** - * @fn quantity_type operator ()(Generator&) + * @fn quantity_type operator ()(Generator&) * @brief Generate a random numberin the range [min, max] * * @pre @@ -111,7 +100,6 @@ namespace corsika { } private: - distribution_type dist_{real_type(0.), real_type(1.)}; value_type min_; diff --git a/corsika/framework/stack/ParticleBase.hpp b/corsika/framework/stack/ParticleBase.hpp index cc43e649b..44e03a521 100644 --- a/corsika/framework/stack/ParticleBase.hpp +++ b/corsika/framework/stack/ParticleBase.hpp @@ -44,19 +44,18 @@ namespace corsika { struct ParticleBase { public: - typedef StackIterator stack_iterator_type; ParticleBase() = default; - // those copy constructors and assigments should never be implemented - ParticleBase(ParticleBase&&) = delete; + // those copy constructors and assigments should never be implemented + + ParticleBase(ParticleBase&&) = delete; ParticleBase(ParticleBase const&) = delete; - ParticleBase operator=(ParticleBase&&) = delete; + ParticleBase operator=(ParticleBase&&) = delete; ParticleBase operator=(ParticleBase const&) = delete; - /** * Delete this particle on the stack. The corresponding iterator * will be invalidated by this operation @@ -67,7 +66,9 @@ namespace corsika { * Method to retrieve the status of the Particle. Is it already deleted? Or not. */ - inline bool isErased() const { return this->getIterator().getStack().isErased(this->getIterator()); } + inline bool isErased() const { + return this->getIterator().getStack().isErased(this->getIterator()); + } /** * Add a secondary particle based on *this on the stack @param @@ -75,7 +76,7 @@ namespace corsika { * function description in the user defined ParticleInterface::AddSecondary(...) */ template <typename... TArgs> - inline stack_iterator_type addSecondary(const TArgs... args) { + inline stack_iterator_type addSecondary(const TArgs... args) { return this->getStack().addSecondary(this->getIterator(), args...); } @@ -86,10 +87,10 @@ namespace corsika { * return the corresponding StackIterator for this particle */ inline stack_iterator_type& getIterator() { - return static_cast<stack_iterator_type&>(*this); + return static_cast<stack_iterator_type&>(*this); } - inline const stack_iterator_type& getIterator() const { + inline const stack_iterator_type& getIterator() const { return static_cast<const stack_iterator_type&>(*this); } @@ -100,28 +101,20 @@ namespace corsika { and getStackData to retrieve data @{ */ - inline auto& getStackData() { - return this->getIterator().getStackData(); - } + inline auto& getStackData() { return this->getIterator().getStackData(); } - inline const auto& getStackData() const { - return this->getIterator().getStackData(); - } + inline const auto& getStackData() const { return this->getIterator().getStackData(); } - inline auto& getStack() { - return this->getIterator().getStack(); - } + inline auto& getStack() { return this->getIterator().getStack(); } - inline const auto& getStack() const { - return this->getIterator().getStack(); - } + inline const auto& getStack() const { return this->getIterator().getStack(); } /** * return the index number of the underlying iterator object */ - inline std::size_t getIndex() const { - return this->getIterator().getIndexFromIterator(); + inline std::size_t getIndex() const { + return this->getIterator().getIndexFromIterator(); } ///@} }; diff --git a/corsika/framework/stack/SecondaryView.hpp b/corsika/framework/stack/SecondaryView.hpp index 112f5053d..515c0f57c 100644 --- a/corsika/framework/stack/SecondaryView.hpp +++ b/corsika/framework/stack/SecondaryView.hpp @@ -1,10 +1,11 @@ /* - * (c) copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * * 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. */ + #pragma once #include <corsika/framework/stack/Stack.hpp> @@ -82,9 +83,6 @@ namespace corsika { typedef Stack<TStackDataType, TParticleInterface> inner_stack_value_type; public: - // using StackIteratorValue = - // StackIteratorInterface<typename std::remove_reference<TStackDataType>::type, - // TParticleInterface, InnerStackTypeValue>; typedef StackIteratorInterface<typename std::remove_reference<TStackDataType>::type, TParticleInterface, inner_stack_value_type> stack_value_iterator; @@ -108,11 +106,6 @@ namespace corsika { TParticleInterface, view_type> stack_view_iterator; - // using ConstStackIterator = - // ConstStackIteratorInterface<typename - // std::remove_reference<TStackDataType>::type, - // TParticleInterface, view_type>; - typedef ConstStackIteratorInterface< typename std::remove_reference<TStackDataType>::type, TParticleInterface, view_type> @@ -174,7 +167,7 @@ namespace corsika { * SecondaryView is derived from. This projectile should not be * used to modify the Stack! */ - inline stack_value_iterator parent() + inline stack_value_iterator parent() const { // todo: check if this can't be Conststack_value_iterator return stack_value_iterator(inner_stack_, projectile_index_); } @@ -184,7 +177,7 @@ namespace corsika { * SecondaryView is derived from. This projectile should not be * used to modify the Stack! */ - inline stack_value_iterator asNewParent() const { + inline stack_value_iterator asNewParent() const { return stack_value_iterator(inner_stack_, projectile_index_); } @@ -192,7 +185,7 @@ namespace corsika { * This return a projectile of this SecondaryView, which can be * used to modify the SecondaryView */ - inline stack_view_iterator getProjectile() { + inline stack_view_iterator getProjectile() { // NOTE: 0 is special marker here for PROJECTILE, see getIndexFromIterator return stack_view_iterator(*this, 0); } @@ -200,18 +193,18 @@ namespace corsika { * Method to add a new secondary particle on this SecondaryView */ template <typename... Args> - inline stack_view_iterator addSecondary(const Args... v); + inline stack_view_iterator addSecondary(const Args... v); /** * overwrite Stack::getSize to return actual number of secondaries */ - inline unsigned int getSize() const { return indices_.size(); } + inline unsigned int getSize() const { return indices_.size(); } - inline unsigned int getEntries() const { + inline unsigned int getEntries() const { return getSize() - inner_stack_reference_type::getErased(); } - inline bool isEmpty() const { return getEntries() == 0; } + inline bool isEmpty() const { return getEntries() == 0; } /** * @name These are functions required by std containers and std loops @@ -221,38 +214,44 @@ namespace corsika { */ // NOTE: the "+1" is since "0" is special marker here for PROJECTILE, see // getIndexFromIterator - inline stack_view_iterator begin(); + inline stack_view_iterator begin(); - inline stack_view_iterator end() { return stack_view_iterator(*this, getSize() + 1); } + inline stack_view_iterator end() { return stack_view_iterator(*this, getSize() + 1); } - inline stack_view_iterator last(); + inline stack_view_iterator last(); - inline const_stack_view_iterator begin() const ; + inline const_stack_view_iterator begin() const; - inline const_stack_view_iterator end() const { return const_stack_view_iterator(*this, getSize() + 1); } + inline const_stack_view_iterator end() const { + return const_stack_view_iterator(*this, getSize() + 1); + } - inline const_stack_view_iterator last() const; + inline const_stack_view_iterator last() const; - inline const_stack_view_iterator cbegin() const; + inline const_stack_view_iterator cbegin() const; - inline const_stack_view_iterator cend() const { return const_stack_view_iterator(*this, getSize()); } + inline const_stack_view_iterator cend() const { + return const_stack_view_iterator(*this, getSize()); + } - inline const_stack_view_iterator clast() const; + inline const_stack_view_iterator clast() const; - inline stack_view_iterator at(unsigned int i) { return stack_view_iterator(*this, i); } + inline stack_view_iterator at(unsigned int i) { + return stack_view_iterator(*this, i); + } - inline const_stack_view_iterator at(unsigned int i) const { + inline const_stack_view_iterator at(unsigned int i) const { return const_stack_view_iterator(*this, i); } - inline stack_view_iterator first() { return stack_view_iterator{*this, 0}; } + inline stack_view_iterator first() { return stack_view_iterator{*this, 0}; } - inline const_stack_view_iterator cfirst() const { + inline const_stack_view_iterator cfirst() const { return const_stack_view_iterator{*this, 0}; } /// @} - inline void swap(stack_view_iterator a, stack_view_iterator b) ; + inline void swap(stack_view_iterator a, stack_view_iterator b); inline void copy(stack_view_iterator a, stack_view_iterator b); @@ -319,7 +318,7 @@ namespace corsika { * "gaps" in the stack are filled with entries from the back * (copied). */ - inline void purge() ; + inline void purge(); inline std::string asString() const; @@ -344,11 +343,11 @@ namespace corsika { * stack_view_iterator::addSecondary via ParticleBase */ template <typename... Args> - inline stack_view_iterator addSecondary(stack_view_iterator& proj, const Args... v) ; + inline stack_view_iterator addSecondary(stack_view_iterator& proj, const Args... v); // forward to inner stack // this also checks the allowed bounds of 'i' - inline bool isErased(unsigned int i) const { + inline bool isErased(unsigned int i) const { if (i >= indices_.size()) return false; return inner_stack_.isErased(getIndexFromIterator(i + 1)); } diff --git a/corsika/framework/stack/Stack.hpp b/corsika/framework/stack/Stack.hpp index e23f543ca..dab5bb2d9 100644 --- a/corsika/framework/stack/Stack.hpp +++ b/corsika/framework/stack/Stack.hpp @@ -89,7 +89,7 @@ namespace corsika { */ Stack() : nDeleted_(0) - , data_() + , data_() , deleted_(std::vector<bool>(data_.getSize(), false)) {} Stack(Stack&) = delete; ///< since Stack can be very big, we don't want to copy it diff --git a/corsika/framework/stack/StackIteratorInterface.hpp b/corsika/framework/stack/StackIteratorInterface.hpp index 5b60f1856..f6240e878 100644 --- a/corsika/framework/stack/StackIteratorInterface.hpp +++ b/corsika/framework/stack/StackIteratorInterface.hpp @@ -146,14 +146,14 @@ namespace corsika { /** @name Iterator interface @{ **/ - inline StackIteratorInterface& operator++() { + inline StackIteratorInterface& operator++() { do { ++index_; } while ( getStack().isErased(*this)); // this also check the allowed bounds of index_ return *this; } - inline StackIteratorInterface operator++(int) { + inline StackIteratorInterface operator++(int) { StackIteratorInterface tmp(*this); do { ++index_; @@ -161,19 +161,19 @@ namespace corsika { getStack().isErased(*this)); // this also check the allowed bounds of index_ return tmp; } - inline StackIteratorInterface operator+(int delta) const { + inline StackIteratorInterface operator+(int delta) const { return StackIteratorInterface(*data_, index_ + delta); } - inline bool operator==(StackIteratorInterface const& rhs) const { + inline bool operator==(StackIteratorInterface const& rhs) const { return index_ == rhs.index_; } - inline bool operator!=(StackIteratorInterface const& rhs) const { + inline bool operator!=(StackIteratorInterface const& rhs) const { return index_ != rhs.index_; } - inline bool operator==( + inline bool operator==( const ConstStackIteratorInterface<TStackData, TParticleInterface, TStackType>& rhs) const; // implemented below - inline bool operator!=( + inline bool operator!=( const ConstStackIteratorInterface<TStackData, TParticleInterface, TStackType>& rhs) const; // implemented below @@ -181,7 +181,7 @@ namespace corsika { * Convert iterator to value type, where value type is the user-provided particle * readout class **/ - inline particle_interface_type& operator*() { + inline particle_interface_type& operator*() { return static_cast<particle_interface_type&>(*this); } @@ -189,7 +189,7 @@ namespace corsika { * Convert iterator to const value type, where value type is the user-provided * particle readout class **/ - inline particle_interface_type const& operator*() const { + inline particle_interface_type const& operator*() const { return static_cast<particle_interface_type const&>(*this); } ///@} diff --git a/corsika/framework/utility/COMBoost.hpp b/corsika/framework/utility/COMBoost.hpp index 7b79af451..0d4d14ebe 100644 --- a/corsika/framework/utility/COMBoost.hpp +++ b/corsika/framework/utility/COMBoost.hpp @@ -51,7 +51,6 @@ namespace corsika { Eigen::Matrix2d inverseBoost_; CoordinateSystemPtr originalCS_; CoordinateSystemPtr rotatedCS_; - }; } // namespace corsika diff --git a/corsika/framework/utility/CorsikaFenv.hpp b/corsika/framework/utility/CorsikaFenv.hpp index a7d51aef5..e9837943f 100644 --- a/corsika/framework/utility/CorsikaFenv.hpp +++ b/corsika/framework/utility/CorsikaFenv.hpp @@ -21,11 +21,11 @@ int fedisableexcept(int excepts); } #ifdef CORSIKA_HAS_FEENABLEEXCEPT - // Nothing to do, OS privides the functions +// Nothing to do, OS privides the functions #else - #ifdef CORSIKA_OS_MAC - #include <corsika/detail/framework/utility/CorsikaFenvOSX.inl> - #else - #include <corsika/detail/framework/utility/CorsikaFenvFallback.inl> - #endif +#ifdef CORSIKA_OS_MAC +#include <corsika/detail/framework/utility/CorsikaFenvOSX.inl> +#else +#include <corsika/detail/framework/utility/CorsikaFenvFallback.inl> +#endif #endif \ No newline at end of file diff --git a/corsika/framework/utility/SaveBoostHistogram.hpp b/corsika/framework/utility/SaveBoostHistogram.hpp index 8e12ba588..13a079410 100644 --- a/corsika/framework/utility/SaveBoostHistogram.hpp +++ b/corsika/framework/utility/SaveBoostHistogram.hpp @@ -28,4 +28,3 @@ namespace corsika { } // namespace corsika #include <corsika/detail/framework/utility/SaveBoostHistogram.inl> - diff --git a/corsika/framework/utility/Singleton.hpp b/corsika/framework/utility/Singleton.hpp index 97fb1dd3c..9b1b7ea50 100644 --- a/corsika/framework/utility/Singleton.hpp +++ b/corsika/framework/utility/Singleton.hpp @@ -46,9 +46,11 @@ namespace corsika { return instance; } - Singleton(const Singleton&) = delete; //Singleton Classes should not be copied. Removes move constructor and move assignment as well - Singleton& operator=(const Singleton&) = delete; //Singleton Classes should not be copied. - + Singleton(const Singleton&) = + delete; // Singleton Classes should not be copied. Removes move constructor and + // move assignment as well + Singleton& operator=(const Singleton&) = + delete; // Singleton Classes should not be copied. protected: // derived class can call ctor and dtor diff --git a/corsika/media/Environment.hpp b/corsika/media/Environment.hpp index 4a8ddb791..a52aeaebe 100644 --- a/corsika/media/Environment.hpp +++ b/corsika/media/Environment.hpp @@ -51,7 +51,8 @@ namespace corsika { * @tparam TVolumeType Type of volume to be created * @tparam TVolumeArgs Types to forward to the constructor * @param args Parameter forwarded to the constructor of TVolumeType - * @retval Retuns unique pointer to a VolumeTreeNode with the same EnvitonmentModel as this class + * @retval Retuns unique pointer to a VolumeTreeNode with the same EnvitonmentModel as + *this class **/ template <class TVolumeType, typename... TVolumeArgs> static std::unique_ptr<BaseNodeType> createNode(TVolumeArgs&&... args); diff --git a/corsika/media/HomogeneousMedium.hpp b/corsika/media/HomogeneousMedium.hpp index ee79dcb6f..c0e025816 100644 --- a/corsika/media/HomogeneousMedium.hpp +++ b/corsika/media/HomogeneousMedium.hpp @@ -38,7 +38,7 @@ namespace corsika { private: MassDensityType const density_; - NuclearComposition const nuclComp_; + NuclearComposition const nuclComp_; }; } // namespace corsika diff --git a/corsika/media/IMagneticFieldModel.hpp b/corsika/media/IMagneticFieldModel.hpp index 71ef51e34..3efd34546 100644 --- a/corsika/media/IMagneticFieldModel.hpp +++ b/corsika/media/IMagneticFieldModel.hpp @@ -24,8 +24,7 @@ namespace corsika { class IMagneticFieldModel : public Model { // a type-alias for a magnetic field vector - using MagneticFieldVector = - Vector<magnetic_flux_density_d>; + using MagneticFieldVector = Vector<magnetic_flux_density_d>; public: /** @@ -34,8 +33,7 @@ namespace corsika { * @param point The location to evaluate the field at. * @returns The magnetic field vector at that point. */ - virtual auto getMagneticField(Point const&) const - -> MagneticFieldVector = 0; + virtual auto getMagneticField(Point const&) const -> MagneticFieldVector = 0; /** * A virtual default destructor. diff --git a/corsika/media/LayeredSphericalAtmosphereBuilder.hpp b/corsika/media/LayeredSphericalAtmosphereBuilder.hpp index 603b66026..5de160d13 100644 --- a/corsika/media/LayeredSphericalAtmosphereBuilder.hpp +++ b/corsika/media/LayeredSphericalAtmosphereBuilder.hpp @@ -99,7 +99,7 @@ namespace corsika { std::stack<typename VolumeTreeNode<TMediumInterface>::VTNUPtr> layers_; // innermost layer first - + }; // end class LayeredSphericalAtmosphereBuilder } // namespace corsika diff --git a/corsika/media/MediumProperties.hpp b/corsika/media/MediumProperties.hpp index 5fb0efeed..76434f1f7 100644 --- a/corsika/media/MediumProperties.hpp +++ b/corsika/media/MediumProperties.hpp @@ -89,4 +89,4 @@ namespace corsika { return corsika::detail::medium_data[static_cast<MediumIntType>(m)]; } -} // namespace corsika::medium +} // namespace corsika diff --git a/corsika/media/NuclearComposition.hpp b/corsika/media/NuclearComposition.hpp index 548e7c809..f8f08704d 100644 --- a/corsika/media/NuclearComposition.hpp +++ b/corsika/media/NuclearComposition.hpp @@ -34,7 +34,7 @@ namespace corsika { * needs to add up to 1 **/ inline NuclearComposition(std::vector<Code> const& pComponents, - std::vector<float> const& pFractions); + std::vector<float> const& pFractions); /** Sum all all relative composition weighted by func(element) * This function sums all relative compositions given during this classes diff --git a/corsika/media/WeightProvider.hpp b/corsika/media/WeightProvider.hpp index 0093e9c5a..8f68926a7 100644 --- a/corsika/media/WeightProvider.hpp +++ b/corsika/media/WeightProvider.hpp @@ -12,14 +12,14 @@ namespace corsika { - /** Double Iterator * Iterator that allowes the iteration of two individual lists at the same time. The *user needs to take care that booth lists have the same length. * @tparam AConstIterator Iterator Type of the first list * @tparam BConstIterator Iterator Type of the second list - \todo TODO: replace with https://www.boost.org/doc/libs/1_74_0/libs/iterator/doc/zip_iterator.html or ranges zip + \todo TODO: replace with + https://www.boost.org/doc/libs/1_74_0/libs/iterator/doc/zip_iterator.html or ranges zip \todo check resource allocation **/ template <class AConstIterator, class BConstIterator> diff --git a/corsika/modules/StackInspector.hpp b/corsika/modules/StackInspector.hpp index 7e6ee9ded..a462b3828 100644 --- a/corsika/modules/StackInspector.hpp +++ b/corsika/modules/StackInspector.hpp @@ -36,7 +36,7 @@ namespace corsika::stack_inspector { private: bool ReportStack_; HEPEnergyType E0_; - const HEPEnergyType dE_threshold_ = 1_eV; + const HEPEnergyType dE_threshold_ = 1_eV; decltype(std::chrono::system_clock::now()) StartTime_; }; diff --git a/corsika/modules/energy_loss/BetheBlochPDG.hpp b/corsika/modules/energy_loss/BetheBlochPDG.hpp index 124e9e59b..6a4930ab1 100644 --- a/corsika/modules/energy_loss/BetheBlochPDG.hpp +++ b/corsika/modules/energy_loss/BetheBlochPDG.hpp @@ -21,7 +21,7 @@ namespace corsika::energy_loss { - /** + /** * PDG2018, passage of particles through matter * * Note, that \f$I_{\mathrm{eff}}\f$ of composite media a determined from \f$ \ln I = @@ -59,7 +59,6 @@ namespace corsika::energy_loss { void printProfile() const; HEPEnergyType getTotal() const; - private: void updateMomentum(corsika::setup::Stack::particle_type&, HEPEnergyType Enew); void fillProfile(setup::Trajectory const&, HEPEnergyType); diff --git a/corsika/modules/pythia8/Interaction.hpp b/corsika/modules/pythia8/Interaction.hpp index 263717cba..71b58de38 100644 --- a/corsika/modules/pythia8/Interaction.hpp +++ b/corsika/modules/pythia8/Interaction.hpp @@ -55,7 +55,8 @@ namespace corsika::pythia8 { void doInteraction(TProjectile&); private: - corsika::default_prng_type& fRNG = corsika::RNGManager::getInstance().getRandomStream("pythia"); + corsika::default_prng_type& fRNG = + corsika::RNGManager::getInstance().getRandomStream("pythia"); Pythia8::Pythia fPythia; Pythia8::SigmaTotal fSigma; const bool fInternalDecays = true; diff --git a/corsika/modules/pythia8/Random.hpp b/corsika/modules/pythia8/Random.hpp index 9a0b6085d..e23c4be73 100644 --- a/corsika/modules/pythia8/Random.hpp +++ b/corsika/modules/pythia8/Random.hpp @@ -19,7 +19,8 @@ namespace corsika::pythia8 { private: std::uniform_real_distribution<double> fDist; - corsika::default_prng_type& fRNG = corsika::RNGManager::getInstance().getRandomStream("pythia"); + corsika::default_prng_type& fRNG = + corsika::RNGManager::getInstance().getRandomStream("pythia"); }; } // namespace corsika::pythia8 diff --git a/corsika/modules/qgsjetII/ParticleConversion.hpp b/corsika/modules/qgsjetII/ParticleConversion.hpp index 65141b366..473365f12 100644 --- a/corsika/modules/qgsjetII/ParticleConversion.hpp +++ b/corsika/modules/qgsjetII/ParticleConversion.hpp @@ -51,13 +51,13 @@ namespace corsika::qgsjetII { NeutralLightMesonType = 101, }; using QgsjetIIHadronTypeIntType = std::underlying_type<QgsjetIIHadronType>::type; -} +} // namespace corsika::qgsjetII // include automatically generated code: #include <corsika/modules/qgsjetII/Generated.inc> namespace corsika::qgsjetII { - + QgsjetIICode constexpr convertToQgsjetII(Code pCode) { return corsika2qgsjetII[static_cast<CodeIntType>(pCode)]; } @@ -92,8 +92,7 @@ namespace corsika::qgsjetII { } QgsjetIIHadronType constexpr getQgsjetIIHadronType(Code pCode) { - return corsika2qgsjetIIHadronType[static_cast<CodeIntType>( - pCode)]; + return corsika2qgsjetIIHadronType[static_cast<CodeIntType>(pCode)]; } -} // namespace corsika::process::qgsjetII +} // namespace corsika::qgsjetII diff --git a/corsika/modules/urqmd/UrQMD.hpp b/corsika/modules/urqmd/UrQMD.hpp index 10c5b6b45..35bbe08f1 100644 --- a/corsika/modules/urqmd/UrQMD.hpp +++ b/corsika/modules/urqmd/UrQMD.hpp @@ -38,7 +38,8 @@ namespace corsika::urqmd { private: static CrossSectionType GetCrossSection(corsika::Code, corsika::Code, HEPEnergyType, int); - corsika::default_prng_type& fRNG = corsika::RNGManager::getInstance().getRandomStream("urqmd"); + corsika::default_prng_type& fRNG = + corsika::RNGManager::getInstance().getRandomStream("urqmd"); std::uniform_int_distribution<int> fBooleanDist{0, 1}; }; diff --git a/corsika/setup/SetupEnvironment.hpp b/corsika/setup/SetupEnvironment.hpp index fade01a63..b7f59b31b 100644 --- a/corsika/setup/SetupEnvironment.hpp +++ b/corsika/setup/SetupEnvironment.hpp @@ -26,4 +26,3 @@ namespace corsika::setup { using Environment = Environment<EnvironmentInterface>; } // end namespace corsika::setup - diff --git a/corsika/setup/SetupStack.hpp b/corsika/setup/SetupStack.hpp index ee1c85df4..88770f228 100644 --- a/corsika/setup/SetupStack.hpp +++ b/corsika/setup/SetupStack.hpp @@ -83,4 +83,3 @@ namespace corsika::setup { #endif // WITH_HISTORY } // namespace corsika::setup - diff --git a/corsika/stack/DummyStack.hpp b/corsika/stack/DummyStack.hpp index 0e1cc5161..bbbfff91a 100644 --- a/corsika/stack/DummyStack.hpp +++ b/corsika/stack/DummyStack.hpp @@ -61,7 +61,7 @@ namespace corsika::dummy_stack { void init() { entries_ = 0; } - inline void clear() { entries_ = 0; } + inline void clear() { entries_ = 0; } inline int getSize() const { return entries_; } inline int getCapacity() const { return entries_; } @@ -69,7 +69,7 @@ namespace corsika::dummy_stack { /** * Function to copy particle at location i2 in stack to i1 */ - inline void copy(const int /*i1*/, const int /*i2*/) {} + inline void copy(const int /*i1*/, const int /*i2*/) {} inline void incrementSize() { entries_++; } inline void decrementSize() { entries_--; } diff --git a/corsika/stack/GeometryNodeStackExtension.hpp b/corsika/stack/GeometryNodeStackExtension.hpp index 6c46fa14b..3450dc2ac 100644 --- a/corsika/stack/GeometryNodeStackExtension.hpp +++ b/corsika/stack/GeometryNodeStackExtension.hpp @@ -19,7 +19,7 @@ namespace corsika::node { /** * Describe "volume node" data on a Stack. - * + * * Corresponding defintion of a stack-readout object, the iteractor * dereference operator will deliver access to these function * defintion of a stack-readout object, the iteractor dereference @@ -35,39 +35,37 @@ namespace corsika::node { typedef T super_type; public: - typedef typename TEnvType::BaseNodeType node_type; // default version for particle-creation from input data - inline void setParticleData(const std::tuple<node_type const*> v) { + inline void setParticleData(const std::tuple<node_type const*> v) { setNode(std::get<0>(v)); } - inline void setParticleData(GeometryDataInterface& parent, - const std::tuple<node_type const*>) { + inline void setParticleData(GeometryDataInterface& parent, + const std::tuple<node_type const*>) { setNode(parent.getNode()); // copy Node from parent particle! } - inline void setParticleData() { setNode(nullptr); } - inline void setParticleData(GeometryDataInterface& parent) { + inline void setParticleData() { setNode(nullptr); } + inline void setParticleData(GeometryDataInterface& parent) { setNode(parent.getNode()); // copy Node from parent particle! } - inline std::string asString() const { - return fmt::format("node={}", fmt::ptr(getNode())); + inline std::string asString() const { + return fmt::format("node={}", fmt::ptr(getNode())); } - inline void setNode(node_type const* v) { + inline void setNode(node_type const* v) { - super_type::getStackData().setNode(super_type::getIndex(), v); + super_type::getStackData().setNode(super_type::getIndex(), v); } - inline node_type const* getNode() const { - return super_type::getStackData().getNode(super_type::getIndex()); + inline node_type const* getNode() const { + return super_type::getStackData().getNode(super_type::getIndex()); } }; // definition of stack-data object to store geometry information - /** * @class GeometryData * @@ -77,64 +75,46 @@ namespace corsika::node { class GeometryData { public: + typedef typename TEnvType::BaseNodeType node_type; + typedef std::vector<const node_type*> node_vector_type; - typedef typename TEnvType::BaseNodeType node_type; - typedef std::vector<const node_type*> node_vector_type; - - GeometryData()= default; + GeometryData() = default; - GeometryData( GeometryData<TEnvType> const& )= default; + GeometryData(GeometryData<TEnvType> const&) = default; - GeometryData( GeometryData<TEnvType> && )= default; + GeometryData(GeometryData<TEnvType>&&) = default; - GeometryData<TEnvType>& - operator=( GeometryData<TEnvType> const& )= default; + GeometryData<TEnvType>& operator=(GeometryData<TEnvType> const&) = default; - GeometryData<TEnvType>& - operator=( GeometryData<TEnvType> && )= default; + GeometryData<TEnvType>& operator=(GeometryData<TEnvType>&&) = default; // these functions are needed for the Stack interface - inline void clear() { - node_vector_.clear(); - } + inline void clear() { node_vector_.clear(); } - inline unsigned int getSize() const { - return node_vector_.size(); - } + inline unsigned int getSize() const { return node_vector_.size(); } - inline unsigned int getCapacity() const { - return node_vector_.size(); - } + inline unsigned int getCapacity() const { return node_vector_.size(); } - inline void copy(const int i1, const int i2) { - node_vector_[i2] = node_vector_[i1]; - } + inline void copy(const int i1, const int i2) { node_vector_[i2] = node_vector_[i1]; } - inline void swap(const int i1, const int i2) { - std::swap(node_vector_[i1], node_vector_[i2]); + inline void swap(const int i1, const int i2) { + std::swap(node_vector_[i1], node_vector_[i2]); } // custom data access function - inline void setNode(const int i, node_type const* v) { - node_vector_[i] = v; - } + inline void setNode(const int i, node_type const* v) { node_vector_[i] = v; } - inline node_type const* getNode(const int i) const { - return node_vector_[i]; - } + inline node_type const* getNode(const int i) const { return node_vector_[i]; } // these functions are also needed by the Stack interface - inline void incrementSize() { - node_vector_.push_back(nullptr); - } + inline void incrementSize() { node_vector_.push_back(nullptr); } - inline void decrementSize() { + inline void decrementSize() { if (node_vector_.size() > 0) { node_vector_.pop_back(); } } // custom private data section private: - node_vector_type node_vector_; }; @@ -143,4 +123,4 @@ namespace corsika::node { typedef GeometryDataInterface<T, TEnv> type; }; -} // namespace corsika::stack::node +} // namespace corsika::node diff --git a/corsika/stack/NuclearStackExtension.hpp b/corsika/stack/NuclearStackExtension.hpp index e429aa89c..1d907aa1b 100644 --- a/corsika/stack/NuclearStackExtension.hpp +++ b/corsika/stack/NuclearStackExtension.hpp @@ -54,24 +54,24 @@ namespace corsika::nuclear_stack { unsigned short, unsigned short> altenative_particle_data_type; - inline void setParticleData(particle_data_type const& v) ; + inline void setParticleData(particle_data_type const& v); - inline void setParticleData(altenative_particle_data_type const& v); + inline void setParticleData(altenative_particle_data_type const& v); inline void setParticleData(super_type& p, particle_data_type const& v); inline void setParticleData(super_type& p, altenative_particle_data_type const& v); - inline std::string asString() const; + inline std::string asString() const; /** * @name individual setters * @{ */ - inline void setNuclearA(const unsigned short vA) { + inline void setNuclearA(const unsigned short vA) { super_type::getStackData().setNuclearA(super_type::getIndex(), vA); } - inline void setNuclearZ(const unsigned short vZ) { + inline void setNuclearZ(const unsigned short vZ) { super_type::getStackData().setNuclearZ(super_type::getIndex(), vZ); } /// @} @@ -80,10 +80,10 @@ namespace corsika::nuclear_stack { * @name individual getters * @{ */ - inline int getNuclearA() const { + inline int getNuclearA() const { return super_type::getStackData().getNuclearA(super_type::getIndex()); } - inline int getNuclearZ() const { + inline int getNuclearZ() const { return super_type::getStackData().getNuclearZ(super_type::getIndex()); } /// @} @@ -91,22 +91,22 @@ namespace corsika::nuclear_stack { /** * Overwrite normal getParticleMass function with nuclear version */ - inline HEPMassType getMass() const; + inline HEPMassType getMass() const; /** * Overwirte normal getChargeNumber function with nuclear version **/ - inline int16_t getChargeNumber() const; + inline int16_t getChargeNumber() const; - inline int getNucleusRef() const { + inline int getNucleusRef() const { return super_type::getStackData().getNucleusRef(super_type::getIndex()); } // LCOV_EXCL_LINE protected: - inline void setNucleusRef(const int vR) { + inline void setNucleusRef(const int vR) { super_type::getStackData().setNucleusRef(super_type::getIndex(), vR); } - inline bool isNucleus() const { + inline bool isNucleus() const { return super_type::getStackData().isNucleus(super_type::getIndex()); } }; @@ -159,35 +159,39 @@ namespace corsika::nuclear_stack { nuclearA_[getNucleusRef(i)] = vA; } - inline void setNuclearZ(const unsigned int i, const unsigned short vZ) { + inline void setNuclearZ(const unsigned int i, const unsigned short vZ) { nuclearZ_[getNucleusRef(i)] = vZ; } - inline void setNucleusRef(const unsigned int i, const int v) { nucleusRef_[i] = v; } + inline void setNucleusRef(const unsigned int i, const int v) { nucleusRef_[i] = v; } - inline int getNuclearA(const unsigned int i) const { return nuclearA_[getNucleusRef(i)]; } + inline int getNuclearA(const unsigned int i) const { + return nuclearA_[getNucleusRef(i)]; + } - inline int getNuclearZ(const unsigned int i) const { return nuclearZ_[getNucleusRef(i)]; } + inline int getNuclearZ(const unsigned int i) const { + return nuclearZ_[getNucleusRef(i)]; + } // this function will create new storage for Nuclear Properties, and return the // reference to it - inline int getNucleusNextRef() ; + inline int getNucleusNextRef(); - inline int getNucleusRef(const unsigned int i) const; + inline int getNucleusRef(const unsigned int i) const; - inline bool isNucleus(const unsigned int i) const { return nucleusRef_[i] >= 0; } + inline bool isNucleus(const unsigned int i) const { return nucleusRef_[i] >= 0; } /** * Function to copy particle at location i1 in stack to i2 */ - inline void copy(const unsigned int i1, const unsigned int i2) ; + inline void copy(const unsigned int i1, const unsigned int i2); /** * Function to copy particle at location i2 in stack to i1 */ - inline void swap(const unsigned int i1, const unsigned int i2) ; + inline void swap(const unsigned int i1, const unsigned int i2); - inline void incrementSize() ; + inline void incrementSize(); - inline void decrementSize() ; + inline void decrementSize(); private: /// the actual memory to store particle data diff --git a/corsika/stack/SuperStupidStack.hpp b/corsika/stack/SuperStupidStack.hpp index df07a8924..54ff12eab 100644 --- a/corsika/stack/SuperStupidStack.hpp +++ b/corsika/stack/SuperStupidStack.hpp @@ -22,7 +22,7 @@ #include <vector> namespace corsika::simple_stack { - + /** * Example of a particle object on the stack. */ @@ -122,7 +122,7 @@ namespace corsika::simple_stack { void dump() const {} - inline void clear() ; + inline void clear(); unsigned int getSize() const { return dataPID_.size(); } unsigned int getCapacity() const { return dataPID_.size(); } @@ -152,7 +152,7 @@ namespace corsika::simple_stack { /** * Function to copy particle at location i2 in stack to i1 */ - inline void copy(size_t i1, size_t i2); + inline void copy(size_t i1, size_t i2); /** * FIXME: change to iterators. @@ -160,9 +160,9 @@ namespace corsika::simple_stack { */ inline void swap(size_t i1, size_t i2); - inline void incrementSize() ; + inline void incrementSize(); - inline void decrementSize() ; + inline void decrementSize(); private: /// the actual memory to store particle data diff --git a/corsika/stack/history/Event.hpp b/corsika/stack/history/Event.hpp index c00f5511b..1a450883b 100644 --- a/corsika/stack/history/Event.hpp +++ b/corsika/stack/history/Event.hpp @@ -44,8 +44,7 @@ namespace corsika::history { void setProjectileIndex(size_t i) { projectile_index_ = i; } size_t projectileIndex() const { return projectile_index_; } - size_t addSecondary(HEPEnergyType energy, - Vector<hepmomentum_d> const& momentum, + size_t addSecondary(HEPEnergyType energy, Vector<hepmomentum_d> const& momentum, Code pid) { secondaries_.emplace_back(energy, momentum, pid); return secondaries_.size() - 1; diff --git a/examples/boundary_example.cpp b/examples/boundary_example.cpp index 573a0c6fd..83e0e77c8 100644 --- a/examples/boundary_example.cpp +++ b/examples/boundary_example.cpp @@ -46,8 +46,8 @@ struct MyBoundaryCrossingProcess ProcessReturn doBoundaryCrossing(Particle& p, typename Particle::node_type const& from, typename Particle::node_type const& to) { - CORSIKA_LOG_INFO("MyBoundaryCrossingProcess: crossing! from: {} to: {} ", fmt::ptr(&from), - fmt::ptr(&to)); + CORSIKA_LOG_INFO("MyBoundaryCrossingProcess: crossing! from: {} to: {} ", + fmt::ptr(&from), fmt::ptr(&to)); auto const& name = get_name(p.getPID()); auto const start = p.getPosition().getCoordinates(); @@ -69,7 +69,7 @@ private: // int main() { - //logging::SetLevel(logging::level::info); + // logging::SetLevel(logging::level::info); CORSIKA_LOG_INFO("boundary_example"); @@ -88,15 +88,12 @@ int main() { auto world = EnvType::createNode<Sphere>( Point{rootCS, 0_m, 0_m, 0_m}, 1_km * std::numeric_limits<double>::infinity()); - using MyHomogeneousModel = - MediumPropertyModel<UniformMagneticField< - HomogeneousMedium<setup::EnvironmentInterface>>>; + using MyHomogeneousModel = MediumPropertyModel< + UniformMagneticField<HomogeneousMedium<setup::EnvironmentInterface>>>; auto const props = world->setModelProperties<MyHomogeneousModel>( - Medium::AirDry1Atm, Vector(rootCS, 0_T, 0_T, 0_T), - 1_kg / (1_m * 1_m * 1_m), - NuclearComposition(std::vector<Code>{Code::Proton}, - std::vector<float>{1.f})); + Medium::AirDry1Atm, Vector(rootCS, 0_T, 0_T, 0_T), 1_kg / (1_m * 1_m * 1_m), + NuclearComposition(std::vector<Code>{Code::Proton}, std::vector<float>{1.f})); // add a "target" sphere with 5km readius at 0,0,0 auto target = EnvType::createNode<Sphere>(Point{rootCS, 0_m, 0_m, 0_m}, 5_km); diff --git a/examples/helix_example.cpp b/examples/helix_example.cpp index 115fdd717..452c0177b 100644 --- a/examples/helix_example.cpp +++ b/examples/helix_example.cpp @@ -23,7 +23,7 @@ int main() { CORSIKA_LOG_INFO("helix_example"); CoordinateSystemPtr const& root = get_root_CoordinateSystem(); - + Point const r0(root, {0_m, 0_m, 0_m}); auto const omegaC = 2 * M_PI * 1_Hz; Vector<speed_d> vPar(root, {0_m / second, 0_m / second, 10_cm / second}); @@ -49,7 +49,7 @@ int main() { } CORSIKA_LOG_INFO("test: {} {} {} {} ", positions[n - 2][0], positions[n - 2][1], - positions[n - 2][2], positions[n - 2][3]); + positions[n - 2][2], positions[n - 2][3]); return EXIT_SUCCESS; } diff --git a/examples/stopping_power.cpp b/examples/stopping_power.cpp index 0036c84ba..863eea200 100644 --- a/examples/stopping_power.cpp +++ b/examples/stopping_power.cpp @@ -45,8 +45,7 @@ int main() { rootCS, 0_m, 0_m, 112.8_km); // this is the CORSIKA 7 start of atmosphere/universe - ShowerAxis showerAxis{injectionPos, - Vector<length_d>{rootCS, 0_m, 0_m, 1_m}, env}; + ShowerAxis showerAxis{injectionPos, Vector<length_d>{rootCS, 0_m, 0_m, 1_m}, env}; energy_loss::BetheBlochPDG eLoss{showerAxis, 300_MeV}; setup::Stack stack; diff --git a/tests/common/PhysicalUnitsCatch2.hpp b/tests/common/PhysicalUnitsCatch2.hpp index ee939407a..3fdc58bfe 100644 --- a/tests/common/PhysicalUnitsCatch2.hpp +++ b/tests/common/PhysicalUnitsCatch2.hpp @@ -10,7 +10,7 @@ #include <corsika/framework/core/PhysicalUnits.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch.hpp> namespace corsika::testing { @@ -26,4 +26,4 @@ namespace corsika::testing { return a.magnitude() == b; } -} +} // namespace corsika::testing diff --git a/tests/common/SetupEnvironment.hpp b/tests/common/SetupEnvironment.hpp index 69d1f6233..6c6ee7677 100644 --- a/tests/common/SetupEnvironment.hpp +++ b/tests/common/SetupEnvironment.hpp @@ -1,3 +1,11 @@ +/* + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu + * + * 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 <corsika/media/HomogeneousMedium.hpp> #include <corsika/media/InhomogeneousMedium.hpp> #include <corsika/media/MediumPropertyModel.hpp> diff --git a/tests/common/SetupTestEnvironment.hpp b/tests/common/SetupTestEnvironment.hpp index 50d5561dc..bcbd175a9 100644 --- a/tests/common/SetupTestEnvironment.hpp +++ b/tests/common/SetupTestEnvironment.hpp @@ -1,3 +1,11 @@ +/* + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu + * + * 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. + */ + #pragma once #include <corsika/framework/geometry/Point.hpp> diff --git a/tests/common/SetupTestStack.hpp b/tests/common/SetupTestStack.hpp index 35103012b..3d5322d4a 100644 --- a/tests/common/SetupTestStack.hpp +++ b/tests/common/SetupTestStack.hpp @@ -1,13 +1,23 @@ +/* + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu + * + * 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. + */ + #pragma once #include <corsika/framework/geometry/Point.hpp> #include <corsika/framework/geometry/RootCoordinateSystem.hpp> #include <corsika/framework/geometry/Vector.hpp> +#include <corsika/setup/SetupStack.hpp> + /** * \file SetupTestStack * - * standard stack setup for unit tests. + * standard stack setup for unit tests. **/ namespace corsika::setup::testing { @@ -15,10 +25,10 @@ namespace corsika::setup::testing { /** * \function setup_stack * - * standard stack setup for unit tests. + * standard stack setup for unit tests. + * * * - * * * \return a tuple with element 0 being a Stack object filled with * one particle, and element 1 the StackView on it. diff --git a/tests/framework/CMakeLists.txt b/tests/framework/CMakeLists.txt index 21dc79b89..6fff5242b 100644 --- a/tests/framework/CMakeLists.txt +++ b/tests/framework/CMakeLists.txt @@ -20,6 +20,13 @@ set (test_framework_sources testRandom.cpp testNullModel.cpp testHelix.cpp + testInteractionCounter.cpp ) CORSIKA_ADD_TEST (testFramework SOURCES ${test_framework_sources}) + +target_compile_definitions ( + testFramework + PRIVATE + REFDATADIR="${CMAKE_CURRENT_SOURCE_DIR}" +) diff --git a/tests/framework/testCOMBoost.cpp b/tests/framework/testCOMBoost.cpp index a96b6c0f6..12e1e3a0d 100644 --- a/tests/framework/testCOMBoost.cpp +++ b/tests/framework/testCOMBoost.cpp @@ -57,7 +57,7 @@ TEST_CASE("rotation") { e1.rebase(rotCS); e2.rebase(rotCS); e3.rebase(rotCS); - + // length of e1, e2 and e3 must all be 1_GeV in rotated CS (not boosted!) CHECK(e1.getNorm() / 1_GeV == Approx(1).margin(absMargin)); CHECK(e2.getNorm() / 1_GeV == Approx(1).margin(absMargin)); @@ -229,10 +229,9 @@ TEST_CASE("boosts") { MomentumVector pProjectileLab{rootCS, {0_GeV, 0_PeV, -1_PeV}}; HEPEnergyType const eProjectileLab = energy(projectileMass, pProjectileLab); FourVector const PprojLab(eProjectileLab, pProjectileLab); - const FourVector PprojLab(eProjectileLab, pProjectileLab); auto const sqrt_s_lab = - sqrt(s(eProjectileLab + targetMass, pProjectileLab.GetComponents(rootCS))); + sqrt(s(eProjectileLab + targetMass, pProjectileLab.getComponents(rootCS))); auto const sqrt_s_lab = sqrt(s(eProjectileLab + targetMass, pProjectileLab.GetComponents(rootCS))); @@ -242,14 +241,14 @@ TEST_CASE("boosts") { // boost projecticle auto const PprojCoM = boost.toCoM(PprojLab); - auto const a = PprojCoM.GetSpaceLikeComponents().GetComponents(boost.GetRotatedCS()); - CHECK(a.GetX() / 1_GeV == Approx(0)); - CHECK(a.GetY() / 1_GeV == Approx(0)); - CHECK(a.GetZ() / (momentum(sqrt_s_lab / 2, projectileMass)) == Approx(1)); + auto const a = PprojCoM.getSpaceLikeComponents().getComponents(boost.getRotatedCS()); + CHECK(a.getX() / 1_GeV == Approx(0)); + CHECK(a.getY() / 1_GeV == Approx(0)); + CHECK(a.getZ() / (momentum(sqrt_s_lab / 2, projectileMass)) == Approx(1)); // boost target auto const PtargCoM = boost.toCoM(FourVector(targetMass, pTargetLab)); - CHECK(PtargCoM.GetTimeLikeComponent() / sqrt_s_lab == Approx(.5)); + CHECK(PtargCoM.getTimeLikeComponent() / sqrt_s_lab == Approx(.5)); // sum of momenta in CoM, should be 0 auto const sumPCoM = @@ -334,7 +333,8 @@ TEST_CASE("rest frame") { FourVector const rest4Mom = boostRest.toCoM(PprojLab); CHECK(rest4Mom.getTimeLikeComponent() / 1_GeV == Approx(projectileMass / 1_GeV)); - CHECK(rest4Mom.getSpaceLikeComponents().getNorm() / 1_GeV == Approx(0).margin(absMargin)); + CHECK(rest4Mom.getSpaceLikeComponents().getNorm() / 1_GeV == + Approx(0).margin(absMargin)); FourVector const a{0_eV, Vector{csPrime, 0_eV, 5_GeV, 0_eV}}; FourVector const b{0_eV, Vector{rootCS, 3_GeV, 0_eV, 0_eV}}; diff --git a/tests/framework/testCascade.cpp b/tests/framework/testCascade.cpp index 5d5dd8b61..9d7cf8b49 100644 --- a/tests/framework/testCascade.cpp +++ b/tests/framework/testCascade.cpp @@ -101,7 +101,6 @@ public: } CORSIKA_LOG_INFO(fmt::format("ProcessCut::doSecondaries size={} count={}", vS.getEntries(), count_)); - } int getCount() const { return count_; } diff --git a/tests/framework/testClassTimer.cpp b/tests/framework/testClassTimer.cpp index e82c373d2..3d35fcc03 100644 --- a/tests/framework/testClassTimer.cpp +++ b/tests/framework/testClassTimer.cpp @@ -126,8 +126,7 @@ TEST_CASE("ClassTimer", "[Timer]") { SECTION("Measure runtime of a const function without arguments") { auto test = foo(); - auto tc = - corsika::ClassTimer<decltype(&foo::bar_const), &foo::bar_const>(test); + auto tc = corsika::ClassTimer<decltype(&foo::bar_const), &foo::bar_const>(test); tc.call(); diff --git a/tests/framework/testCorsikaFenv.cpp b/tests/framework/testCorsikaFenv.cpp index a82f44033..3e4e98e99 100644 --- a/tests/framework/testCorsikaFenv.cpp +++ b/tests/framework/testCorsikaFenv.cpp @@ -21,11 +21,8 @@ static void handle_fpe(int /*signo*/) { gRESULT = 0; } TEST_CASE("CorsikaFenv", "[fenv]") { - SECTION("Enable all exceptions") - { - feenableexcept(FE_ALL_EXCEPT); - } - + SECTION("Enable all exceptions") { feenableexcept(FE_ALL_EXCEPT); } + signal(SIGFPE, handle_fpe); SECTION("exception") { @@ -33,8 +30,6 @@ TEST_CASE("CorsikaFenv", "[fenv]") { [[maybe_unused]] auto trigger = std::log(0.); std::cout << "trigger: " << trigger << std::endl; CHECK(gRESULT == 0); - } - + } } - } diff --git a/tests/framework/testParticles.cpp b/tests/framework/testParticles.cpp index 6f63172fe..ae4b42856 100644 --- a/tests/framework/testParticles.cpp +++ b/tests/framework/testParticles.cpp @@ -66,14 +66,14 @@ TEST_CASE("ParticleProperties", "[Particles]") { SECTION("Lifetimes") { CHECK(get_lifetime(Code::Electron) == - std::numeric_limits<double>::infinity() * si::second); + std::numeric_limits<double>::infinity() * si::second); CHECK(get_lifetime(Code::DPlus) < get_lifetime(Code::Gamma)); CHECK(get_lifetime(Code::RhoPlus) / si::second == - (Approx(4.414566727909413e-24).epsilon(1e-3))); + (Approx(4.414566727909413e-24).epsilon(1e-3))); CHECK(get_lifetime(Code::SigmaMinusBar) / si::second == - (Approx(8.018880848563575e-11).epsilon(1e-5))); + (Approx(8.018880848563575e-11).epsilon(1e-5))); CHECK(get_lifetime(Code::MuPlus) / si::second == - (Approx(2.1970332555864364e-06).epsilon(1e-5))); + (Approx(2.1970332555864364e-06).epsilon(1e-5))); } SECTION("Particle groups: electromagnetic") { diff --git a/tests/framework/testProcessSequence.cpp b/tests/framework/testProcessSequence.cpp index 2fcbfafc4..af4cfd94b 100644 --- a/tests/framework/testProcessSequence.cpp +++ b/tests/framework/testProcessSequence.cpp @@ -45,6 +45,7 @@ public: for (int i = 0; i < nData; ++i) d.data_[i] += 0.933; return ProcessReturn::Ok; } + private: int v_ = 0; }; @@ -64,6 +65,7 @@ public: for (int i = 0; i < nData; ++i) d.data_[i] += 0.111; return ProcessReturn::Ok; } + private: int v_ = 0; }; @@ -83,6 +85,7 @@ public: for (int i = 0; i < nData; ++i) d.data_[i] += 0.333; return ProcessReturn::Ok; } + private: int v_ = 0; }; @@ -105,6 +108,7 @@ public: GrammageType getInteractionLength(TParticle&) const { return 10_g / square(1_cm); } + private: int v_; }; @@ -118,7 +122,7 @@ public: } template <typename TView> - inline void doInteraction(TView& v) const { + inline void doInteraction(TView& v) const { checkInteract |= 2; for (int i = 0; i < nData; ++i) v.parent().data_[i] /= 1.1; cout << "Process2::doInteraction" << endl; @@ -128,6 +132,7 @@ public: cout << "Process2::GetInteractionLength" << endl; return 20_g / (1_cm * 1_cm); } + private: int v_ = 0; }; @@ -151,6 +156,7 @@ public: cout << "Process3::GetInteractionLength" << endl; return 30_g / (1_cm * 1_cm); } + private: int v_ = 0; }; @@ -174,6 +180,7 @@ public: void doInteraction(TView&) const { checkInteract |= 8; } + private: int v_ = 0; }; @@ -222,6 +229,7 @@ public: return ProcessReturn::Ok; } int getCount() const { return count_; } + private: int count_ = 0; }; diff --git a/tests/framework/testRandom.cpp b/tests/framework/testRandom.cpp index 28f83017e..f31a2d9dc 100644 --- a/tests/framework/testRandom.cpp +++ b/tests/framework/testRandom.cpp @@ -16,10 +16,8 @@ #include <limits> #include <random> - using namespace corsika; - SCENARIO("random-number streams can be registered and retrieved") { GIVEN("a RNGManager") { RNGManager& rngManager = RNGManager::getInstance(); diff --git a/tests/framework/testUnits.cpp b/tests/framework/testUnits.cpp index f87af1c2a..2cdd947b1 100644 --- a/tests/framework/testUnits.cpp +++ b/tests/framework/testUnits.cpp @@ -151,6 +151,6 @@ TEST_CASE("PhysicalUnits", "[Units]") { CHECK(convert_SI_to_HEP(6.5823e-25_s) * 1_GeV == Approx(1).epsilon(1e-4)); CHECK(convert_SI_to_HEP(3.8938e-32 * meter * meter) * 1_GeV * 1_GeV == - Approx(1).epsilon(1e-4)); + Approx(1).epsilon(1e-4)); } } diff --git a/tests/media/testEnvironment.cpp b/tests/media/testEnvironment.cpp index d34c59490..14f0ca153 100644 --- a/tests/media/testEnvironment.cpp +++ b/tests/media/testEnvironment.cpp @@ -273,4 +273,3 @@ TEST_CASE("LayeredSphericalAtmosphereBuilder w/ magnetic field") { .getMagneticField(pTest2) .getComponents(gCS)); } - diff --git a/tests/media/testMagneticField.cpp b/tests/media/testMagneticField.cpp index da0a1a5d8..188de07f4 100644 --- a/tests/media/testMagneticField.cpp +++ b/tests/media/testMagneticField.cpp @@ -19,13 +19,11 @@ using namespace corsika; - TEST_CASE("UniformMagneticField w/ Homogeneous Medium") { CoordinateSystemPtr const& gCS = get_root_CoordinateSystem(); Point const gOrigin(gCS, {0_m, 0_m, 0_m}); - // setup our interface types using IModelInterface = IMagneticFieldModel<IMediumModel>; using AtmModel = UniformMagneticField<HomogeneousMedium<IModelInterface>>; diff --git a/tests/media/testMedium.cpp b/tests/media/testMedium.cpp index 09c4af17f..b8f9932e5 100644 --- a/tests/media/testMedium.cpp +++ b/tests/media/testMedium.cpp @@ -37,7 +37,6 @@ TEST_CASE("MediumProperties") { CHECK(air.getDlt0() == 0.0); } - TEST_CASE("MediumPropertyModel w/ Homogeneous") { CoordinateSystemPtr gCS = get_root_CoordinateSystem(); diff --git a/tests/modules/CMakeLists.txt b/tests/modules/CMakeLists.txt index 07caeb442..098412aaa 100644 --- a/tests/modules/CMakeLists.txt +++ b/tests/modules/CMakeLists.txt @@ -1,9 +1,8 @@ set (test_modules_sources TestMain.cpp # ${CORSIKA_DATA}/readLib/source/testData.cc - #testStackInspector.cpp + testStackInspector.cpp #testTrackingLine.cpp - #testInteractionCounter.cpp #testExecTime.cpp #testObservationPlane.cpp testQGSJetII.cpp diff --git a/tests/modules/testInteractionCounter.cpp b/tests/modules/testInteractionCounter.cpp index 5417f3e3e..62a8c17df 100644 --- a/tests/modules/testInteractionCounter.cpp +++ b/tests/modules/testInteractionCounter.cpp @@ -6,26 +6,23 @@ * the license. */ -#include <corsika/process/interaction_counter/InteractionCounter.hpp> +#include <corsika/modules/InteractionCounter.hpp> -#include <corsika/environment/Environment.h> -#include <corsika/environment/HomogeneousMedium.h> -#include <corsika/environment/NuclearComposition.h> -#include <corsika/geometry/Point.h> -#include <corsika/geometry/RootCoordinateSystem.h> -#include <corsika/geometry/Vector.h> -#include <corsika/units/PhysicalUnits.h> +#include <corsika/media/Environment.hpp> +#include <corsika/media/HomogeneousMedium.hpp> +#include <corsika/media/NuclearComposition.hpp> +#include <corsika/framework/geometry/Point.hpp> +#include <corsika/framework/geometry/RootCoordinateSystem.hpp> +#include <corsika/framework/geometry/Vector.hpp> +#include <corsika/framework/core/PhysicalUnits.hpp> -#include <corsika/setup/SetupStack.h> +#include <corsika/setup/SetupStack.hpp> #include <catch2/catch.hpp> #include <numeric> using namespace corsika; -using namespace corsika::process::interaction_counter; -using namespace corsika::units; -using namespace corsika::units::si; const std::string refDataDir = std::string(REFDATADIR); // from cmake diff --git a/tests/modules/testParticleCut.cpp b/tests/modules/testParticleCut.cpp index 06bf73d5d..72a895ecb 100644 --- a/tests/modules/testParticleCut.cpp +++ b/tests/modules/testParticleCut.cpp @@ -36,11 +36,10 @@ TEST_CASE("ParticleCut", "[processes]") { HEPEnergyType const Eabove = 1_TeV; HEPEnergyType const Ebelow = 10_GeV; // list of arbitrary particles - std::vector<Code> const particleList = { - Code::PiPlus, Code::PiMinus, Code::KPlus, - Code::KMinus, Code::K0Long, Code::K0Short, - Code::Electron, Code::MuPlus, Code::NuE, - Code::Neutron, Code::NuMu}; + std::vector<Code> const particleList = {Code::PiPlus, Code::PiMinus, Code::KPlus, + Code::KMinus, Code::K0Long, Code::K0Short, + Code::Electron, Code::MuPlus, Code::NuE, + Code::Neutron, Code::NuMu}; // common stating point const Point point0(rootCS, 0_m, 0_m, 0_m); diff --git a/tests/modules/testSibyll.cpp b/tests/modules/testSibyll.cpp index 8b37e65b4..8c3a9face 100644 --- a/tests/modules/testSibyll.cpp +++ b/tests/modules/testSibyll.cpp @@ -24,7 +24,7 @@ TEST_CASE("Sibyll", "[processes]") { SECTION("Sibyll -> Corsika") { CHECK(Code::Electron == - corsika::sibyll::convertFromSibyll(corsika::sibyll::SibyllCode::Electron)); + corsika::sibyll::convertFromSibyll(corsika::sibyll::SibyllCode::Electron)); } SECTION("Corsika -> Sibyll") { @@ -189,8 +189,8 @@ TEST_CASE("SibyllInterface", "[processes]") { model.doInteraction(view); [[maybe_unused]] const GrammageType length = model.getInteractionLength(particle); // Felix, are those changes OK? Below are the checks before refactory-2020 - //CHECK(length / 1_g * 1_cm * 1_cm == Approx(44.2).margin(.1)); - //CHECK(view.getSize() == 11); + // CHECK(length / 1_g * 1_cm * 1_cm == Approx(44.2).margin(.1)); + // CHECK(view.getSize() == 11); CHECK(length / 1_g * 1_cm * 1_cm == Approx(42.8).margin(.1)); CHECK(view.getSize() == 40); } diff --git a/tests/modules/testStackInspector.cpp b/tests/modules/testStackInspector.cpp index 705379342..86740fa22 100644 --- a/tests/modules/testStackInspector.cpp +++ b/tests/modules/testStackInspector.cpp @@ -24,7 +24,7 @@ using namespace corsika; TEST_CASE("StackInspector", "[processes]") { - auto const& rootCS = RootCoordinateSystem::getInstance().GetRootCoordinateSystem(); + auto const& rootCS = get_root_CoordinateSystem(); Point const origin(rootCS, {0_m, 0_m, 0_m}); Vector<units::si::SpeedType::dimension_type> v(rootCS, 0_m / second, 0_m / second, 1_m / second); @@ -32,18 +32,15 @@ TEST_CASE("StackInspector", "[processes]") { Trajectory<Line> track(line, 10_s); TestCascadeStack stack; - stack.Clear(); + stack.clear(); HEPEnergyType E0 = 100_GeV; - stack.AddParticle(std::tuple<corsika::Code, units::si::HEPEnergyType, - corsika::MomentumVector, Point, units::si::TimeType>{ + stack.addParticle(std::make_tuple( Code::Electron, E0, corsika::MomentumVector(rootCS, {0_GeV, 0_GeV, -1_GeV}), - Point(rootCS, {0_m, 0_m, 10_km}), 0_ns}); + Point(rootCS, {0_m, 0_m, 10_km}), 0_ns)); SECTION("interface") { StackInspector<TestCascadeStack> model(1, true, E0); - - model.Init(); model.doStack(stack); } } diff --git a/tests/modules/testSwitchProcess.cpp b/tests/modules/testSwitchProcess.cpp index eca0fd0ba..296315768 100644 --- a/tests/modules/testSwitchProcess.cpp +++ b/tests/modules/testSwitchProcess.cpp @@ -108,7 +108,8 @@ struct DummyProcess : InteractionProcess<DummyProcess<N>> { // secondaries for DummyProcess<N> for (int i = 0; i < N; ++i) { - // vSec.AddSecondary(std::make_tuple(vSec.GetEnergy() / N)); // <-- FIXME, when SwitchProcess is removedalter + // vSec.AddSecondary(std::make_tuple(vSec.GetEnergy() / N)); // <-- FIXME, when + // SwitchProcess is removedalter } } }; diff --git a/tests/stack/testDummyStack.cpp b/tests/stack/testDummyStack.cpp index c7b055468..2c3110eba 100644 --- a/tests/stack/testDummyStack.cpp +++ b/tests/stack/testDummyStack.cpp @@ -31,7 +31,10 @@ TEST_CASE("DummyStack", "[stack]") { TestStack s; // add 99 particles, each 10th particle is a nucleus with A=i and Z=A/2! - for (int i = 0; i < 99; ++i) { s.addParticle(std::tuple<dummy_stack::NoData>{noData}); } + + for (int i = 0; i < 99; ++i) { + s.addParticle(std::tuple<dummy_stack::NoData>{noData}); + } CHECK(s.getEntries() == 99); for (int i = 0; i < 99; ++i) s.getNextParticle().erase(); diff --git a/tests/stack/testHistoryView.cpp b/tests/stack/testHistoryView.cpp index c702f4c8a..f41a84c96 100644 --- a/tests/stack/testHistoryView.cpp +++ b/tests/stack/testHistoryView.cpp @@ -27,13 +27,13 @@ using namespace corsika; // combine dummy stack with geometry information for tracking template <typename TStackIter> -using StackWithHistoryInterface = CombinedParticleInterface< - nuclear_stack::ParticleDataStack::pi_type, - history::HistoryEventDataInterface, TStackIter>; +using StackWithHistoryInterface = + CombinedParticleInterface<nuclear_stack::ParticleDataStack::pi_type, + history::HistoryEventDataInterface, TStackIter>; -using TestStack = CombinedStack< - typename nuclear_stack::ParticleDataStack::stack_implementation_type, - history::HistoryEventData, StackWithHistoryInterface>; +using TestStack = + CombinedStack<typename nuclear_stack::ParticleDataStack::stack_implementation_type, + history::HistoryEventData, StackWithHistoryInterface>; /* See Issue 161 @@ -47,12 +47,11 @@ using TestStack = CombinedStack< actually needed. Keep an eye on this! */ #if defined(__clang__) -using TheTestStackView = SecondaryView<typename TestStack::StackImpl, - StackWithHistoryInterface, - history::HistorySecondaryProducer>; -#elif defined(__GNUC__) || defined(__GNUG__) using TheTestStackView = - MakeView<TestStack, history::HistorySecondaryProducer>::type; + SecondaryView<typename TestStack::StackImpl, StackWithHistoryInterface, + history::HistorySecondaryProducer>; +#elif defined(__GNUC__) || defined(__GNUG__) +using TheTestStackView = MakeView<TestStack, history::HistorySecondaryProducer>::type; #endif using TestStackView = TheTestStackView; @@ -76,10 +75,9 @@ TEST_CASE("HistoryStackExtensionView", "[stack]") { TestStack stack; // add primary particle - auto p0 = stack.addParticle( - std::make_tuple(Code::Electron, 1.5_GeV, - MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), - Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s)); + auto p0 = stack.addParticle(std::make_tuple( + Code::Electron, 1.5_GeV, MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), + Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s)); CHECK(stack.getEntries() == 1); corsika::history::EventPtr evt = p0.getEvent(); @@ -98,10 +96,9 @@ TEST_CASE("HistoryStackExtensionView", "[stack]") { // add 5 secondaries for (int i = 0; i < 5; ++i) { - auto sec = hview0.addSecondary( - std::make_tuple(Code::Electron, 1.5_GeV, - MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), - Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s)); + auto sec = hview0.addSecondary(std::make_tuple( + Code::Electron, 1.5_GeV, MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), + Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s)); CHECK(sec.getParentEventIndex() == i); CHECK(sec.getEvent() != nullptr); @@ -120,10 +117,9 @@ TEST_CASE("HistoryStackExtensionView", "[stack]") { // add second generation of secondaries // add 10 secondaries for (int i = 0; i < 10; ++i) { - auto sec = hview1.addSecondary( - std::make_tuple(Code::Electron, 1.5_GeV, - MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), - Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s)); + auto sec = hview1.addSecondary(std::make_tuple( + Code::Electron, 1.5_GeV, MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), + Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s)); CHECK(sec.getParentEventIndex() == i); CHECK(sec.getEvent()->parentEvent() == ev1); @@ -147,10 +143,9 @@ TEST_CASE("HistoryStackExtensionView", "[stack]") { for (int i = 0; i < 15; ++i) { CORSIKA_LOG_TRACE("loop, view: " + std::to_string(i)); - auto sec = hview2.addSecondary( - std::make_tuple(Code::Electron, 1.5_GeV, - MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), - Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s)); + auto sec = hview2.addSecondary(std::make_tuple( + Code::Electron, 1.5_GeV, MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), + Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s)); CORSIKA_LOG_TRACE("loop, ---- "); CHECK(sec.getParentEventIndex() == i); @@ -177,10 +172,9 @@ TEST_CASE("HistoryStackExtensionView", "[stack]") { // add 5 secondaries for (int i = 0; i < 5; ++i) { CORSIKA_LOG_TRACE("loop " + std::to_string(i)); - auto sec = proj0.addSecondary( - std::make_tuple(Code::Electron, 1.5_GeV, - MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), - Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s)); + auto sec = proj0.addSecondary(std::make_tuple( + Code::Electron, 1.5_GeV, MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), + Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s)); CHECK(sec.getParentEventIndex() == i); CHECK(sec.getEvent() != nullptr); @@ -198,10 +192,9 @@ TEST_CASE("HistoryStackExtensionView", "[stack]") { // add second generation of secondaries // add 10 secondaries for (unsigned int i = 0; i < 10; ++i) { - auto sec = proj1.addSecondary( - std::make_tuple(Code::Electron, 1.5_GeV, - MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), - Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s)); + auto sec = proj1.addSecondary(std::make_tuple( + Code::Electron, 1.5_GeV, MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), + Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s)); CHECK(sec.getParentEventIndex() == int(i)); CHECK(sec.getEvent()->parentEvent() == ev1); diff --git a/tests/stack/testNuclearStackExtension.cpp b/tests/stack/testNuclearStackExtension.cpp index 6edd0cc67..00c0ceee6 100644 --- a/tests/stack/testNuclearStackExtension.cpp +++ b/tests/stack/testNuclearStackExtension.cpp @@ -25,10 +25,9 @@ TEST_CASE("NuclearStackExtension", "[stack]") { nuclear_stack::NuclearStackExtension<simple_stack::SuperStupidStack, nuclear_stack::ExtendedParticleInterfaceType> s; - s.addParticle( - std::make_tuple(Code::Electron, 1.5_GeV, - MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), - Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s)); + s.addParticle(std::make_tuple( + Code::Electron, 1.5_GeV, MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), + Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s)); CHECK(s.getEntries() == 1); } @@ -37,26 +36,23 @@ TEST_CASE("NuclearStackExtension", "[stack]") { nuclear_stack::ExtendedParticleInterfaceType> s; s.addParticle(std::make_tuple( - Code::Nucleus, 1.5_GeV, - MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), + Code::Nucleus, 1.5_GeV, MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s, 10, 10)); CHECK(s.getEntries() == 1); } SECTION("write invalid nucleus") { nuclear_stack::ParticleDataStack s; - CHECK_THROWS(s.addParticle( - std::make_tuple(Code::Nucleus, 1.5_GeV, - MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), - Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s, 0, 0))); + CHECK_THROWS(s.addParticle(std::make_tuple( + Code::Nucleus, 1.5_GeV, MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), + Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s, 0, 0))); } SECTION("read non nucleus") { nuclear_stack::ParticleDataStack s; - s.addParticle( - std::make_tuple(Code::Electron, 1.5_GeV, - MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), - Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s)); + s.addParticle(std::make_tuple( + Code::Electron, 1.5_GeV, MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), + Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s)); const auto pout = s.getNextParticle(); CHECK(pout.getPID() == Code::Electron); CHECK(pout.getEnergy() == 1.5_GeV); @@ -65,10 +61,9 @@ TEST_CASE("NuclearStackExtension", "[stack]") { SECTION("read nucleus") { nuclear_stack::ParticleDataStack s; - s.addParticle( - std::make_tuple(Code::Nucleus, 1.5_GeV, - MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), - Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s, 10, 9)); + s.addParticle(std::make_tuple( + Code::Nucleus, 1.5_GeV, MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), + Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s, 10, 9)); const auto pout = s.getNextParticle(); CHECK(pout.getPID() == Code::Nucleus); CHECK(pout.getEnergy() == 1.5_GeV); @@ -79,10 +74,9 @@ TEST_CASE("NuclearStackExtension", "[stack]") { SECTION("read invalid nucleus") { nuclear_stack::ParticleDataStack s; - s.addParticle( - std::make_tuple(Code::Electron, 1.5_GeV, - MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), - Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s)); + s.addParticle(std::make_tuple( + Code::Electron, 1.5_GeV, MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), + Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s)); const auto pout = s.getNextParticle(); CHECK_THROWS(pout.getNuclearA()); CHECK_THROWS(pout.getNuclearZ()); @@ -95,14 +89,12 @@ TEST_CASE("NuclearStackExtension", "[stack]") { for (int i = 0; i < 99; ++i) { if ((i + 1) % 10 == 0) { s.addParticle(std::make_tuple( - Code::Nucleus, 1.5_GeV, - MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), + Code::Nucleus, 1.5_GeV, MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s, i, i / 2)); } else { - s.addParticle( - std::make_tuple(Code::Electron, 1.5_GeV, - MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), - Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s)); + s.addParticle(std::make_tuple( + Code::Electron, 1.5_GeV, MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), + Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s)); } } @@ -119,14 +111,12 @@ TEST_CASE("NuclearStackExtension", "[stack]") { for (int i = 0; i < 99; ++i) { if ((i + 1) % 10 == 0) { s.addParticle(std::make_tuple( - Code::Nucleus, i * 15_GeV, - MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), + Code::Nucleus, i * 15_GeV, MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s, i, i / 2)); } else { - s.addParticle( - std::make_tuple(Code::Electron, i * 1.5_GeV, - MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), - Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s)); + s.addParticle(std::make_tuple( + Code::Electron, i * 1.5_GeV, MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), + Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s)); } } @@ -226,27 +216,23 @@ TEST_CASE("NuclearStackExtension", "[stack]") { // not valid: CHECK_THROWS(s.addParticle(std::make_tuple( - Code::Oxygen, 1.5_GeV, - MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), + Code::Oxygen, 1.5_GeV, MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s, 16, 8))); // valid - auto particle = s.addParticle( - std::make_tuple(Code::Nucleus, 1.5_GeV, - MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), - Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s, 10, 9)); + auto particle = s.addParticle(std::make_tuple( + Code::Nucleus, 1.5_GeV, MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), + Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s, 10, 9)); // not valid CHECK_THROWS(particle.addSecondary(std::make_tuple( - Code::Oxygen, 1.5_GeV, - MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), + Code::Oxygen, 1.5_GeV, MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s, 16, 8))); // add a another nucleus, so there are two now - s.addParticle( - std::make_tuple(Code::Nucleus, 1.5_GeV, - MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), - Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s, 10, 9)); + s.addParticle(std::make_tuple( + Code::Nucleus, 1.5_GeV, MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), + Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s, 10, 9)); // not valid, since end() is not a valid entry CHECK_THROWS(s.swap(s.begin(), s.end())); diff --git a/tests/stack/testSuperStupidStack.cpp b/tests/stack/testSuperStupidStack.cpp index 4c520bcbb..52a63e741 100644 --- a/tests/stack/testSuperStupidStack.cpp +++ b/tests/stack/testSuperStupidStack.cpp @@ -24,10 +24,9 @@ TEST_CASE("SuperStupidStack", "[stack]") { SECTION("read+write") { simple_stack::SuperStupidStack s; - s.addParticle( - std::make_tuple(Code::Electron, 1.5_GeV, - MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), - Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s)); + s.addParticle(std::make_tuple( + Code::Electron, 1.5_GeV, MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), + Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s)); // read CHECK(s.getEntries() == 1); @@ -42,10 +41,10 @@ TEST_CASE("SuperStupidStack", "[stack]") { simple_stack::SuperStupidStack s; for (int i = 0; i < 99; ++i) - s.addParticle( - std::make_tuple(Code::Electron, 1.5_GeV, - MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), - Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s)); + + s.addParticle(std::make_tuple( + Code::Electron, 1.5_GeV, MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), + Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s)); CHECK(s.getSize() == 99); -- GitLab