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