Geant4-11
Public Member Functions | Private Attributes | Static Private Attributes
G4Mag_SpinEqRhs Class Reference

#include <G4Mag_SpinEqRhs.hh>

Inheritance diagram for G4Mag_SpinEqRhs:
G4Mag_EqRhs G4EquationOfMotion

Public Member Functions

void EvaluateRhsGivenB (const G4double y[], const G4double B[3], G4double dydx[]) const
 
void EvaluateRhsReturnB (const G4double y[], G4double dydx[], G4double Field[]) const
 
G4double FCof () const
 
 G4Mag_SpinEqRhs (G4MagneticField *MagField)
 
G4double GetAnomaly () const
 
G4FieldGetFieldObj ()
 
const G4FieldGetFieldObj () const
 
void GetFieldValue (const G4double Point[4], G4double Field[]) const
 
void RightHandSide (const G4double y[], G4double dydx[]) const
 
void SetAnomaly (G4double a)
 
void SetChargeMomentumMass (G4ChargeState particleCharge, G4double MomentumXc, G4double mass)
 
void SetFieldObj (G4Field *pField)
 
 ~G4Mag_SpinEqRhs ()
 

Private Attributes

G4double anomaly =0.0011659208
 
G4double beta =0.0
 
G4double charge =0.0
 
G4double fCof_val = 0.0
 
G4double gamma =0.0
 
G4FielditsField = nullptr
 
G4double magMoment =0.0
 
G4double mass =0.0
 
G4double omegac =0.0
 
G4double spin =0.0
 

Static Private Attributes

static const G4double fUnitConstant = 0.299792458 * (GeV/(tesla*m))
 

Detailed Description

Definition at line 45 of file G4Mag_SpinEqRhs.hh.

Constructor & Destructor Documentation

◆ G4Mag_SpinEqRhs()

G4Mag_SpinEqRhs::G4Mag_SpinEqRhs ( G4MagneticField MagField)

Definition at line 37 of file G4Mag_SpinEqRhs.cc.

38 : G4Mag_EqRhs( MagField )
39{
40}
G4Mag_EqRhs(G4MagneticField *magField)
Definition: G4Mag_EqRhs.cc:39

◆ ~G4Mag_SpinEqRhs()

G4Mag_SpinEqRhs::~G4Mag_SpinEqRhs ( )

Definition at line 42 of file G4Mag_SpinEqRhs.cc.

43{
44}

Member Function Documentation

◆ EvaluateRhsGivenB()

void G4Mag_SpinEqRhs::EvaluateRhsGivenB ( const G4double  y[],
const G4double  B[3],
G4double  dydx[] 
) const
virtual

Implements G4Mag_EqRhs.

Definition at line 74 of file G4Mag_SpinEqRhs.cc.

77{
78 G4double momentum_mag_square = sqr(y[3]) + sqr(y[4]) + sqr(y[5]);
79 G4double inv_momentum_magnitude = 1.0 / std::sqrt( momentum_mag_square );
80 G4double cof = FCof()*inv_momentum_magnitude;
81
82 dydx[0] = y[3] * inv_momentum_magnitude; // (d/ds)x = Vx/V
83 dydx[1] = y[4] * inv_momentum_magnitude; // (d/ds)y = Vy/V
84 dydx[2] = y[5] * inv_momentum_magnitude; // (d/ds)z = Vz/V
85
86 if (charge == 0.)
87 {
88 dydx[3] = 0.;
89 dydx[4] = 0.;
90 dydx[5] = 0.;
91 }
92 else
93 {
94 dydx[3] = cof*(y[4]*B[2] - y[5]*B[1]) ; // Ax = a*(Vy*Bz - Vz*By)
95 dydx[4] = cof*(y[5]*B[0] - y[3]*B[2]) ; // Ay = a*(Vz*Bx - Vx*Bz)
96 dydx[5] = cof*(y[3]*B[1] - y[4]*B[0]) ; // Az = a*(Vx*By - Vy*Bx)
97 }
98
99 G4ThreeVector u(y[3], y[4], y[5]);
100 u *= inv_momentum_magnitude;
101
102 G4ThreeVector BField(B[0],B[1],B[2]);
103
104 G4double udb = anomaly*beta*gamma/(1.+gamma) * (BField * u);
105 G4double ucb = (anomaly+1./gamma)/beta;
106
107 // Initialise the values of dydx that we do not update.
108 dydx[6] = dydx[7] = dydx[8] = 0.0;
109
110 G4ThreeVector Spin(y[9],y[10],y[11]);
111
112 G4double pcharge;
113 if (charge == 0.)
114 {
115 pcharge = 1.;
116 }
117 else
118 {
119 pcharge = charge;
120 }
121
122 G4ThreeVector dSpin(0.,0.,0.);
123 if (Spin.mag2() != 0.)
124 {
125 dSpin = pcharge*omegac*(ucb*(Spin.cross(BField))-udb*(Spin.cross(u)));
126 }
127
128 dydx[9] = dSpin.x();
129 dydx[10] = dSpin.y();
130 dydx[11] = dSpin.z();
131
132 return;
133}
G4double B(G4double temperature)
double G4double
Definition: G4Types.hh:83
G4double FCof() const
Definition: G4Mag_EqRhs.hh:62
T sqr(const T &x)
Definition: templates.hh:128

References anomaly, B(), beta, charge, G4Mag_EqRhs::FCof(), gamma, omegac, sqr(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

◆ EvaluateRhsReturnB()

void G4EquationOfMotion::EvaluateRhsReturnB ( const G4double  y[],
G4double  dydx[],
G4double  Field[] 
) const
inlineinherited

◆ FCof()

G4double G4Mag_EqRhs::FCof ( ) const
inlineinherited

◆ GetAnomaly()

G4double G4Mag_SpinEqRhs::GetAnomaly ( ) const
inline

Definition at line 64 of file G4Mag_SpinEqRhs.hh.

64{ return anomaly; }

References anomaly.

◆ GetFieldObj() [1/2]

G4Field * G4EquationOfMotion::GetFieldObj ( )
inlineinherited

◆ GetFieldObj() [2/2]

const G4Field * G4EquationOfMotion::GetFieldObj ( ) const
inlineinherited

Referenced by G4NystromRK4::GetField().

◆ GetFieldValue()

void G4EquationOfMotion::GetFieldValue ( const G4double  Point[4],
G4double  Field[] 
) const
inlineinherited

◆ RightHandSide()

void G4EquationOfMotion::RightHandSide ( const G4double  y[],
G4double  dydx[] 
) const
inlineinherited

◆ SetAnomaly()

void G4Mag_SpinEqRhs::SetAnomaly ( G4double  a)
inline

Definition at line 63 of file G4Mag_SpinEqRhs.hh.

63{ anomaly = a; }

References anomaly.

◆ SetChargeMomentumMass()

void G4Mag_SpinEqRhs::SetChargeMomentumMass ( G4ChargeState  particleCharge,
G4double  MomentumXc,
G4double  mass 
)
virtual

Reimplemented from G4Mag_EqRhs.

Definition at line 47 of file G4Mag_SpinEqRhs.cc.

50{
51 G4Mag_EqRhs::SetChargeMomentumMass( particleCharge, MomentumXc, mass);
52
53 charge = particleCharge.GetCharge();
54 mass = particleMass;
55 magMoment = particleCharge.GetMagneticDipoleMoment();
56 spin = particleCharge.GetSpin();
57
59
61
62 G4double g_BMT;
63 if ( spin != 0. ) g_BMT = (std::abs(magMoment)/muB)/spin;
64 else g_BMT = 2.;
65
66 anomaly = (g_BMT - 2.)/2.;
67
68 G4double E = std::sqrt(sqr(MomentumXc)+sqr(mass));
69 beta = MomentumXc/E;
70 gamma = E/mass;
71}
static constexpr double eplus
Definition: G4SIunits.hh:184
G4double GetCharge() const
G4double GetMagneticDipoleMoment() const
G4double GetSpin() const
virtual void SetChargeMomentumMass(G4ChargeState particleCharge, G4double MomentumXc, G4double mass)
Definition: G4Mag_EqRhs.cc:49
float c_light
Definition: hepunit.py:256
float hbar_Planck
Definition: hepunit.py:263
float c_squared
Definition: hepunit.py:257

References anomaly, beta, source.hepunit::c_light, source.hepunit::c_squared, charge, eplus, gamma, G4ChargeState::GetCharge(), G4ChargeState::GetMagneticDipoleMoment(), G4ChargeState::GetSpin(), source.hepunit::hbar_Planck, magMoment, mass, omegac, G4Mag_EqRhs::SetChargeMomentumMass(), spin, and sqr().

◆ SetFieldObj()

void G4EquationOfMotion::SetFieldObj ( G4Field pField)
inlineinherited

Field Documentation

◆ anomaly

G4double G4Mag_SpinEqRhs::anomaly =0.0011659208
private

◆ beta

G4double G4Mag_SpinEqRhs::beta =0.0
private

Definition at line 71 of file G4Mag_SpinEqRhs.hh.

Referenced by EvaluateRhsGivenB(), and SetChargeMomentumMass().

◆ charge

G4double G4Mag_SpinEqRhs::charge =0.0
private

Definition at line 69 of file G4Mag_SpinEqRhs.hh.

Referenced by EvaluateRhsGivenB(), and SetChargeMomentumMass().

◆ fCof_val

G4double G4Mag_EqRhs::fCof_val = 0.0
privateinherited

Definition at line 69 of file G4Mag_EqRhs.hh.

Referenced by G4Mag_EqRhs::FCof(), and G4Mag_EqRhs::SetChargeMomentumMass().

◆ fUnitConstant

const G4double G4Mag_EqRhs::fUnitConstant = 0.299792458 * (GeV/(tesla*m))
staticprivateinherited

Definition at line 71 of file G4Mag_EqRhs.hh.

◆ gamma

G4double G4Mag_SpinEqRhs::gamma =0.0
private

Definition at line 71 of file G4Mag_SpinEqRhs.hh.

Referenced by EvaluateRhsGivenB(), and SetChargeMomentumMass().

◆ itsField

G4Field* G4EquationOfMotion::itsField = nullptr
privateinherited

Definition at line 90 of file G4EquationOfMotion.hh.

◆ magMoment

G4double G4Mag_SpinEqRhs::magMoment =0.0
private

Definition at line 69 of file G4Mag_SpinEqRhs.hh.

Referenced by SetChargeMomentumMass().

◆ mass

G4double G4Mag_SpinEqRhs::mass =0.0
private

Definition at line 69 of file G4Mag_SpinEqRhs.hh.

Referenced by SetChargeMomentumMass().

◆ omegac

G4double G4Mag_SpinEqRhs::omegac =0.0
private

Definition at line 70 of file G4Mag_SpinEqRhs.hh.

Referenced by EvaluateRhsGivenB(), and SetChargeMomentumMass().

◆ spin

G4double G4Mag_SpinEqRhs::spin =0.0
private

Definition at line 69 of file G4Mag_SpinEqRhs.hh.

Referenced by SetChargeMomentumMass().


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