From 2dbbff20d2ae911fa203b8b38610d3a974a08d1a Mon Sep 17 00:00:00 2001 From: Remy Prechelt <prechelt@hawaii.edu> Date: Tue, 18 May 2021 12:23:01 -1000 Subject: [PATCH] Remove Setup from HistoryObservationPlane. --- .../stack/history/HistoryObservationPlane.inl | 25 ++++++++++++------- .../stack/history/HistoryObservationPlane.hpp | 22 ++++++++-------- 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/corsika/detail/stack/history/HistoryObservationPlane.inl b/corsika/detail/stack/history/HistoryObservationPlane.inl index 66b0f11e4..6cd65c060 100644 --- a/corsika/detail/stack/history/HistoryObservationPlane.inl +++ b/corsika/detail/stack/history/HistoryObservationPlane.inl @@ -13,15 +13,18 @@ namespace corsika::history { - inline HistoryObservationPlane::HistoryObservationPlane(setup::Stack const& stack, - Plane const& obsPlane, - bool deleteOnHit) + template <typename TStack> + inline HistoryObservationPlane<TStack> HistoryObservationPlane(TStack const& stack, + Plane const& obsPlane, + bool deleteOnHit) : stack_{stack} , plane_{obsPlane} , deleteOnHit_{deleteOnHit} {} - inline ProcessReturn HistoryObservationPlane::DoContinuous( - setup::Stack::ParticleType const& particle, setup::Trajectory const& trajectory) { + template <typename TStack> + template <typename TParticle, typename TTrajectory> + inline ProcessReturn HistoryObservationPlane<TStack> DoContinuous( + TParticle const& particle, TTrajectory const& trajectory) { TimeType const timeOfIntersection = (plane_.getCenter() - trajectory.getR0()).dot(plane_.getNormal()) / trajectory.getV0().dot(plane_.getNormal()); @@ -45,8 +48,10 @@ namespace corsika::history { } } - inline LengthType HistoryObservationPlane::MaxStepLength( - setup::Stack::ParticleType const&, setup::Trajectory const& trajectory) { + template <typename TStack> + template <typename TParticle, typename TTrajectory> + inline LengthType HistoryObservationPlane<TStack> MaxStepLength( + TParticle const&, TTrajectory const& trajectory) { TimeType const timeOfIntersection = (plane_.getCenter() - trajectory.getR0()).dot(plane_.getNormal()) / trajectory.getV0().dot(plane_.getNormal()); @@ -59,8 +64,10 @@ namespace corsika::history { return (trajectory.getR0() - pointOfIntersection).norm() * 1.0001; } - inline void HistoryObservationPlane::fillHistoryHistogram( - setup::Stack::ParticleType const& muon) { + template <typename TStack> + template <typename TParticle> + inline void HistoryObservationPlane<TStack> fillHistoryHistogram( + TParticle const& muon) { double const muon_energy = muon.getEnergy() / 1_GeV; int genctr{0}; diff --git a/corsika/stack/history/HistoryObservationPlane.hpp b/corsika/stack/history/HistoryObservationPlane.hpp index 9c97f8722..11a76dc07 100644 --- a/corsika/stack/history/HistoryObservationPlane.hpp +++ b/corsika/stack/history/HistoryObservationPlane.hpp @@ -10,8 +10,6 @@ #include <corsika/geometry/Plane.h> #include <corsika/process/ContinuousProcess.h> -#include <corsika/setup/SetupStack.h> -#include <corsika/setup/SetupTrajectory.h> #include <corsika/units/PhysicalUnits.h> #include <boost/histogram.hpp> @@ -24,22 +22,26 @@ namespace corsika::history { - class HistoryObservationPlane : public ContinuousProcess<HistoryObservationPlane> { + template <typename TStack> + class HistoryObservationPlane + : public ContinuousProcess<HistoryObservationPlane<TStack>> { public: - HistoryObservationPlane(setup::Stack const&, Plane const&, bool = true); + HistoryObservationPlane(TStack const&, Plane const&, bool = true); - LengthType getMaxStepLength(setup::Stack::particle_type const&, - setup::Trajectory const& vTrajectory); + template <typename TParticle, typename TTrajectory> + LengthType getMaxStepLength(TParticle const&, TTrajectory const& vTrajectory); - ProcessReturn doContinuous(setup::Stack::particle_type const& vParticle, - setup::Trajectory const& vTrajectory); + template <typename TParticle, typename TTrajectory> + ProcessReturn doContinuous(TParticle const& vParticle, + TTrajectory const& vTrajectory); auto const& histogram() const { return histogram_; } private: - void fillHistoryHistogram(setup::Stack::particle_type const&); + template <typename TParticle> + void fillHistoryHistogram(TParticle const&); - setup::Stack const& stack_; + TStack const& stack_; Plane const plane_; bool const deleteOnHit_; -- GitLab