IAP GITLAB

Skip to content
Snippets Groups Projects
Commit e8698189 authored by ralfulrich's avatar ralfulrich Committed by Ralf Ulrich
Browse files

cascadeequations process

parent 5f818d43
No related branches found
No related tags found
No related merge requests found
...@@ -31,10 +31,12 @@ namespace corsika { ...@@ -31,10 +31,12 @@ namespace corsika {
setNodes(); // put each particle on stack in correct environment volume setNodes(); // put each particle on stack in correct environment volume
while (!stack_.isEmpty()) { while (!stack_.isEmpty()) {
sequence_.initCascadeEquations();
while (!stack_.isEmpty()) { while (!stack_.isEmpty()) {
CORSIKA_LOG_TRACE("Stack: {}", stack_.asString()); CORSIKA_LOG_TRACE("Stack: {}", stack_.asString());
count_++; count_++;
auto pNext = stack_.getNextParticle(); auto pNext = stack_.getNextParticle();
CORSIKA_LOG_TRACE( CORSIKA_LOG_TRACE(
...@@ -46,6 +48,7 @@ namespace corsika { ...@@ -46,6 +48,7 @@ namespace corsika {
step(pNext); step(pNext);
sequence_.doStack(stack_); sequence_.doStack(stack_);
} }
// do cascade equations, which can put new particles on Stack, // do cascade equations, which can put new particles on Stack,
// thus, the double loop // thus, the double loop
sequence_.doCascadeEquations(stack_); sequence_.doCascadeEquations(stack_);
......
...@@ -381,6 +381,30 @@ namespace corsika { ...@@ -381,6 +381,30 @@ namespace corsika {
} }
} }
template <typename TProcess1, typename TProcess2, int IndexStart, int IndexProcess1,
int IndexProcess2>
void ProcessSequence<TProcess1, TProcess2, IndexStart, IndexProcess1,
IndexProcess2>::initCascadeEquations() {
if constexpr (is_process_v<process1_type>) { // to protect from further compiler
// errors if process1_type is invalid
if constexpr ((process1_type::is_process_sequence &&
!process1_type::is_switch_process_sequence) ||
is_cascade_equations_process_v<process1_type>) {
A_.initCascadeEquations();
}
}
if constexpr (is_process_v<process2_type>) { // to protect from further compiler
// errors if process2_type is invalid
if constexpr ((process2_type::is_process_sequence &&
!process2_type::is_switch_process_sequence) ||
is_cascade_equations_process_v<process2_type>) {
B_.initCascadeEquations();
}
}
} // namespace corsika
template <typename TProcess1, typename TProcess2, int IndexStart, int IndexProcess1, template <typename TProcess1, typename TProcess2, int IndexStart, int IndexProcess1,
int IndexProcess2> int IndexProcess2>
template <typename TSecondaryView> template <typename TSecondaryView>
......
...@@ -99,7 +99,7 @@ namespace corsika { ...@@ -99,7 +99,7 @@ namespace corsika {
configPath.c_str(), configPath.size()); configPath.c_str(), configPath.size());
} }
inline void CONEXhybrid::init() { inline void CONEXhybrid::initCascadeEquations() {
double eprima = primaryEnergy_ / 1_GeV; double eprima = primaryEnergy_ / 1_GeV;
...@@ -234,7 +234,7 @@ namespace corsika { ...@@ -234,7 +234,7 @@ namespace corsika {
} }
template <typename TStack> template <typename TStack>
inline void CONEXhybrid::doCascadeEquations(TStack& stack) { inline void CONEXhybrid::doCascadeEquations(TStack&) {
::conex::conexcascade_(); ::conex::conexcascade_();
......
...@@ -211,11 +211,16 @@ namespace corsika { ...@@ -211,11 +211,16 @@ namespace corsika {
void doStack(TStack& stack); void doStack(TStack& stack);
/** /**
Execute the CascadeEquationsProcess-es in the ProcessSequence * Execute the CascadeEquationsProcess-es in the ProcessSequence.
*/ */
template <typename TStack> template <typename TStack>
void doCascadeEquations(TStack& stack); void doCascadeEquations(TStack& stack);
/**
* Init the CascadeEquationsProcess-es in the ProcessSequence.
*/
void initCascadeEquations();
/** /**
* Calculate the maximum allowed length of the next tracking step, based on all * Calculate the maximum allowed length of the next tracking step, based on all
* ContinuousProcess-es * ContinuousProcess-es
......
...@@ -8,11 +8,13 @@ ...@@ -8,11 +8,13 @@
#pragma once #pragma once
#include <corsika/framework/process/SecondariesProcess.hpp>
#include <corsika/framework/process/CascadeEquationsProcess.hpp>
#include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/core/PhysicalUnits.hpp>
#include <corsika/framework/core/ParticleProperties.hpp> #include <corsika/framework/core/ParticleProperties.hpp>
#include <corsika/framework/geometry/Point.hpp> #include <corsika/framework/geometry/Point.hpp>
#include <corsika/framework/geometry/Vector.hpp> #include <corsika/framework/geometry/Vector.hpp>
#include <corsika/framework/process/SecondariesProcess.hpp>
#include <corsika/media/ShowerAxis.hpp> #include <corsika/media/ShowerAxis.hpp>
#include <corsika/modules/conex/CONEX_f.hpp> #include <corsika/modules/conex/CONEX_f.hpp>
...@@ -23,7 +25,8 @@ namespace corsika { ...@@ -23,7 +25,8 @@ namespace corsika {
LengthType constexpr earthRadius{6371315 * meter}; LengthType constexpr earthRadius{6371315 * meter};
} // namespace conex } // namespace conex
class CONEXhybrid : public SecondariesProcess<CONEXhybrid> { class CONEXhybrid : public CascadeEquationsProcess<CONEXhybrid>,
public SecondariesProcess<CONEXhybrid> {
public: public:
CONEXhybrid(Point center, ShowerAxis const& showerAxis, LengthType groundDist, CONEXhybrid(Point center, ShowerAxis const& showerAxis, LengthType groundDist,
...@@ -41,7 +44,7 @@ namespace corsika { ...@@ -41,7 +44,7 @@ namespace corsika {
* init currently needs to be called to initializa a new * init currently needs to be called to initializa a new
* event. All tables are cleared, etc. * event. All tables are cleared, etc.
*/ */
void init(); void initCascadeEquations();
/** /**
* Cascade equations are solved basoned on the data in the tables * Cascade equations are solved basoned on the data in the tables
......
...@@ -291,8 +291,6 @@ int main(int argc, char** argv) { ...@@ -291,8 +291,6 @@ int main(int argc, char** argv) {
cut.reset(); cut.reset();
eLoss.reset(); eLoss.reset();
conex_model.solveCE();
auto const hists = sibyllCounted.getHistogram() + sibyllNucCounted.getHistogram() + auto const hists = sibyllCounted.getHistogram() + sibyllNucCounted.getHistogram() +
urqmdCounted.getHistogram(); urqmdCounted.getHistogram();
......
...@@ -103,7 +103,7 @@ TEST_CASE("CONEXSourceCut") { ...@@ -103,7 +103,7 @@ TEST_CASE("CONEXSourceCut") {
[[maybe_unused]] corsika::sibyll::NuclearInteraction sibyllNuc(sibyll, env); [[maybe_unused]] corsika::sibyll::NuclearInteraction sibyllNuc(sibyll, env);
CONEXhybrid conex(center, showerAxis, t, injectionHeight, E0, get_PDG(Code::Proton)); CONEXhybrid conex(center, showerAxis, t, injectionHeight, E0, get_PDG(Code::Proton));
conex.init(); conex.initCascadeEquations();
HEPEnergyType const Eem{1_PeV}; HEPEnergyType const Eem{1_PeV};
auto const momentum = showerAxis.getDirection() * Eem; auto const momentum = showerAxis.getDirection() * Eem;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment