diff --git a/Documentation/Examples/geometry_example.cc b/Documentation/Examples/geometry_example.cc index 4c38d1dbfce534385482f480804ec1cd4ed62ae5..da23d81e02baae5381358ff13b12f93d071c5dfe 100644 --- a/Documentation/Examples/geometry_example.cc +++ b/Documentation/Examples/geometry_example.cc @@ -22,8 +22,8 @@ using namespace corsika::units::si; int main() { - std::cout << "geometry_example" << std::endl; - + std::cout << "geometry_example" << std::endl; + // define the root coordinate system geometry::CoordinateSystem& root = geometry::RootCoordinateSystem::GetInstance().GetRootCoordinateSystem(); diff --git a/Documentation/Examples/helix_example.cc b/Documentation/Examples/helix_example.cc index d200cc99678942c427bc3e1a769430d9810ac833..9f3eba67e610c87f63f193b3db3aad5978eda4fc 100644 --- a/Documentation/Examples/helix_example.cc +++ b/Documentation/Examples/helix_example.cc @@ -22,7 +22,7 @@ using namespace corsika::units::si; int main() { std::cout << "helix_example" << std::endl; - + geometry::CoordinateSystem& root = geometry::RootCoordinateSystem::GetInstance().GetRootCoordinateSystem(); diff --git a/Documentation/Examples/particle_list_example.cc b/Documentation/Examples/particle_list_example.cc index 5aefdd41401a4b6ecd67e737f1984166534c3bf3..342c08e7ff6e7cceec63f2aa3583f5fb46199297 100644 --- a/Documentation/Examples/particle_list_example.cc +++ b/Documentation/Examples/particle_list_example.cc @@ -27,7 +27,7 @@ using namespace std; int main() { std::cout << "particle_list_example" << std::endl; - + cout << "------------------------------------------" << "particles in CORSIKA" << "------------------------------------------" << endl; diff --git a/Documentation/Examples/stack_example.cc b/Documentation/Examples/stack_example.cc index dd7de9274ab51f2d0b2d6af55deea35ded47be42..cc638dbe8e622f27db71210a109784a0f4de7eff 100644 --- a/Documentation/Examples/stack_example.cc +++ b/Documentation/Examples/stack_example.cc @@ -51,7 +51,7 @@ void read(corsika::stack::super_stupid::SuperStupidStack& s) { int main() { std::cout << "stack_example" << std::endl; - + corsika::stack::super_stupid::SuperStupidStack s; fill(s); read(s); diff --git a/Documentation/Examples/staticsequence_example.cc b/Documentation/Examples/staticsequence_example.cc index 5959ca5f8fb0c5bcb2dba8a371995cdcb7b4116b..ca75fe4b22172488675fddca7601748acf8e3214 100644 --- a/Documentation/Examples/staticsequence_example.cc +++ b/Documentation/Examples/staticsequence_example.cc @@ -102,7 +102,7 @@ void modular() { int main() { std::cout << "staticsequence_example" << std::endl; - + modular(); return 0; } diff --git a/Documentation/Examples/stopping_power.cc b/Documentation/Examples/stopping_power.cc index 4499aaa746974a61af252d6bff74a8942e26cb4e..f35584827a82851e939754c90fec40f404176113 100644 --- a/Documentation/Examples/stopping_power.cc +++ b/Documentation/Examples/stopping_power.cc @@ -35,7 +35,7 @@ using namespace corsika::units::si; int main() { std::cout << "stopping_power" << std::endl; - + feenableexcept(FE_INVALID); // setup environment, geometry diff --git a/Framework/Cascade/testCascade.cc b/Framework/Cascade/testCascade.cc index 9db2c73ccba340df465f7ac75c518d163fef6cd2..57d565d55f68948ad4cf9f0e4a4db4a757da687a 100644 --- a/Framework/Cascade/testCascade.cc +++ b/Framework/Cascade/testCascade.cc @@ -77,11 +77,13 @@ public: view.AddSecondary( std::tuple<particles::Code, units::si::HEPEnergyType, corsika::stack::MomentumVector, geometry::Point, units::si::TimeType>{ - projectile.GetPID(), E / 2, projectile.GetMomentum(), projectile.GetPosition(), projectile.GetTime()}); + projectile.GetPID(), E / 2, projectile.GetMomentum(), + projectile.GetPosition(), projectile.GetTime()}); view.AddSecondary( std::tuple<particles::Code, units::si::HEPEnergyType, corsika::stack::MomentumVector, geometry::Point, units::si::TimeType>{ - projectile.GetPID(), E / 2, projectile.GetMomentum(), projectile.GetPosition(), projectile.GetTime()}); + projectile.GetPID(), E / 2, projectile.GetMomentum(), + projectile.GetPosition(), projectile.GetTime()}); return EProcessReturn::eInteracted; } diff --git a/Framework/StackInterface/SecondaryView.h b/Framework/StackInterface/SecondaryView.h index 6061fa1baf3a87341ed47ae96b7a59f6cf7a2b91..27f8dc6f316a818f5d22a7f97bbb855c29e48fb7 100644 --- a/Framework/StackInterface/SecondaryView.h +++ b/Framework/StackInterface/SecondaryView.h @@ -78,7 +78,7 @@ namespace corsika::stack { ParticleInterface, InnerStackTypeValue>; using ConstStackIteratorValue = ConstStackIteratorInterface<typename std::remove_reference<StackDataType>::type, - ParticleInterface, InnerStackTypeValue>; + ParticleInterface, InnerStackTypeValue>; /// @} using StackIterator = @@ -123,7 +123,6 @@ namespace corsika::stack { , inner_stack_(vI.GetStack()) , projectile_index_(vI.GetIndex()) {} - /** * This returns the projectile/parent in the original Stack, where this * SecondaryView is derived from. This projectile should not be @@ -142,8 +141,8 @@ namespace corsika::stack { // NOTE: 0 is special marker here for PROJECTILE, see GetIndexFromIterator return StackIterator(*this, 0); } - public: + public: template <typename... Args> StackIterator AddSecondary(const Args... v) { StackIterator proj = GetProjectile(); diff --git a/Framework/StackInterface/StackIteratorInterface.h b/Framework/StackInterface/StackIteratorInterface.h index 010d1fe1e53bbb7d8aa27352069390f80d20b7e6..840962e1aca73e4845e1b371f8ffcc29a8295ef5 100644 --- a/Framework/StackInterface/StackIteratorInterface.h +++ b/Framework/StackInterface/StackIteratorInterface.h @@ -24,8 +24,8 @@ namespace corsika::stack { class SecondaryView; // forward decl template <typename TStackData, template <typename> typename TParticleInterface, - typename StackType> - class ConstStackIteratorInterface; // forward decl + typename StackType> + class ConstStackIteratorInterface; // forward decl /** @class StackIteratorInterface @@ -86,13 +86,14 @@ namespace corsika::stack { friend class SecondaryView<TStackData, TParticleInterface>; // access for SecondaryView - template <typename T> - friend class corsika::history::HistorySecondaryView; + template <typename T> + friend class corsika::history::HistorySecondaryView; + + friend class ConstStackIteratorInterface<TStackData, TParticleInterface, StackType>; - friend class ConstStackIteratorInterface<TStackData, TParticleInterface, StackType>; - protected: unsigned int index_ = 0; + private: StackType* data_ = 0; // info: Particles and StackIterators become invalid when parent // Stack is copied or deleted! @@ -175,10 +176,18 @@ namespace corsika::stack { StackIteratorInterface operator+(int delta) const { return StackIteratorInterface(*data_, index_ + delta); } - bool operator==(const StackIteratorInterface& rhs) const { return index_ == rhs.index_; } - bool operator!=(const StackIteratorInterface& rhs) const { return index_ != rhs.index_; } - bool operator==(const ConstStackIteratorInterface<TStackData, TParticleInterface, StackType>& rhs) const; // implement below - bool operator!=(const ConstStackIteratorInterface<TStackData, TParticleInterface, StackType>& rhs) const; // implement below + bool operator==(const StackIteratorInterface& rhs) const { + return index_ == rhs.index_; + } + bool operator!=(const StackIteratorInterface& rhs) const { + return index_ != rhs.index_; + } + bool operator==( + const ConstStackIteratorInterface<TStackData, TParticleInterface, StackType>& rhs) + const; // implement below + bool operator!=( + const ConstStackIteratorInterface<TStackData, TParticleInterface, StackType>& rhs) + const; // implement below /** * Convert iterator to value type, where value type is the user-provided particle @@ -248,6 +257,7 @@ namespace corsika::stack { protected: unsigned int index_ = 0; + private: const StackType* data_ = 0; // info: Particles and StackIterators become invalid when // parent Stack is copied or deleted! @@ -295,7 +305,7 @@ namespace corsika::stack { return tmp; } ConstStackIteratorInterface operator+(const int delta) const { - return ConstStackIteratorInterface(*data_, index_+delta); + return ConstStackIteratorInterface(*data_, index_ + delta); } bool operator==(const ConstStackIteratorInterface& rhs) const { return index_ == rhs.index_; @@ -303,8 +313,14 @@ namespace corsika::stack { bool operator!=(const ConstStackIteratorInterface& rhs) const { return index_ != rhs.index_; } - bool operator==(const StackIteratorInterface<TStackData, TParticleInterface, StackType>& rhs) const { return index_ == rhs.index_; } - bool operator!=(const StackIteratorInterface<TStackData, TParticleInterface, StackType>& rhs) const { return index_ != rhs.index_; } + bool operator==(const StackIteratorInterface<TStackData, TParticleInterface, + StackType>& rhs) const { + return index_ == rhs.index_; + } + bool operator!=(const StackIteratorInterface<TStackData, TParticleInterface, + StackType>& rhs) const { + return index_ != rhs.index_; + } const ParticleInterfaceType& operator*() const { return static_cast<const ParticleInterfaceType&>(*this); @@ -326,13 +342,20 @@ namespace corsika::stack { ///@} }; // end class ConstStackIterator - - template <typename TStackData, template <typename> typename TParticleInterface, + template <typename TStackData, template <typename> typename TParticleInterface, typename StackType> - bool StackIteratorInterface<TStackData, TParticleInterface, StackType>::operator==(const ConstStackIteratorInterface<TStackData, TParticleInterface, StackType>& rhs) const { return index_ == rhs.index_; } + bool StackIteratorInterface<TStackData, TParticleInterface, StackType>::operator==( + const ConstStackIteratorInterface<TStackData, TParticleInterface, StackType>& rhs) + const { + return index_ == rhs.index_; + } - template <typename TStackData, template <typename> typename TParticleInterface, + template <typename TStackData, template <typename> typename TParticleInterface, typename StackType> - bool StackIteratorInterface<TStackData, TParticleInterface, StackType>::operator!=(const ConstStackIteratorInterface<TStackData, TParticleInterface, StackType>& rhs) const { return index_ != rhs.index_; } + bool StackIteratorInterface<TStackData, TParticleInterface, StackType>::operator!=( + const ConstStackIteratorInterface<TStackData, TParticleInterface, StackType>& rhs) + const { + return index_ != rhs.index_; + } } // namespace corsika::stack diff --git a/Processes/CONEXSourceCut/CONEXSourceCut.cc b/Processes/CONEXSourceCut/CONEXSourceCut.cc index 7a0da45a726bbf40e69aab6264baa288968d47ec..8039d8ed867053756f631a950815aaf50d9c380f 100644 --- a/Processes/CONEXSourceCut/CONEXSourceCut.cc +++ b/Processes/CONEXSourceCut/CONEXSourceCut.cc @@ -31,11 +31,11 @@ corsika::process::EProcessReturn CONEXSourceCut::DoSecondaries( [=](auto const& p) { return pid == p.first; }); if (it != egs_em_codes_.cend()) { // EM particle - + auto const egs_pid = it->second; addParticle(egs_pid, p.GetEnergy(), p.GetMass(), p.GetPosition(), - p.GetMomentum().normalized(), p.GetTime()); + p.GetMomentum().normalized(), p.GetTime()); p.Delete(); } diff --git a/Setup/SetupStack.h b/Setup/SetupStack.h index 6feb7cfbe33ce319d2c798c55cf844234c27270e..9ec7a86a4a106f83553222a9af915d15022ba44f 100644 --- a/Setup/SetupStack.h +++ b/Setup/SetupStack.h @@ -95,7 +95,7 @@ namespace corsika::setup { // ------------------------------------------ // add geometry node tracking data to stack: - + // the GeometryNode stack needs to know the type of geometry-nodes from the // environment: template <typename TStackIter> @@ -114,26 +114,24 @@ namespace corsika::setup { corsika::stack::node::GeometryData<setup::SetupEnvironment>, StackWithGeometryInterface>; - // ------------------------------------------ // Add [optional] history data to stack, too: // combine dummy stack with geometry information for tracking template <typename TStackIter> using StackWithHistoryInterface = corsika::stack::CombinedParticleInterface< - StackWithGeometry::PIType, history::HistoryEventDataInterface, - TStackIter>; + StackWithGeometry::PIType, history::HistoryEventDataInterface, TStackIter>; + + using StackWithHistory = + corsika::stack::CombinedStack<typename StackWithGeometry::StackImpl, + history::HistoryEventData, + StackWithHistoryInterface>; - using StackWithHistory = corsika::stack::CombinedStack< - typename StackWithGeometry::StackImpl, - history::HistoryEventData, StackWithHistoryInterface>; - } // namespace detail - // --------------------------------------- // this is the FINAL stack we use in C8: - //using Stack = detail::StackWithGeometry; + // using Stack = detail::StackWithGeometry; using Stack = detail::StackWithHistory; /*