From 17e89cf2daa8702e737b3a74eb19bd889a9d1afa Mon Sep 17 00:00:00 2001 From: ralfulrich <ralf.ulrich@kit.edu> Date: Thu, 19 Nov 2020 12:35:00 +0100 Subject: [PATCH] interface adaptions --- corsika/detail/framework/core/Cascade.inl | 23 +++------ .../framework/process/ProcessSequence.inl | 9 ++-- corsika/detail/modules/ObservationPlane.inl | 10 ++-- corsika/detail/modules/ParticleCut.inl | 3 +- corsika/detail/modules/StackInspector.inl | 8 ++- corsika/detail/modules/TrackWriter.inl | 6 +-- .../modules/energy_loss/BetheBlochPDG.inl | 8 +-- .../detail/modules/pythia8/Interaction.inl | 3 +- .../detail/modules/qgsjetII/Interaction.inl | 3 +- corsika/detail/modules/sibyll/Interaction.inl | 3 +- .../modules/sibyll/NuclearInteraction.inl | 8 ++- corsika/detail/modules/urqmd/UrQMD.inl | 4 +- corsika/framework/process/BaseProcess.hpp | 2 +- corsika/framework/process/DecayProcess.hpp | 2 +- .../framework/process/InteractionProcess.hpp | 2 +- corsika/framework/process/ProcessSequence.hpp | 3 ++ corsika/modules/ObservationPlane.hpp | 2 +- corsika/modules/ParticleCut.hpp | 2 +- corsika/modules/StackInspector.hpp | 4 +- corsika/modules/SwitchProcess.hpp | 26 +++++----- corsika/modules/TrackWriter.hpp | 2 +- corsika/modules/energy_loss/BetheBlochPDG.hpp | 6 +-- corsika/modules/pythia8/Interaction.hpp | 2 +- corsika/modules/qgsjetII/Interaction.hpp | 2 +- corsika/modules/qgsjetII/QGSJetIIStack.hpp | 4 +- corsika/modules/sibyll/Interaction.hpp | 2 +- corsika/modules/sibyll/NuclearInteraction.hpp | 2 +- corsika/modules/urqmd/UrQMD.hpp | 2 +- examples/cascade_example.cpp | 4 +- tests/framework/testProcessSequence.cpp | 49 ++++++++----------- tests/modules/CMakeLists.txt | 2 +- tests/modules/testNullModel.cpp | 38 +------------- tests/modules/testObservationPlane.cpp | 8 +-- tests/modules/testParticleCut.cpp | 12 ++--- tests/modules/testPythia8.cpp | 2 +- tests/modules/testQGSJetII.cpp | 2 +- tests/modules/testSibyll.cpp | 5 +- tests/modules/testStackInspector.cpp | 2 +- tests/modules/testSwitchProcess.cpp | 26 +++++----- tests/modules/testUrQMD.cpp | 6 +-- 40 files changed, 122 insertions(+), 187 deletions(-) diff --git a/corsika/detail/framework/core/Cascade.inl b/corsika/detail/framework/core/Cascade.inl index 841a9f620..c67343b37 100644 --- a/corsika/detail/framework/core/Cascade.inl +++ b/corsika/detail/framework/core/Cascade.inl @@ -30,13 +30,6 @@ namespace corsika { - template <typename TTracking, typename TProcessList, typename TStack, - typename TStackView> - void Cascade<TTracking, TProcessList, TStack, TStackView>::Init() { - fProcessSequence.Init(); - fStack.Init(); - } - template <typename TTracking, typename TProcessList, typename TStack, typename TStackView> void Cascade<TTracking, TProcessList, TStack, TStackView>::SetNodes() { @@ -58,7 +51,7 @@ namespace corsika { std::cout << "========= next: " << pNext.GetPID() << std::endl; Step(pNext); std::cout << "========= stack ============" << std::endl; - fProcessSequence.DoStack(fStack); + fProcessSequence.doStack(fStack); } // do cascade equations, which can put new particles on Stack, // thus, the double loop @@ -88,7 +81,7 @@ namespace corsika { // determine combined total interaction length (inverse) InverseGrammageType const total_inv_lambda = - fProcessSequence.GetTotalInverseInteractionLength(vParticle); + fProcessSequence.getInverseInteractionLength(vParticle); // sample random exponential step length in grammage corsika::ExponentialDistribution expDist(1 / total_inv_lambda); @@ -110,12 +103,12 @@ namespace corsika { next_interact); // determine the maximum geometric step length - LengthType const distance_max = fProcessSequence.MaxStepLength(vParticle, step); + LengthType const distance_max = fProcessSequence.maxStepLength(vParticle, step); std::cout << "distance_max=" << distance_max << std::endl; // determine combined total inverse decay time InverseTimeType const total_inv_lifetime = - fProcessSequence.GetTotalInverseLifetime(vParticle); + fProcessSequence.getInverseLifetime(vParticle); // sample random exponential decay time corsika::ExponentialDistribution expDistDecay(1 / total_inv_lifetime); @@ -142,9 +135,9 @@ namespace corsika { step.LimitEndTo(min_distance); // apply all continuous processes on particle + track - corsika::EProcessReturn status = fProcessSequence.DoContinuous(vParticle, step); + corsika::ProcessReturn status = fProcessSequence.doContinuous(vParticle, step); - if (status == corsika::EProcessReturn::eParticleAbsorbed) { + if (status == corsika::ProcessReturn::ParticleAbsorbed) { std::cout << "Cascade: delete absorbed particle " << vParticle.GetPID() << " " << vParticle.GetEnergy() / 1_GeV << "GeV" << std::endl; vParticle.Delete(); @@ -239,12 +232,12 @@ namespace corsika { std::cout << "collide" << std::endl; InverseGrammageType const current_inv_length = - fProcessSequence.GetTotalInverseInteractionLength(particle); + fProcessSequence.getInverseInteractionLength(particle); corsika::UniformRealDistribution<InverseGrammageType> uniDist(current_inv_length); const auto sample_process = uniDist(fRNG); auto inv_lambda_count = InverseGrammageType::zero(); - return fProcessSequence.SelectInteraction(particle, projectile, sample_process, + return fProcessSequence.selectInteraction(view, sample_process inv_lambda_count); } diff --git a/corsika/detail/framework/process/ProcessSequence.inl b/corsika/detail/framework/process/ProcessSequence.inl index 5ad6eac22..8596d92d8 100644 --- a/corsika/detail/framework/process/ProcessSequence.inl +++ b/corsika/detail/framework/process/ProcessSequence.inl @@ -156,8 +156,7 @@ namespace corsika { } else if constexpr (std::is_base_of_v<InteractionProcess<process1_type>, process1_type>) { // if this is not a ContinuousProcess --> evaluate probability - auto const particle = view.parent(); - lambda_inv_sum += A_.getInverseInteractionLength(particle); +// FIXME lambda_inv_sum += A_.getInverseInteractionLength(view.parent()); // check if we should execute THIS process and then EXIT if (lambda_inv_select < lambda_inv_sum) { A_.doInteraction(view); @@ -171,7 +170,7 @@ namespace corsika { } else if constexpr (std::is_base_of_v<InteractionProcess<process2_type>, process2_type>) { // if this is not a ContinuousProcess --> evaluate probability - lambda_inv_sum += B_.getInverseInteractionLength(view.parent()); + //lambda_inv_sum += B_.getInverseInteractionLength(view.parent()); <-- FIXME as soon as SecondaryView::parent() is migrated! // check if we should execute THIS process and then EXIT if (lambda_inv_select < lambda_inv_sum) { B_.doInteraction(view); @@ -215,7 +214,7 @@ namespace corsika { if (ret != ProcessReturn::Ok) { return ret; } } else if constexpr (std::is_base_of_v<DecayProcess<process1_type>, process1_type>) { // if this is not a ContinuousProcess --> evaluate probability - decay_inv_sum += A_.getInverseLifetime(view.parent()); + // FIXME decay_inv_sum += A_.getInverseLifetime(view.parent()); // check if we should execute THIS process and then EXIT if (decay_inv_select < decay_inv_sum) { // more pedagogical: rndm_select < // decay_inv_sum / decay_inv_tot @@ -229,7 +228,7 @@ namespace corsika { return B_.selectDecay(view, decay_inv_select, decay_inv_sum); } else if constexpr (std::is_base_of_v<DecayProcess<process2_type>, process2_type>) { // if this is not a ContinuousProcess --> evaluate probability - decay_inv_sum += B_.getInverseLifetime(view.parent()); + // FIXME decay_inv_sum += B_.getInverseLifetime(view.parent()); // check if we should execute THIS process and then EXIT if (decay_inv_select < decay_inv_sum) { B_.doDecay(view); diff --git a/corsika/detail/modules/ObservationPlane.inl b/corsika/detail/modules/ObservationPlane.inl index a63fc3588..cbe582c8b 100644 --- a/corsika/detail/modules/ObservationPlane.inl +++ b/corsika/detail/modules/ObservationPlane.inl @@ -22,17 +22,17 @@ namespace corsika::observation_plane { outputStream_ << "#PDG code, energy / eV, distance to center / m" << std::endl; } - corsika::EProcessReturn ObservationPlane::DoContinuous( + corsika::ProcessReturn ObservationPlane::doContinuous( corsika::setup::Stack::ParticleType const& particle, corsika::setup::Trajectory const& trajectory) { TimeType const timeOfIntersection = (plane_.GetCenter() - trajectory.GetR0()).dot(plane_.GetNormal()) / trajectory.GetV0().dot(plane_.GetNormal()); - if (timeOfIntersection < TimeType::zero()) { return corsika::EProcessReturn::eOk; } + if (timeOfIntersection < TimeType::zero()) { return corsika::ProcessReturn::Ok; } if (plane_.IsAbove(trajectory.GetR0()) == plane_.IsAbove(trajectory.GetPosition(1))) { - return corsika::EProcessReturn::eOk; + return corsika::ProcessReturn::Ok; } outputStream_ << static_cast<int>(corsika::get_PDG(particle.GetPID())) << ' ' @@ -41,9 +41,9 @@ namespace corsika::observation_plane { << std::endl; if (deleteOnHit_) { - return corsika::EProcessReturn::eParticleAbsorbed; + return corsika::ProcessReturn::ParticleAbsorbed; } else { - return corsika::EProcessReturn::eOk; + return corsika::ProcessReturn::Ok; } } diff --git a/corsika/detail/modules/ParticleCut.inl b/corsika/detail/modules/ParticleCut.inl index 53a3f2b76..f079c1a0b 100644 --- a/corsika/detail/modules/ParticleCut.inl +++ b/corsika/detail/modules/ParticleCut.inl @@ -52,7 +52,7 @@ namespace corsika::particle_cut { } } - EProcessReturn ParticleCut::DoSecondaries(corsika::setup::StackView& vS) { + void ParticleCut::doSecondaries(corsika::setup::StackView& vS) { auto p = vS.begin(); while (p != vS.end()) { @@ -83,7 +83,6 @@ namespace corsika::particle_cut { ++p; // next entry in SecondaryView } } - return EProcessReturn::eOk; } void ParticleCut::Init() { diff --git a/corsika/detail/modules/StackInspector.inl b/corsika/detail/modules/StackInspector.inl index 0767cf15a..bd9487bc0 100644 --- a/corsika/detail/modules/StackInspector.inl +++ b/corsika/detail/modules/StackInspector.inl @@ -37,7 +37,7 @@ namespace corsika::stack_inspector { StackInspector<TStack>::~StackInspector() {} template <typename TStack> - corsika::EProcessReturn StackInspector<TStack>::DoStack(const TStack& vS) { + void StackInspector<TStack>::doStack(const TStack& vS) { [[maybe_unused]] int i = 0; HEPEnergyType Etot = 0_GeV; @@ -64,7 +64,7 @@ namespace corsika::stack_inspector { const std::chrono::duration<double> elapsed_seconds = now - StartTime_; std::time_t const now_time = std::chrono::system_clock::to_time_t(now); auto const dE = E0_ - Etot; - if (dE < dE_threshold_) return corsika::EProcessReturn::eOk; + if (dE < dE_threshold_) return; double const progress = dE / E0_; double const eta_seconds = elapsed_seconds.count() / progress; @@ -75,11 +75,9 @@ namespace corsika::stack_inspector { << " time=" << std::put_time(std::localtime(&now_time), "%T") << ", running=" << elapsed_seconds.count() << " seconds" << " (" << std::setw(3) << int(progress * 100) << "%)" - << ", nStep=" << GetStep() << ", stackSize=" << vS.GetSize() + << ", nStep=" << getStep() << ", stackSize=" << vS.GetSize() << ", Estack=" << Etot / 1_GeV << " GeV" << ", ETA=" << std::put_time(std::localtime(&eta_time), "%T") << std::endl; - - return corsika::EProcessReturn::eOk; } template <typename TStack> diff --git a/corsika/detail/modules/TrackWriter.inl b/corsika/detail/modules/TrackWriter.inl index bb6cb9689..1e28bf213 100644 --- a/corsika/detail/modules/TrackWriter.inl +++ b/corsika/detail/modules/TrackWriter.inl @@ -31,8 +31,8 @@ namespace corsika::track_writer { } template <typename TParticle, typename TTrack> - corsika::EProcessReturn TrackWriter::DoContinuous(const TParticle& vP, - const TTrack& vT) { + corsika::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>(corsika::get_PDG(vP.GetPID())); @@ -48,7 +48,7 @@ namespace corsika::track_writer { << std::setw(width) << std::scientific << std::setprecision(precision) << delta[2] / 1_m << '\n'; // clang-format on - return corsika::EProcessReturn::eOk; + return corsika::ProcessReturn::Ok; } template <typename TParticle, typename TTrack> diff --git a/corsika/detail/modules/energy_loss/BetheBlochPDG.inl b/corsika/detail/modules/energy_loss/BetheBlochPDG.inl index da0827cc9..76d64479a 100644 --- a/corsika/detail/modules/energy_loss/BetheBlochPDG.inl +++ b/corsika/detail/modules/energy_loss/BetheBlochPDG.inl @@ -156,9 +156,9 @@ namespace corsika::energy_loss { return BetheBloch(vP, vDX) + RadiationLosses(vP, vDX); } - corsika::EProcessReturn BetheBlochPDG::DoContinuous(SetupParticle& p, + corsika::ProcessReturn BetheBlochPDG::doContinuous(SetupParticle& p, SetupTrack const& t) { - if (p.GetChargeNumber() == 0) return corsika::EProcessReturn::eOk; + if (p.GetChargeNumber() == 0) return corsika::ProcessReturn::Ok; GrammageType const dX = p.GetNode()->GetModelProperties().getIntegratedGrammage(t, t.GetLength()); @@ -171,11 +171,11 @@ namespace corsika::energy_loss { std::cout << "BetheBlochPDG dE=" << dE / 1_MeV << "MeV, " << " E=" << E / 1_GeV << "GeV, Ekin=" << Ekin / 1_GeV << ", Enew=" << Enew / 1_GeV << "GeV" << std::endl; - auto status = corsika::EProcessReturn::eOk; + auto status = corsika::ProcessReturn::Ok; if (-dE > Ekin) { dE = -Ekin; Enew = p.GetMass(); - status = corsika::EProcessReturn::eParticleAbsorbed; + status = corsika::ProcessReturn::ParticleAbsorbed; } p.SetEnergy(Enew); MomentumUpdate(p, Enew); diff --git a/corsika/detail/modules/pythia8/Interaction.inl b/corsika/detail/modules/pythia8/Interaction.inl index c0f3ab72f..90a134eb3 100644 --- a/corsika/detail/modules/pythia8/Interaction.inl +++ b/corsika/detail/modules/pythia8/Interaction.inl @@ -229,7 +229,7 @@ namespace corsika::pythia8 { */ template <> - corsika::EProcessReturn Interaction::DoInteraction(Projectile& vP) { + void Interaction::doInteraction(Projectile& vP) { const auto corsikaBeamId = vP.GetPID(); std::cout << "Pythia::Interaction: " @@ -378,7 +378,6 @@ namespace corsika::pythia8 { << ", Plab_final=" << (Plab_final / 1_GeV).GetComponents() << std::endl; } } - return EProcessReturn::eOk; } } // namespace corsika::pythia8 diff --git a/corsika/detail/modules/qgsjetII/Interaction.inl b/corsika/detail/modules/qgsjetII/Interaction.inl index 029d43a38..35bb3f882 100644 --- a/corsika/detail/modules/qgsjetII/Interaction.inl +++ b/corsika/detail/modules/qgsjetII/Interaction.inl @@ -161,7 +161,7 @@ namespace corsika::qgsjetII { */ template <typename TParticle> - corsika::EProcessReturn Interaction::DoInteraction(TParticle& vP) { + void Interaction::doInteraction(TParticle& vP) { const auto corsikaBeamId = vP.GetPID(); std::cout << "ProcessQgsjetII: " @@ -373,7 +373,6 @@ namespace corsika::qgsjetII { << QGSJetIIFragmentsStackData::GetWoundedNucleonsProjectile() << ", N_fragm,proj=" << qfs.GetSize() << std::endl; } - return corsika::EProcessReturn::eOk; } } // namespace corsika::qgsjetII diff --git a/corsika/detail/modules/sibyll/Interaction.inl b/corsika/detail/modules/sibyll/Interaction.inl index ec2e39f0e..4435675d7 100644 --- a/corsika/detail/modules/sibyll/Interaction.inl +++ b/corsika/detail/modules/sibyll/Interaction.inl @@ -176,7 +176,7 @@ namespace corsika::sibyll { */ template <typename TProjectile> - corsika::EProcessReturn Interaction::DoInteraction(TProjectile& vP) { + void Interaction::doInteraction(TProjectile& vP) { const auto corsikaBeamId = vP.GetPID(); std::cout << "ProcessSibyll: " @@ -354,7 +354,6 @@ namespace corsika::sibyll { << ", Plab_final=" << (Plab_final / 1_GeV).GetComponents() << std::endl; } } - return corsika::EProcessReturn::eOk; } } // namespace corsika::sibyll diff --git a/corsika/detail/modules/sibyll/NuclearInteraction.inl b/corsika/detail/modules/sibyll/NuclearInteraction.inl index 69125e4f7..0043ceb56 100644 --- a/corsika/detail/modules/sibyll/NuclearInteraction.inl +++ b/corsika/detail/modules/sibyll/NuclearInteraction.inl @@ -307,8 +307,8 @@ namespace corsika::sibyll { template <> template <typename TProjectile> - corsika::EProcessReturn - NuclearInteraction<corsika::setup::SetupEnvironment>::DoInteraction(TProjectile& vP) { + void + NuclearInteraction<corsika::setup::SetupEnvironment>::doInteraction(TProjectile& vP) { using namespace si; @@ -585,12 +585,10 @@ namespace corsika::sibyll { PprojNucLab.GetSpaceLikeComponents(), pOrig, tOrig}); // create inelastic interaction std::cout << "calling HadronicInteraction..." << std::endl; - hadronicInteraction_.DoInteraction(inelasticNucleon); + hadronicInteraction_.doInteraction(inelasticNucleon); } std::cout << "NuclearInteraction: DoInteraction: done" << std::endl; - - return corsika::EProcessReturn::eOk; } } // namespace corsika::sibyll diff --git a/corsika/detail/modules/urqmd/UrQMD.inl b/corsika/detail/modules/urqmd/UrQMD.inl index 30b495096..56e78d7dd 100644 --- a/corsika/detail/modules/urqmd/UrQMD.inl +++ b/corsika/detail/modules/urqmd/UrQMD.inl @@ -123,7 +123,7 @@ namespace corsika::urqmd { weightedProdCrossSection; } - corsika::EProcessReturn UrQMD::DoInteraction(SetupProjectile& vProjectile) { + void UrQMD::doInteraction(SetupProjectile& vProjectile) { auto projectileCode = vProjectile.GetPID(); auto const projectileEnergyLab = vProjectile.GetEnergy(); @@ -239,8 +239,6 @@ namespace corsika::urqmd { std::cout << "UrQMD generated " << ::urqmd::sys_.npart << " secondaries!" << std::endl; - - return corsika::EProcessReturn::eOk; } corsika::Code ConvertFromUrQMD(int vItyp, int vIso3) { diff --git a/corsika/framework/process/BaseProcess.hpp b/corsika/framework/process/BaseProcess.hpp index 3ff00d029..711af6588 100644 --- a/corsika/framework/process/BaseProcess.hpp +++ b/corsika/framework/process/BaseProcess.hpp @@ -20,7 +20,7 @@ namespace corsika { are of type BaseProcess<T> \todo rename BaseProcess into just Process - \todo rename _BaseProcess, or find better alternative in + \todo rename _BaseProcess, or find better alternative in FIXME ./Processes/AnalyticProcessors/ExecTime.h, see e.g. how this is done in ProcessSequence.hpp/make_sequence */ diff --git a/corsika/framework/process/DecayProcess.hpp b/corsika/framework/process/DecayProcess.hpp index 358147f36..e614577bd 100644 --- a/corsika/framework/process/DecayProcess.hpp +++ b/corsika/framework/process/DecayProcess.hpp @@ -30,7 +30,7 @@ namespace corsika { /// here starts the interface-definition part // -> enforce TDerived to implement DoDecay... template <typename TParticle> - ProcessReturn doDecay(TParticle&); + void doDecay(TParticle&); template <typename TParticle> TimeType getLifetime(TParticle const&); diff --git a/corsika/framework/process/InteractionProcess.hpp b/corsika/framework/process/InteractionProcess.hpp index a2f121b7d..ecfa7ee55 100644 --- a/corsika/framework/process/InteractionProcess.hpp +++ b/corsika/framework/process/InteractionProcess.hpp @@ -30,7 +30,7 @@ namespace corsika { /// here starts the interface-definition part // -> enforce TDerived to implement DoInteraction... template <typename TParticle> - ProcessReturn doInteraction(TParticle&); + void doInteraction(TParticle&); template <typename TParticle> GrammageType getInteractionLength(TParticle const&); diff --git a/corsika/framework/process/ProcessSequence.hpp b/corsika/framework/process/ProcessSequence.hpp index 99ca05053..e4140b019 100644 --- a/corsika/framework/process/ProcessSequence.hpp +++ b/corsika/framework/process/ProcessSequence.hpp @@ -36,6 +36,9 @@ namespace corsika { well as lvalue Processes in the ProcessSequence. The sequence, and the processes use CRTP. + + \todo There are several FIXME's in the ProcessSequence.inl due to + outstanding migration of SecondaryView::parent() */ template <typename TProcess1, typename TProcess2 = NullModel> diff --git a/corsika/modules/ObservationPlane.hpp b/corsika/modules/ObservationPlane.hpp index a6b817ee5..d05e2b276 100644 --- a/corsika/modules/ObservationPlane.hpp +++ b/corsika/modules/ObservationPlane.hpp @@ -29,7 +29,7 @@ namespace corsika::observation_plane { ObservationPlane(corsika::Plane const&, std::string const&, bool = true); void Init() {} - corsika::EProcessReturn DoContinuous( + corsika::ProcessReturn doContinuous( corsika::setup::Stack::ParticleType const& vParticle, corsika::setup::Trajectory const& vTrajectory); diff --git a/corsika/modules/ParticleCut.hpp b/corsika/modules/ParticleCut.hpp index 0858abc4b..a00bb9714 100644 --- a/corsika/modules/ParticleCut.hpp +++ b/corsika/modules/ParticleCut.hpp @@ -30,7 +30,7 @@ namespace corsika::particle_cut { : fECut(vCut) {} bool ParticleIsInvisible(corsika::Code) const; - EProcessReturn DoSecondaries(corsika::setup::StackView&); + void doSecondaries(corsika::setup::StackView&); template <typename TParticle> bool ParticleIsBelowEnergyCut(TParticle const&) const; diff --git a/corsika/modules/StackInspector.hpp b/corsika/modules/StackInspector.hpp index 22f65e7fc..b20078047 100644 --- a/corsika/modules/StackInspector.hpp +++ b/corsika/modules/StackInspector.hpp @@ -20,14 +20,14 @@ namespace corsika::stack_inspector { typedef typename TStack::ParticleType Particle; - using corsika::StackProcess<StackInspector<TStack>>::GetStep; + using corsika::StackProcess<StackInspector<TStack>>::getStep; public: StackInspector(const int vNStep, const bool vReportStack, const HEPEnergyType vE0); ~StackInspector(); void Init(); - EProcessReturn DoStack(const TStack&); + void doStack(const TStack&); /** * To set a new E0, for example when a new shower event is started diff --git a/corsika/modules/SwitchProcess.hpp b/corsika/modules/SwitchProcess.hpp index d6d0ec52f..b71c568b7 100644 --- a/corsika/modules/SwitchProcess.hpp +++ b/corsika/modules/SwitchProcess.hpp @@ -49,15 +49,15 @@ namespace corsika::switch_process { GrammageType GetInteractionLength(TParticle& vParticle) { if (vParticle.GetEnergy() < fThresholdEnergy) { if constexpr (is_process_sequence_v<TLowEProcess>) { - return fLowEProcess.GetTotalInteractionLength(vParticle); + return fLowEProcess.getInteractionLength(vParticle); } else { - return fLowEProcess.GetInteractionLength(vParticle); + return fLowEProcess.getInteractionLength(vParticle); } } else { if constexpr (is_process_sequence_v<THighEProcess>) { - return fHighEProcess.GetTotalInteractionLength(vParticle); + return fHighEProcess.getInteractionLength(vParticle); } else { - return fHighEProcess.GetInteractionLength(vParticle); + return fHighEProcess.getInteractionLength(vParticle); } } } @@ -66,33 +66,33 @@ namespace corsika::switch_process { // implement DoInteraction() because we want to call SelectInteraction // in case a member process is a ProcessSequence. template <typename TParticle, typename TSecondaries> - EProcessReturn SelectInteraction(TParticle& vP, TSecondaries& vS, + ProcessReturn SelectInteraction(TParticle& vP, TSecondaries& vS, [[maybe_unused]] InverseGrammageType lambda_select, InverseGrammageType& lambda_inv_count) { if (vP.GetEnergy() < fThresholdEnergy) { if constexpr (is_process_sequence_v<TLowEProcess>) { return fLowEProcess.SelectInteraction(vP, vS, lambda_select, lambda_inv_count); } else { - lambda_inv_count += fLowEProcess.GetInverseInteractionLength(vP); + lambda_inv_count += fLowEProcess.getInverseInteractionLength(vP); // check if we should execute THIS process and then EXIT if (lambda_select < lambda_inv_count) { - fLowEProcess.DoInteraction(vS); - return EProcessReturn::eInteracted; + fLowEProcess.doInteraction(vS); + return ProcessReturn::Interacted; } else { - return EProcessReturn::eOk; + return ProcessReturn::Ok; } } } else { if constexpr (is_process_sequence_v<THighEProcess>) { return fHighEProcess.SelectInteraction(vP, vS, lambda_select, lambda_inv_count); } else { - lambda_inv_count += fHighEProcess.GetInverseInteractionLength(vP); + lambda_inv_count += fHighEProcess.getInverseInteractionLength(vP); // check if we should execute THIS process and then EXIT if (lambda_select < lambda_inv_count) { - fHighEProcess.DoInteraction(vS); - return EProcessReturn::eInteracted; + fHighEProcess.doInteraction(vS); + return ProcessReturn::Interacted; } else { - return EProcessReturn::eOk; + return ProcessReturn::Ok; } } } diff --git a/corsika/modules/TrackWriter.hpp b/corsika/modules/TrackWriter.hpp index 3f1341d8a..7cbabf027 100644 --- a/corsika/modules/TrackWriter.hpp +++ b/corsika/modules/TrackWriter.hpp @@ -25,7 +25,7 @@ namespace corsika::track_writer { void Init(); template <typename Particle, typename Track> - corsika::EProcessReturn DoContinuous(const Particle&, const Track&); + ProcessReturn doContinuous(const Particle&, const Track&); template <typename Particle, typename Track> LengthType MaxStepLength(const Particle&, const Track&); diff --git a/corsika/modules/energy_loss/BetheBlochPDG.hpp b/corsika/modules/energy_loss/BetheBlochPDG.hpp index 85fe0bcee..e3c2d78dc 100644 --- a/corsika/modules/energy_loss/BetheBlochPDG.hpp +++ b/corsika/modules/energy_loss/BetheBlochPDG.hpp @@ -28,8 +28,7 @@ namespace corsika::energy_loss { public: template <typename TDim> - BetheBlochPDG(corsika::Point const& injectionPoint, - corsika::Vector<TDim> const& direction) + BetheBlochPDG(Point const& injectionPoint, Vector<TDim> const& direction) : InjectionPoint_(injectionPoint) , ShowerAxisDirection_(direction.normalized()) {} @@ -37,8 +36,7 @@ namespace corsika::energy_loss { : BetheBlochPDG(trajectory.GetPosition(0), trajectory.GetV0()){}; void Init() {} - corsika::EProcessReturn DoContinuous(setup::Stack::ParticleType&, - setup::Trajectory const&); + ProcessReturn doContinuous(setup::Stack::ParticleType&, setup::Trajectory const&); LengthType MaxStepLength(setup::Stack::ParticleType const&, setup::Trajectory const&) const; HEPEnergyType GetTotal() const { return BetheBlochPDGTot_; } diff --git a/corsika/modules/pythia8/Interaction.hpp b/corsika/modules/pythia8/Interaction.hpp index abaf5fdf7..263717cba 100644 --- a/corsika/modules/pythia8/Interaction.hpp +++ b/corsika/modules/pythia8/Interaction.hpp @@ -52,7 +52,7 @@ namespace corsika::pythia8 { */ template <typename TProjectile> - corsika::EProcessReturn DoInteraction(TProjectile&); + void doInteraction(TProjectile&); private: corsika::default_prng_type& fRNG = corsika::RNGManager::getInstance().getRandomStream("pythia"); diff --git a/corsika/modules/qgsjetII/Interaction.hpp b/corsika/modules/qgsjetII/Interaction.hpp index f55bae8b2..d9fc32238 100644 --- a/corsika/modules/qgsjetII/Interaction.hpp +++ b/corsika/modules/qgsjetII/Interaction.hpp @@ -52,7 +52,7 @@ namespace corsika::qgsjetII { */ template <typename TProjectile> - corsika::EProcessReturn DoInteraction(TProjectile&); + void doInteraction(TProjectile&); private: corsika::default_prng_type& fRNG = corsika::RNGManager::getInstance().getRandomStream("qgsjet"); diff --git a/corsika/modules/qgsjetII/QGSJetIIStack.hpp b/corsika/modules/qgsjetII/QGSJetIIStack.hpp index 6103447fa..d47d4a541 100644 --- a/corsika/modules/qgsjetII/QGSJetIIStack.hpp +++ b/corsika/modules/qgsjetII/QGSJetIIStack.hpp @@ -81,7 +81,7 @@ namespace corsika::qgsjetII { public: void SetParticleData(const int vID, const HEPEnergyType vE, const MomentumVector& vP, - const HEPMassType vM) { + const HEPMassType) { SetPID(vID); SetEnergy(vE); SetMomentum(vP); @@ -89,7 +89,7 @@ namespace corsika::qgsjetII { void SetParticleData(ParticleInterface<StackIteratorInterface>& /*parent*/, const int vID, const HEPEnergyType vE, const MomentumVector& vP, - const HEPMassType vM) { + const HEPMassType) { SetPID(vID); SetEnergy(vE); SetMomentum(vP); diff --git a/corsika/modules/sibyll/Interaction.hpp b/corsika/modules/sibyll/Interaction.hpp index 8ce7686a7..8abf35794 100644 --- a/corsika/modules/sibyll/Interaction.hpp +++ b/corsika/modules/sibyll/Interaction.hpp @@ -61,7 +61,7 @@ namespace corsika::sibyll { */ template <typename TProjectile> - corsika::EProcessReturn DoInteraction(TProjectile&); + void doInteraction(TProjectile&); private: corsika::default_prng_type& RNG_ = corsika::RNGManager::getInstance().getRandomStream("sibyll"); diff --git a/corsika/modules/sibyll/NuclearInteraction.hpp b/corsika/modules/sibyll/NuclearInteraction.hpp index e30a4ed01..3386c7935 100644 --- a/corsika/modules/sibyll/NuclearInteraction.hpp +++ b/corsika/modules/sibyll/NuclearInteraction.hpp @@ -50,7 +50,7 @@ namespace corsika::sibyll { GrammageType GetInteractionLength(Particle const&); template <typename TSecondaryView> - corsika::EProcessReturn DoInteraction(TSecondaryView&); + void doInteraction(TSecondaryView&); private: TEnvironment const& environment_; diff --git a/corsika/modules/urqmd/UrQMD.hpp b/corsika/modules/urqmd/UrQMD.hpp index 9005ceb2b..10c5b6b45 100644 --- a/corsika/modules/urqmd/UrQMD.hpp +++ b/corsika/modules/urqmd/UrQMD.hpp @@ -31,7 +31,7 @@ namespace corsika::urqmd { template <typename TParticle> CrossSectionType GetCrossSection(TParticle const&, corsika::Code) const; - corsika::EProcessReturn DoInteraction(corsika::setup::StackView::StackIterator&); + void doInteraction(corsika::setup::StackView::StackIterator&); bool CanInteract(corsika::Code) const; diff --git a/examples/cascade_example.cpp b/examples/cascade_example.cpp index 58e9ee720..e0c04357e 100644 --- a/examples/cascade_example.cpp +++ b/examples/cascade_example.cpp @@ -128,8 +128,8 @@ int main() { injectionPos, corsika::Vector<dimensionless_d>(rootCS, {0, 0, -1})); // assemble all processes into an ordered process list - auto sequence = stackInspect << sibyll << sibyllNuc << decay << eLoss << cut - << trackWriter; + auto sequence = corsika::make_sequence(stackInspect, sibyll, sibyllNuc, decay, eLoss, cut, + trackWriter); // define air shower object, run simulation corsika::Cascade EAS(env, tracking, sequence, stack); diff --git a/tests/framework/testProcessSequence.cpp b/tests/framework/testProcessSequence.cpp index f6a70a1ec..49678576a 100644 --- a/tests/framework/testProcessSequence.cpp +++ b/tests/framework/testProcessSequence.cpp @@ -30,8 +30,6 @@ int checkSec = 0; // use this as a bit field int checkCont = 0; // use this as a bit field class ContinuousProcess1 : public ContinuousProcess<ContinuousProcess1> { - [[maybe_unused]] int v_ = 0; - public: ContinuousProcess1(const int v) : v_(v) { @@ -47,11 +45,11 @@ public: for (int i = 0; i < nData; ++i) d.data_[i] += 0.933; return ProcessReturn::Ok; } +private: + [[maybe_unused]] int v_ = 0; }; class ContinuousProcess2 : public ContinuousProcess<ContinuousProcess2> { - [[maybe_unused]] int v_ = 0; - public: ContinuousProcess2(const int v) : v_(v) { @@ -66,11 +64,11 @@ public: for (int i = 0; i < nData; ++i) d.data_[i] += 0.111; return ProcessReturn::Ok; } +private: + [[maybe_unused]] int v_ = 0; }; class ContinuousProcess3 : public ContinuousProcess<ContinuousProcess3> { - int v_ = 0; - public: ContinuousProcess3(const int v) : v_(v) { @@ -85,6 +83,8 @@ public: for (int i = 0; i < nData; ++i) d.data_[i] += 0.333; return ProcessReturn::Ok; } +private: + [[maybe_unused]] int v_ = 0; }; class Process1 : public InteractionProcess<Process1> { @@ -96,24 +96,20 @@ public: } template <typename TView> - inline ProcessReturn doInteraction(TView& v) const { + inline void doInteraction(TView& v) const { checkInteract |= 1; for (int i = 0; i < nData; ++i) v.parent().data_[i] += 1 + i; - return ProcessReturn::Ok; } template <typename TParticle> GrammageType getInteractionLength(TParticle&) const { return 10_g / square(1_cm); } - private: [[maybe_unused]] int v_; }; class Process2 : public InteractionProcess<Process2> { - [[maybe_unused]] int v_ = 0; - public: Process2(const int v) : v_(v) { @@ -122,22 +118,21 @@ public: } template <typename TView> - inline ProcessReturn 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; - return ProcessReturn::Ok; } template <typename Particle> GrammageType getInteractionLength(Particle&) const { cout << "Process2::GetInteractionLength" << endl; return 20_g / (1_cm * 1_cm); } +private: + [[maybe_unused]] int v_ = 0; }; class Process3 : public InteractionProcess<Process3> { - [[maybe_unused]] int v_ = 0; - public: Process3(const int v) : v_(v) { @@ -146,22 +141,21 @@ public: } template <typename TView> - inline ProcessReturn doInteraction(TView& v) const { + inline void doInteraction(TView& v) const { checkInteract |= 4; for (int i = 0; i < nData; ++i) v.parent().data_[i] *= 1.01; cout << "Process3::DoInteraction" << endl; - return ProcessReturn::Ok; } template <typename Particle> GrammageType getInteractionLength(Particle&) const { cout << "Process3::GetInteractionLength" << endl; return 30_g / (1_cm * 1_cm); } +private: + [[maybe_unused]] int v_ = 0; }; class Process4 : public BaseProcess<Process4> { - [[maybe_unused]] int v_ = 0; - public: Process4(const int v) : v_(v) { @@ -177,13 +171,15 @@ public: return ProcessReturn::Ok; } template <typename TView> - ProcessReturn doInteraction(TView&) const { + void doInteraction(TView&) const { checkInteract |= 8; - return ProcessReturn::Ok; } +private: + [[maybe_unused]] int v_ = 0; }; class Decay1 : public DecayProcess<Decay1> { +public: Decay1(const int) { cout << "Decay1()" << endl; globalCount++; @@ -194,14 +190,12 @@ class Decay1 : public DecayProcess<Decay1> { return 1_s; } template <typename TView> - ProcessReturn doDecay(TView&) const { + void doDecay(TView&) const { checkDecay |= 1; - return ProcessReturn::Ok; } }; class Decay2 : public DecayProcess<Decay2> { - public: Decay2(const int) { cout << "Decay2()" << endl; @@ -213,15 +207,12 @@ public: return 2_s; } template <typename TView> - ProcessReturn doDecay(TView&) const { + void doDecay(TView&) const { checkDecay |= 2; - return ProcessReturn::Ok; } }; class Stack1 : public StackProcess<Stack1> { - int count_ = 0; - public: Stack1(const int n) : StackProcess(n) {} @@ -231,6 +222,8 @@ public: return ProcessReturn::Ok; } int getCount() const { return count_; } +private: + int count_ = 0; }; struct DummyStack {}; diff --git a/tests/modules/CMakeLists.txt b/tests/modules/CMakeLists.txt index 15aa04f4b..0e79964a9 100644 --- a/tests/modules/CMakeLists.txt +++ b/tests/modules/CMakeLists.txt @@ -7,7 +7,7 @@ set (test_modules_sources testPythia8.cpp testQGSJetII.cpp testStackInspector.cpp - testSwitchProcess.cpp +# FIXME, remove entirly during migration: testSwitchProcess.cpp testTrackingLine.cpp testUrQMD.cpp ) diff --git a/tests/modules/testNullModel.cpp b/tests/modules/testNullModel.cpp index 8bf395c08..cfbeeee26 100644 --- a/tests/modules/testNullModel.cpp +++ b/tests/modules/testNullModel.cpp @@ -8,47 +8,13 @@ #include <catch2/catch.hpp> -#include <corsika/modules/NullModel.hpp> +#include <corsika/framework/process/NullModel.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.hpp> -#include <corsika/setup/SetupTrajectory.hpp> - -using namespace corsika::units::si; -using namespace corsika::null_model; using namespace corsika; TEST_CASE("NullModel", "[processes]") { - auto const& dummyCS = - corsika::RootCoordinateSystem::getInstance().GetRootCoordinateSystem(); - corsika::Point const origin(dummyCS, {0_m, 0_m, 0_m}); - corsika::Vector<SpeedType::dimension_type> v(dummyCS, 0_m / second, 0_m / second, - 1_m / second); - corsika::Line line(origin, v); - corsika::Trajectory<corsika::Line> track(line, 10_s); - - setup::Stack stack; - setup::Stack::ParticleType particle = stack.AddParticle( - std::tuple<Code, units::si::HEPEnergyType, corsika::MomentumVector, corsika::Point, - units::si::TimeType>{ - Code::Electron, 100_GeV, - corsika::MomentumVector(dummyCS, {0_GeV, 0_GeV, -1_GeV}), - corsika::Point(dummyCS, {0_m, 0_m, 10_km}), 0_ns}); - SECTION("interface") { - - NullModel model(10_m); - - model.Init(); - [[maybe_unused]] const EProcessReturn ret = model.DoContinuous(particle, track); - LengthType const length = model.MaxStepLength(particle, track); - - CHECK((length / 10_m) == Approx(1)); + [[maybe_unused]] NullModel model; // nothing to test... } } diff --git a/tests/modules/testObservationPlane.cpp b/tests/modules/testObservationPlane.cpp index 890bd5441..c6f9adb5f 100644 --- a/tests/modules/testObservationPlane.cpp +++ b/tests/modules/testObservationPlane.cpp @@ -60,10 +60,10 @@ TEST_CASE("ContinuousProcess interface", "[proccesses][observation_plane]") { obs.Init(); const LengthType length = obs.MaxStepLength(particle, track); - const EProcessReturn ret = obs.DoContinuous(particle, track); + const ProcessReturn ret = obs.doContinuous(particle, track); REQUIRE(length / 10_m == Approx(1).margin(1e-4)); - REQUIRE(ret == EProcessReturn::eParticleAbsorbed); + REQUIRE(ret == ProcessReturn::ParticleAbsorbed); /* SECTION("horizontal plane") { @@ -82,9 +82,9 @@ TEST_CASE("ContinuousProcess interface", "[proccesses][observation_plane]") { obs.Init(); const LengthType length = obs.MaxStepLength(particle, track); - const EProcessReturn ret = obs.DoContinuous(particle, track); + const ProcessReturn ret = obs.doContinuous(particle, track); REQUIRE(length / 10_m == Approx(1).margin(1e-4)); - REQUIRE(ret == EProcessReturn::eOk); + REQUIRE(ret == ProcessReturn::Ok); } } diff --git a/tests/modules/testParticleCut.cpp b/tests/modules/testParticleCut.cpp index ea00b5e5d..8cbab762d 100644 --- a/tests/modules/testParticleCut.cpp +++ b/tests/modules/testParticleCut.cpp @@ -67,7 +67,7 @@ TEST_CASE("ParticleCut", "[processes]") { proType, Eabove, corsika::MomentumVector(rootCS, {0_GeV, 0_GeV, 0_GeV}), corsika::Point(rootCS, 0_m, 0_m, 0_m), 0_ns}); - cut.DoSecondaries(view); + cut.doSecondaries(view); REQUIRE(view.GetSize() == 8); } @@ -90,13 +90,11 @@ TEST_CASE("ParticleCut", "[processes]") { // add secondaries, all with energies below the threshold // only cut is by species for (auto proType : particleList) - projectile.AddSecondary( - std::tuple<corsika::Code, units::si::HEPEnergyType, corsika::MomentumVector, - corsika::Point, units::si::TimeType>{ - proType, Ebelow, corsika::MomentumVector(rootCS, {0_GeV, 0_GeV, 0_GeV}), - corsika::Point(rootCS, 0_m, 0_m, 0_m), 0_ns}); + projectile.AddSecondary(std::make_tuple( + proType, Ebelow, corsika::MomentumVector(rootCS, {0_GeV, 0_GeV, 0_GeV}), + corsika::Point(rootCS, 0_m, 0_m, 0_m), 0_ns)); - cut.DoSecondaries(view); + cut.doSecondaries(view); REQUIRE(view.GetSize() == 0); } diff --git a/tests/modules/testPythia8.cpp b/tests/modules/testPythia8.cpp index 59eb2d1d6..765d0b109 100644 --- a/tests/modules/testPythia8.cpp +++ b/tests/modules/testPythia8.cpp @@ -152,7 +152,7 @@ TEST_CASE("pythia process") { corsika::pythia8::Interaction model; model.Init(); - [[maybe_unused]] const corsika::EProcessReturn ret = model.DoInteraction(projectile); + model.doInteraction(projectile); [[maybe_unused]] const GrammageType length = model.GetInteractionLength(particle); } } diff --git a/tests/modules/testQGSJetII.cpp b/tests/modules/testQGSJetII.cpp index d138930d8..baf4c2fa2 100644 --- a/tests/modules/testQGSJetII.cpp +++ b/tests/modules/testQGSJetII.cpp @@ -109,7 +109,7 @@ TEST_CASE("QgsjetIIInterface", "[processes]") { Interaction model; model.Init(); - [[maybe_unused]] const corsika::EProcessReturn ret = model.DoInteraction(projectile); + model.doInteraction(projectile); [[maybe_unused]] const GrammageType length = model.GetInteractionLength(particle); } } diff --git a/tests/modules/testSibyll.cpp b/tests/modules/testSibyll.cpp index 4c49aabf9..518752b57 100644 --- a/tests/modules/testSibyll.cpp +++ b/tests/modules/testSibyll.cpp @@ -114,8 +114,7 @@ TEST_CASE("SibyllInterface", "[processes]") { Interaction model; - model.Init(); - [[maybe_unused]] const corsika::EProcessReturn ret = model.DoInteraction(projectile); + model.doInteraction(projectile); [[maybe_unused]] const GrammageType length = model.GetInteractionLength(particle); } @@ -139,7 +138,7 @@ TEST_CASE("SibyllInterface", "[processes]") { NuclearInteraction model(hmodel, env); model.Init(); - [[maybe_unused]] const corsika::EProcessReturn ret = model.DoInteraction(projectile); + model.doInteraction(projectile); [[maybe_unused]] const GrammageType length = model.GetInteractionLength(particle); } diff --git a/tests/modules/testStackInspector.cpp b/tests/modules/testStackInspector.cpp index 45f71ccc5..705379342 100644 --- a/tests/modules/testStackInspector.cpp +++ b/tests/modules/testStackInspector.cpp @@ -44,6 +44,6 @@ TEST_CASE("StackInspector", "[processes]") { StackInspector<TestCascadeStack> model(1, true, E0); model.Init(); - [[maybe_unused]] const corsika::EProcessReturn ret = model.DoStack(stack); + model.doStack(stack); } } diff --git a/tests/modules/testSwitchProcess.cpp b/tests/modules/testSwitchProcess.cpp index 73bf7041d..eca0fd0ba 100644 --- a/tests/modules/testSwitchProcess.cpp +++ b/tests/modules/testSwitchProcess.cpp @@ -103,15 +103,13 @@ struct DummyProcess : InteractionProcess<DummyProcess<N>> { } template <typename TSecondaries> - corsika::EProcessReturn DoInteraction(TSecondaries& vSec) { + void doInteraction(TSecondaries&) { // to figure out which process was selected in the end, we produce N // secondaries for DummyProcess<N> for (int i = 0; i < N; ++i) { - vSec.AddSecondary(std::tuple<HEPEnergyType>{vSec.GetEnergy() / N}); + // vSec.AddSecondary(std::make_tuple(vSec.GetEnergy() / N)); // <-- FIXME, when SwitchProcess is removedalter } - - return EProcessReturn::eOk; } }; @@ -125,7 +123,7 @@ TEST_CASE("SwitchProcess from InteractionProcess") { DummyAdditionalProcess proc; switch_process::SwitchProcess switchProcess(low, high, 1_TeV); - auto seq = switchProcess << proc; + auto seq = corsika::make_sequence(switchProcess, proc); SimpleStack stack; @@ -136,7 +134,7 @@ TEST_CASE("SwitchProcess from InteractionProcess") { // low energy process returns 1 kg/m² SECTION("interaction length") { REQUIRE(switchProcess.GetInteractionLength(p) / kgMSq == Approx(1)); - REQUIRE(seq.GetTotalInteractionLength(p) / kgMSq == Approx(3. / 4)); + REQUIRE(seq.getInteractionLength(p) / kgMSq == Approx(3. / 4)); } // low energy process creates 1 secondary @@ -160,7 +158,7 @@ TEST_CASE("SwitchProcess from InteractionProcess") { // high energy process returns 2 kg/m² SECTION("interaction length") { REQUIRE(switchProcess.GetInteractionLength(p) / kgMSq == Approx(2)); - REQUIRE(seq.GetTotalInteractionLength(p) / kgMSq == Approx(6. / 5)); + REQUIRE(seq.getInteractionLength(p) / kgMSq == Approx(6. / 5)); } // high energy process creates 2 secondaries @@ -184,10 +182,10 @@ TEST_CASE("SwitchProcess from ProcessSequence") { DummyProcess<3> outer; DummyProcess<4> additional; - auto seq = innerA << innerB; + auto seq = corsika::make_sequence(innerA, innerB); switch_process::SwitchProcess switchProcess(seq, outer, 1_TeV); - auto completeSeq = switchProcess << additional; + auto completeSeq = corsika::make_sequence(switchProcess, additional); SimpleStack stack; @@ -197,7 +195,7 @@ TEST_CASE("SwitchProcess from ProcessSequence") { SECTION("interaction length") { REQUIRE(switchProcess.GetInteractionLength(p) / kgMSq == Approx(2. / 3)); - REQUIRE(completeSeq.GetTotalInteractionLength(p) / kgMSq == Approx(4. / 7)); + REQUIRE(completeSeq.getInteractionLength(p) / kgMSq == Approx(4. / 7)); } SECTION("SelectInteraction") { @@ -207,13 +205,12 @@ TEST_CASE("SwitchProcess from ProcessSequence") { typename SimpleStack::ParticleType theParticle = stack.GetNextParticle(); // as in corsika::Cascade StackTestView view(theParticle); - auto projectile = view.GetProjectile(); double r = i / 1000.; InverseGrammageType invLambda = r * 7. / 4 / kgMSq; InverseGrammageType accumulator = 0 / kgMSq; - completeSeq.SelectInteraction(p, projectile, invLambda, accumulator); + completeSeq.selectInteraction(view, invLambda, accumulator); numberOfSecondaries.push_back(view.GetSize()); } @@ -231,7 +228,7 @@ TEST_CASE("SwitchProcess from ProcessSequence") { SECTION("interaction length") { REQUIRE(switchProcess.GetInteractionLength(p) / kgMSq == Approx(3)); - REQUIRE(completeSeq.GetTotalInteractionLength(p) / kgMSq == Approx(12. / 7.)); + REQUIRE(completeSeq.getInteractionLength(p) / kgMSq == Approx(12. / 7.)); } SECTION("SelectInteraction") { @@ -241,13 +238,12 @@ TEST_CASE("SwitchProcess from ProcessSequence") { typename SimpleStack::ParticleType theParticle = stack.GetNextParticle(); // as in corsika::Cascade StackTestView view(theParticle); - auto projectile = view.GetProjectile(); double r = i / 1000.; InverseGrammageType invLambda = r * 7. / 12. / kgMSq; InverseGrammageType accumulator = 0 / kgMSq; - completeSeq.SelectInteraction(p, projectile, invLambda, accumulator); + completeSeq.selectInteraction(view, invLambda, accumulator); numberOfSecondaries.push_back(view.GetSize()); } diff --git a/tests/modules/testUrQMD.cpp b/tests/modules/testUrQMD.cpp index 1730be9fb..8a1eaf3bc 100644 --- a/tests/modules/testUrQMD.cpp +++ b/tests/modules/testUrQMD.cpp @@ -163,7 +163,7 @@ TEST_CASE("UrQMD") { // must be assigned to variable, cannot be used as rvalue?! auto projectile = secViewPtr->GetProjectile(); auto const projectileMomentum = projectile.GetMomentum(); - [[maybe_unused]] corsika::EProcessReturn const ret = urqmd.DoInteraction(projectile); + urqmd.doInteraction(projectile); REQUIRE(sumCharge(*secViewPtr) == Z + corsika::charge_number(corsika::Code::Oxygen)); @@ -184,7 +184,7 @@ TEST_CASE("UrQMD") { auto projectile = secViewPtr->GetProjectile(); auto const projectileMomentum = projectile.GetMomentum(); - [[maybe_unused]] corsika::EProcessReturn const ret = urqmd.DoInteraction(projectile); + urqmd.doInteraction(projectile); REQUIRE(sumCharge(*secViewPtr) == corsika::charge_number(corsika::Code::PiPlus) + corsika::charge_number(corsika::Code::Oxygen)); @@ -206,7 +206,7 @@ TEST_CASE("UrQMD") { auto projectile = secViewPtr->GetProjectile(); auto const projectileMomentum = projectile.GetMomentum(); - [[maybe_unused]] corsika::EProcessReturn const ret = urqmd.DoInteraction(projectile); + urqmd.doInteraction(projectile); REQUIRE(sumCharge(*secViewPtr) == corsika::charge_number(corsika::Code::K0Long) + corsika::charge_number(corsika::Code::Oxygen)); -- GitLab