CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
MonopoleEquation Class Reference

#include <MonopoleEquation.h>

Inheritance diagram for MonopoleEquation:

Public Member Functions

void EvaluateRhsGivenB (const G4double y[], const G4double Field[], G4double dydx[]) const override
 
 MonopoleEquation (G4MagneticField *emField)
 
void SetChargeMomentumMass (G4ChargeState particleChargeState, G4double momentum, G4double mass) override
 
 ~MonopoleEquation () override
 

Private Attributes

G4double fElCharge
 
G4double fMagCharge
 
G4double fMassCof
 

Detailed Description

Definition at line 28 of file MonopoleEquation.h.

Constructor & Destructor Documentation

MonopoleEquation::MonopoleEquation ( G4MagneticField *  emField)

Definition at line 23 of file MonopoleEquation.cc.

24  : G4EquationOfMotion( emField )
25 {}
MonopoleEquation::~MonopoleEquation ( )
override

Definition at line 29 of file MonopoleEquation.cc.

30 {}

Member Function Documentation

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

Definition at line 56 of file MonopoleEquation.cc.

References fElCharge, fMagCharge, fMassCof, and mathSSE::sqrt().

59 {
60  // Components of y:
61  // 0-2 dr/ds,
62  // 3-5 dp/ds - momentum derivatives
63 
64  G4double pSquared = y[3]*y[3] + y[4]*y[4] + y[5]*y[5] ;
65 
66  G4double Energy = std::sqrt( pSquared + fMassCof );
67 
68  G4double pModuleInverse = 1.0/std::sqrt(pSquared);
69 
70  G4double inverse_velocity = Energy * pModuleInverse / CLHEP::c_light;
71 
72  G4double cofEl = fElCharge * pModuleInverse ;
73  G4double cofMag = fMagCharge * Energy * pModuleInverse;
74 
75 
76  dydx[0] = y[3]*pModuleInverse ;
77  dydx[1] = y[4]*pModuleInverse ;
78  dydx[2] = y[5]*pModuleInverse ;
79 
80  // G4double magCharge = twopi * hbar_Planck / (eplus * mu0);
81  // magnetic charge in SI units A*m convention
82  // see http://en.wikipedia.org/wiki/Magnetic_monopole
83  // G4cout << "Magnetic charge: " << magCharge << G4endl;
84  // dp/ds = dp/dt * dt/ds = dp/dt / v = Force / velocity
85  // dydx[3] = fMagCharge * Field[0] * inverse_velocity * c_light;
86  // multiplied by c_light to convert to MeV/mm
87  // dydx[4] = fMagCharge * Field[1] * inverse_velocity * c_light;
88  // dydx[5] = fMagCharge * Field[2] * inverse_velocity * c_light;
89 
90  dydx[3] = cofMag * Field[0] + cofEl * (y[4]*Field[2] - y[5]*Field[1]);
91  dydx[4] = cofMag * Field[1] + cofEl * (y[5]*Field[0] - y[3]*Field[2]);
92  dydx[5] = cofMag * Field[2] + cofEl * (y[3]*Field[1] - y[4]*Field[0]);
93 
94  // G4cout << std::setprecision(5)<< "E=" << Energy
95  // << "; p="<< 1/pModuleInverse
96  // << "; mC="<< magCharge
97  // <<"; x=" << y[0]
98  // <<"; y=" << y[1]
99  // <<"; z=" << y[2]
100  // <<"; dydx[3]=" << dydx[3]
101  // <<"; dydx[4]=" << dydx[4]
102  // <<"; dydx[5]=" << dydx[5]
103  // << G4endl;
104 
105  dydx[6] = 0.;//not used
106 
107  // Lab Time of flight
108  dydx[7] = inverse_velocity;
109  return;
110 }
T sqrt(T t)
Definition: SSEVec.h:18
void MonopoleEquation::SetChargeMomentumMass ( G4ChargeState  particleChargeState,
G4double  momentum,
G4double  mass 
)
override

Definition at line 35 of file MonopoleEquation.cc.

References fElCharge, fMagCharge, and fMassCof.

38 {
39  G4double particleMagneticCharge= particleChargeState.MagneticCharge();
40  G4double particleElectricCharge= particleChargeState.GetCharge();
41 
42  fElCharge = CLHEP::eplus*particleElectricCharge*CLHEP::c_light;
43 
44  fMagCharge = CLHEP::eplus*particleMagneticCharge*CLHEP::c_light;
45 
46  // G4cout << " MonopoleEquation: ElectricCharge=" << particleElectricCharge
47  // << "; MagneticCharge=" << particleMagneticCharge
48  // << G4endl;
49 
50  fMassCof = particleMass*particleMass ;
51 }

Member Data Documentation

G4double MonopoleEquation::fElCharge
private

Definition at line 50 of file MonopoleEquation.h.

Referenced by EvaluateRhsGivenB(), and SetChargeMomentumMass().

G4double MonopoleEquation::fMagCharge
private

Definition at line 49 of file MonopoleEquation.h.

Referenced by EvaluateRhsGivenB(), and SetChargeMomentumMass().

G4double MonopoleEquation::fMassCof
private

Definition at line 51 of file MonopoleEquation.h.

Referenced by EvaluateRhsGivenB(), and SetChargeMomentumMass().