Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4EqEMFieldWithEDM.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4EqEMFieldWithEDM.cc 71664 2013-06-20 08:36:05Z gcosmo $
28 //
29 //
30 // This is the standard right-hand side for equation of motion.
31 //
32 // 19.02.2009 Kevin Lynch, based on G4EqEMFieldWithSpin
33 // 06.11.2009 Hiromi Iinuma see:
34 // http://hypernews.slac.stanford.edu/HyperNews/geant4/get/emfields/161.html
35 //
36 // -------------------------------------------------------------------
37 
38 #include "G4EqEMFieldWithEDM.hh"
40 #include "G4ThreeVector.hh"
41 #include "globals.hh"
42 #include "G4PhysicalConstants.hh"
43 #include "G4SystemOfUnits.hh"
44 
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 }
51 
53 {
54 }
55 
56 void
58  G4double MomentumXc,
59  G4double particleMass)
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 }
83 
84 void
86  const G4double Field[],
87  G4double dydx[] ) const
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 }
G4double GetCharge() const
double x() const
void EvaluateRhsGivenB(const G4double y[], const G4double Field[], G4double dydx[]) const
double z() const
void SetChargeMomentumMass(G4ChargeState particleCharge, G4double MomentumXc, G4double mass)
G4EqEMFieldWithEDM(G4ElectroMagneticField *emField)
double y() const
G4double GetSpin() const
double mag2() const
G4double GetMagneticDipoleMoment() const
Hep3Vector cross(const Hep3Vector &) const
T sqr(const T &x)
Definition: templates.hh:145
double G4double
Definition: G4Types.hh:76
float c_light
Definition: hepunit.py:257