CORSIKA  @c8_version@
The framework to simulate particle cascades for astroparticle physics
Intersections.hpp
1 /*
2  * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu
3  *
4  * This software is distributed under the terms of the GNU General Public
5  * Licence version 3 (GPL Version 3). See file LICENSE for a full version of
6  * the license.
7  */
8 
9 #pragma once
10 
12 
13 #include <map> // for pair
14 
15 namespace corsika {
16 
24  class Intersections {
25 
26  Intersections(const Intersections&) = delete;
27  Intersections(Intersections&&) = delete;
28  Intersections& operator=(const Intersections&) = delete;
29 
30  public:
32  : has_intersections_(false) {}
33 
34  Intersections(TimeType&& t1, TimeType&& t2)
35  : has_intersections_(true)
36  , intersections_(std::make_pair(t1, t2)) {}
37 
39  : has_intersections_(true)
40  , intersections_(std::make_pair(
41  t, std::numeric_limits<TimeType::value_type>::infinity() * second)) {}
42 
43  bool hasIntersections() const { return has_intersections_; }
44 
46  TimeType getEntry() const {
47  if (has_intersections_)
48  return intersections_.first;
49  else
50  return std::numeric_limits<TimeType::value_type>::infinity() * second;
51  }
52 
54  TimeType getExit() const {
55  if (has_intersections_)
56  return intersections_.second;
57  else
58  return std::numeric_limits<TimeType::value_type>::infinity() * second;
59  }
60 
61  private:
62  bool has_intersections_;
63  std::pair<TimeType, TimeType> intersections_;
64  };
65 
66 } // namespace corsika
Import and extend the phys::units package.
TimeType getExit() const
! where did the trajectory currently exit the volume
Container to store and return a list of intersections of a trajectory with a geometric volume objects...
`, since they are used everywhere as integral part of the framework.
TimeType getEntry() const
! where did the trajectory currently enter the volume