Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4EqEMFieldWithSpin Class Reference

#include <G4EqEMFieldWithSpin.hh>

Inheritance diagram for G4EqEMFieldWithSpin:
Collaboration diagram for G4EqEMFieldWithSpin:

Public Member Functions

 G4EqEMFieldWithSpin (G4ElectroMagneticField *emField)
 
 ~G4EqEMFieldWithSpin ()
 
void SetChargeMomentumMass (G4ChargeState particleCharge, G4double MomentumXc, G4double mass)
 
void EvaluateRhsGivenB (const G4double y[], const G4double Field[], G4double dydx[]) const
 
void SetAnomaly (G4double a)
 
G4double GetAnomaly () const
 
- Public Member Functions inherited from G4EquationOfMotion
 G4EquationOfMotion (G4Field *Field)
 
virtual ~G4EquationOfMotion ()
 
virtual void EvaluateRhsGivenB (const G4double y[], const G4double B[3], G4double dydx[]) const =0
 
void RightHandSide (const G4double y[], G4double dydx[]) const
 
void EvaluateRhsReturnB (const G4double y[], G4double dydx[], G4double Field[]) const
 
void GetFieldValue (const G4double Point[4], G4double Field[]) const
 
const G4FieldGetFieldObj () const
 
void SetFieldObj (G4Field *pField)
 

Detailed Description

Definition at line 49 of file G4EqEMFieldWithSpin.hh.

Constructor & Destructor Documentation

G4EqEMFieldWithSpin::G4EqEMFieldWithSpin ( G4ElectroMagneticField emField)

Definition at line 45 of file G4EqEMFieldWithSpin.cc.

46  : G4EquationOfMotion( emField ), charge(0.), mass(0.), magMoment(0.),
47  spin(0.), fElectroMagCof(0.), fMassCof(0.), omegac(0.),
48  anomaly(0.0011659208), beta(0.), gamma(0.)
49 {
50 }
G4EquationOfMotion(G4Field *Field)
G4EqEMFieldWithSpin::~G4EqEMFieldWithSpin ( )

Definition at line 52 of file G4EqEMFieldWithSpin.cc.

53 {
54 }

Member Function Documentation

void G4EqEMFieldWithSpin::EvaluateRhsGivenB ( const G4double  y[],
const G4double  Field[],
G4double  dydx[] 
) const

Definition at line 85 of file G4EqEMFieldWithSpin.cc.

88 {
89 
90  // Components of y:
91  // 0-2 dr/ds,
92  // 3-5 dp/ds - momentum derivatives
93  // 9-11 dSpin/ds = (1/beta) dSpin/dt - spin derivatives
94 
95  // The BMT equation, following J.D.Jackson, Classical
96  // Electrodynamics, Second Edition,
97  // dS/dt = (e/mc) S \cross
98  // [ (g/2-1 +1/\gamma) B
99  // -(g/2-1)\gamma/(\gamma+1) (\beta \cdot B)\beta
100  // -(g/2-\gamma/(\gamma+1) \beta \cross E ]
101  // where
102  // S = \vec{s}, where S^2 = 1
103  // B = \vec{B}
104  // \beta = \vec{\beta} = \beta \vec{u} with u^2 = 1
105  // E = \vec{E}
106 
107  G4double pSquared = y[3]*y[3] + y[4]*y[4] + y[5]*y[5] ;
108 
109  G4double Energy = std::sqrt( pSquared + fMassCof );
110  G4double cof2 = Energy/c_light ;
111 
112  G4double pModuleInverse = 1.0/std::sqrt(pSquared) ;
113 
114  G4double inverse_velocity = Energy * pModuleInverse / c_light;
115 
116  G4double cof1 = fElectroMagCof*pModuleInverse ;
117 
118  dydx[0] = y[3]*pModuleInverse ;
119  dydx[1] = y[4]*pModuleInverse ;
120  dydx[2] = y[5]*pModuleInverse ;
121 
122  dydx[3] = cof1*(cof2*Field[3] + (y[4]*Field[2] - y[5]*Field[1])) ;
123 
124  dydx[4] = cof1*(cof2*Field[4] + (y[5]*Field[0] - y[3]*Field[2])) ;
125 
126  dydx[5] = cof1*(cof2*Field[5] + (y[3]*Field[1] - y[4]*Field[0])) ;
127 
128  dydx[6] = dydx[8] = 0.;//not used
129 
130  // Lab Time of flight
131  dydx[7] = inverse_velocity;
132 
133  G4ThreeVector BField(Field[0],Field[1],Field[2]);
134  G4ThreeVector EField(Field[3],Field[4],Field[5]);
135 
136  EField /= c_light;
137 
138  G4ThreeVector u(y[3], y[4], y[5]);
139  u *= pModuleInverse;
140 
141  G4double udb = anomaly*beta*gamma/(1.+gamma) * (BField * u);
142  G4double ucb = (anomaly+1./gamma)/beta;
143  G4double uce = anomaly + 1./(gamma+1.);
144 
145  G4ThreeVector Spin(y[9],y[10],y[11]);
146 
147  G4double pcharge;
148  if (charge == 0.) pcharge = 1.;
149  else pcharge = charge;
150 
151  G4ThreeVector dSpin(0.,0.,0.);
152  if (Spin.mag2() != 0.) {
153  dSpin =
154  pcharge*omegac*( ucb*(Spin.cross(BField))-udb*(Spin.cross(u))
155  // from Jackson
156  // -uce*Spin.cross(u.cross(EField)) );
157  // but this form has one less operation
158  - uce*(u*(Spin*EField) - EField*(Spin*u)) );
159  }
160 
161  dydx[ 9] = dSpin.x();
162  dydx[10] = dSpin.y();
163  dydx[11] = dSpin.z();
164 
165  return ;
166 }
static constexpr double c_light
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

G4double G4EqEMFieldWithSpin::GetAnomaly ( ) const
inline

Definition at line 68 of file G4EqEMFieldWithSpin.hh.

68 { return anomaly; }
void G4EqEMFieldWithSpin::SetAnomaly ( G4double  a)
inline

Definition at line 67 of file G4EqEMFieldWithSpin.hh.

67 { anomaly = a; }
void G4EqEMFieldWithSpin::SetChargeMomentumMass ( G4ChargeState  particleCharge,
G4double  MomentumXc,
G4double  mass 
)
virtual

Implements G4EquationOfMotion.

Definition at line 57 of file G4EqEMFieldWithSpin.cc.

60 {
61  charge = particleCharge.GetCharge();
62  mass = particleMass;
63  magMoment = particleCharge.GetMagneticDipoleMoment();
64  spin = particleCharge.GetSpin();
65 
66  fElectroMagCof = eplus*charge*c_light ;
67  fMassCof = mass*mass;
68 
69  omegac = (eplus/mass)*c_light;
70 
71  G4double muB = 0.5*eplus*hbar_Planck/(mass/c_squared);
72 
73  G4double g_BMT;
74  if ( spin != 0. ) g_BMT = (std::abs(magMoment)/muB)/spin;
75  else g_BMT = 2.;
76 
77  anomaly = (g_BMT - 2.)/2.;
78 
79  G4double E = std::sqrt(sqr(MomentumXc)+sqr(mass));
80  beta = MomentumXc/E;
81  gamma = E/mass;
82 }
G4double GetCharge() const
static constexpr double eplus
Definition: G4SIunits.hh:199
static constexpr double c_squared
static constexpr double c_light
G4double GetSpin() const
G4double GetMagneticDipoleMoment() const
T sqr(const T &x)
Definition: templates.hh:145
double G4double
Definition: G4Types.hh:76
static constexpr double hbar_Planck

Here is the call graph for this function:


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