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_NucleonEqRhs.cc 29 // File name: G4KM_NucleonEqRhs.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_NucleonEqRhs.hh" 36 #include "G4KM_NucleonEqRhs.hh" >> 37 #include "G4NucleiPropertiesTable.hh" 40 #include "G4VNuclearDensity.hh" 38 #include "G4VNuclearDensity.hh" 41 39 42 #include "G4PhysicalConstants.hh" << 43 #include "G4Pow.hh" << 44 40 45 G4KM_NucleonEqRhs::G4KM_NucleonEqRhs(G4KM_Dumm 41 G4KM_NucleonEqRhs::G4KM_NucleonEqRhs(G4KM_DummyField *field, 46 G4V3DNucleus * nucleus) : 42 G4V3DNucleus * nucleus) : 47 G4Mag_EqRhs(field), theNucleus(nucleus) 43 G4Mag_EqRhs(field), theNucleus(nucleus) 48 { 44 { 49 theMass = 0.; 45 theMass = 0.; 50 A = theNucleus->GetMassNumber(); 46 A = theNucleus->GetMassNumber(); 51 factor = hbarc*hbarc*G4Pow::GetInstance()->A << 47 factor = hbarc*hbarc*std::pow(3.*pi2*A,2./3.)/3.; 52 } 48 } 53 49 54 50 55 void G4KM_NucleonEqRhs::EvaluateRhsGivenB(cons 51 void G4KM_NucleonEqRhs::EvaluateRhsGivenB(const G4double y[], 56 const G4double *, 52 const G4double *, 57 G4double dydx[]) const 53 G4double dydx[]) const 58 { 54 { 59 G4double yMod = std::sqrt(y[0]*y[0]+y[1]*y[1 55 G4double yMod = std::sqrt(y[0]*y[0]+y[1]*y[1]+y[2]*y[2]); 60 G4double e = std::sqrt(theMass*theMass+y[3]* 56 G4double e = std::sqrt(theMass*theMass+y[3]*y[3]+y[4]*y[4]+y[5]*y[5]); 61 57 62 // y[0..2] is position 58 // y[0..2] is position 63 // y[3..5] is momentum (and not mom.direction) 59 // y[3..5] is momentum (and not mom.direction) 64 60 65 dydx[0] = c_light*y[3]/e; // 61 dydx[0] = c_light*y[3]/e; // 66 dydx[1] = c_light*y[4]/e; // dq/dt=dH/dp 62 dydx[1] = c_light*y[4]/e; // dq/dt=dH/dp = c*p/e 67 dydx[2] = c_light*y[5]/e; // 63 dydx[2] = c_light*y[5]/e; // 68 64 69 /* 65 /* 70 * // debug 66 * // debug 71 * G4cout << " Nucleon RHS : 0..2(dpos/dt) " 67 * G4cout << " Nucleon RHS : 0..2(dpos/dt) " << 72 * dydx[0] << " " << 68 * dydx[0] << " " << 73 * dydx[1] << " " << 69 * dydx[1] << " " << 74 * dydx[2] << " " << G4endl; 70 * dydx[2] << " " << G4endl; 75 */ 71 */ 76 72 77 73 78 // V=K*rho(r) ==> dydx[3] = -dV/dr*dr/dx = -K* 74 // V=K*rho(r) ==> dydx[3] = -dV/dr*dr/dx = -K*d(rho)/dr*dr/dx. 79 // GF should be V=K*rho(r) ==> dydx[3] = -dV/d 75 // GF should be V=K*rho(r) ==> dydx[3] = -dV/dr*dr/dx = -K*d(rho)/dr*dr/dt 80 // GF and dV/dt = dE/dt ==> dp/dt = dE/dt * d 76 // GF and dV/dt = dE/dt ==> dp/dt = dE/dt * dp/dE = dE/dt *e/p 81 // Idem for dydx[4] and dydx[5] 77 // Idem for dydx[4] and dydx[5] 82 78 83 G4ThreeVector pos(y[0],y[1],y[2]); 79 G4ThreeVector pos(y[0],y[1],y[2]); 84 80 85 const G4VNuclearDensity * nuclearDensity=the 81 const G4VNuclearDensity * nuclearDensity=theNucleus->GetNuclearDensity(); 86 82 87 // do not check for theMass != 0 : it is an er 83 // do not check for theMass != 0 : it is an error and core dump will signal it 88 84 89 G4double density= nuclearDensity->GetDensit 85 G4double density= nuclearDensity->GetDensity(pos); 90 G4double deriv(0); 86 G4double deriv(0); 91 if (density > 0 ) deriv = (factor/theMass)/ << 87 if (density > 0 ) deriv = (factor/theMass)* 92 G4Pow::GetInstance()->A13(density)*nucle << 88 std::pow(density, -1./3.)*nuclearDensity->GetDeriv(pos); 93 89 94 // dydx[3] = yMod == 0 ? 0 : -deriv*y[0]/yMod 90 // dydx[3] = yMod == 0 ? 0 : -deriv*y[0]/yMod; 95 // dydx[4] = yMod == 0 ? 0 : -deriv*y[1]/yMod 91 // dydx[4] = yMod == 0 ? 0 : -deriv*y[1]/yMod; 96 // dydx[5] = yMod == 0 ? 0 : -deriv*y[2]/yMod 92 // dydx[5] = yMod == 0 ? 0 : -deriv*y[2]/yMod; 97 dydx[3] = yMod == 0 ? 0 : deriv*y[0]/yMod*c_ 93 dydx[3] = yMod == 0 ? 0 : deriv*y[0]/yMod*c_light; 98 dydx[4] = yMod == 0 ? 0 : deriv*y[1]/yMod*c_ 94 dydx[4] = yMod == 0 ? 0 : deriv*y[1]/yMod*c_light; 99 dydx[5] = yMod == 0 ? 0 : deriv*y[2]/yMod*c_ 95 dydx[5] = yMod == 0 ? 0 : deriv*y[2]/yMod*c_light; 100 96 101 97 102 /* 98 /* 103 * // debug 99 * // debug 104 * G4cout << " Nucleon RHS : 3..5(dE/dt) " << 100 * G4cout << " Nucleon RHS : 3..5(dE/dt) " << 105 * dydx[3] << " " << 101 * dydx[3] << " " << 106 * dydx[4] << " " << 102 * dydx[4] << " " << 107 * dydx[5] << " " << G4endl; 103 * dydx[5] << " " << G4endl; 108 */ 104 */ 109 } 105 } 110 106 111 // Here by design, but it is unnecessary for n << 107 112 void G4KM_NucleonEqRhs::SetChargeMomentumMass( << 108 113 { << 109 114 } << 115 110