CORSIKA  @c8_version@
The framework to simulate particle cascades for astroparticle physics
corsika::FourVector< TTimeType, TSpaceVecType > Class Template Reference

Description of physical four-vectors. More...

#include <FourVector.hpp>

Public Types

using space_vec_type = typename std::decay< TSpaceVecType >::type
 
using space_type = typename space_vec_type::quantity_type
 
using time_type = typename std::decay< TTimeType >::type
 
using norm_type = space_type
 
using norm_square_type = decltype(std::declval< norm_type >() *std::declval< norm_type >())
 

Public Member Functions

 FourVector (FourVector &&)=default
 
 FourVector (FourVector const &)=default
 
FourVectoroperator= (const FourVector &)=default
 
 FourVector (TTimeType const &eT, TSpaceVecType const &eS)
 
TTimeType getTimeLikeComponent () const
 
TSpaceVecType & getSpaceLikeComponents ()
 
TSpaceVecType const & getSpaceLikeComponents () const
 
norm_square_type getNormSqr () const
 
norm_type getNorm () const
 
bool isTimelike () const
 
bool isSpacelike () const
 
Math operators (class members)
FourVectoroperator+= (FourVector const &)
 
FourVectoroperator-= (FourVector const &)
 
FourVectoroperator*= (double const)
 
FourVectoroperator/= (double const)
 
FourVectoroperator/ (double const)
 
norm_type operator* (FourVector const &b)
 Scalar product of two FourVectors. More...
 

Protected Attributes

TTimeType timeLike_
 
TSpaceVecType spaceLike_
 

Friends

Free math operators

We need to define them inline here since we do not want to implement them as template functions.

They are valid only for the specific types as defined right here.

Note, these are "free function" (even if they don't look as such). Thus, even if the input object uses internal references for storage, the free math operators, of course, must provide value-copies.

FourVector< time_type, space_vec_type > operator+ (FourVector const &a, FourVector const &b)
 
FourVector< time_type, space_vec_type > operator- (FourVector const &a, FourVector const &b)
 
FourVector< time_type, space_vec_type > operator* (FourVector const &a, double const b)
 
FourVector< time_type, space_vec_type > operator/ (FourVector const &a, double const b)
 

Detailed Description

template<typename TTimeType, typename TSpaceVecType>
class corsika::FourVector< TTimeType, TSpaceVecType >

Description of physical four-vectors.

FourVector fully supports units, e.g. E in [GeV/c] and p in [GeV], or also t in [s] and r in [m], etc.

However, for HEP applications it is also possible to use E and p both in [GeV].

Thus, the input units of time-like and space-like coordinates must either be idential (e.g. GeV) or scaled by "c" as in [E/c]=[p].

The FourVector can return its squared-norm getNormSqr and its norm getNorm, whereas norm is sqrt(abs(norm-squared)). The physical units are always calculated and returned properly.

FourVector can also return if it is TimeLike, SpaceLike or PhotonLike.

When a FourVector is initialized with a lvalue references, e.g. as FourVector<TimeType&, Vector<length_d>&>, references are also used as internal data types, which should lead to complete disappearance of the FourVector class during optimization.

Definition at line 51 of file FourVector.hpp.

Member Function Documentation

◆ getNorm()

template<typename TTimeType, typename TSpaceVecType>
norm_type corsika::FourVector< TTimeType, TSpaceVecType >::getNorm ( ) const
Returns
\(\sqrt(p_0^2 - \vec{p}^2)\)

◆ getNormSqr()

template<typename TTimeType, typename TSpaceVecType>
norm_square_type corsika::FourVector< TTimeType, TSpaceVecType >::getNormSqr ( ) const
Returns
\(p_0^2 - \vec{p}^2\)

◆ getSpaceLikeComponents() [1/2]

template<typename TTimeType, typename TSpaceVecType>
TSpaceVecType& corsika::FourVector< TTimeType, TSpaceVecType >::getSpaceLikeComponents ( )
Returns
spaceLike_

◆ getSpaceLikeComponents() [2/2]

template<typename TTimeType, typename TSpaceVecType>
TSpaceVecType const& corsika::FourVector< TTimeType, TSpaceVecType >::getSpaceLikeComponents ( ) const
Returns
spaceLike_;

◆ getTimeLikeComponent()

template<typename TTimeType, typename TSpaceVecType>
TTimeType corsika::FourVector< TTimeType, TSpaceVecType >::getTimeLikeComponent ( ) const
Returns
timeLike_

◆ isSpacelike()

template<typename TTimeType, typename TSpaceVecType>
bool corsika::FourVector< TTimeType, TSpaceVecType >::isSpacelike ( ) const
Returns
if \(|p_0|<|\vec{p}|\)

◆ isTimelike()

template<typename TTimeType, typename TSpaceVecType>
bool corsika::FourVector< TTimeType, TSpaceVecType >::isTimelike ( ) const
Todo:
FIXME: a better alternative would be to define an enumeration enum { SpaceLike =-1, TimeLike, LightLike } V4R_Category; and a method called V4R_Category GetCategory() const; RU: then you have to decide in the constructor which avoids "lazyness"
Returns
if \(|p_0|>|\vec{p}|\)

◆ operator*()

template<typename TTimeType, typename TSpaceVecType>
norm_type corsika::FourVector< TTimeType, TSpaceVecType >::operator* ( FourVector< TTimeType, TSpaceVecType > const &  b)

Scalar product of two FourVectors.

Note that the product between two 4-vectors assumes that you use the same "c" convention for both. Only the LHS vector is checked for this. You cannot mix different conventions due to unit-checking.


The documentation for this class was generated from the following file: