Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4EquationOfMotion.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// G4EquationOfMotion
27//
28// Class description:
29//
30// Abstract Base Class for the right hand size of the equation of
31// motion of a particle in a field.
32
33// Author: John Apostolakis (CERN), 1998
34// -------------------------------------------------------------------
35#ifndef G4EQUATIONOFMOTION_HH
36#define G4EQUATIONOFMOTION_HH
37
38#include "G4Types.hh"
39#include "G4Field.hh" // required in inline method implementations
40#include "G4FieldParameters.hh"
41
42#include "G4ChargeState.hh"
43
44/**
45 * @brief G4EquationOfMotion is the abstract base class for the right
46 * hand size of the equation of motion of a particle in a field.
47 */
48
50{
51 public:
52
53 /**
54 * Constructor for G4EquationOfMotion.
55 * @param[in] Field Pointer to the field.
56 */
58
59 /**
60 * Default virtual Destructor.
61 */
62 virtual ~G4EquationOfMotion() = default;
63
64 /**
65 * Calculates the value of the derivative, given the value of the field.
66 * @param[in] y Coefficients array.
67 * @param[in] Field Field value.
68 * @param[out] dydx Derivatives array.
69 */
70 virtual void EvaluateRhsGivenB( const G4double y[],
71 const G4double B[3],
72 G4double dydx[] ) const = 0;
73
74 /**
75 * Sets the charge, momentum and mass of the current particle.
76 * Used to set the equation's coefficients.
77 * @param[in] particleCharge Magnetic charge and moments in e+ units.
78 * @param[in] MomentumXc Particle momentum.
79 * @param[in] mass Particle mass.
80 */
81 virtual void SetChargeMomentumMass(G4ChargeState particleCharge,
82 G4double MomentumXc,
83 G4double MassXc2) = 0;
84
85 /**
86 * Returns the equation type-ID, "kUserEquation".
87 */
88 virtual G4EquationType GetEquationType() const { return kUserEquation; }
89
90 /**
91 * Calculates the value of the derivative 'dydx' at 'y'.
92 * Calls the virtual function above.
93 * @param[in] y Coefficients array.
94 * @param[out] dydx Derivatives array.
95 */
96 inline void RightHandSide( const G4double y[],
97 G4double dydx[] ) const;
98
99 /**
100 * Calculates the value of the derivative 'dydx' at 'y' as above,
101 * but also returns the value of B.
102 * @param[in] y Coefficients array.
103 * @param[out] dydx Derivatives array.
104 * @param[out] Field Field value.
105 */
106 inline void EvaluateRhsReturnB( const G4double y[],
107 G4double dydx[],
108 G4double Field[] ) const;
109
110 /**
111 * Returns the 'Field' value at the given time 'Point'.
112 * @param[in] Point The time point (x,y,z,t).
113 * @param[out] Field The returned field value.
114 */
115 inline void GetFieldValue( const G4double Point[4],
116 G4double Field[] ) const;
117
118 /**
119 * Accessors and modifier for the field.
120 */
121 inline const G4Field* GetFieldObj() const;
123 inline void SetFieldObj(G4Field* pField);
124
125 private:
126
127 G4Field* itsField = nullptr;
128};
129
130#include "G4EquationOfMotion.icc"
131
132#endif
G4double B(G4double temperature)
G4EquationType
G4EquationType defines the types of equations of motion of a particle in a field in Geant4.
@ kUserEquation
User defined equation of motion.
double G4double
Definition G4Types.hh:83
G4ChargeState is a container for magnetic charge and moments.
G4EquationOfMotion(G4Field *Field)
virtual void EvaluateRhsGivenB(const G4double y[], const G4double B[3], G4double dydx[]) const =0
const G4Field * GetFieldObj() const
virtual ~G4EquationOfMotion()=default
virtual G4EquationType GetEquationType() const
void RightHandSide(const G4double y[], G4double dydx[]) const
void SetFieldObj(G4Field *pField)
virtual void SetChargeMomentumMass(G4ChargeState particleCharge, G4double MomentumXc, G4double MassXc2)=0
void GetFieldValue(const G4double Point[4], G4double Field[]) const
void EvaluateRhsReturnB(const G4double y[], G4double dydx[], G4double Field[]) const
G4Field * GetFieldObj()
G4Field is the abstract class for any kind of field. It allows any kind of field (vector,...
Definition G4Field.hh:67