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.

23 : G4EquationOfMotion(emField) {}
MonopoleEquation::~MonopoleEquation ( )
override

Definition at line 27 of file MonopoleEquation.cc.

27 {}

Member Function Documentation

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

Definition at line 48 of file MonopoleEquation.cc.

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

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

Definition at line 31 of file MonopoleEquation.cc.

References fElCharge, fMagCharge, and fMassCof.

31  {
32  G4double particleMagneticCharge = particleChargeState.MagneticCharge();
33  G4double particleElectricCharge = particleChargeState.GetCharge();
34 
35  fElCharge = CLHEP::eplus * particleElectricCharge * CLHEP::c_light;
36 
37  fMagCharge = CLHEP::eplus * particleMagneticCharge * CLHEP::c_light;
38 
39  // G4cout << " MonopoleEquation: ElectricCharge=" << particleElectricCharge
40  // << "; MagneticCharge=" << particleMagneticCharge
41  // << G4endl;
42 
43  fMassCof = particleMass * particleMass;
44 }

Member Data Documentation

G4double MonopoleEquation::fElCharge
private

Definition at line 43 of file MonopoleEquation.h.

Referenced by EvaluateRhsGivenB(), and SetChargeMomentumMass().

G4double MonopoleEquation::fMagCharge
private

Definition at line 42 of file MonopoleEquation.h.

Referenced by EvaluateRhsGivenB(), and SetChargeMomentumMass().

G4double MonopoleEquation::fMassCof
private

Definition at line 44 of file MonopoleEquation.h.

Referenced by EvaluateRhsGivenB(), and SetChargeMomentumMass().