File indexing completed on 2024-05-10 02:21:26
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <CLHEP/Units/PhysicalConstants.h>
0016 #include <CLHEP/Units/SystemOfUnits.h>
0017 #include "SimG4Core/MagneticField/interface/MonopoleEquation.h"
0018 #include "globals.hh"
0019 #include <iomanip>
0020
0021
0022
0023 MonopoleEquation::MonopoleEquation(G4MagneticField *emField) : G4EquationOfMotion(emField) {}
0024
0025
0026
0027 MonopoleEquation::~MonopoleEquation() {}
0028
0029
0030
0031 void MonopoleEquation::SetChargeMomentumMass(G4ChargeState particleChargeState, G4double, G4double particleMass) {
0032 G4double particleMagneticCharge = particleChargeState.MagneticCharge();
0033 G4double particleElectricCharge = particleChargeState.GetCharge();
0034
0035 fElCharge = CLHEP::eplus * particleElectricCharge * CLHEP::c_light;
0036
0037 fMagCharge = CLHEP::eplus * particleMagneticCharge * CLHEP::c_light;
0038
0039
0040
0041
0042
0043 fMassCof = particleMass * particleMass;
0044 }
0045
0046
0047
0048 void MonopoleEquation::EvaluateRhsGivenB(const G4double y[], const G4double Field[], G4double dydx[]) const {
0049
0050
0051
0052
0053 G4double pSquared = y[3] * y[3] + y[4] * y[4] + y[5] * y[5];
0054
0055 G4double Energy = std::sqrt(pSquared + fMassCof);
0056
0057 G4double pModuleInverse = 1.0 / std::sqrt(pSquared);
0058
0059 G4double inverse_velocity = Energy * pModuleInverse / CLHEP::c_light;
0060
0061 G4double cofEl = fElCharge * pModuleInverse;
0062 G4double cofMag = fMagCharge * Energy * pModuleInverse;
0063
0064 dydx[0] = y[3] * pModuleInverse;
0065 dydx[1] = y[4] * pModuleInverse;
0066 dydx[2] = y[5] * pModuleInverse;
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078 dydx[3] = cofMag * Field[0] + cofEl * (y[4] * Field[2] - y[5] * Field[1]);
0079 dydx[4] = cofMag * Field[1] + cofEl * (y[5] * Field[0] - y[3] * Field[2]);
0080 dydx[5] = cofMag * Field[2] + cofEl * (y[3] * Field[1] - y[4] * Field[0]);
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093 dydx[6] = 0.;
0094
0095
0096 dydx[7] = inverse_velocity;
0097 return;
0098 }
0099
0100