Belle II Software development
G4MonopoleEquation.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9// modified from GEANT4 exoticphysics/monopole/*
10
11#include <simulation/monopoles/G4MonopoleEquation.h>
12
13#include <globals.hh>
14#include <CLHEP/Units/PhysicalConstants.h>
15#include <CLHEP/Units/SystemOfUnits.h>
16#include <G4MagneticField.hh>
17
18using namespace std;
19using namespace Belle2;
20using namespace Belle2::Monopoles;
21using namespace CLHEP;
22
24 : G4EquationOfMotion(mField)
25{}
26
29
30void
31G4MonopoleEquation::SetChargeMomentumMass(G4ChargeState particleChargeState,
32 G4double, // momentum,
33 G4double particleMass)
34{
35 G4double particleMagneticCharge = particleChargeState.MagneticCharge();
36 G4double particleElectricCharge = particleChargeState.GetCharge();
37
38 // fElCharge = particleElectricCharge;
39 fElCharge = eplus * particleElectricCharge * c_light;
40
41 fMagCharge = eplus * particleMagneticCharge * c_light ;
42
43 fMassCof = particleMass * particleMass ;
44}
45
46void
48 const G4double Field[],
49 G4double dydx[]) const
50{
51 // Components of y:
52 // 0-2 dr/ds,
53 // 3-5 dp/ds - momentum derivatives
54
55 G4double pSquared = y[3] * y[3] + y[4] * y[4] + y[5] * y[5] ;
56
57 G4double Energy = std::sqrt(pSquared + fMassCof);
58
59 G4double pModuleInverse = 1.0 / std::sqrt(pSquared);
60
61 G4double inverse_velocity = Energy * pModuleInverse / c_light;
62
63 G4double cofEl = fElCharge * pModuleInverse ;
64 G4double cofMag = fMagCharge * Energy * pModuleInverse;
65
66
67 dydx[0] = y[3] * pModuleInverse ;
68 dydx[1] = y[4] * pModuleInverse ;
69 dydx[2] = y[5] * pModuleInverse ;
70
71 // G4double magCharge = twopi * hbar_Planck / (eplus * mu0);
72 // magnetic charge in SI units A*m convention
73 // see http://en.wikipedia.org/wiki/Magnetic_monopole
74 // G4cout << "Magnetic charge: " << magCharge << G4endl;
75 // dp/ds = dp/dt * dt/ds = dp/dt / v = Force / velocity
76 // dydx[3] = fMagCharge * Field[0] * inverse_velocity * c_light;
77 // multiplied by c_light to convert to MeV/mm
78 // dydx[4] = fMagCharge * Field[1] * inverse_velocity * c_light;
79 // dydx[5] = fMagCharge * Field[2] * inverse_velocity * c_light;
80
81 dydx[3] = cofMag * Field[0] + cofEl * (y[4] * Field[2] - y[5] * Field[1]);
82 dydx[4] = cofMag * Field[1] + cofEl * (y[5] * Field[0] - y[3] * Field[2]);
83 dydx[5] = cofMag * Field[2] + cofEl * (y[3] * Field[1] - y[4] * Field[0]);
84
85 // G4cout << std::setprecision(5)<< "E=" << Energy
86 // << "; p="<< 1/pModuleInverse
87 // << "; mC="<< magCharge
88 // <<"; x=" << y[0]
89 // <<"; y=" << y[1]
90 // <<"; z=" << y[2]
91 // <<"; dydx[3]=" << dydx[3]
92 // <<"; dydx[4]=" << dydx[4]
93 // <<"; dydx[5]=" << dydx[5]
94 // << G4endl;
95
96 dydx[6] = 0.;//not used
97
98 // Lab Time of flight
99 dydx[7] = inverse_velocity;
100 return;
101}
G4double fElCharge
Electric charge in case of a dyon.
G4double fMagCharge
Magnetic charge of the monopole, in e+ units.
G4MonopoleEquation(G4MagneticField *mField)
Constructor.
G4double fMassCof
Square of the monopole mass.
virtual void SetChargeMomentumMass(G4ChargeState particleChargeState, G4double momentum, G4double mass)
G4EquationOfMotion::SetChargeMomentumMass() implementation.
virtual void EvaluateRhsGivenB(const G4double y[], const G4double Field[], G4double dydx[]) const
Given the value of the electromagnetic field, this function calculates the value of the derivative dy...
Abstract base class for different kinds of events.
STL namespace.