CORSIKA8  0.0.0
The framework to simulate particle cascades for astroparticle physics
StraightTrajectory.hpp
1 /*
2  * (c) Copyright 2020 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 #include <corsika/framework/geometry/PhysicalGeometry.hpp>
13 #include <corsika/framework/geometry/BaseTrajectory.hpp>
14 
15 namespace corsika {
16 
28 
29  public:
30  StraightTrajectory() = delete;
31  StraightTrajectory(StraightTrajectory const&) = default;
33  StraightTrajectory& operator=(StraightTrajectory const&) = delete;
34 
42  StraightTrajectory(Line const& theLine, TimeType timeLength)
43  : line_(theLine)
44  , timeLength_(timeLength)
45  , timeStep_(timeLength)
46  , initialVelocity_(theLine.getVelocity(TimeType::zero()))
47  , finalVelocity_(theLine.getVelocity(timeLength)) {}
48 
64  StraightTrajectory(Line const& theLine,
65  TimeType const timeLength, // length of theLine (straight)
66  TimeType const timeStep, // length of bend step (curved)
67  VelocityVector const& initialV, VelocityVector const& finalV)
68  : line_(theLine)
69  , timeLength_(timeLength)
70  , timeStep_(timeStep)
71  , initialVelocity_(initialV)
72  , finalVelocity_(finalV) {}
73 
74  Line const& getLine() const { return line_; }
75 
76  Point getPosition(double const u) const { return line_.getPosition(timeLength_ * u); }
77 
78  VelocityVector getVelocity(double const u) const;
79 
80  DirectionVector getDirection(double const u) const {
81  return getVelocity(u).normalized();
82  }
83 
85  TimeType getDuration(double const u = 1) const;
86 
88  LengthType getLength(double const u = 1) const;
89 
91  void setLength(LengthType const limit);
92 
94  // Scale other properties by "limit/timeLength_"
95  void setDuration(TimeType const limit);
96 
97  protected:
99  LengthType getDistance(double const u) const;
100 
101  void setFinalVelocity(VelocityVector const& v) { finalVelocity_ = v; }
102 
103  private:
104  Line line_;
105  TimeType timeLength_;
106  TimeType timeStep_;
107  VelocityVector initialVelocity_;
108  VelocityVector finalVelocity_;
109  };
110 
111 } // namespace corsika
112 
113 #include <corsika/detail/framework/geometry/StraightTrajectory.inl>
LengthType getDistance(double const u) const
! total length along straight trajectory
Import and extend the phys::units package.
A Line describes a movement in three dimensional space.
Definition: Line.hpp:27
StraightTrajectory(Line const &theLine, TimeType timeLength)
The cascade namespace assembles all objects needed to simulate full particles cascades.
TimeType getDuration(double const u=1) const
! duration along potentially bend trajectory
void setDuration(TimeType const limit)
! set new duration along potentially bend trajectory.
void setLength(LengthType const limit)
! set new duration along potentially bend trajectory.
LengthType getLength(double const u=1) const
! total length along potentially bend trajectory
StraightTrajectory(Line const &theLine, TimeType const timeLength, TimeType const timeStep, VelocityVector const &initialV, VelocityVector const &finalV)
A Trajectory is a description of a momvement of an object in three-dimensional space that describes t...
This implements a straight trajectory between two points.