IAP GITLAB

Helix.hpp 1.84 KB
Newer Older
Ralf Ulrich's avatar
Ralf Ulrich committed
1 2
n/*
 * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
 *
 * This software is distributed under the terms of the GNU General Public
 * Licence version 3 (GPL Version 3). See file LICENSE for a full version of
 * the license.
 */

#pragma once

#include <cmath>
#include <corsika/framework/core/PhysicalUnits.hpp>
#include <corsika/framework/geometry/Point.hpp>
#include <corsika/framework/geometry/Vector.hpp>

namespace corsika {
  /*!
Ralf Ulrich's avatar
Ralf Ulrich committed
18 19
   * \class Helix
   *
20 21 22 23 24 25 26 27 28 29 30 31 32
   * A Helix is defined by the cyclotron frequency \f$ \omega_c \f$, the initial
   * Point r0 and
   * the velocity vectors \f$ \vec{v}_{\parallel} \f$ and \f$ \vec{v}_{\perp} \f$
   * denoting the projections of the initial velocity \f$ \vec{v}_0 \f$ parallel
   * and perpendicular to the axis \f$ \vec{B} \f$, respectively, i.e.
   * \f{align*}{
        \vec{v}_{\parallel} &= \frac{\vec{v}_0 \cdot \vec{B}}{\vec{B}^2} \vec{B} \\
        \vec{v}_{\perp} &= \vec{v}_0 - \vec{v}_{\parallel}
     \f}
   */

  class Helix {

Ralf Ulrich's avatar
Ralf Ulrich committed
33
    using VelocityVec = Vector<SpeedType::dimension_type> ;
34 35

    Point const r0;
Ralf Ulrich's avatar
Ralf Ulrich committed
36
    FrequencyType const omegaC;
37 38 39
    VelocityVec const vPar;
    VelocityVec const vPerp, uPerp;

Ralf Ulrich's avatar
Ralf Ulrich committed
40
    LengthType const radius;
41 42

  public:
Ralf Ulrich's avatar
Ralf Ulrich committed
43
    Helix(Point const& pR0, FrequencyType pOmegaC, VelocityVec const& pvPar,
Ralf Ulrich's avatar
Ralf Ulrich committed
44
          VelocityVec const& pvPerp)
45 46 47 48 49 50 51
        : r0(pR0)
        , omegaC(pOmegaC)
        , vPar(pvPar)
        , vPerp(pvPerp)
        , uPerp(vPerp.cross(vPar.normalized()))
        , radius(pvPar.norm() / abs(pOmegaC)) {}

Ralf Ulrich's avatar
Ralf Ulrich committed
52
    inline Point GetPosition(TimeType t) const;
53

Ralf Ulrich's avatar
Ralf Ulrich committed
54
    inline Point PositionFromArclength(LengthType l) const;
55

Ralf Ulrich's avatar
Ralf Ulrich committed
56
    inline LengthType GetRadius() const;
57

Ralf Ulrich's avatar
Ralf Ulrich committed
58
    inline LengthType ArcLength(TimeType t1, TimeType t2) const;
59

Ralf Ulrich's avatar
Ralf Ulrich committed
60
    inline TimeType TimeFromArclength(LengthType l) const;
61 62 63 64 65
  };

} // namespace corsika

#include <corsika/detail/framework/geometry/Helix.inl>