Import Geant4 10.2.0 source tree
This commit is contained in:
+342
-197
@@ -23,128 +23,253 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4LivermoreGammaConversionModelRC.cc 74822 2013-10-22 14:42:13Z gcosmo $
|
||||
//
|
||||
// Author: Francesco Longo & Gerardo Depaola
|
||||
// on base of G4LivermoreGammaConversionModel
|
||||
//
|
||||
// History:
|
||||
// --------
|
||||
// 12 Apr 2009 V Ivanchenko Cleanup initialisation and generation of secondaries:
|
||||
// - apply internal high-energy limit only in constructor
|
||||
// - do not apply low-energy limit (default is 0)
|
||||
// - use CLHEP electron mass for low-enegry limit
|
||||
// - remove MeanFreePath method and table
|
||||
|
||||
// Author: Sebastien Incerti
|
||||
// 22 January 2012
|
||||
// on base of G4LivermoreGammaConversionModelRC (original version)
|
||||
// and G4LivermoreRayleighModel (MT version)
|
||||
|
||||
#include "G4LivermoreGammaConversionModelRC.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
#include "G4Log.hh"
|
||||
#include "G4Exp.hh"
|
||||
#include "G4Electron.hh"
|
||||
#include "G4Positron.hh"
|
||||
#include "G4Gamma.hh"
|
||||
#include "G4ParticleChangeForGamma.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
using namespace std;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4LivermoreGammaConversionModelRC::G4LivermoreGammaConversionModelRC(const G4ParticleDefinition*,
|
||||
const G4String& nam)
|
||||
:G4VEmModel(nam),fParticleChange(0),smallEnergy(2.*MeV),isInitialised(false),
|
||||
crossSectionHandler(0),meanFreePathTable(0)
|
||||
G4int G4LivermoreGammaConversionModelRC::maxZ = 99;
|
||||
G4LPhysicsFreeVector* G4LivermoreGammaConversionModelRC::data[] = {0};
|
||||
|
||||
G4LivermoreGammaConversionModelRC::G4LivermoreGammaConversionModelRC
|
||||
(const G4ParticleDefinition*, const G4String& nam)
|
||||
:G4VEmModel(nam),isInitialised(false),smallEnergy(2.*MeV)
|
||||
{
|
||||
lowEnergyLimit = 4.0*electron_mass_c2;
|
||||
highEnergyLimit = 100 * GeV;
|
||||
SetHighEnergyLimit(highEnergyLimit);
|
||||
fParticleChange = 0;
|
||||
|
||||
lowEnergyLimit = 2.0*electron_mass_c2;
|
||||
|
||||
verboseLevel= 0;
|
||||
// Verbosity scale:
|
||||
// Verbosity scale for debugging purposes:
|
||||
// 0 = nothing
|
||||
// 1 = warning for energy non-conservation
|
||||
// 2 = details of energy budget
|
||||
// 3 = calculation of cross sections, file openings, sampling of atoms
|
||||
// 4 = entering in methods
|
||||
// 1 = calculation of cross sections, file openings...
|
||||
// 2 = entering in methods
|
||||
|
||||
if(verboseLevel > 0) {
|
||||
G4cout << "Livermore Gamma conversion is constructed " << G4endl
|
||||
<< "Energy range: "
|
||||
<< lowEnergyLimit / MeV << " MeV - "
|
||||
<< highEnergyLimit / GeV << " GeV"
|
||||
<< G4endl;
|
||||
if(verboseLevel > 0)
|
||||
{
|
||||
G4cout << "G4LivermoreGammaConversionModelRC is constructed " << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4LivermoreGammaConversionModelRC::~G4LivermoreGammaConversionModelRC()
|
||||
{
|
||||
if (crossSectionHandler) delete crossSectionHandler;
|
||||
{
|
||||
if(IsMaster()) {
|
||||
for(G4int i=0; i<maxZ; ++i) {
|
||||
if(data[i]) {
|
||||
delete data[i];
|
||||
data[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void
|
||||
G4LivermoreGammaConversionModelRC::Initialise(const G4ParticleDefinition*,
|
||||
const G4DataVector&)
|
||||
void G4LivermoreGammaConversionModelRC::Initialise(
|
||||
const G4ParticleDefinition* particle,
|
||||
const G4DataVector& cuts)
|
||||
{
|
||||
if (verboseLevel > 3)
|
||||
G4cout << "Calling G4LivermoreGammaConversionModelRC::Initialise()" << G4endl;
|
||||
|
||||
if (crossSectionHandler)
|
||||
if (verboseLevel > 1)
|
||||
{
|
||||
crossSectionHandler->Clear();
|
||||
delete crossSectionHandler;
|
||||
}
|
||||
|
||||
// Read data tables for all materials
|
||||
|
||||
crossSectionHandler = new G4CrossSectionHandler();
|
||||
crossSectionHandler->Initialise(0,lowEnergyLimit,100.*GeV,400);
|
||||
G4String crossSectionFile = "pair/pp-cs-";
|
||||
crossSectionHandler->LoadData(crossSectionFile);
|
||||
|
||||
//
|
||||
|
||||
if (verboseLevel > 2)
|
||||
G4cout << "Loaded cross section files for Livermore Gamma Conversion model RC" << G4endl;
|
||||
|
||||
if (verboseLevel > 0) {
|
||||
G4cout << "Livermore Gamma Conversion model is initialized " << G4endl
|
||||
G4cout << "Calling Initialise() of G4LivermoreGammaConversionModelRC."
|
||||
<< G4endl
|
||||
<< "Energy range: "
|
||||
<< LowEnergyLimit() / MeV << " MeV - "
|
||||
<< HighEnergyLimit() / GeV << " GeV"
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
if(isInitialised) return;
|
||||
if(IsMaster())
|
||||
{
|
||||
|
||||
// Initialise element selector
|
||||
|
||||
InitialiseElementSelectors(particle, cuts);
|
||||
|
||||
// Access to elements
|
||||
|
||||
char* path = getenv("G4LEDATA");
|
||||
|
||||
G4ProductionCutsTable* theCoupleTable =
|
||||
G4ProductionCutsTable::GetProductionCutsTable();
|
||||
|
||||
G4int numOfCouples = theCoupleTable->GetTableSize();
|
||||
|
||||
for(G4int i=0; i<numOfCouples; ++i)
|
||||
{
|
||||
const G4Material* material =
|
||||
theCoupleTable->GetMaterialCutsCouple(i)->GetMaterial();
|
||||
const G4ElementVector* theElementVector = material->GetElementVector();
|
||||
G4int nelm = material->GetNumberOfElements();
|
||||
|
||||
for (G4int j=0; j<nelm; ++j)
|
||||
{
|
||||
G4int Z = (G4int)(*theElementVector)[j]->GetZ();
|
||||
if(Z < 1) { Z = 1; }
|
||||
else if(Z > maxZ) { Z = maxZ; }
|
||||
if(!data[Z]) { ReadData(Z, path); }
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isInitialised) { return; }
|
||||
fParticleChange = GetParticleChangeForGamma();
|
||||
isInitialised = true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4LivermoreGammaConversionModelRC::InitialiseLocal(
|
||||
const G4ParticleDefinition*, G4VEmModel* masterModel)
|
||||
{
|
||||
SetElementSelectors(masterModel->GetElementSelectors());
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4double
|
||||
G4LivermoreGammaConversionModelRC::MinPrimaryEnergy(const G4Material*,
|
||||
const G4ParticleDefinition*,
|
||||
G4double)
|
||||
{
|
||||
return lowEnergyLimit;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4LivermoreGammaConversionModelRC::ReadData(size_t Z, const char* path)
|
||||
{
|
||||
if (verboseLevel > 1)
|
||||
{
|
||||
G4cout << "Calling ReadData() of G4LivermoreGammaConversionModelRC"
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
if(data[Z]) { return; }
|
||||
|
||||
const char* datadir = path;
|
||||
|
||||
if(!datadir)
|
||||
{
|
||||
datadir = getenv("G4LEDATA");
|
||||
if(!datadir)
|
||||
{
|
||||
G4Exception("G4LivermoreGammaConversionModelRC::ReadData()",
|
||||
"em0006",FatalException,
|
||||
"Environment variable G4LEDATA not defined");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
data[Z] = new G4LPhysicsFreeVector();
|
||||
|
||||
//
|
||||
|
||||
std::ostringstream ost;
|
||||
ost << datadir << "/livermore/pair/pp-cs-" << Z <<".dat";
|
||||
std::ifstream fin(ost.str().c_str());
|
||||
|
||||
if( !fin.is_open())
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << "G4LivermoreGammaConversionModelRC data file <" << ost.str().c_str()
|
||||
<< "> is not opened!" << G4endl;
|
||||
G4Exception("G4LivermoreGammaConversionModelRC::ReadData()",
|
||||
"em0003",FatalException,
|
||||
ed,"G4LEDATA version should be G4EMLOW6.27 or later.");
|
||||
return;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
|
||||
if(verboseLevel > 3) { G4cout << "File " << ost.str()
|
||||
<< " is opened by G4LivermoreGammaConversionModelRC" << G4endl;}
|
||||
|
||||
data[Z]->Retrieve(fin, true);
|
||||
}
|
||||
|
||||
// Activation of spline interpolation
|
||||
data[Z] ->SetSpline(true);
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4double
|
||||
G4LivermoreGammaConversionModelRC::ComputeCrossSectionPerAtom(const G4ParticleDefinition*,
|
||||
G4double GammaEnergy,
|
||||
G4double Z, G4double,
|
||||
G4double, G4double)
|
||||
{
|
||||
if (verboseLevel > 3) {
|
||||
if (verboseLevel > 1)
|
||||
{
|
||||
G4cout << "Calling ComputeCrossSectionPerAtom() of G4LivermoreGammaConversionModelRC"
|
||||
<< G4endl;
|
||||
}
|
||||
if (GammaEnergy < lowEnergyLimit || GammaEnergy > highEnergyLimit) return 0;
|
||||
|
||||
G4double cs = crossSectionHandler->FindValue(G4int(Z), GammaEnergy);
|
||||
return cs;
|
||||
if (GammaEnergy < lowEnergyLimit) { return 0.0; }
|
||||
|
||||
G4double xs = 0.0;
|
||||
|
||||
G4int intZ=G4int(Z);
|
||||
|
||||
if(intZ < 1 || intZ > maxZ) { return xs; }
|
||||
|
||||
G4LPhysicsFreeVector* pv = data[intZ];
|
||||
|
||||
// if element was not initialised
|
||||
// do initialisation safely for MT mode
|
||||
if(!pv)
|
||||
{
|
||||
InitialiseForElement(0, intZ);
|
||||
pv = data[intZ];
|
||||
if(!pv) { return xs; }
|
||||
}
|
||||
// x-section is taken from the table
|
||||
xs = pv->Value(GammaEnergy);
|
||||
|
||||
if(verboseLevel > 0)
|
||||
{
|
||||
G4int n = pv->GetVectorLength() - 1;
|
||||
G4cout << "****** DEBUG: tcs value for Z=" << Z << " at energy (MeV)="
|
||||
<< GammaEnergy/MeV << G4endl;
|
||||
G4cout << " cs (Geant4 internal unit)=" << xs << G4endl;
|
||||
G4cout << " -> first cs value in EADL data file (iu) =" << (*pv)[0] << G4endl;
|
||||
G4cout << " -> last cs value in EADL data file (iu) =" << (*pv)[n] << G4endl;
|
||||
G4cout << "*********************************************************" << G4endl;
|
||||
}
|
||||
|
||||
return xs;
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4LivermoreGammaConversionModelRC::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
|
||||
const G4MaterialCutsCouple* couple,
|
||||
const G4DynamicParticle* aDynamicGamma,
|
||||
G4double,
|
||||
G4double)
|
||||
void G4LivermoreGammaConversionModelRC::SampleSecondaries(
|
||||
std::vector<G4DynamicParticle*>* fvect,
|
||||
const G4MaterialCutsCouple* couple,
|
||||
const G4DynamicParticle* aDynamicGamma,
|
||||
G4double, G4double)
|
||||
{
|
||||
|
||||
// The energies of the e+ e- secondaries are sampled using the Bethe - Heitler
|
||||
@@ -157,44 +282,44 @@ void G4LivermoreGammaConversionModelRC::SampleSecondaries(std::vector<G4DynamicP
|
||||
// pair creation in both nuclear and atomic electron fields. However triplet
|
||||
// prodution is not generated.
|
||||
|
||||
if (verboseLevel > 3)
|
||||
G4cout << "Calling SampleSecondaries() of G4LivermoreGammaConversionModelRC" << G4endl;
|
||||
if (verboseLevel > 1) {
|
||||
G4cout << "Calling SampleSecondaries() of G4LivermoreGammaConversionModelRC"
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
G4double photonEnergy = aDynamicGamma->GetKineticEnergy();
|
||||
G4ParticleMomentum photonDirection = aDynamicGamma->GetMomentumDirection();
|
||||
|
||||
G4double epsilon ;
|
||||
G4double epsilon0Local = electron_mass_c2 / photonEnergy ;
|
||||
G4double electronTotEnergy;
|
||||
G4double positronTotEnergy;
|
||||
|
||||
G4double electronTotEnergy = 0.0;
|
||||
G4double positronTotEnergy = 0.0;
|
||||
G4double HardPhotonEnergy = 0.0;
|
||||
|
||||
|
||||
|
||||
|
||||
// Do it fast if photon energy < 2. MeV
|
||||
if (photonEnergy < smallEnergy )
|
||||
{
|
||||
epsilon = epsilon0Local + (0.5 - epsilon0Local) * G4UniformRand();
|
||||
|
||||
if (G4int(2*G4UniformRand()))
|
||||
{
|
||||
electronTotEnergy = (1. - epsilon) * photonEnergy;
|
||||
positronTotEnergy = epsilon * photonEnergy;
|
||||
}
|
||||
else
|
||||
{
|
||||
positronTotEnergy = (1. - epsilon) * photonEnergy;
|
||||
electronTotEnergy = epsilon * photonEnergy;
|
||||
}
|
||||
if (G4UniformRand() > 0.5)
|
||||
{
|
||||
electronTotEnergy = (1. - epsilon) * photonEnergy;
|
||||
positronTotEnergy = epsilon * photonEnergy;
|
||||
}
|
||||
else
|
||||
{
|
||||
positronTotEnergy = (1. - epsilon) * photonEnergy;
|
||||
electronTotEnergy = epsilon * photonEnergy;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Select randomly one element in the current material
|
||||
//const G4Element* element = crossSectionHandler->SelectRandomElement(couple,photonEnergy);
|
||||
|
||||
const G4ParticleDefinition* particle = aDynamicGamma->GetDefinition();
|
||||
const G4Element* element = SelectRandomAtom(couple,particle,photonEnergy);
|
||||
G4cout << "G4LivermoreGammaConversionModelRC::SampleSecondaries" << G4endl;
|
||||
|
||||
|
||||
if (element == 0)
|
||||
{
|
||||
G4cout << "G4LivermoreGammaConversionModelRC::SampleSecondaries - element = 0"
|
||||
@@ -208,109 +333,120 @@ void G4LivermoreGammaConversionModelRC::SampleSecondaries(std::vector<G4DynamicP
|
||||
<< G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Extract Coulomb factor for this Element
|
||||
G4double fZ = 8. * (ionisation->GetlogZ3());
|
||||
if (photonEnergy > 50. * MeV) fZ += 8. * (element->GetfCoulomb());
|
||||
|
||||
|
||||
// Limits of the screening variable
|
||||
G4double screenFactor = 136. * epsilon0Local / (element->GetIonisation()->GetZ3()) ;
|
||||
G4double screenMax = std::exp ((42.24 - fZ)/8.368) - 0.952 ;
|
||||
G4double screenMax = G4Exp ((42.24 - fZ)/8.368) - 0.952 ;
|
||||
G4double screenMin = std::min(4.*screenFactor,screenMax) ;
|
||||
|
||||
|
||||
// Limits of the energy sampling
|
||||
G4double epsilon1 = 0.5 - 0.5 * std::sqrt(1. - screenMin / screenMax) ;
|
||||
G4double epsilonMin = std::max(epsilon0Local,epsilon1);
|
||||
G4double epsilonRange = 0.5 - epsilonMin ;
|
||||
|
||||
|
||||
// Sample the energy rate of the created electron (or positron)
|
||||
G4double screen;
|
||||
G4double gReject ;
|
||||
|
||||
|
||||
G4double f10 = ScreenFunction1(screenMin) - fZ;
|
||||
G4double f20 = ScreenFunction2(screenMin) - fZ;
|
||||
G4double normF1 = std::max(f10 * epsilonRange * epsilonRange,0.);
|
||||
G4double normF2 = std::max(1.5 * f20,0.);
|
||||
|
||||
// Method for Radiative corrections
|
||||
|
||||
G4double a=393.3750918, b=115.3070201, c=810.6428451, d=19.96497475, e=1016.874592, f=1.936685510,
|
||||
gLocal=751.2140962, h=0.099751048, i=299.9466339, j=0.002057250, k=49.81034926;
|
||||
gLocal=751.2140962, h=0.099751048, i=299.9466339, j=0.002057250, k=49.81034926;
|
||||
G4double aa=-18.6371131, bb=-1729.95248, cc=9450.971186, dd=106336.0145, ee=55143.09287, ff=-117602.840,
|
||||
gg=-721455.467, hh=693957.8635, ii=156266.1085, jj=533209.9347;
|
||||
gg=-721455.467, hh=693957.8635, ii=156266.1085, jj=533209.9347;
|
||||
G4double Rechazo = 0.;
|
||||
G4double logepsMin = log(epsilonMin);
|
||||
G4double NormaRC = a + b*logepsMin + c/logepsMin + d*pow(logepsMin,2.) + e/pow(logepsMin,2.) + f*pow(logepsMin,3.) +
|
||||
gLocal/pow(logepsMin,3.) + h*pow(logepsMin,4.) + i/pow(logepsMin,4.) + j*pow(logepsMin,5.) +
|
||||
k/pow(logepsMin,5.);
|
||||
|
||||
|
||||
G4double HardPhotonThreshold = 0.08;
|
||||
gLocal/pow(logepsMin,3.) + h*pow(logepsMin,4.) + i/pow(logepsMin,4.) + j*pow(logepsMin,5.) +
|
||||
k/pow(logepsMin,5.);
|
||||
|
||||
G4double HardPhotonThreshold = 0.08;
|
||||
G4double r1, r2, r3, beta=0, gbeta, sigt = 582.068, sigh, rejet;
|
||||
// , Pi = 2.*acos(0.);
|
||||
G4double cg = (11./2.)/(exp(-11.*HardPhotonThreshold/2.)-exp(-11./2.));
|
||||
|
||||
|
||||
r1 = G4UniformRand();
|
||||
sigh = 1028.58*exp(-HardPhotonThreshold/0.09033) + 136.63; // sigma hard
|
||||
sigh = 1028.58*exp(-HardPhotonThreshold/0.09033) + 136.63; // sigma hard
|
||||
|
||||
|
||||
if (r1 > 1.- sigh/sigt) {
|
||||
r2 = G4UniformRand();
|
||||
rejet = 0.;
|
||||
while (r2 > rejet) {
|
||||
while (r2 > rejet) {
|
||||
r3 = G4UniformRand();
|
||||
beta = (-2./11.)*log(exp(-0.08*11./2.)-r3*11./(2.*cg));
|
||||
gbeta = exp(-11.*beta/2.);
|
||||
rejet = fbeta(beta)/(8000.*gbeta);
|
||||
}
|
||||
HardPhotonEnergy = beta * photonEnergy;
|
||||
HardPhotonEnergy = beta * photonEnergy;
|
||||
}
|
||||
else{
|
||||
HardPhotonEnergy = 0.;
|
||||
}
|
||||
|
||||
photonEnergy -= HardPhotonEnergy;
|
||||
|
||||
do {
|
||||
do {
|
||||
if (normF1 / (normF1 + normF2) > G4UniformRand() )
|
||||
{
|
||||
epsilon = 0.5 - epsilonRange * std::pow(G4UniformRand(), 0.3333) ;
|
||||
screen = screenFactor / (epsilon * (1. - epsilon));
|
||||
gReject = (ScreenFunction1(screen) - fZ) / f10 ;
|
||||
}
|
||||
else
|
||||
{
|
||||
epsilon = epsilonMin + epsilonRange * G4UniformRand();
|
||||
screen = screenFactor / (epsilon * (1 - epsilon));
|
||||
gReject = (ScreenFunction2(screen) - fZ) / f20 ;
|
||||
}
|
||||
} while ( gReject < G4UniformRand() );
|
||||
|
||||
if (G4int(2*G4UniformRand())) epsilon = (1. - epsilon); // Extención de Epsilon hasta 1.
|
||||
|
||||
G4double logepsilon = log(epsilon);
|
||||
G4double deltaP_R1 = 1. + (a + b*logepsilon + c/logepsilon + d*pow(logepsilon,2.) + e/pow(logepsilon,2.) +
|
||||
f*pow(logepsilon,3.) + gLocal/pow(logepsilon,3.) + h*pow(logepsilon,4.) + i/pow(logepsilon,4.) +
|
||||
j*pow(logepsilon,5.) + k/pow(logepsilon,5.))/100.;
|
||||
G4double deltaP_R2 = 1.+((aa + cc*logepsilon + ee*pow(logepsilon,2.) + gg*pow(logepsilon,3.) + ii*pow(logepsilon,4.))
|
||||
/ (1. + bb*logepsilon + dd*pow(logepsilon,2.) + ff*pow(logepsilon,3.) + hh*pow(logepsilon,4.)
|
||||
+ jj*pow(logepsilon,5.) ))/100.;
|
||||
|
||||
if (epsilon <= 0.5)
|
||||
{
|
||||
Rechazo = deltaP_R1/NormaRC;
|
||||
}
|
||||
else
|
||||
{
|
||||
Rechazo = deltaP_R2/NormaRC;
|
||||
}
|
||||
G4cout << Rechazo << " " << NormaRC << " " << epsilon << G4endl;
|
||||
} while (Rechazo < G4UniformRand() );
|
||||
|
||||
do
|
||||
{
|
||||
do
|
||||
{
|
||||
if (normF1 / (normF1 + normF2) > G4UniformRand() )
|
||||
{
|
||||
epsilon = 0.5 - epsilonRange * std::pow(G4UniformRand(), 0.333333) ;
|
||||
screen = screenFactor / (epsilon * (1. - epsilon));
|
||||
gReject = (ScreenFunction1(screen) - fZ) / f10 ;
|
||||
}
|
||||
else
|
||||
{
|
||||
epsilon = epsilonMin + epsilonRange * G4UniformRand();
|
||||
screen = screenFactor / (epsilon * (1 - epsilon));
|
||||
gReject = (ScreenFunction2(screen) - fZ) / f20 ;
|
||||
}
|
||||
} while ( gReject < G4UniformRand() );
|
||||
|
||||
|
||||
|
||||
if (G4UniformRand()>0.5) epsilon = (1. - epsilon); // Extención de Epsilon hasta 1.
|
||||
|
||||
G4double logepsilon = log(epsilon);
|
||||
G4double deltaP_R1 = 1. + (a + b*logepsilon + c/logepsilon + d*pow(logepsilon,2.) + e/pow(logepsilon,2.) +
|
||||
f*pow(logepsilon,3.) + gLocal/pow(logepsilon,3.) + h*pow(logepsilon,4.) + i/pow(logepsilon,4.) +
|
||||
j*pow(logepsilon,5.) + k/pow(logepsilon,5.))/100.;
|
||||
G4double deltaP_R2 = 1.+((aa + cc*logepsilon + ee*pow(logepsilon,2.) + gg*pow(logepsilon,3.) + ii*pow(logepsilon,4.))
|
||||
/ (1. + bb*logepsilon + dd*pow(logepsilon,2.) + ff*pow(logepsilon,3.) + hh*pow(logepsilon,4.)
|
||||
+ jj*pow(logepsilon,5.) ))/100.;
|
||||
|
||||
if (epsilon <= 0.5)
|
||||
{
|
||||
Rechazo = deltaP_R1/NormaRC;
|
||||
}
|
||||
else
|
||||
{
|
||||
Rechazo = deltaP_R2/NormaRC;
|
||||
}
|
||||
//G4cout << Rechazo << " " << NormaRC << " " << epsilon << G4endl;
|
||||
|
||||
} while (Rechazo < G4UniformRand() );
|
||||
|
||||
electronTotEnergy = (1. - epsilon) * photonEnergy;
|
||||
positronTotEnergy = epsilon * photonEnergy;
|
||||
|
||||
|
||||
} // End of epsilon sampling
|
||||
|
||||
|
||||
|
||||
// Fix charges randomly
|
||||
|
||||
|
||||
|
||||
|
||||
// Scattered electron (positron) angles. ( Z - axis along the parent photon)
|
||||
// Universal distribution suggested by L. Urban (Geant3 manual (1993) Phys211),
|
||||
// derived from Tsai distribution (Rev. Mod. Phys. 49, 421 (1977)
|
||||
@@ -323,11 +459,11 @@ void G4LivermoreGammaConversionModelRC::SampleSecondaries(std::vector<G4DynamicP
|
||||
// if (9. / (9. + d) > G4UniformRand())
|
||||
if (0.25 > G4UniformRand())
|
||||
{
|
||||
u = - std::log(G4UniformRand() * G4UniformRand()) / a1 ;
|
||||
u = - G4Log(G4UniformRand() * G4UniformRand()) / a1 ;
|
||||
}
|
||||
else
|
||||
{
|
||||
u = - std::log(G4UniformRand() * G4UniformRand()) / a2 ;
|
||||
u = - G4Log(G4UniformRand() * G4UniformRand()) / a2 ;
|
||||
}
|
||||
|
||||
G4double thetaEle = u*electron_mass_c2/electronTotEnergy;
|
||||
@@ -344,8 +480,6 @@ void G4LivermoreGammaConversionModelRC::SampleSecondaries(std::vector<G4DynamicP
|
||||
|
||||
G4double electronKineEnergy = std::max(0.,electronTotEnergy - electron_mass_c2) ;
|
||||
|
||||
// SI - The range test has been removed wrt original G4LowEnergyGammaconversion class
|
||||
|
||||
G4ThreeVector electronDirection (dxEle, dyEle, dzEle);
|
||||
electronDirection.rotateUz(photonDirection);
|
||||
|
||||
@@ -353,11 +487,9 @@ void G4LivermoreGammaConversionModelRC::SampleSecondaries(std::vector<G4DynamicP
|
||||
electronDirection,
|
||||
electronKineEnergy);
|
||||
|
||||
// The e+ is always created (even with kinetic energy = 0) for further annihilation
|
||||
// The e+ is always created
|
||||
G4double positronKineEnergy = std::max(0.,positronTotEnergy - electron_mass_c2) ;
|
||||
|
||||
// SI - The range test has been removed wrt original G4LowEnergyGammaconversion class
|
||||
|
||||
G4ThreeVector positronDirection (dxPos, dyPos, dzPos);
|
||||
positronDirection.rotateUz(photonDirection);
|
||||
|
||||
@@ -366,10 +498,9 @@ void G4LivermoreGammaConversionModelRC::SampleSecondaries(std::vector<G4DynamicP
|
||||
positronDirection,
|
||||
positronKineEnergy);
|
||||
// Fill output vector
|
||||
// G4cout << "Cree el e+ " << epsilon << G4endl;
|
||||
fvect->push_back(particle1);
|
||||
fvect->push_back(particle2);
|
||||
|
||||
|
||||
if (HardPhotonEnergy > 0.)
|
||||
{
|
||||
G4double thetaHardPhoton = u*electron_mass_c2/HardPhotonEnergy;
|
||||
@@ -377,16 +508,15 @@ void G4LivermoreGammaConversionModelRC::SampleSecondaries(std::vector<G4DynamicP
|
||||
G4double dxHardP= std::sin(thetaHardPhoton)*std::cos(phi);
|
||||
G4double dyHardP= std::sin(thetaHardPhoton)*std::sin(phi);
|
||||
G4double dzHardP =std::cos(thetaHardPhoton);
|
||||
|
||||
|
||||
G4ThreeVector hardPhotonDirection (dxHardP, dyHardP, dzHardP);
|
||||
hardPhotonDirection.rotateUz(photonDirection);
|
||||
G4DynamicParticle* particle3 = new G4DynamicParticle (G4Gamma::Gamma(),
|
||||
hardPhotonDirection,
|
||||
hardPhotonDirection,
|
||||
HardPhotonEnergy);
|
||||
fvect->push_back(particle3);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// kill incident photon
|
||||
fParticleChange->SetProposedKineticEnergy(0.);
|
||||
fParticleChange->ProposeTrackStatus(fStopAndKill);
|
||||
@@ -402,7 +532,7 @@ G4double G4LivermoreGammaConversionModelRC::ScreenFunction1(G4double screenVaria
|
||||
G4double value;
|
||||
|
||||
if (screenVariable > 1.)
|
||||
value = 42.24 - 8.368 * std::log(screenVariable + 0.952);
|
||||
value = 42.24 - 8.368 * G4Log(screenVariable + 0.952);
|
||||
else
|
||||
value = 42.392 - screenVariable * (7.796 - 1.961 * screenVariable);
|
||||
|
||||
@@ -418,55 +548,70 @@ G4double G4LivermoreGammaConversionModelRC::ScreenFunction2(G4double screenVaria
|
||||
G4double value;
|
||||
|
||||
if (screenVariable > 1.)
|
||||
value = 42.24 - 8.368 * std::log(screenVariable + 0.952);
|
||||
value = 42.24 - 8.368 * G4Log(screenVariable + 0.952);
|
||||
else
|
||||
value = 41.405 - screenVariable * (5.828 - 0.8945 * screenVariable);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4LivermoreGammaConversionModelRC::fbeta(G4double x)
|
||||
{
|
||||
// compute the probabililty distribution for hard photon
|
||||
G4double Pi, gamma, eta, d, p1, p2, p3, p4, p5, p6, p7, ffbeta;
|
||||
gamma = (1.-x)*(1.-x)/x;
|
||||
eta = (1.-x)/(1.+x);
|
||||
d = Dilog(1./x)-Dilog(x);
|
||||
Pi = 2.*acos(0.);
|
||||
p1 = -1.*(25528.*pow(gamma,2) + 116044.* gamma +151556.)/105.;
|
||||
p2 = 256.* pow(gamma,3) + 1092.* pow(gamma,2) +1260.*gamma + 420.;
|
||||
p3 = (676.*pow(gamma,3) + 9877.*pow(gamma,2) + 58415.*gamma + 62160.)/105.;
|
||||
p4 = 64.*pow(gamma,3) + 305.*pow(gamma,2) + 475.*gamma + 269. - 276./gamma;
|
||||
p5 = (676.*pow(gamma,3) + 38109.*pow(gamma,2) + 211637.*gamma + 266660. - 53632./gamma)/105.;
|
||||
p6 = 32.*pow(gamma,2) + 416.*gamma + 1310. +1184./gamma;
|
||||
p7 = 128.*pow(gamma,3) + 802.*pow(gamma,2) + 1028.*gamma - 470. - 1184./gamma;
|
||||
ffbeta = (1.-x) * (p1 + p2*Pi*Pi/6. + p3*log(gamma) +
|
||||
p4*pow(log(x),2) + (p5 + p6*log(gamma))*eta*log(x) + p7*d*eta);
|
||||
|
||||
return ffbeta;
|
||||
// compute the probabililty distribution for hard photon
|
||||
G4double Pi, gamma, eta, d, p1, p2, p3, p4, p5, p6, p7, ffbeta;
|
||||
gamma = (1.-x)*(1.-x)/x;
|
||||
eta = (1.-x)/(1.+x);
|
||||
d = Dilog(1./x)-Dilog(x);
|
||||
Pi = 2.*acos(0.);
|
||||
p1 = -1.*(25528.*pow(gamma,2) + 116044.* gamma +151556.)/105.;
|
||||
p2 = 256.* pow(gamma,3) + 1092.* pow(gamma,2) +1260.*gamma + 420.;
|
||||
p3 = (676.*pow(gamma,3) + 9877.*pow(gamma,2) + 58415.*gamma + 62160.)/105.;
|
||||
p4 = 64.*pow(gamma,3) + 305.*pow(gamma,2) + 475.*gamma + 269. - 276./gamma;
|
||||
p5 = (676.*pow(gamma,3) + 38109.*pow(gamma,2) + 211637.*gamma + 266660. - 53632./gamma)/105.;
|
||||
p6 = 32.*pow(gamma,2) + 416.*gamma + 1310. +1184./gamma;
|
||||
p7 = 128.*pow(gamma,3) + 802.*pow(gamma,2) + 1028.*gamma - 470. - 1184./gamma;
|
||||
ffbeta = (1.-x) * (p1 + p2*Pi*Pi/6. + p3*log(gamma) +
|
||||
p4*pow(log(x),2) + (p5 + p6*log(gamma))*eta*log(x) + p7*d*eta);
|
||||
return ffbeta;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4double G4LivermoreGammaConversionModelRC::Dilog(G4double y)
|
||||
{
|
||||
G4double fdilog = 0.0;
|
||||
G4double Pi = 2.*acos(0.); // serve?
|
||||
if (y <= 0.5) {
|
||||
fdilog = pow(Pi,2)/6. + (1.-y)*(log(1-y)-1.)+pow((1.-y),2)*((1./2.)*log(1.-y)-1./4.)
|
||||
+pow((1.-y),3)*((1./3.)*log(1.-y)-1./9.)+pow((1.-y),4)*((1./4.)*log(1.-y)-1./16.);
|
||||
}
|
||||
if (0.5 < y && y < 2.) {
|
||||
fdilog = 1.-y+pow((1.-y),2)/4.+pow((1.-y),3)/9.+pow((1.-y),4)/16.+
|
||||
pow((1.-y),5)/25.+pow((1.-y),6)/36.+pow((1.-y),7)/49.;
|
||||
}
|
||||
if (y >= 2.) {
|
||||
fdilog = -pow(log(y),2)/2. - pow(Pi,2)/6. + (log(y)+1.)/y +
|
||||
(log(y)/2.+1./4.)/pow(y,2) + (log(y)/3.+1./9.)/pow(y,3);
|
||||
}
|
||||
return fdilog;
|
||||
|
||||
G4double fdilog = 0.0;
|
||||
G4double Pi = 2.*acos(0.); // serve?
|
||||
if (y <= 0.5) {
|
||||
fdilog = pow(Pi,2)/6. + (1.-y)*(log(1-y)-1.)+pow((1.-y),2)*((1./2.)*log(1.-y)-1./4.)
|
||||
+pow((1.-y),3)*((1./3.)*log(1.-y)-1./9.)+pow((1.-y),4)*((1./4.)*log(1.-y)-1./16.);
|
||||
}
|
||||
if (0.5 < y && y < 2.) {
|
||||
fdilog = 1.-y+pow((1.-y),2)/4.+pow((1.-y),3)/9.+pow((1.-y),4)/16.+
|
||||
pow((1.-y),5)/25.+pow((1.-y),6)/36.+pow((1.-y),7)/49.;
|
||||
}
|
||||
if (y >= 2.) {
|
||||
fdilog = -pow(log(y),2)/2. - pow(Pi,2)/6. + (log(y)+1.)/y +
|
||||
(log(y)/2.+1./4.)/pow(y,2) + (log(y)/3.+1./9.)/pow(y,3);
|
||||
}
|
||||
return fdilog;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "G4AutoLock.hh"
|
||||
namespace { G4Mutex LivermoreGammaConversionModelRCMutex = G4MUTEX_INITIALIZER; }
|
||||
|
||||
void G4LivermoreGammaConversionModelRC::InitialiseForElement(
|
||||
const G4ParticleDefinition*,
|
||||
G4int Z)
|
||||
{
|
||||
G4AutoLock l(&LivermoreGammaConversionModelRCMutex);
|
||||
// G4cout << "G4LivermoreGammaConversionModelRC::InitialiseForElement Z= "
|
||||
// << Z << G4endl;
|
||||
if(!data[Z]) { ReadData(Z); }
|
||||
l.unlock();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Reference in New Issue
Block a user