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
17using namespace std;
18using namespace Belle2;
19using namespace Belle2::Monopoles;
20using namespace CLHEP;
21
23 : G4EquationOfMotion(mField)
24{}
25
27{}
28
29void
30G4MonopoleEquation::SetChargeMomentumMass(G4ChargeState particleChargeState,
31 G4double, // momentum,
32 G4double particleMass)
33{
34 G4double particleMagneticCharge = particleChargeState.MagneticCharge();
35 G4double particleElectricCharge = particleChargeState.GetCharge();
36
37 // fElCharge = particleElectricCharge;
38 fElCharge = eplus * particleElectricCharge * c_light;
39
40 fMagCharge = eplus * particleMagneticCharge * c_light ;
41
42 fMassCof = particleMass * particleMass ;
43}
44
45void
47 const G4double Field[],
48 G4double dydx[]) const
49{
50 // Components of y:
51 // 0-2 dr/ds,
52 // 3-5 dp/ds - momentum derivatives
53
54 G4double pSquared = y[3] * y[3] + y[4] * y[4] + y[5] * y[5] ;
55
56 G4double Energy = std::sqrt(pSquared + fMassCof);
57
58 G4double pModuleInverse = 1.0 / std::sqrt(pSquared);
59
60 G4double inverse_velocity = Energy * pModuleInverse / c_light;
61
62 G4double cofEl = fElCharge * pModuleInverse ;
63 G4double cofMag = fMagCharge * Energy * pModuleInverse;
64
65
66 dydx[0] = y[3] * pModuleInverse ;
67 dydx[1] = y[4] * pModuleInverse ;
68 dydx[2] = y[5] * pModuleInverse ;
69
70 // G4double magCharge = twopi * hbar_Planck / (eplus * mu0);
71 // magnetic charge in SI units A*m convention
72 // see http://en.wikipedia.org/wiki/Magnetic_monopole
73 // G4cout << "Magnetic charge: " << magCharge << G4endl;
74 // dp/ds = dp/dt * dt/ds = dp/dt / v = Force / velocity
75 // dydx[3] = fMagCharge * Field[0] * inverse_velocity * c_light;
76 // multiplied by c_light to convert to MeV/mm
77 // dydx[4] = fMagCharge * Field[1] * inverse_velocity * c_light;
78 // dydx[5] = fMagCharge * Field[2] * inverse_velocity * c_light;
79
80 dydx[3] = cofMag * Field[0] + cofEl * (y[4] * Field[2] - y[5] * Field[1]);
81 dydx[4] = cofMag * Field[1] + cofEl * (y[5] * Field[0] - y[3] * Field[2]);
82 dydx[5] = cofMag * Field[2] + cofEl * (y[3] * Field[1] - y[4] * Field[0]);
83
84 // G4cout << std::setprecision(5)<< "E=" << Energy
85 // << "; p="<< 1/pModuleInverse
86 // << "; mC="<< magCharge
87 // <<"; x=" << y[0]
88 // <<"; y=" << y[1]
89 // <<"; z=" << y[2]
90 // <<"; dydx[3]=" << dydx[3]
91 // <<"; dydx[4]=" << dydx[4]
92 // <<"; dydx[5]=" << dydx[5]
93 // << G4endl;
94
95 dydx[6] = 0.;//not used
96
97 // Lab Time of flight
98 dydx[7] = inverse_velocity;
99 return;
100}
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.