From 064867b47e069f4f0c927682fdcf416efae24baa Mon Sep 17 00:00:00 2001 From: Maximilian Reininghaus <maximilian.reininghaus@tu-dortmund.de> Date: Mon, 25 Mar 2019 11:06:49 -0300 Subject: [PATCH] playing with tracking --- Documentation/Examples/cascade_example.cc | 2 +- Framework/Cascade/Cascade.h | 15 +++++++-------- Processes/TrackingLine/TrackingLine.h | 16 +++------------- 3 files changed, 11 insertions(+), 22 deletions(-) diff --git a/Documentation/Examples/cascade_example.cc b/Documentation/Examples/cascade_example.cc index 555b64c0..0d4dc8c0 100644 --- a/Documentation/Examples/cascade_example.cc +++ b/Documentation/Examples/cascade_example.cc @@ -348,7 +348,7 @@ int main() { cout << "input angles: theta=" << theta << " phi=" << phi << endl; cout << "input momentum: " << plab.GetComponents() / 1_GeV << endl; Point pos(rootCS, 0_m, 0_m, 0_m); - for (int l = 0; l < 100; ++l) { + for (int l = 0; l < 1; ++l) { stack.AddParticle(std::tuple<particles::Code, units::si::HEPEnergyType, corsika::stack::MomentumVector, geometry::Point, units::si::TimeType>{beamCode, E0, plab, pos, 0_ns}); diff --git a/Framework/Cascade/Cascade.h b/Framework/Cascade/Cascade.h index 4a82d38b..45eaece1 100644 --- a/Framework/Cascade/Cascade.h +++ b/Framework/Cascade/Cascade.h @@ -91,7 +91,7 @@ namespace corsika::cascade { fEnvironment.GetUniverse()->GetContainingNode(p.GetPosition()); p.SetNode(numericalNode); - std::cout << "initial node " << p.GetNode() << std::endl; + std::cout << "initial node " << p.GetNode()->GetModelProperties().GetName() << std::endl; }); } @@ -146,13 +146,6 @@ namespace corsika::cascade { auto const* currentNumericalNode = fEnvironment.GetUniverse()->GetContainingNode(particle.GetPosition()); - std::cout << "nodes: " << currentLogicalNode << " " << currentNumericalNode - << std::endl; - - if (currentNumericalNode != currentLogicalNode) { - throw std::runtime_error("numerical and logical nodes don't match"); - } - if (currentNumericalNode == &*fEnvironment.GetUniverse()) { throw std::runtime_error("particle entered void Universe"); } @@ -234,6 +227,12 @@ namespace corsika::cascade { } else { // step-length limitation within volume std::cout << "step-length limitation" << std::endl; } + std::cout << "nodes: " << currentLogicalNode->GetModelProperties().GetName() << " " << currentNumericalNode->GetModelProperties().GetName() + << std::endl; + + if (currentNumericalNode != currentLogicalNode) { + throw std::runtime_error("numerical and logical nodes don't match"); + } } else { // boundary crossing std::cout << "boundary crossing! next node = " << nextVol << std::endl; particle.SetNode(nextVol); diff --git a/Processes/TrackingLine/TrackingLine.h b/Processes/TrackingLine/TrackingLine.h index ef482fd3..ff3b178a 100644 --- a/Processes/TrackingLine/TrackingLine.h +++ b/Processes/TrackingLine/TrackingLine.h @@ -90,30 +90,20 @@ namespace corsika::process { if (t1.magnitude() > 0) intersections.emplace_back(t1, &nextNode); else if (t2.magnitude() > 0) - intersections.emplace_back(t2, &nextNode); + throw std::runtime_error("inside other volume"); } }; for (auto const& child : children) { addIfIntersects(*child, *child); } - for (auto const* ex : excluded) { addIfIntersects(*ex, *ex); } - if (numericallyInside) { - addIfIntersects( - *currentLogicalVolumeNode, - *currentLogicalVolumeNode - ->GetParent()); // todo: add parent node to vector, not current! - } else { + { auto const& sphere = dynamic_cast<geometry::Sphere const&>( currentLogicalVolumeNode->GetVolume()); // for the moment we are a bit bold here and assume // everything is a sphere, crashes with exception if not auto const [t1, t2] = *TimeOfIntersection(line, sphere); - - if (t1 > 0_s) { - assert(t2 > 0_s); - intersections.emplace_back(t2, currentLogicalVolumeNode->GetParent()); - } + intersections.emplace_back(t2, currentLogicalVolumeNode->GetParent()); } auto const minIter = std::min_element( -- GitLab