IAP GITLAB

Skip to content
Snippets Groups Projects
Commit b6a74928 authored by ralfulrich's avatar ralfulrich
Browse files

make examples run MUCH faster and with less output

parent 7e296a3c
No related branches found
No related tags found
No related merge requests found
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#include <corsika/geometry/Trajectory.h> #include <corsika/geometry/Trajectory.h>
#include <corsika/geometry/Vector.h> #include <corsika/geometry/Vector.h>
#include <corsika/units/PhysicalUnits.h> #include <corsika/units/PhysicalUnits.h>
#include <corsika/logging/Logging.h>
#include <optional> #include <optional>
#include <type_traits> #include <type_traits>
#include <utility> #include <utility>
...@@ -38,7 +40,7 @@ namespace corsika::process { ...@@ -38,7 +40,7 @@ namespace corsika::process {
class TrackingLine { class TrackingLine {
public: public:
TrackingLine(){}; TrackingLine() = default;
template <typename Particle> // was Stack previously, and argument was template <typename Particle> // was Stack previously, and argument was
// Stack::StackIterator // Stack::StackIterator
...@@ -49,27 +51,23 @@ namespace corsika::process { ...@@ -49,27 +51,23 @@ namespace corsika::process {
p.GetMomentum() / p.GetEnergy() * corsika::units::constants::c; p.GetMomentum() / p.GetEnergy() * corsika::units::constants::c;
auto const currentPosition = p.GetPosition(); auto const currentPosition = p.GetPosition();
std::cout << "TrackingLine pid: " << p.GetPID() C8LOG_DEBUG(
<< " , E = " << p.GetEnergy() / 1_GeV << " GeV" << std::endl; "TrackingLine pid: {}"
std::cout << "TrackingLine pos: " " , E = {} GeV",
<< currentPosition.GetCoordinates() p.GetPID(), p.GetEnergy() / 1_GeV);
// << " [" << p.GetNode()->GetModelProperties().GetName() << "]" C8LOG_DEBUG("TrackingLine pos: {}", currentPosition.GetCoordinates());
<< std::endl; C8LOG_DEBUG("TrackingLine E: {} GeV", p.GetEnergy() / 1_GeV);
std::cout << "TrackingLine E: " << p.GetEnergy() / 1_GeV << " GeV" << std::endl; C8LOG_DEBUG("TrackingLine p: {} GeV", p.GetMomentum().GetComponents() / 1_GeV);
std::cout << "TrackingLine p: " << p.GetMomentum().GetComponents() / 1_GeV C8LOG_DEBUG("TrackingLine v: {} ", velocity.GetComponents());
<< " GeV " << std::endl;
std::cout << "TrackingLine v: " << velocity.GetComponents() << std::endl;
// to do: include effect of magnetic field // to do: include effect of magnetic field
geometry::Line line(currentPosition, velocity); geometry::Line line(currentPosition, velocity);
auto const* currentLogicalVolumeNode = p.GetNode(); auto const* currentLogicalVolumeNode = p.GetNode();
//~ auto const* currentNumericalVolumeNode =
//~ fEnvironment.GetUniverse()->GetContainingNode(currentPosition);
auto const numericallyInside = auto const numericallyInside =
currentLogicalVolumeNode->GetVolume().Contains(currentPosition); currentLogicalVolumeNode->GetVolume().Contains(currentPosition);
std::cout << "numericallyInside = " << (numericallyInside ? "true" : "false"); C8LOG_DEBUG("numericallyInside = {} ", numericallyInside);
auto const& children = currentLogicalVolumeNode->GetChildNodes(); auto const& children = currentLogicalVolumeNode->GetChildNodes();
auto const& excluded = currentLogicalVolumeNode->GetExcludedNodes(); auto const& excluded = currentLogicalVolumeNode->GetExcludedNodes();
...@@ -85,14 +83,11 @@ namespace corsika::process { ...@@ -85,14 +83,11 @@ namespace corsika::process {
if (auto opt = TimeOfIntersection(line, sphere); opt.has_value()) { if (auto opt = TimeOfIntersection(line, sphere); opt.has_value()) {
auto const [t1, t2] = *opt; auto const [t1, t2] = *opt;
std::cout << "intersection times: " << t1 / 1_s << "; " C8LOG_DEBUG("intersection times: {} s; {} s", t1 / 1_s, t2 / 1_s);
<< t2 / 1_s
// << " " << vtn.GetModelProperties().GetName()
<< std::endl;
if (t1.magnitude() > 0) if (t1.magnitude() > 0)
intersections.emplace_back(t1, &vtn); intersections.emplace_back(t1, &vtn);
else if (t2.magnitude() > 0) else if (t2.magnitude() > 0)
std::cout << "inside other volume" << std::endl; C8LOG_DEBUG("inside other volume");
} }
}; };
...@@ -123,10 +118,7 @@ namespace corsika::process { ...@@ -123,10 +118,7 @@ namespace corsika::process {
min = minIter->first; min = minIter->first;
} }
std::cout << " t-intersect: " C8LOG_DEBUG(" t-intersect: {} ", min);
<< min
// << " " << minIter->second->GetModelProperties().GetName()
<< std::endl;
return std::make_tuple(geometry::Trajectory<geometry::Line>(line, min), return std::make_tuple(geometry::Trajectory<geometry::Line>(line, min),
velocity.norm() * min, minIter->second); velocity.norm() * min, minIter->second);
......
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