#include <G4Mag_SpinEqRhs.hh>
Inheritance diagram for G4Mag_SpinEqRhs:
Public Member Functions | |
G4Mag_SpinEqRhs (G4MagneticField *MagField) | |
~G4Mag_SpinEqRhs () | |
void | SetChargeMomentumMass (G4double particleCharge, G4double MomentumXc, G4double mass) |
void | EvaluateRhsGivenB (const G4double y[], const G4double B[3], G4double dydx[]) const |
void | SetAnomaly (G4double a) |
G4double | GetAnomaly () const |
Definition at line 50 of file G4Mag_SpinEqRhs.hh.
G4Mag_SpinEqRhs::G4Mag_SpinEqRhs | ( | G4MagneticField * | MagField | ) |
Definition at line 45 of file G4Mag_SpinEqRhs.cc.
00046 : G4Mag_EqRhs( MagField ), omegac(0.), anomaly(0.0011659208), 00047 pcharge(0.), E(0.), gamma(0.), beta(0.) 00048 { 00049 }
G4Mag_SpinEqRhs::~G4Mag_SpinEqRhs | ( | ) |
void G4Mag_SpinEqRhs::EvaluateRhsGivenB | ( | const G4double | y[], | |
const G4double | B[3], | |||
G4double | dydx[] | |||
) | const [virtual] |
Implements G4Mag_EqRhs.
Definition at line 76 of file G4Mag_SpinEqRhs.cc.
References G4Mag_EqRhs::FCof(), and sqr().
00079 { 00080 G4double momentum_mag_square = sqr(y[3]) + sqr(y[4]) + sqr(y[5]); 00081 G4double inv_momentum_magnitude = 1.0 / std::sqrt( momentum_mag_square ); 00082 G4double cof = FCof()*inv_momentum_magnitude; 00083 00084 dydx[0] = y[3] * inv_momentum_magnitude; // (d/ds)x = Vx/V 00085 dydx[1] = y[4] * inv_momentum_magnitude; // (d/ds)y = Vy/V 00086 dydx[2] = y[5] * inv_momentum_magnitude; // (d/ds)z = Vz/V 00087 00088 if (pcharge == 0.) { 00089 dydx[3] = 0.; 00090 dydx[4] = 0.; 00091 dydx[5] = 0.; 00092 } else { 00093 dydx[3] = cof*(y[4]*B[2] - y[5]*B[1]) ; // Ax = a*(Vy*Bz - Vz*By) 00094 dydx[4] = cof*(y[5]*B[0] - y[3]*B[2]) ; // Ay = a*(Vz*Bx - Vx*Bz) 00095 dydx[5] = cof*(y[3]*B[1] - y[4]*B[0]) ; // Az = a*(Vx*By - Vy*Bx) 00096 } 00097 00098 G4ThreeVector u(y[3], y[4], y[5]); 00099 u *= inv_momentum_magnitude; 00100 00101 G4ThreeVector BField(B[0],B[1],B[2]); 00102 00103 G4double udb = anomaly*beta*gamma/(1.+gamma) * (BField * u); 00104 G4double ucb = (anomaly+1./gamma)/beta; 00105 00106 // Initialise the values of dydx that we do not update. 00107 dydx[6] = dydx[7] = dydx[8] = 0.0; 00108 00109 G4ThreeVector Spin(y[9],y[10],y[11]); 00110 00111 G4ThreeVector dSpin; 00112 00113 if (pcharge == 0.) { 00114 // dSpin = (3.8260837/2.)*omegac*(Spin.cross(BField)); 00115 dSpin = omegac*(ucb*(Spin.cross(BField))-udb*(Spin.cross(u))); 00116 } else { 00117 dSpin = pcharge*omegac*(ucb*(Spin.cross(BField))-udb*(Spin.cross(u))); 00118 } 00119 00120 dydx[ 9] = dSpin.x(); 00121 dydx[10] = dSpin.y(); 00122 dydx[11] = dSpin.z(); 00123 00124 return ; 00125 }
G4double G4Mag_SpinEqRhs::GetAnomaly | ( | ) | const [inline] |
void G4Mag_SpinEqRhs::SetAnomaly | ( | G4double | a | ) | [inline] |
void G4Mag_SpinEqRhs::SetChargeMomentumMass | ( | G4double | particleCharge, | |
G4double | MomentumXc, | |||
G4double | mass | |||
) | [virtual] |
Reimplemented from G4Mag_EqRhs.
Definition at line 56 of file G4Mag_SpinEqRhs.cc.
References SetAnomaly(), G4Mag_EqRhs::SetChargeMomentumMass(), and sqr().
00059 { 00060 // To set fCof_val 00061 G4Mag_EqRhs::SetChargeMomentumMass(particleCharge, MomentumXc, particleMass); 00062 00063 omegac = (eplus/particleMass)*c_light; 00064 00065 pcharge = particleCharge; 00066 00067 E = std::sqrt(sqr(MomentumXc)+sqr(particleMass)); 00068 beta = MomentumXc/E; 00069 gamma = E/particleMass; 00070 00071 G4double neutronAnomaly = -2.9156797; 00072 if (pcharge==0.) SetAnomaly(neutronAnomaly); 00073 }