G4KM_NucleonEqRhs.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // -------------------------------------------------------------------
00028 //      GEANT 4 class implementation file 
00029 //
00030 //      CERN, Geneva, Switzerland
00031 //
00032 //      File name:     G4KM_NucleonEqRhs.cc
00033 //
00034 //      Author:        Alessandro Brunengo (Alessandro.Brunengo@ge.infn.it)
00035 // 
00036 //      Creation date: 5 June 2000
00037 // -------------------------------------------------------------------
00038 
00039 #include "G4KM_NucleonEqRhs.hh"
00040 #include "G4VNuclearDensity.hh"
00041 
00042 #include "G4PhysicalConstants.hh"
00043 
00044 G4KM_NucleonEqRhs::G4KM_NucleonEqRhs(G4KM_DummyField *field,
00045                                      G4V3DNucleus * nucleus) :
00046   G4Mag_EqRhs(field), theNucleus(nucleus)
00047 {
00048   theMass = 0.;
00049   A = theNucleus->GetMassNumber();
00050   factor = hbarc*hbarc*std::pow(3.*pi2*A,2./3.)/3.;
00051 }
00052 
00053 
00054 void G4KM_NucleonEqRhs::EvaluateRhsGivenB(const G4double y[],
00055                                           const G4double *,
00056                                           G4double dydx[]) const
00057 {
00058   G4double yMod = std::sqrt(y[0]*y[0]+y[1]*y[1]+y[2]*y[2]);
00059   G4double e = std::sqrt(theMass*theMass+y[3]*y[3]+y[4]*y[4]+y[5]*y[5]);
00060 
00061 // y[0..2] is position
00062 // y[3..5] is momentum (and not mom.direction)
00063     
00064   dydx[0] = c_light*y[3]/e;   //
00065   dydx[1] = c_light*y[4]/e;   //  dq/dt=dH/dp = c*p/e
00066   dydx[2] = c_light*y[5]/e;   // 
00067 
00068 /*
00069  * // debug
00070  *  G4cout << " Nucleon RHS : 0..2(dpos/dt) " << 
00071  *       dydx[0] << " " <<
00072  *       dydx[1] << " " <<
00073  *       dydx[2] << " " << G4endl;
00074  */
00075 
00076       
00077 // V=K*rho(r) ==> dydx[3] = -dV/dr*dr/dx = -K*d(rho)/dr*dr/dx.
00078 // GF should be V=K*rho(r) ==> dydx[3] = -dV/dr*dr/dx = -K*d(rho)/dr*dr/dt
00079 // GF  and dV/dt = dE/dt ==> dp/dt = dE/dt * dp/dE = dE/dt *e/p
00080 // Idem for dydx[4] and dydx[5]
00081 
00082   G4ThreeVector pos(y[0],y[1],y[2]);
00083 
00084   const G4VNuclearDensity * nuclearDensity=theNucleus->GetNuclearDensity();
00085 
00086 // do not check for theMass != 0 : it is an error and core dump will signal it
00087 
00088   G4double density=  nuclearDensity->GetDensity(pos);
00089   G4double deriv(0);
00090   if (density > 0 ) deriv = (factor/theMass)*
00091                         std::pow(density, -1./3.)*nuclearDensity->GetDeriv(pos);
00092 
00093 //  dydx[3] = yMod == 0 ? 0 : -deriv*y[0]/yMod;
00094 //  dydx[4] = yMod == 0 ? 0 : -deriv*y[1]/yMod;
00095 //  dydx[5] = yMod == 0 ? 0 : -deriv*y[2]/yMod;
00096   dydx[3] = yMod == 0 ? 0 : deriv*y[0]/yMod*c_light;
00097   dydx[4] = yMod == 0 ? 0 : deriv*y[1]/yMod*c_light;
00098   dydx[5] = yMod == 0 ? 0 : deriv*y[2]/yMod*c_light;
00099 
00100 
00101 /*
00102  * // debug
00103  * G4cout << " Nucleon RHS : 3..5(dE/dt) " << 
00104  *       dydx[3] << " " <<
00105  *       dydx[4] << " " <<
00106  *       dydx[5] << " " << G4endl;
00107  */
00108 }
00109 
00110 
00111 
00112 

Generated on Mon May 27 17:48:43 2013 for Geant4 by  doxygen 1.4.7