Import Geant4 10.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-12-09 12:35:28 +01:00
parent 4ec577e5c4
commit a3452e42ac
3514 changed files with 210500 additions and 89628 deletions
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNAMeltonAttachmentModel.hh 96606 2016-04-25 13:33:42Z gcosmo $
// $Id: G4DNAMeltonAttachmentModel.hh 98733 2016-08-09 10:51:58Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -66,10 +66,14 @@ public:
inline void SetDissociationFlag(G4bool);
inline G4bool GetDissociationFlag();
inline void SelectStationary(G4bool input);
protected:
G4ParticleChangeForGamma* fParticleChangeForGamma;
private:
G4bool statCode;
// Water density table
const std::vector<G4double>* fpWaterDensity;
@@ -97,4 +101,11 @@ inline G4bool G4DNAMeltonAttachmentModel::GetDissociationFlag()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4DNAMeltonAttachmentModel::SelectStationary (G4bool input)
{
statCode = input;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -23,9 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNAMolecularReaction.hh 85244 2014-10-27 08:24:13Z gcosmo $
// $Id: G4DNAMolecularReaction.hh 100802 2016-11-02 14:55:27Z gcosmo $
//
// Author: Mathieu Karamitros, kara@cenbg.in2p3.fr
// Author: Mathieu Karamitros
// The code is developed in the framework of the ESA AO7146
//
@@ -23,9 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNAMolecularStepByStepModel.hh 94218 2015-11-09 08:24:48Z gcosmo $
// $Id: G4DNAMolecularStepByStepModel.hh 100802 2016-11-02 14:55:27Z gcosmo $
//
// Author: Mathieu Karamitros, kara@cenbg.in2p3.fr
// Author: Mathieu Karamitros
// The code is developed in the framework of the ESA AO7146
//
@@ -23,9 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNAMoleculeEncounterStepper.hh 91584 2015-07-27 13:01:48Z gcosmo $
// $Id: G4DNAMoleculeEncounterStepper.hh 100802 2016-11-02 14:55:27Z gcosmo $
//
// Author: Mathieu Karamitros, kara@cenbg.in2p3.fr
// Author: Mathieu Karamitros
// The code is developed in the framework of the ESA AO7146
//
@@ -23,9 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNAOneStepThermalizationModel.hh 96932 2016-05-18 09:07:51Z gcosmo $
// $Id: G4DNAOneStepThermalizationModel.hh 101354 2016-11-15 08:27:51Z gcosmo $
//
// Author: Mathieu Karamitros, kara@cenbg.in2p3.fr
// Author: Mathieu Karamitros
// The code is developed in the framework of the ESA AO7146
//
@@ -50,25 +50,61 @@
#include "G4VEmModel.hh"
class G4ITNavigator;
class G4Navigator;
namespace DNA{
namespace Penetration{
//-----------------------
/*
* Article: Jintana Meesungnoen, Jean-Paul Jay-Gerin,
* Abdelali Filali-Mouhim, and Samlee Mankhetkorn (2002)
* Low-Energy Electron Penetration Range in Liquid Water.
* Radiation Research: November 2002, Vol. 158, No. 5, pp.657-660.
*/
struct Meesungnoen2002{
static void GetPenetration(G4double energy,
G4ThreeVector& displacement);
static double GetRmean(double energy);
//-----
// Polynomial fit of Meesungnoen, 2002
static const double gCoeff[13];
};
//-----------------------
/*
* Article: Terrissol M, Beaudre A (1990) Simulation of space and time
* evolution of radiolytic species induced by electrons in water.
* Radiat Prot Dosimetry 31:171175
*/
struct Terrisol1990{
static void GetPenetration(G4double energy,
G4ThreeVector& displacement);
static double GetRmean(double energy);
static double Get3DStdDeviation(double energy);
//-----
// Terrisol, 1990
static const double gEnergies_T1990[11];
static const double gStdDev_T1990[11];
};
}
}
/**
* When an electron reaches the highest energy domain of G4DNAOneStepThermalizationModel,
* it is then automatically converted into a solvated electron and displace from its original
* position using a published thermalization statistic.
*
* Article: Jintana Meesungnoen, Jean-Paul Jay-Gerin,
* Abdelali Filali-Mouhim, and Samlee Mankhetkorn (2002)
* Low-Energy Electron Penetration Range in Liquid Water.
* Radiation Research: November 2002, Vol. 158, No. 5, pp. 657-660.
* When an electron reaches the highest energy domain of
* G4DNAOneStepThermalizationModel,
* it is then automatically converted into a solvated electron and displace
* from its original position using a published thermalization statistic.
*/
class G4DNAOneStepThermalizationModel : public G4VEmModel
template<typename MODEL=DNA::Penetration::Meesungnoen2002>
class G4TDNAOneStepThermalizationModel : public G4VEmModel
{
public:
G4DNAOneStepThermalizationModel(const G4ParticleDefinition* p = 0,
typedef MODEL Model;
G4TDNAOneStepThermalizationModel(const G4ParticleDefinition* p = 0,
const G4String& nam =
"DNAOneStepThermalizationModel");
virtual ~G4DNAOneStepThermalizationModel();
virtual ~G4TDNAOneStepThermalizationModel();
virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
@@ -84,27 +120,35 @@ public:
G4double tmin,
G4double maxEnergy);
inline void SetVerbose(int);
inline void SetVerbose(int flag){
fVerboseLevel = flag;
}
void GetPenetration(G4double energy,
G4ThreeVector& displacement);
double GetRmean(double energy);
protected:
const std::vector<G4double>* fpWaterDensity;
G4ThreeVector RadialDistributionOfProducts(G4double Rrms) const;
G4ParticleChangeForGamma* fParticleChangeForGamma;
G4bool fIsInitialised;
G4int fVerboseLevel;
G4ITNavigator* fNavigator;
G4Navigator* fNavigator;
private:
G4DNAOneStepThermalizationModel&
operator=(const G4DNAOneStepThermalizationModel &right);
G4DNAOneStepThermalizationModel(const G4DNAOneStepThermalizationModel&);
G4TDNAOneStepThermalizationModel&
operator=(const G4TDNAOneStepThermalizationModel &right);
G4TDNAOneStepThermalizationModel(const G4TDNAOneStepThermalizationModel&);
};
inline void G4DNAOneStepThermalizationModel::SetVerbose(int flag)
{
fVerboseLevel = flag;
}
#include "G4DNAOneStepThermalizationModel.hpp"
typedef G4TDNAOneStepThermalizationModel<DNA::Penetration::Meesungnoen2002> G4DNAOneStepThermalizationModel;
// typedef G4TDNAOneStepThermalizationModel<DNA::Penetration::Terrisol1990> G4DNAOneStepThermalizationModel;
// Note: if you use the above distribution, it would be
// better to follow the electrons down to 6 eV and only then apply
// the one step thermalization
#endif
@@ -0,0 +1,254 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNAOneStepThermalizationModel.cc 96841 2016-05-12 13:40:37Z matkara $
//
// Author: Mathieu Karamitros
//
// WARNING : This class is released as a prototype.
// It might strongly evolve or even disapear in the next releases.
//
// History:
// -----------
// 13 Nov 2016 M.Karamitros created
//
// -------------------------------------------------------------------
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4DNAWaterExcitationStructure.hh"
#include "G4ParticleChangeForGamma.hh"
#include "G4NistManager.hh"
#include "G4DNAChemistryManager.hh"
#include "G4DNAMolecularMaterial.hh"
#include "G4TransportationManager.hh"
#include "G4ITNavigator.hh"
#include "G4Navigator.hh"
//#define MODEL_VERBOSE
//------------------------------------------------------------------------------
template<typename MODEL>
G4TDNAOneStepThermalizationModel<MODEL>::
G4TDNAOneStepThermalizationModel(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;
}
//------------------------------------------------------------------------------
template<typename MODEL>
G4TDNAOneStepThermalizationModel<MODEL>::~G4TDNAOneStepThermalizationModel()
{
if(fNavigator)
{
// if(fNavigator->GetNavigatorState())
// delete fNavigator->GetNavigatorState();
delete fNavigator;
}
}
//------------------------------------------------------------------------------
template<typename MODEL>
void G4TDNAOneStepThermalizationModel<MODEL>::
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 G4Navigator();
if(navigator){ // add these checks for testing mode
auto world=navigator->GetWorldVolume();
if(world){
fNavigator->SetWorldVolume(world);
//fNavigator->NewNavigatorState();
}
}
fpWaterDensity =
G4DNAMolecularMaterial::Instance()->
GetNumMolPerVolTableFor(G4Material::GetMaterial("G4_WATER"));
}
//------------------------------------------------------------------------------
template<typename MODEL>
G4double G4TDNAOneStepThermalizationModel<MODEL>::
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.;
}
//------------------------------------------------------------------------------
template<typename MODEL>
double G4TDNAOneStepThermalizationModel<MODEL>::GetRmean(double k){
return MODEL::GetRmean(k);
}
//------------------------------------------------------------------------------
template<typename MODEL>
void G4TDNAOneStepThermalizationModel<MODEL>::
GetPenetration(G4double k, G4ThreeVector& displacement)
{
return MODEL::GetPenetration(k, displacement);
}
//------------------------------------------------------------------------------
template<typename MODEL>
void G4TDNAOneStepThermalizationModel<MODEL>::
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())
{
fParticleChangeForGamma->ProposeTrackStatus(fStopAndKill);
fParticleChangeForGamma->ProposeLocalEnergyDeposit(k);
if(G4DNAChemistryManager::IsActivated())
{
G4ThreeVector displacement(0,0,0);
GetPenetration(k, displacement);
//______________________________________________________________
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;
//--
// 6/09/16 - recupere de molecular dissocation
double mag_displacement = displacement.mag();
G4ThreeVector displacement_direction = displacement/mag_displacement;
// double step = DBL_MAX;
// step = fNavigator->CheckNextStep(theIncomingTrack->GetPosition(),
// displacement_direction,
// mag_displacement,
// safety);
//
//
// if(safety < mag_displacement)
// {
//// mag_displacement = prNewSafety;
// finalPosition = theIncomingTrack->GetPosition()
// + (displacement/displacementMag)*safety*0.80;
// }
//--
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);
}
}
}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNASancheExcitationModel.hh 96606 2016-04-25 13:33:42Z gcosmo $
// $Id: G4DNASancheExcitationModel.hh 98733 2016-08-09 10:51:58Z gcosmo $
// GEANT4 tag $Name: $
//
@@ -77,11 +77,16 @@ public:
verboseLevel = verbose;
}
inline void SelectStationary(G4bool input);
protected:
G4ParticleChangeForGamma* fParticleChangeForGamma;
private:
G4bool statCode;
// Water density table
const std::vector<G4double>* fpWaterDensity;
@@ -125,6 +130,13 @@ inline void G4DNASancheExcitationModel::ExtendLowEnergyLimit(G4double threshold)
SetLowEnergyLimit(threshold);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4DNASancheExcitationModel::SelectStationary (G4bool input)
{
statCode = input;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -23,9 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNASmoluchowskiReactionModel.hh 91584 2015-07-27 13:01:48Z gcosmo $
// $Id: G4DNASmoluchowskiReactionModel.hh 100802 2016-11-02 14:55:27Z gcosmo $
//
// Author: Mathieu Karamitros, kara@cenbg.in2p3.fr
// Author: Mathieu Karamitros
// The code is developed in the framework of the ESA AO7146
//
@@ -23,9 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNATransformElectronModel.hh 85244 2014-10-27 08:24:13Z gcosmo $
// $Id: G4DNATransformElectronModel.hh 100802 2016-11-02 14:55:27Z gcosmo $
//
// Author: Mathieu Karamitros, kara@cenbg.in2p3.fr
// Author: Mathieu Karamitros
// The code is developed in the framework of the ESA AO7146
//
@@ -11,7 +11,7 @@
#
# Generated on : 24/9/2010
#
# $Id: sources.cmake 93936 2015-11-04 09:37:59Z gcosmo $
# $Id: sources.cmake 101354 2016-11-15 08:27:51Z gcosmo $
#
#------------------------------------------------------------------------------
@@ -74,6 +74,7 @@ GEANT4_DEFINE_MODULE(NAME G4emdna-models
G4DNARuddIonisationModel.hh
G4DNASancheExcitationModel.hh
G4DNAOneStepThermalizationModel.hh
G4DNAOneStepThermalizationModel.hpp
G4DNAScreenedRutherfordElasticModel.hh
G4DNATransformElectronModel.hh
G4DNAUeharaScreenedRutherfordElasticModel.hh
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNAMeltonAttachmentModel.cc 96606 2016-04-25 13:33:42Z gcosmo $
// $Id: G4DNAMeltonAttachmentModel.cc 98733 2016-08-09 10:51:58Z gcosmo $
//
// Created by Z. Francis
@@ -73,6 +73,10 @@ G4DNAMeltonAttachmentModel::G4DNAMeltonAttachmentModel(const G4ParticleDefinitio
fParticleChangeForGamma = 0;
fDissociationFlag = true;
fData = 0;
// Selection of stationary mode
statCode = false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -243,9 +247,19 @@ SampleSecondaries(std::vector<G4DynamicParticle*>* /*fvect*/,
// Electron is killed
G4double electronEnergy0 = aDynamicElectron->GetKineticEnergy();
fParticleChangeForGamma->SetProposedKineticEnergy(0.);
fParticleChangeForGamma->ProposeTrackStatus(fStopAndKill);
fParticleChangeForGamma->ProposeLocalEnergyDeposit(electronEnergy0);
if (!statCode)
{
fParticleChangeForGamma->SetProposedKineticEnergy(0.);
fParticleChangeForGamma->ProposeTrackStatus(fStopAndKill);
fParticleChangeForGamma->ProposeLocalEnergyDeposit(electronEnergy0);
}
else
{
fParticleChangeForGamma->SetProposedKineticEnergy(electronEnergy0);
fParticleChangeForGamma->ProposeLocalEnergyDeposit(electronEnergy0);
}
if(fDissociationFlag)
{
@@ -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;
}
}}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNASancheExcitationModel.cc 96606 2016-04-25 13:33:42Z gcosmo $
// $Id: G4DNASancheExcitationModel.cc 98733 2016-08-09 10:51:58Z gcosmo $
//
// Created by Z. Francis
@@ -72,6 +72,10 @@ G4DNASancheExcitationModel::G4DNASancheExcitationModel(const G4ParticleDefinitio
fParticleChangeForGamma = 0;
fpWaterDensity = 0;
// Selection of stationary mode
statCode = false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -271,9 +275,21 @@ void G4DNASancheExcitationModel::SampleSecondaries(std::vector<
if (electronEnergy0 < HighEnergyLimit() && newEnergy>0.)
{
fParticleChangeForGamma->ProposeMomentumDirection(aDynamicElectron->GetMomentumDirection());
fParticleChangeForGamma->SetProposedKineticEnergy(newEnergy);
fParticleChangeForGamma->ProposeLocalEnergyDeposit(excitationEnergy);
if (!statCode)
{
fParticleChangeForGamma->ProposeMomentumDirection(aDynamicElectron->GetMomentumDirection());
fParticleChangeForGamma->SetProposedKineticEnergy(newEnergy);
fParticleChangeForGamma->ProposeLocalEnergyDeposit(excitationEnergy);
}
else
{
fParticleChangeForGamma->ProposeMomentumDirection(aDynamicElectron->GetMomentumDirection());
fParticleChangeForGamma->SetProposedKineticEnergy(electronEnergy0);
fParticleChangeForGamma->ProposeLocalEnergyDeposit(excitationEnergy);
}
}
//