Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // 23 // 27 // ------------------------------------------- 24 // ------------------------------------------------------------------- 28 // GEANT 4 class implementation file 25 // GEANT 4 class implementation file 29 // 26 // 30 // CERN, Geneva, Switzerland 27 // CERN, Geneva, Switzerland 31 // 28 // 32 // File name: G4KM_OpticalEqRhs.cc 29 // File name: G4KM_OpticalEqRhs.cc 33 // 30 // 34 // Author: Alessandro Brunengo (Al 31 // Author: Alessandro Brunengo (Alessandro.Brunengo@ge.infn.it) 35 // 32 // 36 // Creation date: 5 June 2000 33 // Creation date: 5 June 2000 37 // ------------------------------------------- 34 // ------------------------------------------------------------------- 38 35 39 #include "G4KM_OpticalEqRhs.hh" 36 #include "G4KM_OpticalEqRhs.hh" 40 #include "G4PhysicalConstants.hh" << 37 #include "G4NucleiPropertiesTable.hh" 41 #include "G4NucleiProperties.hh" << 42 #include "G4VNuclearDensity.hh" 38 #include "G4VNuclearDensity.hh" 43 #include "G4HadTmpUtil.hh" 39 #include "G4HadTmpUtil.hh" 44 40 >> 41 45 G4KM_OpticalEqRhs::G4KM_OpticalEqRhs(G4KM_Dumm 42 G4KM_OpticalEqRhs::G4KM_OpticalEqRhs(G4KM_DummyField *field, 46 G4V3DNucleus * nucleus) : 43 G4V3DNucleus * nucleus) : 47 G4Mag_EqRhs(field), theNucleus(nucleus) 44 G4Mag_EqRhs(field), theNucleus(nucleus) 48 { 45 { 49 theFactor = 0; 46 theFactor = 0; 50 theMass = 0; 47 theMass = 0; 51 } 48 } 52 49 53 50 54 void G4KM_OpticalEqRhs::SetFactor(G4double mas 51 void G4KM_OpticalEqRhs::SetFactor(G4double mass, G4double opticalParameter) 55 { 52 { 56 G4double A = theNucleus->GetMassNumber(); 53 G4double A = theNucleus->GetMassNumber(); 57 G4double Z = theNucleus->GetCharge(); 54 G4double Z = theNucleus->GetCharge(); 58 G4double bindingEnergy = G4NucleiProperties: << 55 G4double bindingEnergy = G4NucleiPropertiesTable::GetBindingEnergy(G4lrint(Z), G4lrint(A)); 59 G4double nucleusMass = Z*proton_mass_c2+(A-Z 56 G4double nucleusMass = Z*proton_mass_c2+(A-Z)*neutron_mass_c2+bindingEnergy; 60 G4double reducedMass = mass*nucleusMass/(mas 57 G4double reducedMass = mass*nucleusMass/(mass+nucleusMass); 61 58 62 G4double nucleonMass = (proton_mass_c2+neutr 59 G4double nucleonMass = (proton_mass_c2+neutron_mass_c2)/2; 63 60 64 // _factor in (MeV*fermi)*fermi/MeV = fermi*fe 61 // _factor in (MeV*fermi)*fermi/MeV = fermi*fermi -- need to have A as density normalized to 1 65 theFactor = 2*pi*hbarc*hbarc*(1+mass/nucleon 62 theFactor = 2*pi*hbarc*hbarc*(1+mass/nucleonMass)* opticalParameter/reducedMass * A; 66 63 67 theMass = mass; 64 theMass = mass; 68 } 65 } 69 66 70 67 71 void G4KM_OpticalEqRhs::EvaluateRhsGivenB(cons 68 void G4KM_OpticalEqRhs::EvaluateRhsGivenB(const G4double y[], const G4double *, 72 G4double dydx[]) const 69 G4double dydx[]) const 73 { 70 { 74 G4double yMod = std::sqrt(y[0]*y[0]+y[1]*y[1 << 71 G4double yMod = sqrt(y[0]*y[0]+y[1]*y[1]+y[2]*y[2]); 75 G4double e = std::sqrt(theMass*theMass+y[3]* << 72 G4double e = sqrt(theMass*theMass+y[3]*y[3]+y[4]*y[4]+y[5]*y[5]); 76 dydx[0] = c_light*y[3]/e; // 73 dydx[0] = c_light*y[3]/e; // 77 dydx[1] = c_light*y[4]/e; // dq/dt=dH/dp 74 dydx[1] = c_light*y[4]/e; // dq/dt=dH/dp = c*p/e 78 dydx[2] = c_light*y[5]/e; // 75 dydx[2] = c_light*y[5]/e; // 79 76 80 // V=K*rho(r) ==> dydx[3] = -dV/dr*dr/dx = -K* 77 // V=K*rho(r) ==> dydx[3] = -dV/dr*dr/dx = -K*d(rho)/dr*dr/dx. 81 // Idem for dydx[4] and dydx[5] 78 // Idem for dydx[4] and dydx[5] 82 79 83 const G4VNuclearDensity * nuclearDensity=the 80 const G4VNuclearDensity * nuclearDensity=theNucleus->GetNuclearDensity(); 84 81 85 G4ThreeVector pos(y[0],y[1],y[2]); 82 G4ThreeVector pos(y[0],y[1],y[2]); 86 G4double deriv = theFactor*nuclearDensity->G 83 G4double deriv = theFactor*nuclearDensity->GetDeriv(pos); 87 84 88 dydx[3] = yMod == 0 ? 0 : -deriv*y[0]/yMod*c 85 dydx[3] = yMod == 0 ? 0 : -deriv*y[0]/yMod*c_light; 89 dydx[4] = yMod == 0 ? 0 : -deriv*y[1]/yMod*c 86 dydx[4] = yMod == 0 ? 0 : -deriv*y[1]/yMod*c_light; 90 dydx[5] = yMod == 0 ? 0 : -deriv*y[2]/yMod*c 87 dydx[5] = yMod == 0 ? 0 : -deriv*y[2]/yMod*c_light; 91 } 88 } 92 89 93 // Here by design, but it is unnecessary for n << 90 94 void G4KM_OpticalEqRhs::SetChargeMomentumMass( << 91 95 { << 92 96 } << 97 93