From ca180706d4a65e63724826c31373913f808c0402 Mon Sep 17 00:00:00 2001 From: ralfulrich <ralf.ulrich@kit.edu> Date: Mon, 28 Sep 2020 12:47:14 +0200 Subject: [PATCH] revert column-width for clang-foramt back to 90 --- .clang-format | 2 +- Documentation/Examples/geometry_example.cc | 2 +- Environment/testEnvironment.cc | 3 +- Framework/StackInterface/SecondaryView.h | 59 ++++++++++------ Framework/StackInterface/Stack.h | 17 ++--- .../StackInterface/StackIteratorInterface.h | 56 +++++++-------- .../StackInterface/testStackInterface.cc | 32 ++++----- Processes/CONEXSourceCut/CONEXSourceCut.cc | 3 +- Processes/CONEXSourceCut/CONEXSourceCut.h | 4 +- .../CONEXSourceCut/testCONEXSourceCut.cc | 7 +- .../HadronicElasticModel.cc | 11 +-- .../testInteractionCounter.cc | 14 ++-- Processes/ParticleCut/testParticleCut.cc | 6 +- Processes/Pythia/Interaction.cc | 12 ++-- Processes/Sibyll/NuclearInteraction.cc | 2 +- Processes/UrQMD/UrQMD.cc | 10 +-- Processes/UrQMD/UrQMD.h | 2 +- Processes/UrQMD/testUrQMD.cc | 14 ++-- Setup/SetupStack.h | 10 +-- Stack/History/HistoryStackExtension.h | 2 +- Stack/History/testHistoryView.cc | 68 ++++++++++--------- .../NuclearStackExtension.h | 4 +- 22 files changed, 178 insertions(+), 162 deletions(-) diff --git a/.clang-format b/.clang-format index 2f702594c..0ac489959 100644 --- a/.clang-format +++ b/.clang-format @@ -1,7 +1,7 @@ --- Language: Cpp -ColumnLimit: 0 # line width, 0: respect programmer's choice +ColumnLimit: 90 # line width, 0: respect programmer's choice TabWidth: 8 UseTab: Never diff --git a/Documentation/Examples/geometry_example.cc b/Documentation/Examples/geometry_example.cc index fa5902673..da23d81e0 100644 --- a/Documentation/Examples/geometry_example.cc +++ b/Documentation/Examples/geometry_example.cc @@ -41,7 +41,7 @@ int main() { Vector<length_d> const diff = p2 - - p1; // the distance between the points, basically the translation vector given above + p1; // the distance between the points, basically the translation vector given above auto const norm = diff.squaredNorm(); // squared length with the right dimension // print the components of the vector as given in the different CS diff --git a/Environment/testEnvironment.cc b/Environment/testEnvironment.cc index b13539656..088dacb1c 100644 --- a/Environment/testEnvironment.cc +++ b/Environment/testEnvironment.cc @@ -145,8 +145,7 @@ struct Exponential { template <int N> auto Derivative(Point const& p, Vector<dimensionless_d> const& v) const { - return v.GetComponents()[0] * (*this)(p) / - corsika::units::static_pow<N>(1_m); + return v.GetComponents()[0] * (*this)(p) / corsika::units::static_pow<N>(1_m); } auto FirstDerivative(Point const& p, Vector<dimensionless_d> const& v) const { diff --git a/Framework/StackInterface/SecondaryView.h b/Framework/StackInterface/SecondaryView.h index ea350463c..732779a24 100644 --- a/Framework/StackInterface/SecondaryView.h +++ b/Framework/StackInterface/SecondaryView.h @@ -59,9 +59,9 @@ namespace corsika::stack { GetIndexFromIterator. */ - template <typename StackDataType, - template <typename> typename ParticleInterface, - template <class T1, template <class> class T2> class MSecondaryProducer = DefaultSecondaryProducer> + template <typename StackDataType, template <typename> typename ParticleInterface, + template <class T1, template <class> class T2> class MSecondaryProducer = + DefaultSecondaryProducer> class SecondaryView : public Stack<StackDataType&, ParticleInterface>, public MSecondaryProducer<StackDataType, ParticleInterface> { @@ -82,12 +82,20 @@ namespace corsika::stack { using InnerStackTypeValue = Stack<StackDataType, ParticleInterface>; public: - using StackIteratorValue = StackIteratorInterface<typename std::remove_reference<StackDataType>::type, ParticleInterface, InnerStackTypeValue>; - using ConstStackIteratorValue = ConstStackIteratorInterface<typename std::remove_reference<StackDataType>::type, ParticleInterface, InnerStackTypeValue>; + using StackIteratorValue = + StackIteratorInterface<typename std::remove_reference<StackDataType>::type, + ParticleInterface, InnerStackTypeValue>; + using ConstStackIteratorValue = + ConstStackIteratorInterface<typename std::remove_reference<StackDataType>::type, + ParticleInterface, InnerStackTypeValue>; /// @} - using StackIterator = StackIteratorInterface<typename std::remove_reference<StackDataType>::type, ParticleInterface, ViewType>; - using ConstStackIterator = ConstStackIteratorInterface<typename std::remove_reference<StackDataType>::type, ParticleInterface, ViewType>; + using StackIterator = + StackIteratorInterface<typename std::remove_reference<StackDataType>::type, + ParticleInterface, ViewType>; + using ConstStackIterator = + ConstStackIteratorInterface<typename std::remove_reference<StackDataType>::type, + ParticleInterface, ViewType>; /** * this is the full type of the declared ParticleInterface: typedef typename @@ -95,14 +103,16 @@ namespace corsika::stack { using ParticleType = StackIterator; using ParticleInterfaceType = typename StackIterator::ParticleInterfaceType; - friend class StackIteratorInterface<typename std::remove_reference<StackDataType>::type, ParticleInterface, ViewType>; + friend class StackIteratorInterface< + typename std::remove_reference<StackDataType>::type, ParticleInterface, ViewType>; - friend class ConstStackIteratorInterface<typename std::remove_reference<StackDataType>::type, ParticleInterface, ViewType>; + friend class ConstStackIteratorInterface< + typename std::remove_reference<StackDataType>::type, ParticleInterface, ViewType>; friend class ParticleBase<StackIterator>; - //template <template <typename> typename M1> - //friend class MSecondaryProducer; + // template <template <typename> typename M1> + // friend class MSecondaryProducer; private: /** @@ -136,7 +146,9 @@ namespace corsika::stack { * used to modify the Stack! */ - ConstStackIteratorValue parent() const { return ConstStackIteratorValue(inner_stack_, projectile_index_); } + ConstStackIteratorValue parent() const { + return ConstStackIteratorValue(inner_stack_, projectile_index_); + } /** * This return a projectile of this SecondaryView, which can be @@ -295,11 +307,15 @@ namespace corsika::stack { * different */ bool isDeleted(const StackIterator& p) const { return isDeleted(p.GetIndex() - 1); } - bool isDeleted(const ConstStackIterator& p) const { return isDeleted(p.GetIndex() - 1); } + bool isDeleted(const ConstStackIterator& p) const { + return isDeleted(p.GetIndex() - 1); + } /** * delete this particle */ - bool isDeleted(const ParticleInterfaceType& p) const { return isDeleted(p.GetIterator()); } + bool isDeleted(const ParticleInterfaceType& p) const { + return isDeleted(p.GetIterator()); + } /** * Function to ultimatively remove the last entry from the stack, @@ -307,7 +323,8 @@ namespace corsika::stack { * the function will just return false and do nothing. */ bool purgeLastIfDeleted() { - if (!isDeleted(getSize() - 1)) return false; // the last particle is not marked for deletion. Do nothing. + if (!isDeleted(getSize() - 1)) + return false; // the last particle is not marked for deletion. Do nothing. inner_stack_.purge(GetIndexFromIterator(getSize())); InnerStackTypeRef::nDeleted_--; indices_.pop_back(); @@ -365,8 +382,8 @@ namespace corsika::stack { public: /** * Method is called after a new SecondaryView has been - * created. Extra logic can be introduced here. - * + * created. Extra logic can be introduced here. + * * The input Particle is a reference object into the original * parent stack! It is not a reference into the SecondaryView * itself. @@ -379,7 +396,7 @@ namespace corsika::stack { /** * Method is called after a new Secondary has been created on the * SecondaryView. Extra logic can be introduced here. - * + * * The input Particle is the new secondary that was produced and * is of course a reference into the SecondaryView itself. */ @@ -399,10 +416,12 @@ namespace corsika::stack { */ #if not defined(__clang__) && defined(__GNUC__) || defined(__GNUG__) template <typename TStack, - template <class TStack_, template <class> class MPIType_> class MSecondaryProducer = corsika::stack::DefaultSecondaryProducer, + template <class TStack_, template <class> class MPIType_> + class MSecondaryProducer = corsika::stack::DefaultSecondaryProducer, template <typename> typename MPIType_ = TStack::template MPIType> struct MakeView { - using type = corsika::stack::SecondaryView<typename TStack::StackImpl, MPIType_, MSecondaryProducer>; + using type = corsika::stack::SecondaryView<typename TStack::StackImpl, MPIType_, + MSecondaryProducer>; }; #endif diff --git a/Framework/StackInterface/Stack.h b/Framework/StackInterface/Stack.h index ea84ad86d..d1c10ca97 100644 --- a/Framework/StackInterface/Stack.h +++ b/Framework/StackInterface/Stack.h @@ -50,13 +50,12 @@ namespace corsika::stack { loops, ranges, etc. */ - template <typename TStackData, - template <typename> typename MParticleInterface> + template <typename TStackData, template <typename> typename MParticleInterface> class Stack { using StackDataValueType = std::remove_reference_t<TStackData>; private: - TStackData data_; ///< this in general holds all the data and can be quite big + TStackData data_; ///< this in general holds all the data and can be quite big std::vector<bool> deleted_; ///< bit field to flag deleted entries protected: unsigned int nDeleted_ = 0; @@ -126,12 +125,14 @@ namespace corsika::stack { friend class StackIteratorInterface<StackDataValueType, MParticleInterface, Stack>; friend class ConstStackIteratorInterface<StackDataValueType, MParticleInterface, Stack>; - //friend class SecondaryView<StackDataValueType, MParticleInterface>; - template <typename T1, //=TStackData, - template <typename> typename M1, //=MParticleInterface, - // template<typename>typename M2> + // friend class SecondaryView<StackDataValueType, MParticleInterface>; + template <typename T1, //=TStackData, + template <typename> + typename M1, //=MParticleInterface, + // template<typename>typename M2> template <class T2, template <class> class T3> class MSecondaryProducer> - friend class SecondaryView; //<TStackData,MParticleInterface,M>; // access for SecondaryView + friend class SecondaryView; //<TStackData,MParticleInterface,M>; // access for + //SecondaryView friend class ParticleBase<StackIterator>; diff --git a/Framework/StackInterface/StackIteratorInterface.h b/Framework/StackInterface/StackIteratorInterface.h index 33c4965e1..b0c86c462 100644 --- a/Framework/StackInterface/StackIteratorInterface.h +++ b/Framework/StackInterface/StackIteratorInterface.h @@ -11,9 +11,8 @@ #include <corsika/stack/ParticleBase.h> namespace corsika::history { - template <typename T, - template <typename> typename ParticleInterface> - //class HistorySecondaryView; // forward decl. for befriending + template <typename T, template <typename> typename ParticleInterface> + // class HistorySecondaryView; // forward decl. for befriending class HistorySecondaryProducer; } @@ -22,9 +21,8 @@ namespace corsika::stack { template <typename TStackData, template <typename> typename TParticleInterface> class Stack; // forward decl - template <typename TStackData, - template <typename> typename TParticleInterface, - //template <typename> typename TProd> + template <typename TStackData, template <typename> typename TParticleInterface, + // template <typename> typename TProd> template <class T1, template <class> class T2> class MSecondaryProducer> class SecondaryView; // forward decl @@ -70,8 +68,7 @@ namespace corsika::stack { corsika::processes::sibyll::SibStack class */ - template <typename TStackData, - template <typename> typename TParticleInterface, + template <typename TStackData, template <typename> typename TParticleInterface, typename StackType = Stack<TStackData, TParticleInterface>> class StackIteratorInterface : public TParticleInterface< @@ -84,21 +81,20 @@ namespace corsika::stack { // friends are needed for access to protected methods friend class Stack<TStackData, - TParticleInterface>; // for access to GetIndex for Stack + TParticleInterface>; // for access to GetIndex for Stack friend class Stack<TStackData&, TParticleInterface>; // for access to GetIndex // SecondaryView : public Stack friend class ParticleBase<StackIteratorInterface>; // for access to GetStackData template <typename T1, //=TStackData, template <typename> typename M1, //=TParticleInterface, - template <typename T, - template <typename> typename T3> typename M2> + template <typename T, template <typename> typename T3> typename M2> // template <typename> typename M2> - friend class SecondaryView; //<TStackData,TParticleInterface,M>; // access for SecondaryView + friend class SecondaryView; //<TStackData,TParticleInterface,M>; // access for + //SecondaryView - template <typename T, - template <typename> typename ParticleInterface> - //friend class corsika::history::HistorySecondaryView; + template <typename T, template <typename> typename ParticleInterface> + // friend class corsika::history::HistorySecondaryView; friend class corsika::history::HistorySecondaryProducer; friend class ConstStackIteratorInterface<TStackData, TParticleInterface, StackType>; @@ -258,23 +254,27 @@ namespace corsika::stack { // friends are needed for access to protected methods friend class Stack<TStackData, - TParticleInterface>; // for access to GetIndex for Stack - friend class Stack<TStackData&, TParticleInterface>; // for access to GetIndex - // SecondaryView : public Stack - friend class ParticleBase<ConstStackIteratorInterface>; // for access to GetStackData - //friend class SecondaryView<TStackData, - // TParticleInterface>; // access for SecondaryView - template <typename T1, //=TStackData, - template <typename> typename M1, //=TParticleInterface, - // template <typename> typename M2> + TParticleInterface>; // for access to GetIndex for Stack + friend class Stack<TStackData&, TParticleInterface>; // for access to GetIndex + // SecondaryView : public Stack + friend class ParticleBase< + ConstStackIteratorInterface>; // for access to GetStackData + // friend class SecondaryView<TStackData, + // TParticleInterface>; // + // access for + // SecondaryView + template <typename T1, //=TStackData, + template <typename> + typename M1, //=TParticleInterface, + // template <typename> typename M2> template <class T2, template <class> class T3> class MSecondaryProducer> - friend class SecondaryView; //<TStackData,TParticleInterface,M>; // access for SecondaryView + friend class SecondaryView; //<TStackData,TParticleInterface,M>; // access for + //SecondaryView friend class StackIteratorInterface<TStackData, TParticleInterface, StackType>; - template <typename T, - template <typename> typename ParticleInterface> - //friend class corsika::history::HistorySecondaryView; + template <typename T, template <typename> typename ParticleInterface> + // friend class corsika::history::HistorySecondaryView; friend class corsika::history::HistorySecondaryProducer; protected: diff --git a/Framework/StackInterface/testStackInterface.cc b/Framework/StackInterface/testStackInterface.cc index 47cee856a..854888b52 100644 --- a/Framework/StackInterface/testStackInterface.cc +++ b/Framework/StackInterface/testStackInterface.cc @@ -168,23 +168,23 @@ TEST_CASE("Stack", "[Stack]") { CHECK(s.getSize() == 0); CHECK(s.getEntries() == 0); CHECK(s.IsEmpty()); - + s.AddParticle(std::tuple{9.888}); - s.AddParticle(std::tuple{8.999}); + s.AddParticle(std::tuple{8.999}); CHECK(s.getSize() == 2); CHECK(s.getEntries() == 2); CHECK(!s.IsEmpty()); auto p1 = s.begin(); - auto p2 = p1+1; + auto p2 = p1 + 1; - CHECK(p1.GetData()==9.888); - CHECK(p2.GetData()==8.999); + CHECK(p1.GetData() == 9.888); + CHECK(p2.GetData() == 8.999); s.Swap(p1, p2); - - CHECK(p1.GetData()==8.999); - CHECK(p2.GetData()==9.888); + + CHECK(p1.GetData() == 8.999); + CHECK(p2.GetData() == 9.888); } SECTION("copy particle") { @@ -192,22 +192,22 @@ TEST_CASE("Stack", "[Stack]") { CHECK(s.getSize() == 0); CHECK(s.getEntries() == 0); CHECK(s.IsEmpty()); - + s.AddParticle(std::tuple{9.888}); - s.AddParticle(std::tuple{8.999}); + s.AddParticle(std::tuple{8.999}); CHECK(s.getSize() == 2); CHECK(s.getEntries() == 2); CHECK(!s.IsEmpty()); auto p1 = s.begin(); - auto p2 = p1+1; + auto p2 = p1 + 1; - CHECK(p1.GetData()==9.888); - CHECK(p2.GetData()==8.999); + CHECK(p1.GetData() == 9.888); + CHECK(p2.GetData() == 8.999); s.Copy(p1, p2); - - CHECK(p1.GetData()==9.888); - CHECK(p2.GetData()==9.888); + + CHECK(p1.GetData() == 9.888); + CHECK(p2.GetData() == 9.888); } } diff --git a/Processes/CONEXSourceCut/CONEXSourceCut.cc b/Processes/CONEXSourceCut/CONEXSourceCut.cc index b2de7cdbe..8039d8ed8 100644 --- a/Processes/CONEXSourceCut/CONEXSourceCut.cc +++ b/Processes/CONEXSourceCut/CONEXSourceCut.cc @@ -187,8 +187,7 @@ CONEXSourceCut::CONEXSourceCut(geometry::Point center, auto const transform = geometry::CoordinateSystem::GetTransformation( intermediateCS2, c8cs); // either this way or vice versa... TODO: test this! - std::cout << transform.matrix() << std::endl - << std::endl; + std::cout << transform.matrix() << std::endl << std::endl; std::cout << geometry::CoordinateSystem::GetTransformation(intermediateCS, c8cs).matrix() << std::endl diff --git a/Processes/CONEXSourceCut/CONEXSourceCut.h b/Processes/CONEXSourceCut/CONEXSourceCut.h index 115b8fc95..121d8c163 100644 --- a/Processes/CONEXSourceCut/CONEXSourceCut.h +++ b/Processes/CONEXSourceCut/CONEXSourceCut.h @@ -53,8 +53,8 @@ namespace corsika::process { geometry::Point const center_; //!< center of CONEX Earth environment::ShowerAxis const& showerAxis_; - units::si::LengthType groundDist_; //!< length from injection point to shower core - geometry::Point const showerCore_; //!< shower core + units::si::LengthType groundDist_; //!< length from injection point to shower core + geometry::Point const showerCore_; //!< shower core geometry::CoordinateSystem const conexObservationCS_; //!< CONEX observation frame geometry::Vector<units::si::dimensionless_d> const x_sf_, y_sf_; //!< unit vectors of CONEX shower frame, z_sf is shower axis direction diff --git a/Processes/CONEXSourceCut/testCONEXSourceCut.cc b/Processes/CONEXSourceCut/testCONEXSourceCut.cc index 031ea746f..82d208521 100644 --- a/Processes/CONEXSourceCut/testCONEXSourceCut.cc +++ b/Processes/CONEXSourceCut/testCONEXSourceCut.cc @@ -55,10 +55,9 @@ TEST_CASE("CONEXSourceCut") { auto const observationHeight = 1.4_km + conex::earthRadius; auto const injectionHeight = 112.75_km + conex::earthRadius; - auto const t = - -observationHeight * cos(thetaRad) + - sqrt(-units::static_pow<2>(sin(thetaRad) * observationHeight) + - units::static_pow<2>(injectionHeight)); + auto const t = -observationHeight * cos(thetaRad) + + sqrt(-units::static_pow<2>(sin(thetaRad) * observationHeight) + + units::static_pow<2>(injectionHeight)); Point const showerCore{rootCS, 0_m, 0_m, observationHeight}; Point const injectionPos = showerCore + diff --git a/Processes/HadronicElasticModel/HadronicElasticModel.cc b/Processes/HadronicElasticModel/HadronicElasticModel.cc index 5cfc99174..cdc01d9a9 100644 --- a/Processes/HadronicElasticModel/HadronicElasticModel.cc +++ b/Processes/HadronicElasticModel/HadronicElasticModel.cc @@ -154,10 +154,13 @@ process::EProcessReturn HadronicElasticInteraction::DoInteraction(SetupView& vie pProjectileCoMNorm * sin(theta) * sin(phi), pProjectileCoMNorm * cos(theta)}))); - view.AddSecondary(std::tuple<particles::Code, units::si::HEPEnergyType, - corsika::stack::MomentumVector, geometry::Point, units::si::TimeType>{ - p.GetPID(), sqrt(projectileScatteredLab.GetSpaceLikeComponents().squaredNorm() + units::static_pow<2>(particles::GetMass(p.GetPID()))), - projectileScatteredLab.GetSpaceLikeComponents(), p.GetPosition(), p.GetTime()}); + view.AddSecondary( + std::tuple<particles::Code, units::si::HEPEnergyType, + corsika::stack::MomentumVector, geometry::Point, units::si::TimeType>{ + p.GetPID(), + sqrt(projectileScatteredLab.GetSpaceLikeComponents().squaredNorm() + + units::static_pow<2>(particles::GetMass(p.GetPID()))), + projectileScatteredLab.GetSpaceLikeComponents(), p.GetPosition(), p.GetTime()}); return process::EProcessReturn::eOk; } diff --git a/Processes/InteractionCounter/testInteractionCounter.cc b/Processes/InteractionCounter/testInteractionCounter.cc index 6dfd2da9a..7d8f78041 100644 --- a/Processes/InteractionCounter/testInteractionCounter.cc +++ b/Processes/InteractionCounter/testInteractionCounter.cc @@ -59,8 +59,7 @@ auto setupStack(int vA, int vZ, HEPEnergyType vMomentum, TNodeType* vNodePtr, geometry::Point const origin(cs, {0_m, 0_m, 0_m}); corsika::stack::MomentumVector const pLab(cs, {vMomentum, 0_GeV, 0_GeV}); - HEPEnergyType const E0 = - sqrt(units::static_pow<2>(mN * vA) + pLab.squaredNorm()); + HEPEnergyType const E0 = sqrt(units::static_pow<2>(mN * vA) + pLab.squaredNorm()); setup::Stack::StackIterator particle = stack->AddParticle(std::tuple<particles::Code, units::si::HEPEnergyType, corsika::stack::MomentumVector, geometry::Point, @@ -69,8 +68,7 @@ auto setupStack(int vA, int vZ, HEPEnergyType vMomentum, TNodeType* vNodePtr, particle.SetNode(vNodePtr); return std::make_tuple( - std::move(stack), - std::make_unique<decltype(setup::StackView(particle))>(particle)); + std::move(stack), std::make_unique<decltype(setup::StackView(particle))>(particle)); } template <typename TNodeType> @@ -81,9 +79,8 @@ auto setupStack(particles::Code vProjectileType, HEPEnergyType vMomentum, geometry::Point const origin(cs, {0_m, 0_m, 0_m}); corsika::stack::MomentumVector const pLab(cs, {vMomentum, 0_GeV, 0_GeV}); - HEPEnergyType const E0 = - sqrt(units::static_pow<2>(particles::GetMass(vProjectileType)) + - pLab.squaredNorm()); + HEPEnergyType const E0 = sqrt( + units::static_pow<2>(particles::GetMass(vProjectileType)) + pLab.squaredNorm()); auto particle = stack->AddParticle( std::tuple<particles::Code, units::si::HEPEnergyType, corsika::stack::MomentumVector, geometry::Point, units::si::TimeType>{ @@ -91,8 +88,7 @@ auto setupStack(particles::Code vProjectileType, HEPEnergyType vMomentum, particle.SetNode(vNodePtr); return std::make_tuple( - std::move(stack), - std::make_unique<decltype(setup::StackView(particle))>(particle)); + std::move(stack), std::make_unique<decltype(setup::StackView(particle))>(particle)); } struct DummyProcess { diff --git a/Processes/ParticleCut/testParticleCut.cc b/Processes/ParticleCut/testParticleCut.cc index 9ed381dfe..05805cd92 100644 --- a/Processes/ParticleCut/testParticleCut.cc +++ b/Processes/ParticleCut/testParticleCut.cc @@ -38,9 +38,9 @@ TEST_CASE("ParticleCut", "[processes]") { const HEPEnergyType Ebelow = 10_GeV; // list of arbitrary particles std::vector<particles::Code> particleList = { - particles::Code::PiPlus, particles::Code::PiMinus, particles::Code::KPlus, - particles::Code::KMinus, particles::Code::K0Long, particles::Code::K0Short, - particles::Code::Electron, particles::Code::MuPlus, particles::Code::NuE, + particles::Code::PiPlus, particles::Code::PiMinus, particles::Code::KPlus, + particles::Code::KMinus, particles::Code::K0Long, particles::Code::K0Short, + particles::Code::Electron, particles::Code::MuPlus, particles::Code::NuE, particles::Code::Neutron}; SECTION("cut on particle type: inv") { diff --git a/Processes/Pythia/Interaction.cc b/Processes/Pythia/Interaction.cc index 0de68ef9f..fe641a626 100644 --- a/Processes/Pythia/Interaction.cc +++ b/Processes/Pythia/Interaction.cc @@ -51,14 +51,14 @@ namespace corsika::process::pythia { // define which particles are passed to corsika, i.e. which particles make it into // history even very shortlived particles like charm or pi0 are of interest here const std::vector<particles::Code> HadronsWeWantTrackedByCorsika = { - particles::Code::PiPlus, particles::Code::PiMinus, - particles::Code::Pi0, particles::Code::KMinus, - particles::Code::KPlus, particles::Code::K0Long, - particles::Code::K0Short, particles::Code::SigmaPlus, + particles::Code::PiPlus, particles::Code::PiMinus, + particles::Code::Pi0, particles::Code::KMinus, + particles::Code::KPlus, particles::Code::K0Long, + particles::Code::K0Short, particles::Code::SigmaPlus, particles::Code::SigmaMinus, particles::Code::Lambda0, - particles::Code::Xi0, particles::Code::XiMinus, + particles::Code::Xi0, particles::Code::XiMinus, particles::Code::OmegaMinus, particles::Code::DPlus, - particles::Code::DMinus, particles::Code::D0, + particles::Code::DMinus, particles::Code::D0, particles::Code::D0Bar}; Interaction::SetParticleListStable(HadronsWeWantTrackedByCorsika); diff --git a/Processes/Sibyll/NuclearInteraction.cc b/Processes/Sibyll/NuclearInteraction.cc index dc442cb93..1a814e0dd 100644 --- a/Processes/Sibyll/NuclearInteraction.cc +++ b/Processes/Sibyll/NuclearInteraction.cc @@ -45,7 +45,7 @@ namespace corsika::process::sibyll { using namespace corsika::particles; const int k = targetComponentsIndex_.at(pCode); Code pNuclei[] = {Code::Helium, Code::Lithium7, Code::Oxygen, - Code::Neon, Code::Argon, Code::Iron}; + Code::Neon, Code::Argon, Code::Iron}; cout << "en/A "; for (auto& j : pNuclei) cout << std::setw(9) << j; cout << endl; diff --git a/Processes/UrQMD/UrQMD.cc b/Processes/UrQMD/UrQMD.cc index 6afc2d642..45f3abaff 100644 --- a/Processes/UrQMD/UrQMD.cc +++ b/Processes/UrQMD/UrQMD.cc @@ -126,8 +126,8 @@ CrossSectionType UrQMD::GetCrossSection(particles::Code projectileCode, !IsNucleus(targetCode)) { // both particles are "special" auto const mProj = particles::GetMass(projectileCode); auto const mTar = particles::GetMass(targetCode); - double sqrtS = sqrt(units::static_pow<2>(mProj) + - units::static_pow<2>(mTar) + 2 * labEnergy * mTar) * + double sqrtS = sqrt(units::static_pow<2>(mProj) + units::static_pow<2>(mTar) + + 2 * labEnergy * mTar) * (1 / 1_GeV); // we must set some UrQMD globals first... @@ -213,9 +213,9 @@ bool UrQMD::CanInteract(particles::Code code) const { // so we unfortunately have to forbid these interactions for the time being. static particles::Code const validProjectileCodes[] = { - particles::Code::Proton, particles::Code::AntiProton, particles::Code::Neutron, - particles::Code::AntiNeutron, particles::Code::PiPlus, particles::Code::PiMinus, - particles::Code::KPlus, particles::Code::KMinus, particles::Code::K0Short, + particles::Code::Proton, particles::Code::AntiProton, particles::Code::Neutron, + particles::Code::AntiNeutron, particles::Code::PiPlus, particles::Code::PiMinus, + particles::Code::KPlus, particles::Code::KMinus, particles::Code::K0Short, particles::Code::K0Long}; return std::find(std::cbegin(validProjectileCodes), std::cend(validProjectileCodes), diff --git a/Processes/UrQMD/UrQMD.h b/Processes/UrQMD/UrQMD.h index 016c958aa..937b6d702 100644 --- a/Processes/UrQMD/UrQMD.h +++ b/Processes/UrQMD/UrQMD.h @@ -117,7 +117,7 @@ namespace corsika::process::UrQMD { int nevents; std::array<int, 2> spityp; // particle codes of: [0]: projectile, [1]: target int prspflg; // projectile special flag - int trspflg; // target special flag, set to 1 unless target is nucleus > H + int trspflg; // target special flag, set to 1 unless target is nucleus > H std::array<int, 2> spiso3; // particle codes of: [0]: projectile, [1]: target int outsteps, bflag, srtflag, efuncflag, nsrt, npb, firstev; } inputs_; diff --git a/Processes/UrQMD/testUrQMD.cc b/Processes/UrQMD/testUrQMD.cc index e9d9de025..2b1f5bcef 100644 --- a/Processes/UrQMD/testUrQMD.cc +++ b/Processes/UrQMD/testUrQMD.cc @@ -85,8 +85,7 @@ auto setupStack(int vA, int vZ, HEPEnergyType vMomentum, TNodeType* vNodePtr, geometry::Point const origin(cs, {0_m, 0_m, 0_m}); corsika::stack::MomentumVector const pLab(cs, {vMomentum, 0_GeV, 0_GeV}); - HEPEnergyType const E0 = - sqrt(units::static_pow<2>(mN * vA) + pLab.squaredNorm()); + HEPEnergyType const E0 = sqrt(units::static_pow<2>(mN * vA) + pLab.squaredNorm()); auto particle = stack->AddParticle(std::tuple<particles::Code, units::si::HEPEnergyType, corsika::stack::MomentumVector, geometry::Point, @@ -106,9 +105,8 @@ auto setupStack(particles::Code vProjectileType, HEPEnergyType vMomentum, geometry::Point const origin(cs, {0_m, 0_m, 0_m}); corsika::stack::MomentumVector const pLab(cs, {vMomentum, 0_GeV, 0_GeV}); - HEPEnergyType const E0 = - sqrt(units::static_pow<2>(particles::GetMass(vProjectileType)) + - pLab.squaredNorm()); + HEPEnergyType const E0 = sqrt( + units::static_pow<2>(particles::GetMass(vProjectileType)) + pLab.squaredNorm()); auto particle = stack->AddParticle( std::tuple<particles::Code, units::si::HEPEnergyType, corsika::stack::MomentumVector, geometry::Point, units::si::TimeType>{ @@ -138,9 +136,9 @@ TEST_CASE("UrQMD") { [[maybe_unused]] auto const& node_dummy = nodePtr; particles::Code validProjectileCodes[] = { - particles::Code::PiPlus, particles::Code::PiMinus, particles::Code::Proton, - particles::Code::Neutron, particles::Code::KPlus, particles::Code::KMinus, - particles::Code::K0, particles::Code::K0Bar, particles::Code::K0Long}; + particles::Code::PiPlus, particles::Code::PiMinus, particles::Code::Proton, + particles::Code::Neutron, particles::Code::KPlus, particles::Code::KMinus, + particles::Code::K0, particles::Code::K0Bar, particles::Code::K0Long}; for (auto code : validProjectileCodes) { auto [stack, view] = setupStack(code, 100_GeV, nodePtr, cs); diff --git a/Setup/SetupStack.h b/Setup/SetupStack.h index 8721a0236..c58d8f0d3 100644 --- a/Setup/SetupStack.h +++ b/Setup/SetupStack.h @@ -16,7 +16,6 @@ #include <corsika/setup/SetupEnvironment.h> - namespace corsika::setup { namespace detail { @@ -62,8 +61,8 @@ namespace corsika::setup { // the version without history // using Stack = detail::StackWithGeometry; - //template<typename T1, template<typename>typename M2> - //using StackViewProducer = corsika::stack::DefaultSecondaryProducer<T1,M2>; + // template<typename T1, template<typename>typename M2> + // using StackViewProducer = corsika::stack::DefaultSecondaryProducer<T1,M2>; // the version with history using Stack = detail::StackWithHistory; @@ -73,7 +72,7 @@ namespace corsika::setup { namespace detail { /* See Issue 161 - + unfortunately clang does not support this in the same way (yet) as gcc, so we have to distinguish here. If clang cataches up, we could remove the clang branch here and also in @@ -89,7 +88,8 @@ namespace corsika::setup { // corsika::setup::detail::StackWithGeometryInterface>; corsika::setup::detail::StackWithHistoryInterface>; #elif defined(__GNUC__) || defined(__GNUG__) - using TheStackView = corsika::stack::MakeView<corsika::setup::Stack, StackViewProducer>::type; + using TheStackView = + corsika::stack::MakeView<corsika::setup::Stack, StackViewProducer>::type; #endif } // namespace detail diff --git a/Stack/History/HistoryStackExtension.h b/Stack/History/HistoryStackExtension.h index bbb594b37..76f136bcb 100644 --- a/Stack/History/HistoryStackExtension.h +++ b/Stack/History/HistoryStackExtension.h @@ -27,7 +27,7 @@ namespace corsika::history { template <typename TEvent> class HistoryData { using EventPtr = - std::shared_ptr<TEvent>; //!< Pointer to the event where this particle was created + std::shared_ptr<TEvent>; //!< Pointer to the event where this particle was created using ParentEventIndex = int; //!< index to TEvent::secondaries_ using DataType = std::pair<EventPtr, ParentEventIndex>; diff --git a/Stack/History/testHistoryView.cc b/Stack/History/testHistoryView.cc index 874d50f36..6461ed1df 100644 --- a/Stack/History/testHistoryView.cc +++ b/Stack/History/testHistoryView.cc @@ -53,11 +53,13 @@ using TheTestStackView = corsika::stack::SecondaryView<typename TestStack::Stack StackWithHistoryInterface, history::HistorySecondaryProducer>; #elif defined(__GNUC__) || defined(__GNUG__) -//using TheTestStackView = corsika::stack::MakeView<TestStack, history::HistorySecondaryProducer>::type; -using TheTestStackView = corsika::stack::MakeView<TestStack, history::HistorySecondaryProducer>::type; +// using TheTestStackView = corsika::stack::MakeView<TestStack, +// history::HistorySecondaryProducer>::type; +using TheTestStackView = + corsika::stack::MakeView<TestStack, history::HistorySecondaryProducer>::type; #endif -using TestStackView = TheTestStackView; //history::HistorySecondaryView<TheTestStackView>; +using TestStackView = TheTestStackView; // history::HistorySecondaryView<TheTestStackView>; TEST_CASE("HistoryStackExtension", "[stack]") { @@ -93,12 +95,12 @@ TEST_CASE("HistoryStackExtension", "[stack]") { // add 5 secondaries for (int i = 0; i < 5; ++i) { - auto sec = hview0.AddSecondary( - std::tuple<particles::Code, units::si::HEPEnergyType, - corsika::stack::MomentumVector, geometry::Point, units::si::TimeType>{ - particles::Code::Electron, 1.5_GeV, - corsika::stack::MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), - Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s}); + auto sec = hview0.AddSecondary(std::tuple<particles::Code, units::si::HEPEnergyType, + corsika::stack::MomentumVector, + geometry::Point, units::si::TimeType>{ + particles::Code::Electron, 1.5_GeV, + corsika::stack::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); @@ -115,12 +117,12 @@ TEST_CASE("HistoryStackExtension", "[stack]") { // add second generation of secondaries // add 10 secondaries for (int i = 0; i < 10; ++i) { - auto sec = hview1.AddSecondary( - std::tuple<particles::Code, units::si::HEPEnergyType, - corsika::stack::MomentumVector, geometry::Point, units::si::TimeType>{ - particles::Code::Electron, 1.5_GeV, - corsika::stack::MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), - Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s}); + auto sec = hview1.AddSecondary(std::tuple<particles::Code, units::si::HEPEnergyType, + corsika::stack::MomentumVector, + geometry::Point, units::si::TimeType>{ + particles::Code::Electron, 1.5_GeV, + corsika::stack::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); @@ -142,12 +144,12 @@ TEST_CASE("HistoryStackExtension", "[stack]") { for (int i = 0; i < 15; ++i) { C8LOG_TRACE("loop, view: " + std::to_string(i)); - auto sec = hview2.AddSecondary( - std::tuple<particles::Code, units::si::HEPEnergyType, - corsika::stack::MomentumVector, geometry::Point, units::si::TimeType>{ - particles::Code::Electron, 1.5_GeV, - corsika::stack::MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), - Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s}); + auto sec = hview2.AddSecondary(std::tuple<particles::Code, units::si::HEPEnergyType, + corsika::stack::MomentumVector, + geometry::Point, units::si::TimeType>{ + particles::Code::Electron, 1.5_GeV, + corsika::stack::MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), + Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s}); C8LOG_TRACE("loop, ---- "); CHECK(sec.GetParentEventIndex() == i); @@ -205,12 +207,12 @@ TEST_CASE("HistoryStackExtension", "[stack]") { // add 5 secondaries for (int i = 0; i < 5; ++i) { C8LOG_TRACE("loop " + std::to_string(i)); - auto sec = proj0.AddSecondary( - std::tuple<particles::Code, units::si::HEPEnergyType, - corsika::stack::MomentumVector, geometry::Point, units::si::TimeType>{ - particles::Code::Electron, 1.5_GeV, - corsika::stack::MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), - Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s}); + auto sec = proj0.AddSecondary(std::tuple<particles::Code, units::si::HEPEnergyType, + corsika::stack::MomentumVector, + geometry::Point, units::si::TimeType>{ + particles::Code::Electron, 1.5_GeV, + corsika::stack::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); @@ -228,12 +230,12 @@ TEST_CASE("HistoryStackExtension", "[stack]") { // add second generation of secondaries // add 10 secondaries for (int i = 0; i < 10; ++i) { - auto sec = proj1.AddSecondary( - std::tuple<particles::Code, units::si::HEPEnergyType, - corsika::stack::MomentumVector, geometry::Point, units::si::TimeType>{ - particles::Code::Electron, 1.5_GeV, - corsika::stack::MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), - Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s}); + auto sec = proj1.AddSecondary(std::tuple<particles::Code, units::si::HEPEnergyType, + corsika::stack::MomentumVector, + geometry::Point, units::si::TimeType>{ + particles::Code::Electron, 1.5_GeV, + corsika::stack::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); diff --git a/Stack/NuclearStackExtension/NuclearStackExtension.h b/Stack/NuclearStackExtension/NuclearStackExtension.h index e9ead6eb2..61c663e7e 100644 --- a/Stack/NuclearStackExtension/NuclearStackExtension.h +++ b/Stack/NuclearStackExtension/NuclearStackExtension.h @@ -275,8 +275,8 @@ namespace corsika::stack { fNucleusRef[i2] = -1; // flag as non-nucleus fNuclearA.erase(fNuclearA.cbegin() + ref2); // remove data for i2 fNuclearZ.erase(fNuclearZ.cbegin() + ref2); // remove data for i2 - const int n = fNucleusRef.size(); // update fNucleusRef: indices above ref2 - // must be decremented by 1 + const int n = fNucleusRef.size(); // update fNucleusRef: indices above ref2 + // must be decremented by 1 for (int i = 0; i < n; ++i) { if (fNucleusRef[i] > ref2) { fNucleusRef[i] -= 1; } } -- GitLab