Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21:12

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 /// \file exoticphysics/monopole/src/G4MonopoleEquation.cc
0027 /// \brief Implementation of the G4MonopoleEquation class
0028 //
0029 //
0030 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0031 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0032 //
0033 //
0034 // class G4MonopoleEquation
0035 //
0036 // Class description:
0037 //
0038 //
0039 //  This is the standard right-hand side for equation of motion.
0040 //
0041 //  The only case another is required is when using a moving reference
0042 //  frame ... or extending the class to include additional Forces,
0043 //  eg an electric field
0044 //
0045 //  10.11.98   V.Grichine
0046 //
0047 //  30.04.10   S.Burdin (modified to use for the monopole trajectories).
0048 //
0049 //  15.06.10   B.Bozsogi (replaced the hardcoded magnetic charge with
0050 //                        the one passed by G4MonopoleTransportation)
0051 //                       +workaround to pass the electric charge.
0052 //
0053 //  12.07.10  S.Burdin (added equations for the electric charges)
0054 // -------------------------------------------------------------------
0055 
0056 #include "G4MonopoleEquation.hh"
0057 
0058 #include "G4PhysicalConstants.hh"
0059 #include "G4SystemOfUnits.hh"
0060 #include "globals.hh"
0061 
0062 #include <iomanip>
0063 
0064 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0065 
0066 G4MonopoleEquation::G4MonopoleEquation(G4MagneticField* emField) : G4EquationOfMotion(emField)
0067 {
0068   G4cout << "G4MonopoleEquation::G4MonopoleEquation" << G4endl;
0069 }
0070 
0071 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0072 
0073 G4MonopoleEquation::~G4MonopoleEquation() {}
0074 
0075 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0076 
0077 void G4MonopoleEquation::SetChargeMomentumMass(G4ChargeState particleChargeState,
0078                                                G4double,  // momentum,
0079                                                G4double particleMass)
0080 {
0081   G4double particleMagneticCharge = particleChargeState.MagneticCharge();
0082   G4double particleElectricCharge = particleChargeState.GetCharge();
0083 
0084   //   fElCharge = particleElectricCharge;
0085   fElCharge = eplus * particleElectricCharge * c_light;
0086 
0087   fMagCharge = eplus * particleMagneticCharge * c_light;
0088 
0089   // G4cout << " G4MonopoleEquation: ElectricCharge=" << particleElectricCharge
0090   //           << "; MagneticCharge=" << particleMagneticCharge
0091   //           << G4endl;
0092 
0093   fMassCof = particleMass * particleMass;
0094 }
0095 
0096 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0097 
0098 void G4MonopoleEquation::EvaluateRhsGivenB(const G4double y[], const G4double Field[],
0099                                            G4double dydx[]) const
0100 {
0101   // Components of y:
0102   //    0-2 dr/ds,
0103   //    3-5 dp/ds - momentum derivatives
0104 
0105   G4double pSquared = y[3] * y[3] + y[4] * y[4] + y[5] * y[5];
0106 
0107   G4double Energy = std::sqrt(pSquared + fMassCof);
0108 
0109   G4double pModuleInverse = 1.0 / std::sqrt(pSquared);
0110 
0111   G4double inverse_velocity = Energy * pModuleInverse / c_light;
0112 
0113   G4double cofEl = fElCharge * pModuleInverse;
0114   G4double cofMag = fMagCharge * Energy * pModuleInverse;
0115 
0116   dydx[0] = y[3] * pModuleInverse;
0117   dydx[1] = y[4] * pModuleInverse;
0118   dydx[2] = y[5] * pModuleInverse;
0119 
0120   // G4double magCharge = twopi * hbar_Planck / (eplus * mu0);
0121   // magnetic charge in SI units A*m convention
0122   //  see http://en.wikipedia.org/wiki/Magnetic_monopole
0123   //   G4cout  << "Magnetic charge:  " << magCharge << G4endl;
0124   // dp/ds = dp/dt * dt/ds = dp/dt / v = Force / velocity
0125   // dydx[3] = fMagCharge * Field[0]  * inverse_velocity  * c_light;
0126   // multiplied by c_light to convert to MeV/mm
0127   //     dydx[4] = fMagCharge * Field[1]  * inverse_velocity  * c_light;
0128   //     dydx[5] = fMagCharge * Field[2]  * inverse_velocity  * c_light;
0129 
0130   dydx[3] = cofMag * Field[0] + cofEl * (y[4] * Field[2] - y[5] * Field[1]);
0131   dydx[4] = cofMag * Field[1] + cofEl * (y[5] * Field[0] - y[3] * Field[2]);
0132   dydx[5] = cofMag * Field[2] + cofEl * (y[3] * Field[1] - y[4] * Field[0]);
0133 
0134   //        G4cout << std::setprecision(5)<< "E=" << Energy
0135   //               << "; p="<< 1/pModuleInverse
0136   //               << "; mC="<< magCharge
0137   //               <<"; x=" << y[0]
0138   //               <<"; y=" << y[1]
0139   //               <<"; z=" << y[2]
0140   //               <<"; dydx[3]=" << dydx[3]
0141   //               <<"; dydx[4]=" << dydx[4]
0142   //               <<"; dydx[5]=" << dydx[5]
0143   //               << G4endl;
0144 
0145   dydx[6] = 0.;  // not used
0146 
0147   // Lab Time of flight
0148   dydx[7] = inverse_velocity;
0149   return;
0150 }
0151 
0152 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......