diff --git a/corsika/detail/framework/analytics/ClassTimer.inl b/corsika/detail/framework/analytics/ClassTimer.inl index 3d60bef3c65aeaa925c9eae39099f3c60af20832..dca6fb5ce128761146936929895d3ce8a65ddb00 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 9a53644f2660348b3649ab0043b7f9b0f2b8fc45..2d68f8c1019849314ac9c082bf8c34b4d08e8409 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 e5bd52b193b0a4b5849526de2a1db1e8b250c63e..50ec4b03b249ec3bfbe89f41c25fd4f33d04dc3f 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 8a1b9e2e8cbab644fb296028b79b0a199ed74a8b..efcf716d3320487334713dd79bdf77ddd67f0a24 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 8823f213227ce9ec027a521e0a4d3948aa3a46c0..6c0a039e5466ef46d2d3014b7e91a6f0621c922c 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 fe740cf8e8d6c28668411720773edf91562db53b..c20a8f21fccfed478815f21f5bf354ad3ad2a93a 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 f35e23e17cc9d5e6db46dd1470ba5646118e0959..e158e04d36a59bbec08e1b3e2b7e6aebc76ee7ab 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 8b841685828ecf9794ea2dce805210aa4f118f85..6c550c1ce716deb8e3004f775a81b9bebb182d75 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 3b5118abe17a261d2bd78c230cfc2f30850b2fe3..151b35daec64d4909ef3492e80ee3c0c57a64429 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 a43010c195d1d7eaebb9033a809f4623dfde5679..fd8aa4f5c0d3387b5d3fb0a40dbbcba5e66423a0 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 8ddcb851f6bdec74d14aa7c1bc1928217efc5339..575ab43b73e48efe733e2bde64a99503bce44199 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 ffc816b933158c2bcbd65583e184835371ad33a5..4ead3b9b87674bae7011c489ec719049968eade1 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 d5db7472a22a2923768f47cbe8eddced6446f28b..5e22a8fef47d4664275cd6bb1dee5e29c0cbe4d7 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 60201a39859aa933f5bf313c2e98ec7e1da2fb52..ed6a9c1beedb9b6a256af1e84c17724be9057471 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 0d67b57c8e6ec4dceee0689394d3e4414c4aee44..80a1b77caa404185bc618183590d48c67a730dbb 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 4fb6e1c654b70a41a05e272a94b323236793fc87..ba0dd888adb79485b544a0700e56a609136d976e 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 2b7049e475f1f20fb1ac08ee8477f22a3e66dcf2..06b17451c64a1adbbbda9a5b046f634eea2d287d 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 c55847cc5cae713e263130459f7fccb84266bcf0..b8482d02e9fbedd0627efd3029957171bdaffcb1 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 855cc0b3ba4bfdfd2ee6eb66fbf05da4f8536088..792182a9efee3d45fc07176524d6fdb017ed0dca 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 0835551c9cd42ff6dc1405a9b8f9380dd4f1d78d..e3b50839a11b3b07c04b67d5f6d7f2ec8bfe4655 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 94e7e13a1ae5f795452a3df76fd9abff7df1f6f7..33b9066c2a040bf74fa342ace617879cd15dd347 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 0bf88ff6743b9fc90271d509730858563d9d58d3..6d288ee5a516924ccb33b6555928e20806a1a475 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 2ffaecefc85394a797cc0c8c6574e90908804cff..f8421ab0672026430310b50030279fc883a84d14 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 a3420dcc49071bf1433126dfbdcc33704182566a..7d526ba03f28015fb9c9186478274a97bf7933e2 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 05e8749c8499a29ae67ef3d5f0d0c152d88d3476..ad5ab5e0f20c2bf4ad8207319dbe6af53cf33ac6 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 09c4c101d910d3066473ae79237db24b1ce79770..6a2bdd6e9bbcabc6501df21e022dbf8a7403105f 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 409d393f25f73437f2421adce869fbc87477970f..491cd3aa9e94f3794804af14b83752c0cd7606e9 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 ed3009ef4d639f9a6cb96e6d0d33dcc79e41cf5f..73e29cf13d2b15ec2ff02af7b60eaf5554f0f364 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 cbe582c8b3c7f94f58ce6c1b6ae67e44a112e2df..4229207f43de9004d88d920044ea1d92e8345dfe 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 3890b451042536b89881270d49c6b9470a3e1e0a..0b4aa3f6a9423aac7bac613d454ba7dd5785e1d1 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 5ddedeb1cad217ddd5e37e28bf5a896ceaf7673a..8c28f1ee31ee086a5aac4c35e38130a96d9e3a5c 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 d22ea176b547dc61b2ebc954596108b0bea2b91d..5484075280307da66253856674f2784487662c33 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 6f0f32304c3aaa69814407159a692ab29ab87e97..290aa55a6fd031249f2360bc2d2660e7203a8688 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 9ba0107a9737d28f8d664b0d19260b5d7216093a..197fd3453c38b6e07094519485ec9b233e57bf7f 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 c39909159dd124cd5cc6a5b350419b81981b6ef9..2e639d2b88670f1f9771e94e9e8fcc4815f30654 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 90a134eb398731caaeaf6e08ea857e6ce8ed48fb..687f40c37f17288317b00cdad4e58336a6c64459 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 cfd19bb19cb768a79c303760e34733f5e23f0f15..9800526131225f1c3828b1d0dc0352ca524cc843 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 7a9287276d3077225daa9c8f8f8f81481c78f25f..be20e499582ab5961d239ddd071ca6aba03d860b 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 3f11c6ad60f639cb0a1c015127f2a54096349ddb..291bc7b873986dec5c7ba5ea573211b578918a26 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 8405888ccf2717f196ec3d4736fe50713970af6e..60f86fb48130ba5df29da5d27c5741baa80c1c47 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 4efc9563212ab966575bced7443c34511937b1fc..130ac0173920a78bdd774914c5f285a90caa51ff 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 56e78d7dd37d5a0a7e8ae3c2dd3361436269dd6d..f76772168129a074c8530dd67ef92cbfac3efb39 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 f78bc631399239b645b35ac823895de7d0e22715..39b129bd18e1df946b807ec3c1b204d89522e9c1 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 7b5b3c3c5afa73cd709c0775809adb423819ceda..d31e940f6371826772f0c29a4915663a00397f28 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 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..4181d1eb88e13b76a5af0a9ae56f5586ddf707bd 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 6b003d5de8499d19e2f4f8b2253d323d044fefb5..4aa68883799f8b7d33efd0d3de923806c5b966ec 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 7958f6f81badb96b16e6ca4198ae9eb685b450d5..5fed5b778af088bfa68ccb839efb2c1eba33f67c 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 2a3f5d89a11859ce671912f07a1077d2d4297e50..b5aaae5c4ed6db978a86e2ec2dac8d928c1a2d59 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 d3040c98b698b41023e11af548211ad6f67e7808..4df67f488dfaa0ebc998d67689d28238b6e2834b 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 adac5d0e1841f7526f54ab4a54282eaa6a882cd1..bec9a2700cbc250e82ce09ccd515ad497c2bd69d 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 fb1645786db242dc0625c2324e2574dedb57eccf..36b897f75ed37aa7f8acacb4c6a3bfef15ae307a 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 5569149c6d1e75d010fa243913e4b959857ac28e..b094f6d435a3da0034c54089e90aa7e0c3da5c38 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 bf4f5ab85793d917ff653400ae0ebb9df804764d..31f57d395c3253c64fb2d0b02936e1d6d3114664 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 3e1e1856434c37b72e2739c3385c2de025d565b5..ea99139db79179c188dc856171ccb0f421928955 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 fb1645786db242dc0625c2324e2574dedb57eccf..36b897f75ed37aa7f8acacb4c6a3bfef15ae307a 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 5b0c1ba2a8d614d4a81e30118c2a38520e577e34..c8787712c67134581364ca1ce99b1da6b37b5445 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 e014dd86d0195db910741ee23add5b1aa83385fd..0cf5e66d781a12b8df5e04d6d4872fda97ecdb5a 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 9aa7b917dabb9c22debfbb451514e1b1b127379d..9f5ef956f6bfe3ad9903a58b4574581981335b02 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 97a265445aa52e0cd4f132bfe3c42193a5094874..8d56350ab9d26022766680660bf35208e3d2490e 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 2f0949b09c902158f2015651f34221417aea1e02..0e4746f31a924f4bf597f93eada980696d493efb 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 072a1855b3fc38c551a31a9b9c9fd9bcbc5fc2a8..fab4f628daea92560a00244c16da881f6b7521d0 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 057730b95f4d50ac7665eccb8e8328f1a78d8abf..be499bf8b788f0384689609162bdd169dbab695a 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 469d14c46fc045b645246f75814e418d2395a063..fab65b86e92874fb2d7a0ade93aaabb51a3a1ff6 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 51e34ce452cb42ed6b031e00f4e090ec1401525e..77b351941d1a7a8e2c09ea2074df0427a77189ec 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 adea2337855f6fcab5cec1ef8d188a322419e6b1..775d62570114d11b1148ade910e520ee66e7841a 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 620e72ecd7faee9cf2d101af2ffeb62c793147e8..781a23717a6fef420ee8ed3a8e8d658fa4c5e768 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 cc43e649bee9a689e724f0f620bd7cfc7607a844..44e03a521e6cb668c4073f8d185aa6dea579a7de 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 112f5053d59adc148f847031ab347b235ccb0728..515c0f57c2a1457daf198ba7fc36ac2e30d04dbf 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 e23f543ca0b10d99659ba541221e7f6e4f50d37f..dab5bb2d90e9c971f77f2b4bbc68232fddf3df94 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 5b60f1856cacec1c318b67f28e178b378c6bdfc4..f6240e87800d9232bb100587d68dde50850cb2a5 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 7b79af45107f77f1a1b98531c04282c543c3aa00..0d4d14ebeb96a7256a1b7c1dafdffd1ef7327a51 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 a7d51aef55b6c1ff7819bbed6fa8d44b99be9b79..e9837943f92771ce1d787872793bab3352ef74c5 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 8e12ba588a6f0053c1b08ab61c8145f64004a82f..13a079410e7c4735e88eb0ec56f5346f96ad2407 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 97fb1dd3c2ce7c766b883a9b3164b1c1f880dd90..9b1b7ea500f1d723ab46fb6326ee854a1cac0c4a 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 4a8ddb791e91569e02a044f5c108ddebd1b8c666..a52aeaebe3c33548f52db8aeddcc096940ff9307 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 ee79dcb6f037ea43ac42e9de32533eb403b9c48f..c0e0258166accdd65c6f806f02243f37599f88e2 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 71ef51e34faf7d8ffaf45ef67ec376e6587ae8b4..3efd34546e8a34285f8fb4b51defba93ec86b761 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 603b66026b2c01cb1601d5d66d00a9237dd58203..5de160d136e54f61537d9c49943cc863137bb7dd 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 5fb0efeed900ff000ed4807425c1c70b2398d18f..76434f1f710e3799b5fc74e25ad83334015ac834 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 548e7c8097182a2b4319eca57643e38631583f86..f8f08704d3bc1f97deba819c886d6d2abd4b5ca9 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 0093e9c5ad908ebdbb6a0055f457a9d425c11adb..8f68926a7392b1ff354bd03a1a90540997f271cd 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 7e6ee9ded63adabd9319057c28ea783ad5ccd6f6..a462b382815e5031f2ad3e314225a85f54e6c7cd 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 124e9e59bc97832e043382e9d6145f581b460516..6a4930ab1650095efffd1e4f5ea7f5ae458ce3a3 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 263717cba858841837e9933ec18bd4040515ed5c..71b58de38514106c75de59fc420f77c93dbacd65 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 9a0b6085dc739ebf0b7b323c8ca244d9911bc01e..e23c4be739836959a9463188af4b40670042db3f 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 65141b36614c3dc07ed7e819ef23ff81af5f92bd..473365f126a54e2249198d6ad1efc912363a7e96 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 10c5b6b45064ceb06471661fa03945ad8419c7fe..35bbe08f1d92c268f99cef6d0a7be72886ebe85e 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 fade01a6390ea35a05d942e3e98800d936cd026b..b7f59b31b6aa34d914206285f37463ce4981cb37 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 ee1c85df450ccf1361f496708e12a24e5b6fe54e..88770f2289e64b55bde54532ab914c86a9c15c66 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 0e1cc5161fd8fb2e3cfde7ef3d701d48b2e709fb..bbbfff91a46e1c2a3348040105f0e0afdb0a5855 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 6c46fa14b827c6ca074d95e6e79e1d10247aad74..3450dc2ac4433c9cbf51ade1fd41b90092dbc60d 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 e429aa89c43a4ef48674607f05cb27db682d32e3..1d907aa1b4c95af73c83d2480f89d0e6f8c29f8f 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 df07a8924082366eadbacac5503fb5b3ea202734..54ff12eab9ff5ee8759a6e6f722a9dee79f48727 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 c00f5511b3ce91f748cdcb372d345f6d4da8ff13..1a450883bb29e55c65af1edcced5f6b5dfd5361f 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 573a0c6fd0d7b0b8707289a3327111f9adeda923..83e0e77c8d6eb72aad1eb4c99e1acd5ec33a1999 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 115fdd7172ad5c1e68f6cea29104fc84ceff66a4..452c0177b402cb44164d8f82a5e3e43ef7ce80ff 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 0036c84ba61debd779a81c176354214991bcefb3..863eea200acb3434cd76421522f9ef4df2f88398 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 ee939407a02755294b2141be4eb3b4ac9278cd89..3fdc58bfeb8ddb4845bbf3b760aacb9e2fef6422 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 69d1f6233cb390cb074347bcdd7a3a1cbbdcb61e..6c6ee7677ab3a724ccbd8204df851a411aaa119f 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 50d5561dc38021bfeed55f3f2ae0a69613069785..bcbd175a91bbb03ce673e2ec25c276c22338170b 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 35103012b2865aeab9f8af8a4a2bbc4ec43881a9..3d5322d4a79f5a4be0d397348daff9bbf5530c87 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 21dc79b89bd2e4a542d40ef5bbca26f540d77d93..6fff5242b7adb30edb8bea02498194945b7bab51 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 a96b6c0f6e14ffb9ba436b6aedb1b1b724320bd1..12e1e3a0dffe13fc56699e4bcf22706aa6a6074e 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 5d5dd8b613d9f07479f435022ce663abf11aba3d..9d7cf8b494cae79e1e9ee59f3756364c200e1403 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 e82c373d2fe4615c5dc4867158caadad2ffd3e2f..3d35fcc03d2bc4c62c4aec131377e0b7c61973ed 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 a82f440333fdc5b5ccc78f38b93dcdf0b460ecba..3e4e98e99d184a537ee18e0fd14816d95391242f 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 6f63172fe1320ead88be1191eec28c3cd0e00245..ae4b428566e947fec840be0068e5b9e3de574262 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 2fcbfafc4204ba494ce9b6b643236055cba0fcf4..af4cfd94bac13cce10db21ccb85e25aa867ed12a 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 28f83017edb6d2b3be2722de648d9a7e56d6426a..f31a2d9dcacd2c0c15fcf94d515c4fc465a469ba 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 f87af1c2a2ee56da960d9ea530bcb9b328cc4826..2cdd947b1e4e2e053e6c3ba0a7efc0c9e2c9499e 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 d34c594903e80eec5ad19dde3d1ff9f1d72a16e5..14f0ca15342c2969803be5b6c5a17d4a62d37607 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 da0a1a5d80e8702d0533c4d132db95c16a984d4a..188de07f4748020c133f80b8aa96bcf1ccc3d37e 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 09c4af17fa2e243739145c5f345fa2d6a0e3a453..b8f9932e52daf42654d908fd5f0311074ac5d19a 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 07caeb4422b7cb738100108dd13d3d82a7590eab..098412aaa8924debfa1bbbb92d1002835339dda8 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 5417f3e3ec90ea7955e705e6fb836efd22198f8f..62a8c17dfb29f23ec42c607d7dbe5df7663d3c5d 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 06bf73d5d6a053554d4e854b98da97ef30ba9e6d..72a895ecbf5cd018f10d7ce69b2fc9e6e7a2e35b 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 8b37e65b449f583a2cd93751a64bf997c409614d..8c3a9face515cf795c3754deea176562f5ef09cf 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 705379342b999e5ae142eb037067262ae5fb4478..86740fa22f98175dd5436dc5a234fa3145e4a77a 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 eca0fd0ba7ea8f28aab6af884119db628356f442..296315768c9f0b2fc87bde1331351ee54c016e15 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 c7b0554689438cd91a7a1fd5e20a96209364c067..2c3110eba2103c216d720f47b9b60459d702dc60 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 c702f4c8ae8adf111c06821b1d0178b6f3355b74..f41a84c96cb0ce7cb3f2731e6a222937010e1aaa 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 6edd0cc67dd2fa7c05f4c75d944a6964ef7171a5..00c0ceee6a2f55bb7fc08a07438ec1b42ffa3bd4 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 4c520bcbb7be7460705c41974590a482445a1a7e..52a63e74120163f4ae3e3dc537b5d3cb26895789 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);