Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4EqEMFieldWithEDM Class Reference

G4EqEMFieldWithEDM implements the right-hand side of equation of motion in a combined electric and magnetic field, with spin tracking for both MDM and EDM terms. More...

#include <G4EqEMFieldWithEDM.hh>

Inheritance diagram for G4EqEMFieldWithEDM:

Public Member Functions

 G4EqEMFieldWithEDM (G4ElectroMagneticField *emField)
 ~G4EqEMFieldWithEDM () override=default
void SetChargeMomentumMass (G4ChargeState particleCharge, G4double MomentumXc, G4double mass) override
void EvaluateRhsGivenB (const G4double y[], const G4double Field[], G4double dydx[]) const override
void SetAnomaly (G4double a)
G4double GetAnomaly () const
void SetEta (G4double n)
G4double GetEta () const
G4EquationType GetEquationType () const override
Public Member Functions inherited from G4EquationOfMotion
 G4EquationOfMotion (G4Field *Field)
virtual ~G4EquationOfMotion ()=default
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
G4FieldGetFieldObj ()
void SetFieldObj (G4Field *pField)

Detailed Description

G4EqEMFieldWithEDM implements the right-hand side of equation of motion in a combined electric and magnetic field, with spin tracking for both MDM and EDM terms.

Definition at line 50 of file G4EqEMFieldWithEDM.hh.

Constructor & Destructor Documentation

◆ G4EqEMFieldWithEDM()

G4EqEMFieldWithEDM::G4EqEMFieldWithEDM ( G4ElectroMagneticField * emField)

Constructor for G4EqEMFieldWithEDM.

Parameters
[in]emFieldPointer to the electromagnetic field.

Definition at line 41 of file G4EqEMFieldWithEDM.cc.

42 : G4EquationOfMotion( emField )
43{
44}
G4EquationOfMotion(G4Field *Field)

◆ ~G4EqEMFieldWithEDM()

G4EqEMFieldWithEDM::~G4EqEMFieldWithEDM ( )
overridedefault

Default Destructor.

Member Function Documentation

◆ EvaluateRhsGivenB()

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

Calculates the value of the derivative, given the value of the electromagnetic field.

Parameters
[in]yCoefficients array.
[in]FieldField value.
[out]dydxDerivatives array.

Definition at line 81 of file G4EqEMFieldWithEDM.cc.

84{
85
86 // Components of y:
87 // 0-2 dr/ds,
88 // 3-5 dp/ds - momentum derivatives
89 // 9-11 dSpin/ds = (1/beta) dSpin/dt - spin derivatives
90
91 // The BMT equation, following J.D.Jackson, Classical
92 // Electrodynamics, Second Edition, with additions for EDM
93 // evolution from
94 // M.Nowakowski, et.al. Eur.J.Phys.26, pp 545-560, (2005)
95 // or
96 // Silenko, Phys.Rev.ST Accel.Beams 9:034003, (2006)
97
98 // dS/dt = (e/m) S \cross
99 // MDM: [ (g/2-1 +1/\gamma) B
100 // -(g/2-1)\gamma/(\gamma+1) (\beta \cdot B)\beta
101 // -(g/2-\gamma/(\gamma+1) \beta \cross E
102 //
103 // EDM: eta/2( E - gamma/(gamma+1) \beta (\beta \cdot E)
104 // + \beta \cross B ) ]
105 //
106 // where
107 // S = \vec{s}, where S^2 = 1
108 // B = \vec{B}
109 // \beta = \vec{\beta} = \beta \vec{u} with u^2 = 1
110 // E = \vec{E}
111
112 G4double pSquared = y[3]*y[3] + y[4]*y[4] + y[5]*y[5] ;
113
114 G4double Energy = std::sqrt( pSquared + fMassCof );
115 G4double cof2 = Energy/c_light ;
116
117 G4double pModuleInverse = 1.0/std::sqrt(pSquared) ;
118
119 G4double inverse_velocity = Energy * pModuleInverse / c_light;
120
121 G4double cof1 = fElectroMagCof*pModuleInverse ;
122
123 dydx[0] = y[3]*pModuleInverse ;
124 dydx[1] = y[4]*pModuleInverse ;
125 dydx[2] = y[5]*pModuleInverse ;
126
127 dydx[3] = cof1*(cof2*Field[3] + (y[4]*Field[2] - y[5]*Field[1])) ;
128
129 dydx[4] = cof1*(cof2*Field[4] + (y[5]*Field[0] - y[3]*Field[2])) ;
130
131 dydx[5] = cof1*(cof2*Field[5] + (y[3]*Field[1] - y[4]*Field[0])) ;
132
133 dydx[6] = dydx[8] = 0.;//not used
134
135 // Lab Time of flight
136 dydx[7] = inverse_velocity;
137
138 G4ThreeVector BField(Field[0],Field[1],Field[2]);
139 G4ThreeVector EField(Field[3],Field[4],Field[5]);
140
141 EField /= c_light;
142
143 G4ThreeVector u(y[3], y[4], y[5]);
144 u *= pModuleInverse;
145
146 G4double udb = anomaly*beta*gamma/(1.+gamma) * (BField * u);
147 G4double ucb = (anomaly+1./gamma)/beta;
148 G4double uce = anomaly + 1./(gamma+1.);
149 G4double ude = beta*gamma/(1.+gamma)*(EField*u);
150
151 G4ThreeVector Spin(y[9],y[10],y[11]);
152
153 G4double pcharge;
154 if (charge == 0.)
155 {
156 pcharge = 1.;
157 }
158 else
159 {
160 pcharge = charge;
161 }
162
163 G4ThreeVector dSpin(0.,0.,0.);
164 if (Spin.mag2() != 0.)
165 {
166 dSpin = pcharge*omegac*( ucb*(Spin.cross(BField))-udb*(Spin.cross(u))
167 // from Jackson
168 // -uce*Spin.cross(u.cross(EField)) )
169 // but this form has one less operation
170 - uce*(u*(Spin*EField) - EField*(Spin*u))
171 + eta/2.*(Spin.cross(EField) - ude*(Spin.cross(u))
172 // +Spin.cross(u.cross(Bfield))
173 + (u*(Spin*BField) - BField*(Spin*u)) ) );
174 }
175
176 dydx[ 9] = dSpin.x();
177 dydx[10] = dSpin.y();
178 dydx[11] = dSpin.z();
179
180 return;
181}
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition G4Types.hh:83

◆ GetAnomaly()

G4double G4EqEMFieldWithEDM::GetAnomaly ( ) const
inline

Definition at line 91 of file G4EqEMFieldWithEDM.hh.

91{ return anomaly; }

◆ GetEquationType()

G4EquationType G4EqEMFieldWithEDM::GetEquationType ( ) const
inlineoverridevirtual

Returns the equation type-ID, "kEqEMfieldWithEDM".

Reimplemented from G4EquationOfMotion.

Definition at line 102 of file G4EqEMFieldWithEDM.hh.

102{ return kEqEMfieldWithEDM; }
@ kEqEMfieldWithEDM

◆ GetEta()

G4double G4EqEMFieldWithEDM::GetEta ( ) const
inline

Definition at line 97 of file G4EqEMFieldWithEDM.hh.

97{ return eta; }

◆ SetAnomaly()

void G4EqEMFieldWithEDM::SetAnomaly ( G4double a)
inline

Setter and getter for magnetic anomaly.

Definition at line 90 of file G4EqEMFieldWithEDM.hh.

90{ anomaly = a; }

◆ SetChargeMomentumMass()

void G4EqEMFieldWithEDM::SetChargeMomentumMass ( G4ChargeState particleCharge,
G4double MomentumXc,
G4double mass )
overridevirtual

Sets the charge, momentum and mass of the current particle. Used to set the equation's coefficients.

Parameters
[in]particleChargeMagnetic charge and moments in e+ units.
[in]MomentumXcParticle momentum.
[in]massParticle mass.

Implements G4EquationOfMotion.

Definition at line 47 of file G4EqEMFieldWithEDM.cc.

50{
51 charge = particleCharge.GetCharge();
52 mass = particleMass;
53 magMoment = particleCharge.GetMagneticDipoleMoment();
54 spin = particleCharge.GetSpin();
55
56 fElectroMagCof = eplus*charge*c_light;
57 fMassCof = mass*mass;
58
59 omegac = (eplus/mass)*c_light;
60
61 G4double muB = 0.5*eplus*hbar_Planck/(mass/c_squared);
62
63 G4double g_BMT;
64 if ( spin != 0. )
65 {
66 g_BMT = (std::abs(magMoment)/muB)/spin;
67 }
68 else
69 {
70 g_BMT = 2.;
71 }
72
73 anomaly = (g_BMT - 2.)/2.;
74
75 G4double E = std::sqrt(sqr(MomentumXc)+sqr(mass));
76 beta = MomentumXc/E;
77 gamma = E/mass;
78}
G4double GetCharge() const
G4double GetMagneticDipoleMoment() const
G4double GetSpin() const
T sqr(const T &x)
Definition templates.hh:128

◆ SetEta()

void G4EqEMFieldWithEDM::SetEta ( G4double n)
inline

Setter and getter for EDM eta parameter.

Definition at line 96 of file G4EqEMFieldWithEDM.hh.

96{ eta = n; }

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