From 60184f842c5194abc069a04017ea67c93ec3907f Mon Sep 17 00:00:00 2001 From: Remy Prechelt <prechelt@hawaii.edu> Date: Tue, 18 May 2021 10:30:31 -1000 Subject: [PATCH] Update incorrect file formatting with clang. --- .../detail/framework/geometry/FourVector.inl | 22 +++++++++---------- .../framework/geometry/QuantityVector.inl | 4 ++-- corsika/detail/media/HomogeneousMedium.inl | 4 ++-- corsika/detail/media/WeightProvider.inl | 2 +- corsika/detail/modules/ObservationPlane.inl | 10 ++++----- .../modules/energy_loss/BetheBlochPDG.inl | 19 +++++++--------- .../modules/proposal/ProposalProcessBase.inl | 4 ++-- corsika/detail/modules/pythia8/Decay.inl | 1 - .../detail/modules/pythia8/Interaction.inl | 3 +-- corsika/detail/modules/sibyll/Interaction.inl | 1 - corsika/framework/geometry/BaseTrajectory.hpp | 3 --- corsika/media/BaseExponential.hpp | 3 +-- corsika/media/IEmpty.hpp | 2 -- corsika/modules/ObservationPlane.hpp | 11 +++++----- corsika/modules/energy_loss/BetheBlochPDG.hpp | 14 +++++------- corsika/modules/pythia8/Interaction.hpp | 2 +- examples/em_shower.cpp | 4 ++-- examples/hybrid_MC.cpp | 4 ++-- examples/vertical_EAS.cpp | 3 ++- tests/common/SetupTestTrajectory.hpp | 1 - tests/modules/testObservationPlane.cpp | 12 ++++++---- 21 files changed, 57 insertions(+), 72 deletions(-) diff --git a/corsika/detail/framework/geometry/FourVector.inl b/corsika/detail/framework/geometry/FourVector.inl index 5d871430d..62542aae5 100644 --- a/corsika/detail/framework/geometry/FourVector.inl +++ b/corsika/detail/framework/geometry/FourVector.inl @@ -54,8 +54,8 @@ namespace corsika { } template <typename TTimeType, typename TSpaceVecType> - inline FourVector<TTimeType, TSpaceVecType>& FourVector<TTimeType, TSpaceVecType>:: - operator+=(FourVector const& b) { + inline FourVector<TTimeType, TSpaceVecType>& + FourVector<TTimeType, TSpaceVecType>::operator+=(FourVector const& b) { timeLike_ += b.timeLike_; spaceLike_ += b.spaceLike_; @@ -63,39 +63,39 @@ namespace corsika { } template <typename TTimeType, typename TSpaceVecType> - inline FourVector<TTimeType, TSpaceVecType>& FourVector<TTimeType, TSpaceVecType>:: - operator-=(FourVector const& b) { + inline FourVector<TTimeType, TSpaceVecType>& + FourVector<TTimeType, TSpaceVecType>::operator-=(FourVector const& b) { timeLike_ -= b.timeLike_; spaceLike_ -= b.spaceLike_; return *this; } template <typename TTimeType, typename TSpaceVecType> - inline FourVector<TTimeType, TSpaceVecType>& FourVector<TTimeType, TSpaceVecType>:: - operator*=(double const b) { + inline FourVector<TTimeType, TSpaceVecType>& + FourVector<TTimeType, TSpaceVecType>::operator*=(double const b) { timeLike_ *= b; spaceLike_ *= b; return *this; } template <typename TTimeType, typename TSpaceVecType> - inline FourVector<TTimeType, TSpaceVecType>& FourVector<TTimeType, TSpaceVecType>:: - operator/=(double const b) { + inline FourVector<TTimeType, TSpaceVecType>& + FourVector<TTimeType, TSpaceVecType>::operator/=(double const b) { timeLike_ /= b; spaceLike_.getComponents() /= b; return *this; } template <typename TTimeType, typename TSpaceVecType> - inline FourVector<TTimeType, TSpaceVecType>& FourVector<TTimeType, TSpaceVecType>:: - operator/(double const b) { + inline FourVector<TTimeType, TSpaceVecType>& + FourVector<TTimeType, TSpaceVecType>::operator/(double const b) { *this /= b; return *this; } template <typename TTimeType, typename TSpaceVecType> inline typename FourVector<TTimeType, TSpaceVecType>::norm_type - FourVector<TTimeType, TSpaceVecType>::operator*(FourVector const& b) { + FourVector<TTimeType, TSpaceVecType>::operator*(FourVector const& b) { if constexpr (std::is_same<time_type, decltype(std::declval<space_type>() / meter * second)>::value) return timeLike_ * b.timeLike_ * constants::cSquared - spaceLike_.norm(); diff --git a/corsika/detail/framework/geometry/QuantityVector.inl b/corsika/detail/framework/geometry/QuantityVector.inl index a932e4de8..c7f9457b9 100644 --- a/corsika/detail/framework/geometry/QuantityVector.inl +++ b/corsika/detail/framework/geometry/QuantityVector.inl @@ -17,8 +17,8 @@ namespace corsika { template <typename TDimension> - inline typename QuantityVector<TDimension>::quantity_type QuantityVector<TDimension>:: - operator[](size_t const index) const { + inline typename QuantityVector<TDimension>::quantity_type + QuantityVector<TDimension>::operator[](size_t const index) const { return quantity_type(phys::units::detail::magnitude_tag, eigenVector_[index]); } diff --git a/corsika/detail/media/HomogeneousMedium.inl b/corsika/detail/media/HomogeneousMedium.inl index 94fb90cd4..368073c9f 100644 --- a/corsika/detail/media/HomogeneousMedium.inl +++ b/corsika/detail/media/HomogeneousMedium.inl @@ -32,8 +32,8 @@ namespace corsika { } template <typename T> - inline GrammageType HomogeneousMedium<T>::getIntegratedGrammage( - BaseTrajectory const&, LengthType to) const { + inline GrammageType HomogeneousMedium<T>::getIntegratedGrammage(BaseTrajectory const&, + LengthType to) const { return to * density_; } diff --git a/corsika/detail/media/WeightProvider.inl b/corsika/detail/media/WeightProvider.inl index b9cf1be7a..2bbc58dd3 100644 --- a/corsika/detail/media/WeightProvider.inl +++ b/corsika/detail/media/WeightProvider.inl @@ -20,7 +20,7 @@ namespace corsika { template <class AConstIterator, class BConstIterator> inline typename WeightProviderIterator<AConstIterator, BConstIterator>::value_type - WeightProviderIterator<AConstIterator, BConstIterator>::operator*() const { + WeightProviderIterator<AConstIterator, BConstIterator>::operator*() const { return ((*aIter_) * (*bIter_)).magnitude(); } diff --git a/corsika/detail/modules/ObservationPlane.inl b/corsika/detail/modules/ObservationPlane.inl index 3a1ab82e6..967b93141 100644 --- a/corsika/detail/modules/ObservationPlane.inl +++ b/corsika/detail/modules/ObservationPlane.inl @@ -10,8 +10,8 @@ namespace corsika { template <typename TTracking, typename TOutput> ObservationPlane<TTracking, TOutput>::ObservationPlane(Plane const& obsPlane, - DirectionVector const& x_axis, - bool deleteOnHit) + DirectionVector const& x_axis, + bool deleteOnHit) : plane_(obsPlane) , deleteOnHit_(deleteOnHit) , energy_ground_(0_GeV) @@ -22,8 +22,7 @@ namespace corsika { template <typename TTracking, typename TOutput> template <typename TParticle, typename TTrajectory> inline ProcessReturn ObservationPlane<TTracking, TOutput>::doContinuous( - TParticle& particle, TTrajectory&, - bool const stepLimit) { + TParticle& particle, TTrajectory&, bool const stepLimit) { /* The current step did not yet reach the ObservationPlane, do nothing now and wait: */ @@ -62,8 +61,7 @@ namespace corsika { template <typename TTracking, typename TOutput> template <typename TParticle, typename TTrajectory> inline LengthType ObservationPlane<TTracking, TOutput>::getMaxStepLength( - TParticle const& particle, - TTrajectory const& trajectory) { + TParticle const& particle, TTrajectory const& trajectory) { CORSIKA_LOG_TRACE("particle={}, pos={}, dir={}, plane={}", particle.asString(), particle.getPosition(), particle.getDirection(), plane_.asString()); diff --git a/corsika/detail/modules/energy_loss/BetheBlochPDG.inl b/corsika/detail/modules/energy_loss/BetheBlochPDG.inl index d7af6a1f0..a2f643cc5 100644 --- a/corsika/detail/modules/energy_loss/BetheBlochPDG.inl +++ b/corsika/detail/modules/energy_loss/BetheBlochPDG.inl @@ -125,8 +125,8 @@ namespace corsika { // radiation losses according to PDG 2018, ch. 33 ref. [5] template <typename TParticle> - inline HEPEnergyType BetheBlochPDG::getRadiationLosses( - TParticle const& vP, GrammageType const vDX) { + inline HEPEnergyType BetheBlochPDG::getRadiationLosses(TParticle const& vP, + GrammageType const vDX) { // simple-minded hard-coded value for b(E) inspired by data from // http://pdg.lbl.gov/2018/AtomicNuclearProperties/ for N and O. auto constexpr b = 3.0 * 1e-6 * square(1_cm) / 1_g; @@ -134,14 +134,13 @@ namespace corsika { } template <typename TParticle> - inline HEPEnergyType BetheBlochPDG::getTotalEnergyLoss( - TParticle const& vP, GrammageType const vDX) { + inline HEPEnergyType BetheBlochPDG::getTotalEnergyLoss(TParticle const& vP, + GrammageType const vDX) { return getBetheBloch(vP, vDX) + getRadiationLosses(vP, vDX); } template <typename TParticle, typename TTrajectory> - inline ProcessReturn BetheBlochPDG::doContinuous(TParticle& p, - TTrajectory const& t, + inline ProcessReturn BetheBlochPDG::doContinuous(TParticle& p, TTrajectory const& t, bool const) { // if this step was limiting the CORSIKA stepping, the particle is lost @@ -172,9 +171,8 @@ namespace corsika { } template <typename TParticle, typename TTrajectory> - inline LengthType BetheBlochPDG::getMaxStepLength( - TParticle const& vParticle, - TTrajectory const& vTrack) const { + inline LengthType BetheBlochPDG::getMaxStepLength(TParticle const& vParticle, + TTrajectory const& vTrack) const { if (vParticle.getChargeNumber() == 0) { return meter * std::numeric_limits<double>::infinity(); } @@ -198,8 +196,7 @@ namespace corsika { } template <typename TParticle> - inline void BetheBlochPDG::updateMomentum(TParticle& vP, - HEPEnergyType Enew) { + inline void BetheBlochPDG::updateMomentum(TParticle& vP, HEPEnergyType Enew) { HEPMomentumType Pnew = elab2plab(Enew, vP.getMass()); auto pnew = vP.getMomentum(); vP.setMomentum(pnew * Pnew / pnew.getNorm()); diff --git a/corsika/detail/modules/proposal/ProposalProcessBase.inl b/corsika/detail/modules/proposal/ProposalProcessBase.inl index 7b0710088..bc497ea94 100644 --- a/corsika/detail/modules/proposal/ProposalProcessBase.inl +++ b/corsika/detail/modules/proposal/ProposalProcessBase.inl @@ -67,8 +67,8 @@ namespace corsika::proposal { } } - inline size_t ProposalProcessBase::hash::operator()(const calc_key_t& p) const - noexcept { + inline size_t ProposalProcessBase::hash::operator()( + const calc_key_t& p) const noexcept { return p.first ^ std::hash<Code>{}(p.second); } diff --git a/corsika/detail/modules/pythia8/Decay.inl b/corsika/detail/modules/pythia8/Decay.inl index e02f38b86..f3f743364 100644 --- a/corsika/detail/modules/pythia8/Decay.inl +++ b/corsika/detail/modules/pythia8/Decay.inl @@ -12,7 +12,6 @@ #include <corsika/framework/utility/COMBoost.hpp> - namespace corsika::pythia8 { inline Decay::Decay(bool const print_listing) diff --git a/corsika/detail/modules/pythia8/Interaction.inl b/corsika/detail/modules/pythia8/Interaction.inl index 56dfeb2e4..752ac96a1 100644 --- a/corsika/detail/modules/pythia8/Interaction.inl +++ b/corsika/detail/modules/pythia8/Interaction.inl @@ -154,8 +154,7 @@ namespace corsika::pythia8 { } template <typename TParticle> - inline GrammageType Interaction::getInteractionLength( - TParticle const& particle) { + inline GrammageType Interaction::getInteractionLength(TParticle const& particle) { // coordinate system, get global frame of reference MomentumVector const& pMomentum = particle.getMomentum(); diff --git a/corsika/detail/modules/sibyll/Interaction.inl b/corsika/detail/modules/sibyll/Interaction.inl index 087946bac..c6adf5e10 100644 --- a/corsika/detail/modules/sibyll/Interaction.inl +++ b/corsika/detail/modules/sibyll/Interaction.inl @@ -21,7 +21,6 @@ #include <tuple> - namespace corsika::sibyll { inline Interaction::Interaction(const bool sibyll_printout_on) diff --git a/corsika/framework/geometry/BaseTrajectory.hpp b/corsika/framework/geometry/BaseTrajectory.hpp index 433df38db..01177b892 100644 --- a/corsika/framework/geometry/BaseTrajectory.hpp +++ b/corsika/framework/geometry/BaseTrajectory.hpp @@ -36,7 +36,6 @@ namespace corsika { class BaseTrajectory { public: - virtual Point getPosition(double const u) const = 0; virtual VelocityVector getVelocity(double const u) const = 0; @@ -50,8 +49,6 @@ namespace corsika { virtual void setLength(LengthType const limit) = 0; virtual void setDuration(TimeType const limit) = 0; - - }; } // namespace corsika diff --git a/corsika/media/BaseExponential.hpp b/corsika/media/BaseExponential.hpp index 9fe436cb0..66f907943 100644 --- a/corsika/media/BaseExponential.hpp +++ b/corsika/media/BaseExponential.hpp @@ -61,8 +61,7 @@ namespace corsika { * \f] */ // clang-format on - LengthType getArclengthFromGrammage(BaseTrajectory const& line, - GrammageType grammage, + LengthType getArclengthFromGrammage(BaseTrajectory const& line, GrammageType grammage, DirectionVector const& axis) const; public: diff --git a/corsika/media/IEmpty.hpp b/corsika/media/IEmpty.hpp index ffd642fd0..e67771d24 100644 --- a/corsika/media/IEmpty.hpp +++ b/corsika/media/IEmpty.hpp @@ -25,7 +25,6 @@ namespace corsika { class IEmpty { public: - virtual LengthType getArclengthFromGrammage(BaseTrajectory const&, GrammageType) const = 0; @@ -35,7 +34,6 @@ namespace corsika { template <typename TModel = IEmpty> class Empty : public TModel { public: - LengthType getArclengthFromGrammage(BaseTrajectory const&, GrammageType) const { return 0. * meter; } diff --git a/corsika/modules/ObservationPlane.hpp b/corsika/modules/ObservationPlane.hpp index 522631ff2..6d71d8f76 100644 --- a/corsika/modules/ObservationPlane.hpp +++ b/corsika/modules/ObservationPlane.hpp @@ -31,20 +31,19 @@ namespace corsika { another more specialized output class. */ template <typename TTracking, typename TOutputWriter = ObservationPlaneWriterParquet> - class ObservationPlane : public ContinuousProcess<ObservationPlane<TTracking, TOutputWriter>>, - public TOutputWriter { + class ObservationPlane + : public ContinuousProcess<ObservationPlane<TTracking, TOutputWriter>>, + public TOutputWriter { public: ObservationPlane(Plane const&, DirectionVector const&, bool = true); template <typename TParticle, typename TTrajectory> - ProcessReturn doContinuous(TParticle& vParticle, - TTrajectory& vTrajectory, + ProcessReturn doContinuous(TParticle& vParticle, TTrajectory& vTrajectory, bool const stepLimit); template <typename TParticle, typename TTrajectory> - LengthType getMaxStepLength(TParticle const&, - TTrajectory const& vTrajectory); + LengthType getMaxStepLength(TParticle const&, TTrajectory const& vTrajectory); void showResults() const; void reset(); diff --git a/corsika/modules/energy_loss/BetheBlochPDG.hpp b/corsika/modules/energy_loss/BetheBlochPDG.hpp index ce527abdd..5f606b82d 100644 --- a/corsika/modules/energy_loss/BetheBlochPDG.hpp +++ b/corsika/modules/energy_loss/BetheBlochPDG.hpp @@ -50,8 +50,8 @@ namespace corsika { * globally limiting factor (or not) clang-format-on **/ template <typename TParticle, typename TTrajectory> - ProcessReturn doContinuous(TParticle& particle, - TTrajectory const& track, bool const limitFlag); + ProcessReturn doContinuous(TParticle& particle, TTrajectory const& track, + bool const limitFlag); template <typename TParticle, typename TTrajectory> LengthType getMaxStepLength(TParticle const&, @@ -59,16 +59,13 @@ namespace corsika { const; //! limited by the energy threshold! By default the limit is the particle //! rest mass, i.e. kinetic energy is zero template <typename TParticle> - static HEPEnergyType getBetheBloch(TParticle const&, - const GrammageType); + static HEPEnergyType getBetheBloch(TParticle const&, const GrammageType); template <typename TParticle> - static HEPEnergyType getRadiationLosses(TParticle const&, - const GrammageType); + static HEPEnergyType getRadiationLosses(TParticle const&, const GrammageType); template <typename TParticle> - static HEPEnergyType getTotalEnergyLoss(TParticle const&, - const GrammageType); + static HEPEnergyType getTotalEnergyLoss(TParticle const&, const GrammageType); void showResults() const; void reset(); @@ -77,7 +74,6 @@ namespace corsika { HEPEnergyType getTotal() const; private: - template <typename TParticle> void updateMomentum(TParticle&, HEPEnergyType Enew); diff --git a/corsika/modules/pythia8/Interaction.hpp b/corsika/modules/pythia8/Interaction.hpp index 868554046..f1a6e0d93 100644 --- a/corsika/modules/pythia8/Interaction.hpp +++ b/corsika/modules/pythia8/Interaction.hpp @@ -36,7 +36,7 @@ namespace corsika::pythia8 { std::tuple<CrossSectionType, CrossSectionType> getCrossSection( const Code BeamId, const Code TargetId, const HEPEnergyType CoMenergy); - template <typename TParticle> + template <typename TParticle> GrammageType getInteractionLength(TParticle const&); /** diff --git a/examples/em_shower.cpp b/examples/em_shower.cpp index d5a3f8f9b..378d8b3ee 100644 --- a/examples/em_shower.cpp +++ b/examples/em_shower.cpp @@ -156,8 +156,8 @@ int main(int argc, char** argv) { LongitudinalProfile longprof{showerAxis}; Plane const obsPlane(showerCore, DirectionVector(rootCS, {0., 0., 1.})); - ObservationPlane<setup::Tracking> observationLevel(obsPlane, DirectionVector(rootCS, {1., 0., 0.}), - "particles.dat"); + ObservationPlane<setup::Tracking> observationLevel( + obsPlane, DirectionVector(rootCS, {1., 0., 0.}), "particles.dat"); output.add("obsplane", observationLevel); auto sequence = make_sequence(emCascadeCounted, emContinuous, longprof, cut, diff --git a/examples/hybrid_MC.cpp b/examples/hybrid_MC.cpp index 3b82b0cd6..9993d390e 100644 --- a/examples/hybrid_MC.cpp +++ b/examples/hybrid_MC.cpp @@ -220,8 +220,8 @@ int main(int argc, char** argv) { LongitudinalProfile longprof{showerAxis}; Plane const obsPlane(showerCore, DirectionVector(rootCS, {0., 0., 1.})); - ObservationPlane<setup::Tracking> observationLevel(obsPlane, DirectionVector(rootCS, {1., 0., 0.}), - "particles.dat"); + ObservationPlane<setup::Tracking> observationLevel( + obsPlane, DirectionVector(rootCS, {1., 0., 0.}), "particles.dat"); output.add("obsplane", observationLevel); corsika::urqmd::UrQMD urqmd_model; diff --git a/examples/vertical_EAS.cpp b/examples/vertical_EAS.cpp index ac6944585..190492722 100644 --- a/examples/vertical_EAS.cpp +++ b/examples/vertical_EAS.cpp @@ -286,7 +286,8 @@ int main(int argc, char** argv) { LongitudinalProfile longprof{showerAxis}; Plane const obsPlane(showerCore, DirectionVector(rootCS, {0., 0., 1.})); - ObservationPlane<setup::Tracking, NoOutput> observationLevel(obsPlane, DirectionVector(rootCS, {1., 0., 0.})); + ObservationPlane<setup::Tracking, NoOutput> observationLevel( + obsPlane, DirectionVector(rootCS, {1., 0., 0.})); // register the observation plane with the output output.add("particles", observationLevel); diff --git a/tests/common/SetupTestTrajectory.hpp b/tests/common/SetupTestTrajectory.hpp index 1bf4cd78f..827231719 100644 --- a/tests/common/SetupTestTrajectory.hpp +++ b/tests/common/SetupTestTrajectory.hpp @@ -43,5 +43,4 @@ namespace corsika::setup::testing { tEnd); } - } // namespace corsika::setup::testing diff --git a/tests/modules/testObservationPlane.cpp b/tests/modules/testObservationPlane.cpp index 5b603982a..e6fd80ee5 100644 --- a/tests/modules/testObservationPlane.cpp +++ b/tests/modules/testObservationPlane.cpp @@ -56,7 +56,8 @@ TEST_CASE("ObservationPlane", "interface") { SECTION("horizontal plane") { Plane const obsPlane(Point(cs, {10_m, 0_m, 0_m}), DirectionVector(cs, {1., 0., 0.})); - ObservationPlane<setup::Tracking, NoOutput> obs(obsPlane, DirectionVector(cs, {0., 1., 0.})); + ObservationPlane<setup::Tracking, NoOutput> obs(obsPlane, + DirectionVector(cs, {0., 1., 0.})); LengthType const length = obs.getMaxStepLength(particle, no_used_track); ProcessReturn const ret = obs.doContinuous(particle, no_used_track, true); @@ -84,7 +85,8 @@ TEST_CASE("ObservationPlane", "interface") { SECTION("transparent plane") { Plane const obsPlane(Point(cs, {1_m, 0_m, 0_m}), DirectionVector(cs, {1., 0., 0.})); - ObservationPlane<setup::Tracking, NoOutput> obs(obsPlane, DirectionVector(cs, {0., 0., 1.}), false); + ObservationPlane<setup::Tracking, NoOutput> obs( + obsPlane, DirectionVector(cs, {0., 0., 1.}), false); LengthType const length = obs.getMaxStepLength(particle, no_used_track); ProcessReturn const ret = obs.doContinuous(particle, no_used_track, false); @@ -102,7 +104,8 @@ TEST_CASE("ObservationPlane", "interface") { Plane const obsPlane(Point(cs, {10_m, 5_m, 5_m}), DirectionVector(cs, {1, 0.1, -0.05})); - ObservationPlane<setup::Tracking, NoOutput> obs(obsPlane, DirectionVector(cs, {0., 1., 0.})); + ObservationPlane<setup::Tracking, NoOutput> obs(obsPlane, + DirectionVector(cs, {0., 1., 0.})); LengthType const length = obs.getMaxStepLength(particle, no_used_track); ProcessReturn const ret = obs.doContinuous(particle, no_used_track, true); @@ -113,7 +116,8 @@ TEST_CASE("ObservationPlane", "interface") { SECTION("output") { Plane const obsPlane(Point(cs, {1_m, 0_m, 0_m}), DirectionVector(cs, {1., 0., 0.})); - ObservationPlane<setup::Tracking, NoOutput> obs(obsPlane, DirectionVector(cs, {0., 0., 1.}), false); + ObservationPlane<setup::Tracking, NoOutput> obs( + obsPlane, DirectionVector(cs, {0., 0., 1.}), false); auto const cfg = obs.getConfig(); CHECK(cfg["type"]); } -- GitLab