IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 16d51e13 authored by Maximilian Reininghaus's avatar Maximilian Reininghaus :vulcan:
Browse files

set nodes at beginning of cascade

parent 761f9371
No related branches found
No related tags found
2 merge requests!91Resolve "define further classes of processes (MaintenanceProcess?)",!76Resolve "Handling of boundary crossings in geometry tree"
Pipeline #324 passed
...@@ -36,9 +36,6 @@ ...@@ -36,9 +36,6 @@
#include <corsika/utl/CorsikaFenv.h> #include <corsika/utl/CorsikaFenv.h>
#include <boost/type_index.hpp>
using boost::typeindex::type_id_with_cvr;
#include <iostream> #include <iostream>
#include <limits> #include <limits>
#include <typeinfo> #include <typeinfo>
...@@ -267,9 +264,6 @@ int main() { ...@@ -267,9 +264,6 @@ int main() {
// auto sequence = p0 << sibyll << decay << hadronicElastic << cut << trackWriter; // auto sequence = p0 << sibyll << decay << hadronicElastic << cut << trackWriter;
auto sequence = p0 << sibyll << sibyllNuc << decay << cut << trackWriter; auto sequence = p0 << sibyll << sibyllNuc << decay << cut << trackWriter;
// cout << "decltype(sequence)=" << type_id_with_cvr<decltype(sequence)>().pretty_name()
// << "\n";
// setup particle stack, and add primary particle // setup particle stack, and add primary particle
setup::Stack stack; setup::Stack stack;
stack.Clear(); stack.Clear();
......
...@@ -77,12 +77,28 @@ namespace corsika::cascade { ...@@ -77,12 +77,28 @@ namespace corsika::cascade {
fProcessSequence.Init(); fProcessSequence.Init();
fStack.Init(); fStack.Init();
} }
/**
* set the nodes for all particles on the stack according to their numerical
* position
*/
void SetNodes() {
std::for_each(fStack.begin(), fStack.end(), [&](auto& p) {
auto const* numericalNode =
fEnvironment.GetUniverse()->GetContainingNode(p.GetPosition());
p.SetNode(numericalNode);
std::cout << "initial node " << p.GetNode() << std::endl;
});
}
/** /**
* The Run function is the main simulation loop, which processes * The Run function is the main simulation loop, which processes
* particles from the Stack until the Stack is empty. * particles from the Stack until the Stack is empty.
*/ */
void Run() { void Run() {
SetNodes();
while (!fStack.IsEmpty()) { while (!fStack.IsEmpty()) {
while (!fStack.IsEmpty()) { while (!fStack.IsEmpty()) {
auto pNext = fStack.GetNextParticle(); auto pNext = fStack.GetNextParticle();
......
  • Owner

    I guess you have seen that the "Node" information is automatically passed on to "secondaries" produced on the stack. Thus, after your initialization this information should be correct for all particles, until they traverse into a different volume.

  • Author Owner

    I think they are not. The first secondary processed in the loop already has a null pointer.

  • Owner

    this was resolved as part of MR !76 (merged)

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