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

#include <G4EqEMFieldWithEDM.hh>

+ Inheritance diagram for G4EqEMFieldWithEDM:

Public Member Functions

 G4EqEMFieldWithEDM (G4ElectroMagneticField *emField)
 
 ~G4EqEMFieldWithEDM () override
 
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
 
- 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
 
G4FieldGetFieldObj ()
 
void SetFieldObj (G4Field *pField)
 

Detailed Description

Definition at line 44 of file G4EqEMFieldWithEDM.hh.

Constructor & Destructor Documentation

◆ G4EqEMFieldWithEDM()

G4EqEMFieldWithEDM::G4EqEMFieldWithEDM ( G4ElectroMagneticField * emField)

Definition at line 42 of file G4EqEMFieldWithEDM.cc.

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

◆ ~G4EqEMFieldWithEDM()

G4EqEMFieldWithEDM::~G4EqEMFieldWithEDM ( )
overridedefault

Member Function Documentation

◆ EvaluateRhsGivenB()

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

Definition at line 84 of file G4EqEMFieldWithEDM.cc.

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

◆ GetAnomaly()

G4double G4EqEMFieldWithEDM::GetAnomaly ( ) const
inline

Definition at line 63 of file G4EqEMFieldWithEDM.hh.

63{ return anomaly; }

◆ GetEta()

G4double G4EqEMFieldWithEDM::GetEta ( ) const
inline

Definition at line 67 of file G4EqEMFieldWithEDM.hh.

67{ return eta; }

◆ SetAnomaly()

void G4EqEMFieldWithEDM::SetAnomaly ( G4double a)
inline

Definition at line 62 of file G4EqEMFieldWithEDM.hh.

62{ anomaly = a; }

◆ SetChargeMomentumMass()

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

Implements G4EquationOfMotion.

Definition at line 50 of file G4EqEMFieldWithEDM.cc.

53{
54 charge = particleCharge.GetCharge();
55 mass = particleMass;
56 magMoment = particleCharge.GetMagneticDipoleMoment();
57 spin = particleCharge.GetSpin();
58
59 fElectroMagCof = eplus*charge*c_light;
60 fMassCof = mass*mass;
61
62 omegac = (eplus/mass)*c_light;
63
64 G4double muB = 0.5*eplus*hbar_Planck/(mass/c_squared);
65
66 G4double g_BMT;
67 if ( spin != 0. )
68 {
69 g_BMT = (std::abs(magMoment)/muB)/spin;
70 }
71 else
72 {
73 g_BMT = 2.;
74 }
75
76 anomaly = (g_BMT - 2.)/2.;
77
78 G4double E = std::sqrt(sqr(MomentumXc)+sqr(mass));
79 beta = MomentumXc/E;
80 gamma = E/mass;
81}
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

Definition at line 66 of file G4EqEMFieldWithEDM.hh.

66{ eta = n; }

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