Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4EqEMFieldWithEDM Class Reference

#include <G4EqEMFieldWithEDM.hh>

Inheritance diagram for G4EqEMFieldWithEDM:
G4EquationOfMotion

Public Member Functions

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

Detailed Description

Definition at line 50 of file G4EqEMFieldWithEDM.hh.

Constructor & Destructor Documentation

G4EqEMFieldWithEDM::G4EqEMFieldWithEDM ( G4ElectroMagneticField emField)

Definition at line 45 of file G4EqEMFieldWithEDM.cc.

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

Definition at line 52 of file G4EqEMFieldWithEDM.cc.

53 {
54 }

Member Function Documentation

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

Definition at line 85 of file G4EqEMFieldWithEDM.cc.

References python.hepunit::c_light, CLHEP::Hep3Vector::cross(), CLHEP::Hep3Vector::mag2(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

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

Definition at line 69 of file G4EqEMFieldWithEDM.hh.

69 { return anomaly; }
G4double G4EqEMFieldWithEDM::GetEta ( ) const
inline

Definition at line 73 of file G4EqEMFieldWithEDM.hh.

73 { return eta; }
void G4EqEMFieldWithEDM::SetAnomaly ( G4double  a)
inline

Definition at line 68 of file G4EqEMFieldWithEDM.hh.

References test::a.

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

Implements G4EquationOfMotion.

Definition at line 57 of file G4EqEMFieldWithEDM.cc.

References python.hepunit::c_light, python.hepunit::c_squared, python.hepunit::eplus, G4ChargeState::GetCharge(), G4ChargeState::GetMagneticDipoleMoment(), G4ChargeState::GetSpin(), python.hepunit::hbar_Planck, and sqr().

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 = (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
G4double GetSpin() const
G4double GetMagneticDipoleMoment() const
T sqr(const T &x)
Definition: templates.hh:145
double G4double
Definition: G4Types.hh:76
float c_light
Definition: hepunit.py:257
void G4EqEMFieldWithEDM::SetEta ( G4double  n)
inline

Definition at line 72 of file G4EqEMFieldWithEDM.hh.

References n.

72 { eta = n; }
const G4int n

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