Import Geant4 10.3.0 source tree
This commit is contained in:
+150
-232
@@ -23,9 +23,9 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4DNAOneStepThermalizationModel.cc 96861 2016-05-13 13:43:04Z gcosmo $
|
||||
// $Id: G4DNAOneStepThermalizationModel.cc 101807 2016-11-30 13:42:28Z gunter $
|
||||
//
|
||||
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
|
||||
// Author: Mathieu Karamitros
|
||||
//
|
||||
// WARNING : This class is released as a prototype.
|
||||
// It might strongly evolve or even disapear in the next releases.
|
||||
@@ -36,244 +36,162 @@
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include <algorithm>
|
||||
#include "G4DNAOneStepThermalizationModel.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4DNAWaterExcitationStructure.hh"
|
||||
#include "G4ParticleChangeForGamma.hh"
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4DNAChemistryManager.hh"
|
||||
#include "G4DNAMolecularMaterial.hh"
|
||||
#include "G4ITNavigator.hh"
|
||||
#include "G4Navigator.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4ITNavigator.hh"
|
||||
#include "G4Exp.hh"
|
||||
|
||||
//#define MODEL_VERBOSE
|
||||
|
||||
G4DNAOneStepThermalizationModel::
|
||||
G4DNAOneStepThermalizationModel(const G4ParticleDefinition*,
|
||||
const G4String& nam) :
|
||||
G4VEmModel(nam), fIsInitialised(false)
|
||||
{
|
||||
fVerboseLevel = 0;
|
||||
SetLowEnergyLimit(0.);
|
||||
G4DNAWaterExcitationStructure exStructure;
|
||||
SetHighEnergyLimit(exStructure.ExcitationEnergy(0));
|
||||
fParticleChangeForGamma = 0;
|
||||
fpWaterDensity = 0;
|
||||
fNavigator = 0;
|
||||
}
|
||||
#include "G4RandomDirection.hh"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
G4DNAOneStepThermalizationModel::~G4DNAOneStepThermalizationModel()
|
||||
{
|
||||
if(fNavigator)
|
||||
{
|
||||
if(fNavigator->GetNavigatorState())
|
||||
delete fNavigator->GetNavigatorState();
|
||||
delete fNavigator;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void G4DNAOneStepThermalizationModel::
|
||||
Initialise(const G4ParticleDefinition* particleDefinition,
|
||||
const G4DataVector&)
|
||||
{
|
||||
#ifdef MODEL_VERBOSE
|
||||
if(fVerboseLevel)
|
||||
G4cout << "Calling G4DNAOneStepThermalizationModel::Initialise()" << G4endl;
|
||||
#endif
|
||||
if (particleDefinition->GetParticleName() != "e-")
|
||||
{
|
||||
G4ExceptionDescription errMsg;
|
||||
errMsg << "G4DNAOneStepThermalizationModel can only be applied "
|
||||
"to electrons";
|
||||
G4Exception("G4DNAOneStepThermalizationModel::CrossSectionPerVolume",
|
||||
"G4DNAOneStepThermalizationModel001",
|
||||
FatalErrorInArgument,errMsg);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!fIsInitialised)
|
||||
{
|
||||
fIsInitialised = true;
|
||||
fParticleChangeForGamma = GetParticleChangeForGamma();
|
||||
}
|
||||
|
||||
G4Navigator* navigator =
|
||||
G4TransportationManager::GetTransportationManager()->
|
||||
GetNavigatorForTracking();
|
||||
|
||||
fNavigator = new G4ITNavigator();
|
||||
|
||||
fNavigator->SetWorldVolume(navigator->GetWorldVolume());
|
||||
fNavigator->NewNavigatorState();
|
||||
|
||||
fpWaterDensity =
|
||||
G4DNAMolecularMaterial::Instance()->
|
||||
GetNumMolPerVolTableFor(G4Material::GetMaterial("G4_WATER"));
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
G4double G4DNAOneStepThermalizationModel::
|
||||
CrossSectionPerVolume(const G4Material* material,
|
||||
const G4ParticleDefinition*,
|
||||
G4double ekin,
|
||||
G4double,
|
||||
G4double)
|
||||
{
|
||||
#ifdef MODEL_VERBOSE
|
||||
if(fVerboseLevel > 1)
|
||||
G4cout << "Calling CrossSectionPerVolume() of G4DNAOneStepThermalizationModel"
|
||||
<< G4endl;
|
||||
#endif
|
||||
|
||||
if(ekin > HighEnergyLimit())
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
G4double waterDensity = (*fpWaterDensity)[material->GetIndex()];
|
||||
|
||||
if(waterDensity!= 0.0)
|
||||
{
|
||||
return DBL_MAX;
|
||||
}
|
||||
return 0.;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
G4ThreeVector G4DNAOneStepThermalizationModel::
|
||||
RadialDistributionOfProducts(G4double expectationValue) const
|
||||
{
|
||||
G4double sigma = std::sqrt(1.57) / 2 * expectationValue;
|
||||
|
||||
G4double XValueForfMax = std::sqrt(2. * sigma * sigma);
|
||||
G4double fMaxValue = std::sqrt(2. / 3.14)
|
||||
* 1. / (sigma * sigma * sigma)
|
||||
* (XValueForfMax * XValueForfMax)
|
||||
* G4Exp(-1. / 2. * (XValueForfMax * XValueForfMax)
|
||||
/ (sigma * sigma));
|
||||
|
||||
G4double R;
|
||||
|
||||
do
|
||||
{
|
||||
G4double aRandomfValue = fMaxValue * G4UniformRand();
|
||||
|
||||
G4double sign;
|
||||
if(G4UniformRand() > 0.5)
|
||||
{
|
||||
sign = +1.;
|
||||
namespace DNA{ namespace Penetration{
|
||||
|
||||
const double
|
||||
Meesungnoen2002::gCoeff[13] =
|
||||
{ -4.06217193e-08, 3.06848412e-06, -9.93217814e-05,
|
||||
1.80172797e-03, -2.01135480e-02, 1.42939448e-01,
|
||||
-6.48348714e-01, 1.85227848e+00, -3.36450378e+00,
|
||||
4.37785068e+00, -4.20557339e+00, 3.81679083e+00,
|
||||
-2.34069784e-01 };
|
||||
// fit from Meesungnoen, 2002
|
||||
|
||||
const double
|
||||
Terrisol1990::gEnergies_T1990[11] =
|
||||
{ 0.2, 0.5, 1, 2, 3, 4, 5, 6, 7,
|
||||
// The two last are not in the dataset
|
||||
8, 9}; // eV
|
||||
|
||||
const double
|
||||
Terrisol1990::gStdDev_T1990[11] =
|
||||
{ 17.68*CLHEP::angstrom,
|
||||
22.3*CLHEP::angstrom,
|
||||
28.49*CLHEP::angstrom,
|
||||
45.35*CLHEP::angstrom,
|
||||
70.03*CLHEP::angstrom,
|
||||
98.05*CLHEP::angstrom,
|
||||
120.56*CLHEP::angstrom,
|
||||
132.73*CLHEP::angstrom,
|
||||
142.60*CLHEP::angstrom,
|
||||
// the above value as given in the paper's table does not match
|
||||
// b=27.22 nm nor the mean value. 129.62*CLHEP::angstrom could be
|
||||
// a better fit.
|
||||
//
|
||||
// The two last are made up
|
||||
137.9*CLHEP::angstrom,
|
||||
120.7*CLHEP::angstrom
|
||||
}; // angstrom
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
double Meesungnoen2002::GetRmean(double k){
|
||||
G4double k_eV = k/eV;
|
||||
|
||||
if(k_eV>0.1){ // data until 0.2 eV
|
||||
G4double r_mean = 0;
|
||||
for(int8_t i=12; i!=-1 ; --i){
|
||||
r_mean+=gCoeff[12-i]*std::pow(k_eV,i);
|
||||
}
|
||||
r_mean*=CLHEP::nanometer;
|
||||
return r_mean;
|
||||
}
|
||||
else
|
||||
{
|
||||
sign = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Meesungnoen2002::GetPenetration(G4double k,
|
||||
G4ThreeVector& displacement){
|
||||
displacement=G4ThreeVector(0,0,0);
|
||||
G4double k_eV = k/eV;
|
||||
|
||||
if(k_eV>0.1){ // data until 0.2 eV
|
||||
G4double r_mean = 0;
|
||||
for(int8_t i=12; i!=-1 ; --i){
|
||||
r_mean+=gCoeff[12-i]*std::pow(k_eV,i);
|
||||
}
|
||||
|
||||
r_mean*=nanometer;
|
||||
|
||||
//G4cout << "rmean = " << r_mean << G4endl;
|
||||
|
||||
static constexpr double r2s=0.62665706865775006; //sqrt(CLHEP::pi)/pow(2,3./2.)
|
||||
|
||||
// Use r_mean to build a 3D gaussian
|
||||
double sigma3D = r_mean*r2s;
|
||||
double x = G4RandGauss::shoot(0,sigma3D);
|
||||
double y = G4RandGauss::shoot(0,sigma3D);
|
||||
double z = G4RandGauss::shoot(0,sigma3D);
|
||||
displacement=G4ThreeVector(x,y,z);
|
||||
}
|
||||
|
||||
R = expectationValue + sign*3.*sigma* G4UniformRand();
|
||||
G4double f = std::sqrt(2./3.14) * 1/std::pow(sigma, 3)
|
||||
* R*R * G4Exp(-1./2. * R*R/(sigma*sigma));
|
||||
|
||||
if(aRandomfValue < f)
|
||||
{
|
||||
break;
|
||||
else{
|
||||
displacement=G4RandomDirection()*(1e-3*CLHEP::nanometer);
|
||||
// rare events:
|
||||
// prevent H2O and secondary electron to be at the spot
|
||||
}
|
||||
}
|
||||
while(1);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
double Terrisol1990::Get3DStdDeviation(double energy){
|
||||
G4double k_eV = energy/eV;
|
||||
if(k_eV < 0.2) return 1e-3*CLHEP::nanometer;
|
||||
// rare events:
|
||||
// prevent H2O and secondary electron to be at the spot
|
||||
|
||||
if(k_eV == 9.) return gStdDev_T1990[10];
|
||||
// TODO if k_eV > 9
|
||||
|
||||
G4double costheta = (2. * G4UniformRand()-1.);
|
||||
G4double theta = std::acos(costheta);
|
||||
G4double phi = 2. * pi * G4UniformRand();
|
||||
size_t lowBin, upBin;
|
||||
|
||||
if(k_eV >= 1.){
|
||||
lowBin=std::floor(k_eV)+1;
|
||||
upBin=std::min(lowBin+1, size_t(10));
|
||||
}
|
||||
else{
|
||||
auto it=std::lower_bound(&gEnergies_T1990[0],
|
||||
&gEnergies_T1990[2],
|
||||
k_eV);
|
||||
lowBin = it-&gEnergies_T1990[0];
|
||||
upBin = lowBin+1;
|
||||
}
|
||||
|
||||
double lowE = gEnergies_T1990[lowBin];
|
||||
double upE = gEnergies_T1990[upBin];
|
||||
|
||||
// G4cout << lowE << " " << upE << G4endl;
|
||||
|
||||
double lowS = gStdDev_T1990[lowBin];
|
||||
double upS = gStdDev_T1990[upBin];
|
||||
|
||||
double tanA = (lowS-upS)/(lowE-upE);
|
||||
double sigma3D = lowS + (k_eV-lowE)*tanA;
|
||||
return sigma3D;
|
||||
}
|
||||
|
||||
double Terrisol1990::GetRmean(double energy){
|
||||
double sigma3D=Get3DStdDeviation(energy);
|
||||
|
||||
static constexpr double s2r=1.595769121605731;
|
||||
// pow(2,3./2.)/sqrt(CLHEP::pi)
|
||||
|
||||
double r_mean=sigma3D*s2r;
|
||||
return r_mean;
|
||||
}
|
||||
|
||||
void Terrisol1990::GetPenetration(G4double energy,
|
||||
G4ThreeVector& displacement){
|
||||
double sigma3D=Get3DStdDeviation(energy);
|
||||
// G4cout << "sigma3D = " << sigma3D/CLHEP::nanometer << G4endl;
|
||||
|
||||
static constexpr double factor = 2.20496999539;
|
||||
// 1./(3. - 8./CLHEP::pi);
|
||||
|
||||
double sigma1D = std::sqrt(std::pow(sigma3D, 2.)*factor);
|
||||
|
||||
// G4cout << "sigma1D = " << sigma1D/CLHEP::nanometer << G4endl;
|
||||
|
||||
G4double xDirection = R * std::cos(phi) * std::sin(theta);
|
||||
G4double yDirection = R * std::sin(theta) * std::sin(phi);
|
||||
G4double zDirection = R * costheta;
|
||||
G4ThreeVector RandDirection = G4ThreeVector(xDirection,
|
||||
yDirection,
|
||||
zDirection);
|
||||
|
||||
return RandDirection;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void G4DNAOneStepThermalizationModel::
|
||||
SampleSecondaries(std::vector<G4DynamicParticle*>*,
|
||||
const G4MaterialCutsCouple*,
|
||||
const G4DynamicParticle* particle,
|
||||
G4double,
|
||||
G4double)
|
||||
{
|
||||
#ifdef MODEL_VERBOSE
|
||||
if(fVerboseLevel)
|
||||
G4cout << "Calling SampleSecondaries() of G4DNAOneStepThermalizationModel"
|
||||
<< G4endl;
|
||||
#endif
|
||||
|
||||
G4double k = particle->GetKineticEnergy();
|
||||
|
||||
if (k <= HighEnergyLimit())
|
||||
{
|
||||
G4double k_eV = k/eV;
|
||||
|
||||
fParticleChangeForGamma->ProposeTrackStatus(fStopAndKill);
|
||||
fParticleChangeForGamma->ProposeLocalEnergyDeposit(k);
|
||||
|
||||
if(G4DNAChemistryManager::IsActivated())
|
||||
{
|
||||
|
||||
G4double r_mean =
|
||||
(-0.003*std::pow(k_eV,6)
|
||||
+ 0.0749*std::pow(k_eV,5)
|
||||
- 0.7197*std::pow(k_eV,4)
|
||||
+ 3.1384*std::pow(k_eV,3)
|
||||
- 5.6926*std::pow(k_eV,2)
|
||||
+ 5.6237*k_eV
|
||||
- 0.7883)*nanometer;
|
||||
|
||||
G4ThreeVector displacement = RadialDistributionOfProducts (r_mean);
|
||||
|
||||
//______________________________________________________________
|
||||
const G4Track * theIncomingTrack =
|
||||
fParticleChangeForGamma->GetCurrentTrack();
|
||||
G4ThreeVector finalPosition(theIncomingTrack->GetPosition()+displacement);
|
||||
|
||||
fNavigator->SetWorldVolume(theIncomingTrack->GetTouchable()->
|
||||
GetVolume(theIncomingTrack->GetTouchable()->
|
||||
GetHistoryDepth()));
|
||||
|
||||
double displacementMag = displacement.mag();
|
||||
double safety = DBL_MAX;
|
||||
G4ThreeVector direction = displacement/displacementMag;
|
||||
|
||||
fNavigator->ResetHierarchyAndLocate(theIncomingTrack->GetPosition(),
|
||||
direction,
|
||||
*((G4TouchableHistory*)
|
||||
theIncomingTrack->GetTouchable()));
|
||||
|
||||
fNavigator->ComputeStep(theIncomingTrack->GetPosition(),
|
||||
displacement/displacementMag,
|
||||
displacementMag,
|
||||
safety);
|
||||
|
||||
if(safety <= displacementMag)
|
||||
{
|
||||
finalPosition = theIncomingTrack->GetPosition()
|
||||
+ (displacement/displacementMag)*safety*0.80;
|
||||
}
|
||||
|
||||
G4DNAChemistryManager::Instance()->CreateSolvatedElectron(theIncomingTrack,
|
||||
&finalPosition);
|
||||
|
||||
fParticleChangeForGamma->SetProposedKineticEnergy(25.e-3*eV);
|
||||
}
|
||||
}
|
||||
}
|
||||
double x = G4RandGauss::shoot(0.,sigma1D);
|
||||
double y = G4RandGauss::shoot(0.,sigma1D);
|
||||
double z = G4RandGauss::shoot(0.,sigma1D);
|
||||
displacement=G4ThreeVector(x,y,z);
|
||||
// G4cout << "displacement[nm]: "
|
||||
// << displacement.mag()/CLHEP::nanometer << G4endl;
|
||||
}
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user