Import Geant4 11.0.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2021-06-25 16:12:29 +02:00
parent c968e26a39
commit 6399a014b6
4200 changed files with 207479 additions and 237366 deletions
@@ -351,9 +351,10 @@ static const G4float e73[78] = { 18.11f, 23.3f, 27.86f, 31.99f, 35.83f, 42.84f,
void G4ASTARStopping::AddData(const G4float* stop, const G4Material* mat)
{
G4LPhysicsFreeVector* v = new G4LPhysicsFreeVector(78, T0[0], T0[77]);
for(size_t i=0; i<78; ++i) { v->PutValues(i, T0[i], ((G4double)stop[i])*fac); }
v->SetSpline(true);
G4PhysicsFreeVector* v = new G4PhysicsFreeVector(78, T0[0], T0[77], true);
for(size_t i=0; i<78; ++i) {
v->PutValues(i, T0[i], ((G4double)stop[i])*fac);
}
v->FillSecondDerivatives();
materials.push_back(mat);
sdata.push_back(v);
@@ -273,10 +273,9 @@ G4double G4AtimaEnergyLossModel::ComputeDEDXPerVolume(const G4Material* material
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4AtimaEnergyLossModel::CorrectionsAlongStep(const G4MaterialCutsCouple* couple,
const G4DynamicParticle* dp,
G4double& eloss,
G4double&,
G4double length)
const G4DynamicParticle* dp,
const G4double& length,
G4double& eloss)
{
if(isIon) {
const G4ParticleDefinition* p = dp->GetDefinition();
@@ -73,7 +73,7 @@ G4double G4AtimaFluctuations::tableE[] = {0.0};
G4AtimaFluctuations::G4AtimaFluctuations(const G4String& nam)
: G4VEmFluctuationModel(nam),
particle(0),
particle(nullptr),
particleMass(CLHEP::proton_mass_c2),
charge(1.0),
chargeSquare(1.0),
@@ -113,17 +113,16 @@ void G4AtimaFluctuations::InitialiseMe(const G4ParticleDefinition* part)
charge = part->GetPDGCharge()/eplus;
chargeSquare = charge*charge;
effChargeSquare= chargeSquare;
uniFluct.InitialiseMe(part);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double
G4AtimaFluctuations::SampleFluctuations(const G4MaterialCutsCouple* couple,
const G4DynamicParticle* dp,
G4double tmax,
G4double length,
G4double meanLoss)
const G4DynamicParticle* dp,
G4double tmax,
G4double length,
G4double meanLoss)
{
// G4cout << "### meanLoss= " << meanLoss << G4endl;
if(meanLoss <= minLoss) return meanLoss;
@@ -199,7 +198,7 @@ G4double G4AtimaFluctuations::Dispersion(const G4Material* mat,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4AtimaFluctuations::SetParticleAndCharge(const G4ParticleDefinition* part,
G4double q2)
G4double q2)
{
if(part != particle) {
particle = part;
@@ -208,12 +207,11 @@ void G4AtimaFluctuations::SetParticleAndCharge(const G4ParticleDefinition* part,
chargeSquare = charge*charge;
}
effChargeSquare = q2;
uniFluct.SetParticleAndCharge(part, q2);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4AtimaFluctuations::EnergyTable_interpolate(const G4double* table, G4double xval,const G4double* y){
G4double G4AtimaFluctuations::EnergyTable_interpolate(const G4double* table, G4double xval, const G4double* y){
G4double r;
G4int num=200;
G4double lxval = G4Log(xval)/MLN10;
@@ -573,5 +571,3 @@ const G4double G4AtimaFluctuations::ls_X_coefficients_ahi[110][200]=
{1.01126,1.01197,1.01271,1.0135,1.01432,1.01519,1.01611,1.01708,1.01809,1.01917,1.0203,1.02149,1.02275,1.02408,1.02548,1.02696,1.02852,1.03016,1.0319,1.03373,1.03566,1.0377,1.03985,1.04212,1.04452,1.04705,1.04971,1.05253,1.05549,1.05862,1.06192,1.0654,1.06907,1.07294,1.07701,1.0813,1.08583,1.09059,1.0956,1.10088,1.10644,1.11228,1.11843,1.12489,1.13167,1.1388,1.14629,1.15414,1.16238,1.17101,1.18005,1.18952,1.19942,1.20978,1.22059,1.23189,1.24367,1.25594,1.26872,1.28202,1.29584,1.31019,1.32507,1.34049,1.35645,1.37295,1.38998,1.40754,1.42562,1.44422,1.46332,1.48291,1.50297,1.52348,1.54442,1.56576,1.58748,1.60954,1.63191,1.65455,1.67743,1.7005,1.72372,1.74704,1.77041,1.79378,1.8171,1.84033,1.86339,1.88624,1.90883,1.93109,1.95298,1.97445,1.99543,2.01589,2.03577,2.05503,2.07364,2.09154,2.10871,2.12512,2.14074,2.15555,2.16953,2.18267,2.19497,2.20642,2.21702,2.22679,2.23571,2.24383,2.25114,2.25766,2.26343,2.26847,2.2728,2.27645,2.27944,2.28181,2.28358,2.28479,2.28545,2.28559,2.28524,2.28442,2.28314,2.28142,2.27929,2.27674,2.27379,2.27044,2.2667,2.26257,2.25804,2.25312,2.24778,2.24203,2.23584,2.22921,2.22211,2.21453,2.20644,2.19782,2.18863,2.17886,2.16846,2.1574,2.14565,2.13318,2.11993,2.10588,2.09096,2.07516,2.0584,2.04065,2.02187,2.00199,1.98096,1.95875,1.93529,1.91054,1.88445,1.85697,1.82805,1.79765,1.76573,1.73227,1.69722,1.66058,1.62232,1.58246,1.54099,1.49795,1.45338,1.40733,1.35989,1.31114,1.26121,1.21025,1.15842,1.10592,1.05296,0.999789,0.946659,0.893843,0.841623,0.790283,0.7401,0.691337,0.644234,0.598992,0.555777,0.514707,0.475849,0.439226,0.404811,0.372549,0.342355,0.314138},
{1.01107,1.01177,1.0125,1.01328,1.01409,1.01495,1.01585,1.0168,1.0178,1.01886,1.01997,1.02115,1.02239,1.0237,1.02508,1.02653,1.02807,1.02969,1.0314,1.0332,1.0351,1.03711,1.03923,1.04147,1.04383,1.04632,1.04895,1.05172,1.05465,1.05773,1.06099,1.06442,1.06804,1.07185,1.07588,1.08012,1.08458,1.08929,1.09425,1.09947,1.10496,1.11074,1.11683,1.12322,1.12995,1.13702,1.14444,1.15223,1.16041,1.16898,1.17797,1.18738,1.19724,1.20755,1.21833,1.22959,1.24134,1.2536,1.26637,1.27967,1.2935,1.30787,1.32279,1.33825,1.35427,1.37085,1.38798,1.40565,1.42387,1.44263,1.4619,1.48169,1.50198,1.52274,1.54396,1.5656,1.58765,1.61007,1.63283,1.6559,1.67922,1.70277,1.72649,1.75034,1.77428,1.79824,1.82219,1.84605,1.86979,1.89334,1.91664,1.93965,1.9623,1.98454,2.00632,2.02758,2.04828,2.06837,2.0878,2.10654,2.12455,2.14179,2.15824,2.17388,2.18868,2.20263,2.21572,2.22794,2.2393,2.24979,2.25944,2.26824,2.27621,2.28338,2.28975,2.29537,2.30025,2.30441,2.30789,2.31071,2.31291,2.3145,2.31552,2.31599,2.31593,2.31537,2.31432,2.3128,2.31083,2.30842,2.30558,2.3023,2.29861,2.2945,2.28996,2.285,2.27959,2.27375,2.26745,2.26067,2.2534,2.24562,2.23731,2.22844,2.21898,2.20891,2.19819,2.18678,2.17467,2.16179,2.14813,2.13362,2.11824,2.10194,2.08466,2.06637,2.04701,2.02654,2.00489,1.98203,1.9579,1.93246,1.90564,1.87741,1.84773,1.81654,1.78381,1.74951,1.71361,1.6761,1.63696,1.5962,1.55383,1.50987,1.46439,1.41743,1.36908,1.31944,1.26864,1.21684,1.1642,1.11092,1.05724,1.00339,0.94964,0.896264,0.843547,0.791776,0.741226,0.692157,0.644807,0.599371,0.556007,0.514825,0.475882,0.439192,0.404725,0.372418,0.342184,0.31393}
};
@@ -50,8 +50,6 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
using namespace std;
G4BetheBlochIonGasModel::G4BetheBlochIonGasModel(const G4ParticleDefinition* p,
const G4String& nam) : G4BetheBlochModel(p,nam), currentCharge(0.0)
{}
@@ -65,7 +63,7 @@ G4BetheBlochIonGasModel::~G4BetheBlochIonGasModel()
G4double G4BetheBlochIonGasModel::ChargeSquareRatio(const G4Track& track)
{
currentCharge = track.GetDynamicParticle()->GetCharge()/eplus;
currentCharge = track.GetDynamicParticle()->GetCharge()/CLHEP::eplus;
G4double q2 = currentCharge*currentCharge;
SetChargeSquareRatio(q2);
return q2;
@@ -76,8 +74,7 @@ G4double G4BetheBlochIonGasModel::ChargeSquareRatio(const G4Track& track)
G4double G4BetheBlochIonGasModel::GetParticleCharge(const G4ParticleDefinition*,
const G4Material*, G4double)
{
return currentCharge*eplus;
return currentCharge*CLHEP::eplus;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -62,6 +62,7 @@
#include "G4Electron.hh"
#include "G4LossTableManager.hh"
#include "G4EmCorrections.hh"
#include "G4EmParameters.hh"
#include "G4ParticleChangeForLoss.hh"
#include "G4ICRU90StoppingData.hh"
#include "G4Log.hh"
@@ -328,18 +329,17 @@ G4double G4BetheBlochModel::ComputeDEDXPerVolume(const G4Material* material,
void G4BetheBlochModel::CorrectionsAlongStep(const G4MaterialCutsCouple* couple,
const G4DynamicParticle* dp,
G4double& eloss,
G4double&,
G4double length)
const G4double& length,
G4double& eloss)
{
if(isIon) {
const G4Material* mat = couple->GetMaterial();
const G4ParticleDefinition* p = dp->GetDefinition();
G4double preKinEnergy = dp->GetKineticEnergy();
const G4double preKinEnergy = dp->GetKineticEnergy();
G4double e = preKinEnergy - eloss*0.5;
if(e < preKinEnergy*0.75) { e = preKinEnergy*0.75; }
G4double q2 = corr->EffectiveChargeSquareRatio(p,mat,e);
const G4double q2 = corr->EffectiveChargeSquareRatio(p,mat,e);
GetModelOfFluctuations()->SetParticleAndCharge(p, q2);
G4double qfactor = q2*corr->EffectiveChargeCorrection(p,mat,e)/corrFactor;
@@ -351,10 +351,13 @@ void G4BetheBlochModel::CorrectionsAlongStep(const G4MaterialCutsCouple* couple,
}
G4double elossnew = eloss*qfactor + highOrder;
eloss = std::max(std::min(elossnew,preKinEnergy),eloss*0.5);
//G4cout << "G4BetheBlochModel::CorrectionsAlongStep: e= " << preKinEnergy
// << " qfactor= " << qfactor
// << " highOrder= " << highOrder << " ("
// << highOrder/eloss << ")" << G4endl;
/*
G4cout << "G4BetheBlochModel::CorrectionsAlongStep: e= " << preKinEnergy
<< " qfactor= " << qfactor
<< " highOrder= " << highOrder << " ("
<< highOrder/eloss << ")"
" q2= " << q2 << " corrFactor= " << corrFactor << G4endl;
*/
}
}
@@ -367,17 +370,16 @@ void G4BetheBlochModel::SampleSecondaries(vector<G4DynamicParticle*>* vdp,
G4double maxEnergy)
{
G4double kineticEnergy = dp->GetKineticEnergy();
G4double tmax = MaxSecondaryEnergy(dp->GetDefinition(),kineticEnergy);
G4double maxKinEnergy = std::min(maxEnergy,tmax);
const G4double tmax = MaxSecondaryEnergy(dp->GetDefinition(),kineticEnergy);
const G4double maxKinEnergy = std::min(maxEnergy,tmax);
if(minKinEnergy >= maxKinEnergy) { return; }
//G4cout << "G4BetheBlochModel::SampleSecondaries Emin= " << minKinEnergy
// << " Emax= " << maxKinEnergy << G4endl;
G4double totEnergy = kineticEnergy + mass;
G4double etot2 = totEnergy*totEnergy;
G4double beta2 = kineticEnergy*(kineticEnergy + 2.0*mass)/etot2;
const G4double totEnergy = kineticEnergy + mass;
const G4double etot2 = totEnergy*totEnergy;
const G4double beta2 = kineticEnergy*(kineticEnergy + 2.0*mass)/etot2;
G4double deltaKinEnergy, f;
G4double f1 = 0.0;
@@ -427,13 +429,11 @@ void G4BetheBlochModel::SampleSecondaries(vector<G4DynamicParticle*>* vdp,
G4ThreeVector deltaDirection;
if(UseAngularGeneratorFlag()) {
const G4Material* mat = couple->GetMaterial();
G4int Z = SelectRandomAtomNumber(mat);
const G4Material* mat = couple->GetMaterial();
deltaDirection =
GetAngularDistribution()->SampleDirection(dp, deltaKinEnergy, Z, mat);
GetAngularDistribution()->SampleDirection(dp, deltaKinEnergy,
SelectRandomAtomNumber(mat),
mat);
} else {
G4double deltaMomentum =
@@ -441,11 +441,10 @@ void G4BetheBlochModel::SampleSecondaries(vector<G4DynamicParticle*>* vdp,
G4double cost = deltaKinEnergy * (totEnergy + electron_mass_c2) /
(deltaMomentum * dp->GetTotalMomentum());
cost = std::min(cost, 1.0);
G4double sint = std::sqrt((1.0 - cost)*(1.0 + cost));
const G4double sint = std::sqrt((1.0 - cost)*(1.0 + cost));
const G4double phi = twopi*rndmEngineMod->flat();
G4double phi = twopi*rndmEngineMod->flat();
deltaDirection.set(sint*cos(phi),sint*sin(phi), cost) ;
deltaDirection.set(sint*std::cos(phi),sint*std::sin(phi), cost) ;
deltaDirection.rotateUz(dp->GetMomentumDirection());
}
/*
@@ -122,12 +122,6 @@
#include <cassert>
// // Q : Use enum G4EmProcessSubType hire ?
// enum G45DConversionMode
// {
// kEPair, kMuPair
// };
const G4int kEPair = 0;
const G4int kMuPair = 1;
@@ -136,11 +130,13 @@ const G4int kMuPair = 1;
G4BetheHeitler5DModel::G4BetheHeitler5DModel(const G4ParticleDefinition* pd,
const G4String& nam)
: G4PairProductionRelModel(pd, nam),fVerbose(1),fConversionType(0),
iraw(false),
: G4PairProductionRelModel(pd, nam),
fLepton1(G4Electron::Definition()),fLepton2(G4Positron::Definition()),
fTheMuPlus(G4MuonPlus::Definition()),fTheMuMinus(G4MuonMinus::Definition()),
fVerbose(1),
fConversionType(0),
fConvMode(kEPair),
fTheMuPlus(G4MuonPlus::Definition()),fTheMuMinus(G4MuonMinus::Definition())
iraw(false)
{
theIonTable = G4IonTable::GetIonTable();
//Q: Do we need this on Model
@@ -167,7 +163,7 @@ void G4BetheHeitler5DModel::Initialise(const G4ParticleDefinition* part,
// > 3 print rejection warning from transformation (fix bug from gammaray .. )
// > 4 print photon direction & polarisation
fVerbose = theManager->Verbose();
fConversionType = theManager->GetConversionType();
fConversionType = theManager->GetConversionType();
//////////////////////////////////////////////////////////////
// iraw :
// true : isolated electron or nucleus.
@@ -1,168 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
//
// File name: G4BohrFluctuations
//
// Author: Vladimir Ivanchenko
//
// Creation date: 02.04.2003
//
// Modifications:
//
// 23-05-03 Add control on parthalogical cases (V.Ivanchenko)
// 16-10-03 Changed interface to Initialisation (V.Ivanchenko)
//
// Class Description: Sampling of Gaussion fluctuations
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4BohrFluctuations.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "Randomize.hh"
#include "G4Poisson.hh"
#include "G4ParticleDefinition.hh"
#include "G4MaterialCutsCouple.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
using namespace std;
G4BohrFluctuations::G4BohrFluctuations(const G4String& nam)
:G4VEmFluctuationModel(nam),
particle(0),
minNumberInteractionsBohr(2.0),
minFraction(0.2),
xmin(0.2),
minLoss(0.001*eV)
{
particleMass = proton_mass_c2;
chargeSquare = 1.0;
kineticEnergy = 0.0;
beta2 = 0.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4BohrFluctuations::~G4BohrFluctuations()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4BohrFluctuations::InitialiseMe(const G4ParticleDefinition* part)
{
particle = part;
particleMass = part->GetPDGMass();
G4double q = part->GetPDGCharge()/eplus;
chargeSquare = q*q;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double
G4BohrFluctuations::SampleFluctuations(const G4MaterialCutsCouple* couple,
const G4DynamicParticle* dp,
G4double tmax,
G4double length,
G4double meanLoss)
{
if(meanLoss <= minLoss) { return meanLoss; }
const G4Material* material = couple->GetMaterial();
G4double siga = Dispersion(material,dp,tmax,length);
G4double loss = meanLoss;
G4double navr = meanLoss*meanLoss/siga;
//G4cout << "### meanLoss= " << meanLoss << " navr= " << navr << G4endl;
if (navr >= minNumberInteractionsBohr) {
// Increase fluctuations for big fractional energy loss
if ( meanLoss > minFraction*kineticEnergy ) {
G4double gam = (kineticEnergy - meanLoss)/particleMass + 1.0;
G4double b2 = 1.0 - 1.0/(gam*gam);
if(b2 < xmin*beta2) b2 = xmin*beta2;
G4double x = b2/beta2;
G4double x3 = 1.0/(x*x*x);
siga *= 0.25*(1.0 + x)*(x3 + (1.0/b2 - 0.5)/(1.0/beta2 - 0.5) );
}
siga = sqrt(siga);
G4double twomeanLoss = meanLoss + meanLoss;
//G4cout << "siga= " << siga << " 2edp= " << twomeanLoss <<G4endl;
if(twomeanLoss < siga) {
G4double x;
do {
loss = twomeanLoss*G4UniformRand();
x = (loss - meanLoss)/siga;
// Loop checking, 03-Aug-2015, Vladimir Ivanchenko
} while (1.0 - 0.5*x*x < G4UniformRand());
} else {
do {
loss = G4RandGauss::shoot(meanLoss,siga);
// Loop checking, 03-Aug-2015, Vladimir Ivanchenko
} while (0.0 > loss || loss > twomeanLoss);
}
// Poisson fluctuations
} else {
G4double n = (G4double)(G4Poisson(navr));
loss = meanLoss*n/navr;
}
//G4cout << "loss= " << loss << G4endl;
return loss;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4BohrFluctuations::Dispersion(const G4Material* material,
const G4DynamicParticle* dp,
G4double tmax,
G4double length)
{
if(!particle) { InitialiseMe(dp->GetDefinition()); }
G4double electronDensity = material->GetElectronDensity();
kineticEnergy = dp->GetKineticEnergy();
G4double etot = kineticEnergy + particleMass;
beta2 = kineticEnergy*(kineticEnergy + 2.0*particleMass)/(etot*etot);
G4double siga = (1.0/beta2 - 0.5) * twopi_mc2_rcl2 * tmax * length
* electronDensity * chargeSquare;
return siga;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -64,6 +64,7 @@
#include "G4ParticleChangeForLoss.hh"
#include "G4LossTableManager.hh"
#include "G4EmCorrections.hh"
#include "G4EmParameters.hh"
#include "G4DeltaAngle.hh"
#include "G4ICRU90StoppingData.hh"
#include "G4NistManager.hh"
@@ -78,28 +79,18 @@ G4ASTARStopping* G4BraggIonModel::fASTAR = nullptr;
G4BraggIonModel::G4BraggIonModel(const G4ParticleDefinition* p,
const G4String& nam)
: G4VEmModel(nam),
corr(nullptr),
particle(nullptr),
fParticleChange(nullptr),
fICRU90(nullptr),
currentMaterial(nullptr),
baseMaterial(nullptr),
iMolecula(-1),
iASTAR(-1),
iICRU90(-1),
isIon(false)
: G4VEmModel(nam)
{
SetHighEnergyLimit(2.0*MeV);
SetHighEnergyLimit(2.0*CLHEP::MeV);
HeMass = 3.727417*GeV;
rateMassHe2p = HeMass/proton_mass_c2;
lowestKinEnergy = 1.0*keV/rateMassHe2p;
HeMass = 3.727417*CLHEP::GeV;
rateMassHe2p = HeMass/CLHEP::proton_mass_c2;
lowestKinEnergy = 1.0*CLHEP::keV/rateMassHe2p;
massFactor = 1000.*amu_c2/HeMass;
theZieglerFactor = eV*cm2*1.0e-15;
theZieglerFactor = CLHEP::eV*CLHEP::cm2*1.0e-15;
theElectron = G4Electron::Electron();
corrFactor = 1.0;
if(p) { SetParticle(p); }
if(nullptr != p) { SetParticle(p); }
else { SetParticle(theElectron); }
}
@@ -124,17 +115,17 @@ void G4BraggIonModel::Initialise(const G4ParticleDefinition* p,
if(IsMaster()) {
if(nullptr == fASTAR) { fASTAR = new G4ASTARStopping(); }
if(particle->GetPDGMass() < GeV) { fASTAR->Initialise(); }
if(particle->GetPDGMass() < CLHEP::GeV) { fASTAR->Initialise(); }
if(G4EmParameters::Instance()->UseICRU90Data()) {
if(!fICRU90) {
if(nullptr == fICRU90) {
fICRU90 = G4NistManager::Instance()->GetICRU90StoppingData();
} else if(particle->GetPDGMass() < GeV) { fICRU90->Initialise(); }
} else if(particle->GetPDGMass() < CLHEP::GeV) { fICRU90->Initialise(); }
}
}
if(nullptr == fParticleChange) {
if(UseAngularGeneratorFlag() && !GetAngularDistribution()) {
if(UseAngularGeneratorFlag() && nullptr == GetAngularDistribution()) {
SetAngularDistribution(new G4DeltaAngle());
}
G4String pname = particle->GetParticleName();
@@ -203,7 +194,7 @@ G4double G4BraggIonModel::ComputeCrossSectionPerElectron(
if( 0.0 < spin ) { cross += 0.5*(maxEnergy - cutEnergy)/energy2; }
cross *= twopi_mc2_rcl2*chargeSquare/beta2;
cross *= CLHEP::twopi_mc2_rcl2*chargeSquare/beta2;
}
// G4cout << "BR: e= " << kineticEnergy << " tmin= " << cutEnergy
// << " tmax= " << tmax << " cross= " << cross << G4endl;
@@ -263,7 +254,7 @@ G4double G4BraggIonModel::ComputeDEDXPerVolume(const G4Material* material,
G4double beta2 = bg2/(gam*gam);
G4double x = tmin/tmax;
dedx += (G4Log(x) + (1.0 - x)*beta2) * twopi_mc2_rcl2
dedx += (G4Log(x) + (1.0 - x)*beta2) * CLHEP::twopi_mc2_rcl2
* (material->GetElectronDensity())/beta2;
}
@@ -283,9 +274,8 @@ G4double G4BraggIonModel::ComputeDEDXPerVolume(const G4Material* material,
void G4BraggIonModel::CorrectionsAlongStep(const G4MaterialCutsCouple* couple,
const G4DynamicParticle* dp,
G4double& eloss,
G4double&,
G4double /*length*/)
const G4double&,
G4double& eloss)
{
// this method is called only for ions
const G4ParticleDefinition* p = dp->GetDefinition();
@@ -70,6 +70,7 @@
#include "G4ParticleChangeForLoss.hh"
#include "G4LossTableManager.hh"
#include "G4EmCorrections.hh"
#include "G4EmParameters.hh"
#include "G4DeltaAngle.hh"
#include "G4ICRU90StoppingData.hh"
#include "G4NistManager.hh"
@@ -78,32 +79,21 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
using namespace std;
G4PSTARStopping* G4BraggModel::fPSTAR = nullptr;
G4BraggModel::G4BraggModel(const G4ParticleDefinition* p, const G4String& nam)
: G4VEmModel(nam),
particle(nullptr),
fICRU90(nullptr),
currentMaterial(nullptr),
baseMaterial(nullptr),
protonMassAMU(1.007276),
iMolecula(-1),
iPSTAR(-1),
iICRU90(-1),
isIon(false)
protonMassAMU(1.007276)
{
fParticleChange = nullptr;
SetHighEnergyLimit(2.0*MeV);
SetHighEnergyLimit(2.0*CLHEP::MeV);
lowestKinEnergy = 1.0*keV;
theZieglerFactor = eV*cm2*1.0e-15;
lowestKinEnergy = 1.0*CLHEP::keV;
theZieglerFactor = CLHEP::eV*CLHEP::cm2*1.0e-15;
theElectron = G4Electron::Electron();
expStopPower125 = 0.0;
corr = G4LossTableManager::Instance()->EmCorrections();
if(p) { SetParticle(p); }
if(nullptr != p) { SetParticle(p); }
else { SetParticle(theElectron); }
}
@@ -126,11 +116,11 @@ void G4BraggModel::Initialise(const G4ParticleDefinition* p,
if(IsMaster()) {
if(nullptr == fPSTAR) { fPSTAR = new G4PSTARStopping(); }
if(particle->GetPDGMass() < GeV) { fPSTAR->Initialise(); }
if(particle->GetPDGMass() < CLHEP::GeV) { fPSTAR->Initialise(); }
if(G4EmParameters::Instance()->UseICRU90Data()) {
if(!fICRU90) {
fICRU90 = G4NistManager::Instance()->GetICRU90StoppingData();
} else if(particle->GetPDGMass() < GeV) { fICRU90->Initialise(); }
} else if(particle->GetPDGMass() < CLHEP::GeV) { fICRU90->Initialise(); }
}
}
@@ -192,7 +182,7 @@ G4double G4BraggModel::ComputeCrossSectionPerElectron(
if( 0.0 < spin ) { cross += 0.5*(maxEnergy - cutEnergy)/energy2; }
cross *= twopi_mc2_rcl2*chargeSquare/beta2;
cross *= CLHEP::twopi_mc2_rcl2*chargeSquare/beta2;
}
// G4cout << "BR: e= " << kineticEnergy << " tmin= " << cutEnergy
// << " tmax= " << tmax << " cross= " << cross << G4endl;
@@ -237,7 +227,7 @@ G4double G4BraggModel::ComputeDEDXPerVolume(const G4Material* material,
G4double dedx = 0.0;
if(tkin < lowestKinEnergy) {
dedx = DEDX(material, lowestKinEnergy)*sqrt(tkin/lowestKinEnergy);
dedx = DEDX(material, lowestKinEnergy)*std::sqrt(tkin/lowestKinEnergy);
} else {
dedx = DEDX(material, tkin);
}
@@ -250,7 +240,7 @@ G4double G4BraggModel::ComputeDEDXPerVolume(const G4Material* material,
G4double beta2 = bg2/(gam*gam);
G4double x = cutEnergy/tmax;
dedx += (G4Log(x) + (1.0 - x)*beta2) * twopi_mc2_rcl2
dedx += (G4Log(x) + (1.0 - x)*beta2) * CLHEP::twopi_mc2_rcl2
* (material->GetElectronDensity())/beta2;
}
@@ -260,13 +250,12 @@ G4double G4BraggModel::ComputeDEDXPerVolume(const G4Material* material,
//G4cout << "E(MeV)= " << tkin/MeV << " dedx= " << dedx
// << " " << material->GetName() << G4endl;
return dedx;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4BraggModel::SampleSecondaries(vector<G4DynamicParticle*>* vdp,
void G4BraggModel::SampleSecondaries(std::vector<G4DynamicParticle*>* vdp,
const G4MaterialCutsCouple* couple,
const G4DynamicParticle* dp,
G4double xmin,
@@ -315,15 +304,15 @@ void G4BraggModel::SampleSecondaries(vector<G4DynamicParticle*>* vdp,
} else {
G4double deltaMomentum =
sqrt(deltaKinEnergy * (deltaKinEnergy + 2.0*electron_mass_c2));
std::sqrt(deltaKinEnergy * (deltaKinEnergy + 2.0*electron_mass_c2));
G4double cost = deltaKinEnergy * (energy + electron_mass_c2) /
(deltaMomentum * dp->GetTotalMomentum());
if(cost > 1.0) { cost = 1.0; }
G4double sint = sqrt((1.0 - cost)*(1.0 + cost));
G4double sint = std::sqrt((1.0 - cost)*(1.0 + cost));
G4double phi = twopi*rndmEngineMod->flat();
deltaDirection.set(sint*cos(phi),sint*sin(phi), cost) ;
deltaDirection.set(sint*std::cos(phi),sint*std::sin(phi), cost) ;
deltaDirection.rotateUz(dp->GetMomentumDirection());
}
@@ -412,7 +401,7 @@ G4double G4BraggModel::StoppingPower(const G4Material* material,
104.1512f, 44.665f, 60.0843f, 18.0152f, 18.0152f, 12.0f};
if ( T < 10.0 ) {
ionloss = ((G4double)(a[iMolecula][0])) * sqrt(T) ;
ionloss = ((G4double)(a[iMolecula][0])) * std::sqrt(T) ;
} else if ( T < 10000.0 ) {
G4double x1 = (G4double)(a[iMolecula][1]);
@@ -573,12 +562,12 @@ G4double G4BraggModel::ElectronicStoppingPower(G4double z,
// Carbon specific case for E < 40 keV
if ( T < 40.0 && 5 == i) {
fac = sqrt(T*0.025);
fac = std::sqrt(T*0.025);
T = 40.0;
// Free electron gas model
} else if ( T < 10.0 ) {
fac = sqrt(T*0.1) ;
fac = std::sqrt(T*0.1) ;
T = 10.0;
}
@@ -790,12 +779,12 @@ G4double G4BraggModel::ChemicalFactor(G4double kineticEnergy,
static const G4double gamma25 = 1.0 + 25.0*keV /proton_mass_c2;
static const G4double gamma125 = 1.0 + 125.0*keV/proton_mass_c2;
static const G4double beta25 = sqrt(1.0 - 1.0/(gamma25*gamma25));
static const G4double beta125 = sqrt(1.0 - 1.0/(gamma125*gamma125));
static const G4double beta25 = std::sqrt(1.0 - 1.0/(gamma25*gamma25));
static const G4double beta125 = std::sqrt(1.0 - 1.0/(gamma125*gamma125));
static const G4double f12525 = 1.0 + G4Exp( 1.48*(beta125/beta25 - 7.0) );
G4double gamma = 1.0 + kineticEnergy/proton_mass_c2;
G4double beta = sqrt(1.0 - 1.0/(gamma*gamma));
G4double beta = std::sqrt(1.0 - 1.0/(gamma*gamma));
G4double factor = 1.0 + (expStopPower125/eloss125 - 1.0) * f12525/
(1.0 + G4Exp( 1.48 * ( beta/beta25 - 7.0 ) ) );
@@ -44,14 +44,13 @@
using namespace std;
G4ComptonScattering::G4ComptonScattering(const G4String& processName,
G4ProcessType type):G4VEmProcess (processName, type),
isInitialised(false)
G4ProcessType type):G4VEmProcess (processName, type)
{
SetStartFromNullFlag(true);
SetBuildTableFlag(true);
SetSecondaryParticle(G4Electron::Electron());
SetProcessSubType(fComptonScattering);
SetMinKinEnergyPrim(1*MeV);
SetMinKinEnergyPrim(1*CLHEP::MeV);
SetSplineFlag(true);
}
@@ -73,7 +72,7 @@ void G4ComptonScattering::InitialiseProcess(const G4ParticleDefinition*)
{
if(!isInitialised) {
isInitialised = true;
if(!EmModel(0)) { SetEmModel(new G4KleinNishinaCompton()); }
if(nullptr == EmModel(0)) { SetEmModel(new G4KleinNishinaCompton()); }
G4EmParameters* param = G4EmParameters::Instance();
EmModel(0)->SetLowEnergyLimit(param->MinKinEnergy());
EmModel(0)->SetHighEnergyLimit(param->MaxKinEnergy());
@@ -83,11 +82,6 @@ void G4ComptonScattering::InitialiseProcess(const G4ParticleDefinition*)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4ComptonScattering::PrintInfo()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4ComptonScattering::ProcessDescription(std::ostream& out) const
{
out << " Compton scattering";
@@ -58,12 +58,12 @@
using namespace std;
G4CoulombScattering::G4CoulombScattering(const G4String& name)
: G4VEmProcess(name),q2Max(TeV*TeV),isInitialised(false)
: G4VEmProcess(name),q2Max(CLHEP::TeV*CLHEP::TeV),isInitialised(false)
{
// G4cout << "G4CoulombScattering constructor "<< G4endl;
SetBuildTableFlag(true);
SetStartFromNullFlag(false);
SetIntegral(true);
SetCrossSectionType(fEmOnePeak);
SetSecondaryParticle(G4Proton::Proton());
SetProcessSubType(fCoulombScattering);
}
@@ -77,7 +77,7 @@ G4CoulombScattering::~G4CoulombScattering()
G4bool G4CoulombScattering::IsApplicable(const G4ParticleDefinition& p)
{
return (p.GetPDGCharge() != 0.0 && !p.IsShortLived());
return (p.GetPDGCharge() != 0.0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -114,7 +114,7 @@ void G4CoulombScattering::InitialiseProcess(const G4ParticleDefinition* p)
//G4cout << name << " type: " << p->GetParticleType()
//<< " mass= " << mass << G4endl;
yes = true;
if (mass > GeV || p->GetParticleType() == "nucleus") {
if (mass > CLHEP::GeV || p->GetParticleType() == "nucleus") {
SetBuildTableFlag(false);
yes = false;
if(name != "GenericIon") { SetVerboseLevel(0); }
@@ -124,7 +124,7 @@ void G4CoulombScattering::InitialiseProcess(const G4ParticleDefinition* p)
name != "kaon+" && name != "proton" ) { SetVerboseLevel(0); }
}
if(!EmModel(0)) {
if(nullptr == EmModel(0)) {
if(yes) { SetEmModel(new G4eCoulombScatteringModel()); }
else { SetEmModel(new G4IonCoulombScatteringModel()); }
}
@@ -161,7 +161,7 @@ G4double G4CoulombScattering::MinPrimaryEnergy(const G4ParticleDefinition* part,
void G4CoulombScattering::StreamProcessInfo(std::ostream& outFile) const
{
G4double tetmin = G4EmParameters::Instance()->MscThetaLimit()/degree;
G4double tetmin = G4EmParameters::Instance()->MscThetaLimit()/CLHEP::degree;
outFile << " ";
if(tetmin > 179.) { outFile << "ThetaMin(p)"; }
else { outFile << tetmin; }
@@ -54,8 +54,8 @@ G4ESTARStopping::G4ESTARStopping(const G4String& datatype)
currentMaterial = 0;
matIndex = -1;
sdata.resize(280,nullptr);
name.resize(280,"");
sdata.resize(280,0);
type = 0;
if("basic" == datatype) { type = 1; }
@@ -962,10 +962,11 @@ void G4ESTARStopping::AddData(const G4double* ekin, const G4double* stop,
G4double x1, x2, x3, x4, x5, x6, x7;
static const G4double fac = MeV*cm2/g;
if(nullptr != sdata[idx]) { delete sdata[idx]; }
// hardtyped data
if(0 == type) {
sdata[idx] = new G4LPhysicsFreeVector(25, ekin[0]*MeV, ekin[24]*MeV);
sdata[idx] = new G4PhysicsFreeVector(25, ekin[0]*MeV, ekin[24]*MeV, true);
for(size_t i=0; i<25; ++i) {
sdata[idx]->PutValues(i, ekin[i]*MeV, stop[i]*fac);
}
@@ -988,7 +989,7 @@ void G4ESTARStopping::AddData(const G4double* ekin, const G4double* stop,
ed,"G4LEDATA version should be G4EMLOW6.34 or later.");
return;
}
sdata[idx] = new G4LPhysicsFreeVector(81, 0.01*MeV, GeV);
sdata[idx] = new G4PhysicsFreeVector(81, 0.01*MeV, GeV, true);
for(size_t i=0; i<81; ++i) {
fin >> x1 >> x2 >> x3 >> x4 >> x5 >> x6 >> x7;
sdata[idx]->PutValues(i, x1*MeV, x4*fac);
@@ -1012,13 +1013,12 @@ void G4ESTARStopping::AddData(const G4double* ekin, const G4double* stop,
ed,"G4LEDATA version should be G4EMLOW6.34 or later.");
return;
}
sdata[idx] = new G4LPhysicsFreeVector(97, 0.001*MeV, 10*GeV);
sdata[idx] = new G4PhysicsFreeVector(97, 0.001*MeV, 10*GeV, true);
for(size_t i=0; i<97; ++i) {
fin >> x1 >> x2 >> x3 >> x4 >> x5;
sdata[idx]->PutValues(i, x1*MeV, x4*fac);
}
}
sdata[idx]->SetSpline(true);
sdata[idx]->FillSecondDerivatives();
//G4cout << "done " << G4endl;
}
@@ -41,13 +41,10 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
using namespace std;
G4GammaConversion::G4GammaConversion(const G4String& processName,
G4ProcessType type):G4VEmProcess (processName, type),
isInitialised(false)
G4ProcessType type):G4VEmProcess (processName, type)
{
SetMinKinEnergy(2.0*electron_mass_c2);
SetMinKinEnergy(2.0*CLHEP::electron_mass_c2);
SetProcessSubType(fGammaConversion);
SetStartFromNullFlag(true);
SetBuildTableFlag(true);
@@ -74,12 +71,12 @@ void G4GammaConversion::InitialiseProcess(const G4ParticleDefinition*)
if(!isInitialised) {
isInitialised = true;
G4EmParameters* param = G4EmParameters::Instance();
G4double emin = std::max(param->MinKinEnergy(), 2*electron_mass_c2);
G4double emin = std::max(param->MinKinEnergy(), 2*CLHEP::electron_mass_c2);
G4double emax = param->MaxKinEnergy();
SetMinKinEnergy(emin);
if(!EmModel(0)) { SetEmModel(new G4PairProductionRelModel()); }
if(nullptr == EmModel(0)) { SetEmModel(new G4PairProductionRelModel()); }
EmModel(0)->SetLowEnergyLimit(emin);
EmModel(0)->SetHighEnergyLimit(emax);
AddEmModel(1, EmModel(0));
@@ -91,16 +88,11 @@ void G4GammaConversion::InitialiseProcess(const G4ParticleDefinition*)
G4double G4GammaConversion::MinPrimaryEnergy(const G4ParticleDefinition*,
const G4Material*)
{
return 2*electron_mass_c2;
return 2*CLHEP::electron_mass_c2;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4GammaConversion::PrintInfo()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4GammaConversion::ProcessDescription(std::ostream& out) const
{
out << " Gamma conversion";
@@ -1,228 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
//
// File name: G4HeatedKleinNishinaCompton
//
// Author: Vladimir Grichine on base of M. Maire and V. Ivanchenko code
//
// Creation date: 15.03.2009
//
// Modifications: 07.07.2014 V.Ivanchenko make direct inheritence from
// G4KleinNishinaCompton
//
//
// Class Description:
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4HeatedKleinNishinaCompton.hh"
#include "globals.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4RandomDirection.hh"
#include "Randomize.hh"
#include "G4Log.hh"
#include "G4Exp.hh"
#include "G4Electron.hh"
#include "G4Gamma.hh"
#include "G4ParticleChangeForGamma.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
using namespace std;
G4HeatedKleinNishinaCompton::G4HeatedKleinNishinaCompton(
const G4ParticleDefinition* p, const G4String& nam)
: G4KleinNishinaCompton(p, nam)
{
fTemperature = 1.0*keV;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4HeatedKleinNishinaCompton::~G4HeatedKleinNishinaCompton()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4HeatedKleinNishinaCompton::SampleSecondaries(
std::vector<G4DynamicParticle*>* fvect,
const G4MaterialCutsCouple*,
const G4DynamicParticle* aDynamicGamma,
G4double, G4double)
{
// do nothing below the threshold
if(aDynamicGamma->GetKineticEnergy() <= LowEnergyLimit()) { return; }
// The scattered gamma energy is sampled according to Klein - Nishina formula.
// The random number techniques of Butcher & Messel are used
// (Nuc Phys 20(1960),15).
// Note : Effects due to binding of atomic electrons are negliged.
// We start to prepare a heated electron from Maxwell distribution.
// Then we try to boost to the electron rest frame and make scattering.
// The final step is to recover new gamma 4momentum in the lab frame
G4double eMomentumC2 = G4RandGamma::shoot(1.5, 1.);
eMomentumC2 *= 2*electron_mass_c2*fTemperature; // electron (pc)^2
G4ThreeVector eMomDir = G4RandomDirection();
eMomDir *= std::sqrt(eMomentumC2);
G4double eEnergy = std::sqrt(eMomentumC2+electron_mass_c2*electron_mass_c2);
G4LorentzVector electron4v = G4LorentzVector(eMomDir,eEnergy);
G4ThreeVector bst = electron4v.boostVector();
G4LorentzVector gamma4v = aDynamicGamma->Get4Momentum();
gamma4v.boost(-bst);
G4ThreeVector gammaMomV = gamma4v.vect();
G4double gamEnergy0 = gammaMomV.mag();
// G4double gamEnergy0 = aDynamicGamma->GetKineticEnergy();
G4double E0_m = gamEnergy0 / electron_mass_c2 ;
// G4ThreeVector gamDirection0 = /aDynamicGamma->GetMomentumDirection();
G4ThreeVector gamDirection0 = gammaMomV/gamEnergy0;
// sample the energy rate of the scattered gamma in the electron rest frame
//
G4double epsilon, epsilonsq, onecost, sint2, greject ;
G4double eps0 = 1./(1. + 2.*E0_m);
G4double epsilon0sq = eps0*eps0;
G4double alpha1 = - G4Log(eps0);
G4double alpha2 = 0.5*(1.- epsilon0sq);
G4int nloop = 0;
do
{
++nloop;
// false interaction if too many iterations
if(nloop > 1000) { return; }
if ( alpha1/(alpha1+alpha2) > G4UniformRand() )
{
epsilon = G4Exp(-alpha1*G4UniformRand()); // eps0**r
epsilonsq = epsilon*epsilon;
}
else
{
epsilonsq = epsilon0sq + (1.- epsilon0sq)*G4UniformRand();
epsilon = sqrt(epsilonsq);
};
onecost = (1.- epsilon)/(epsilon*E0_m);
sint2 = onecost*(2.-onecost);
greject = 1. - epsilon*sint2/(1.+ epsilonsq);
// Loop checking, 03-Aug-2015, Vladimir Ivanchenko
} while (greject < G4UniformRand());
//
// scattered gamma angles. ( Z - axis along the parent gamma)
//
G4double cosTeta = 1. - onecost;
G4double sinTeta = sqrt (sint2);
G4double Phi = twopi * G4UniformRand();
G4double dirx = sinTeta*cos(Phi), diry = sinTeta*sin(Phi), dirz = cosTeta;
//
// update G4VParticleChange for the scattered gamma
//
G4ThreeVector gamDirection1 ( dirx,diry,dirz );
gamDirection1.rotateUz(gamDirection0);
G4double gamEnergy1 = epsilon*gamEnergy0;
gamDirection1 *= gamEnergy1;
G4LorentzVector gamma4vfinal = G4LorentzVector(gamDirection1,gamEnergy1);
// kinematic of the scattered electron
//
G4double eKinEnergy = gamEnergy0 - gamEnergy1;
G4ThreeVector eDirection = gamEnergy0*gamDirection0 - gamEnergy1*gamDirection1;
eDirection = eDirection.unit();
G4double eFinalMom = std::sqrt(eKinEnergy*(eKinEnergy+2*electron_mass_c2));
eDirection *= eFinalMom;
G4LorentzVector e4vfinal = G4LorentzVector(eDirection,gamEnergy1+electron_mass_c2);
gamma4vfinal.boost(bst);
e4vfinal.boost(bst);
gamDirection1 = gamma4vfinal.vect();
gamEnergy1 = gamDirection1.mag();
gamDirection1 /= gamEnergy1;
G4double edep = 0.0;
if(gamEnergy1 > lowestSecondaryEnergy) {
fParticleChange->ProposeMomentumDirection(gamDirection1);
fParticleChange->SetProposedKineticEnergy(gamEnergy1);
} else {
fParticleChange->ProposeTrackStatus(fStopAndKill);
fParticleChange->SetProposedKineticEnergy(0.0);
edep = gamEnergy1;
}
//
// kinematic of the scattered electron
//
eKinEnergy = e4vfinal.t()-electron_mass_c2;
if(eKinEnergy > lowestSecondaryEnergy) {
eDirection = e4vfinal.vect().unit();
// create G4DynamicParticle object for the electron.
G4DynamicParticle* dp =
new G4DynamicParticle(theElectron,eDirection,eKinEnergy);
fvect->push_back(dp);
} else {
edep += eKinEnergy;
}
// energy balance
if(edep > 0.0) {
fParticleChange->ProposeLocalEnergyDeposit(edep);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -404,9 +404,8 @@ G4double G4ICRU73QOModel::GetL2(G4double normEnergy) const
void G4ICRU73QOModel::CorrectionsAlongStep(const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double&,
G4double&,
G4double)
const G4double&,
G4double&)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -335,7 +335,7 @@ void G4KleinNishinaModel::SampleSecondaries(
// sample deexcitation
//
if(fAtomDeexcitation) {
if(nullptr != fAtomDeexcitation) {
G4int index = couple->GetIndex();
if(fAtomDeexcitation->CheckDeexcitationActiveRegion(index)) {
G4int Z = elm->GetZasInt();
@@ -201,11 +201,11 @@ void G4LindhardSorensenData::InitialiseData()
-0.015675051, -0.027353574, -0.03931666, -0.050325729, -0.06174447}};
for(G4int i=0; i<=LVECT; ++i) {
data[i] = new G4PhysicsLinearVector(xmin, xmax, NPOINT-1);
data[i]->SetSpline(true);
data[i] = new G4PhysicsLinearVector(xmin, xmax, NPOINT-1, true);
for(std::size_t j=0; j<NPOINT; ++j) {
data[i]->PutValue(j, lsdata[i][j]);
}
data[i]->FillSecondDerivatives();
}
}
@@ -271,9 +271,8 @@ G4LindhardSorensenIonModel::ComputeDEDXPerVolume(const G4Material* material,
void
G4LindhardSorensenIonModel::CorrectionsAlongStep(const G4MaterialCutsCouple* couple,
const G4DynamicParticle* dp,
G4double& eloss,
G4double&,
G4double length)
const G4double& length,
G4double& eloss)
{
const G4ParticleDefinition* p = dp->GetDefinition();
SetParticle(p);
@@ -82,7 +82,7 @@ G4MollerBhabhaModel::G4MollerBhabhaModel(const G4ParticleDefinition* p,
isInitialised(false)
{
theElectron = G4Electron::Electron();
if(p) { SetParticle(p); }
if(nullptr != p) { SetParticle(p); }
fParticleChange = nullptr;
}
@@ -106,7 +106,7 @@ G4double G4MollerBhabhaModel::MaxSecondaryEnergy(const G4ParticleDefinition*,
void G4MollerBhabhaModel::Initialise(const G4ParticleDefinition* p,
const G4DataVector&)
{
if(!particle) { SetParticle(p); }
if(p != particle) { SetParticle(p); }
if(isInitialised) { return; }
@@ -119,13 +119,11 @@ void G4MollerBhabhaModel::Initialise(const G4ParticleDefinition* p,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double
G4MollerBhabhaModel::ComputeCrossSectionPerElectron(const G4ParticleDefinition* p,
G4double kineticEnergy,
G4double cutEnergy,
G4double maxEnergy)
G4double G4MollerBhabhaModel::ComputeCrossSectionPerElectron(
const G4ParticleDefinition* p, G4double kineticEnergy,
G4double cutEnergy, G4double maxEnergy)
{
if(!particle) { SetParticle(p); }
if(p != particle) { SetParticle(p); }
G4double cross = 0.0;
G4double tmax = MaxSecondaryEnergy(p, kineticEnergy);
@@ -205,7 +203,7 @@ G4double G4MollerBhabhaModel::ComputeDEDXPerVolume(
G4double kineticEnergy,
G4double cut)
{
if(nullptr == particle) { SetParticle(p); }
if(p != particle) { SetParticle(p); }
// calculate the dE/dx due to the ionization by Seltzer-Berger formula
// checl low-energy limit
G4double electronDensity = material->GetElectronDensity();
@@ -71,7 +71,7 @@ G4NuclearStopping::~G4NuclearStopping()
G4bool G4NuclearStopping::IsApplicable (const G4ParticleDefinition& p)
{
return (p.GetPDGCharge() != 0.0 && !p.IsShortLived());
return (p.GetPDGCharge() != 0.0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -81,7 +81,9 @@ void G4NuclearStopping::InitialiseProcess(const G4ParticleDefinition*)
if(!isInitialized) {
isInitialized = true;
if(!EmModel(0)) { SetEmModel(new G4ICRU49NuclearStoppingModel()); }
if(nullptr == EmModel(0)) {
SetEmModel(new G4ICRU49NuclearStoppingModel());
}
AddEmModel(1, EmModel());
EmModel()->SetActivationHighEnergyLimit(10*GeV);
EmModel()->SetParticleChange(&nParticleChange);
@@ -143,11 +145,6 @@ G4VParticleChange* G4NuclearStopping::AlongStepDoIt(const G4Track& track,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4NuclearStopping::PrintInfo()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4NuclearStopping::ProcessDescription(std::ostream& out) const
{
out << " Nuclear stopping";
@@ -104,7 +104,7 @@ G4PAIModel::~G4PAIModel()
void G4PAIModel::Initialise(const G4ParticleDefinition* p,
const G4DataVector& cuts)
{
if(fVerbose > 0) {
if(fVerbose > 1) {
G4cout<<"G4PAIModel::Initialise for "<<p->GetParticleName()<<G4endl;
}
SetParticle(p);
@@ -114,7 +114,7 @@ void G4PAIModel::Initialise(const G4ParticleDefinition* p,
delete fModelData;
fMaterialCutsCoupleVector.clear();
if(fVerbose > 0) {
if(fVerbose > 1) {
G4cout << "G4PAIModel instantiates data for " << p->GetParticleName()
<< G4endl;
}
@@ -136,10 +136,9 @@ void G4PAIModel::Initialise(const G4ParticleDefinition* p,
numRegions = 1;
}
if(fVerbose > 0) {
if(fVerbose > 1) {
G4cout << "G4PAIModel is defined for " << numRegions << " regions "
<< G4endl;
G4cout << " total number of materials " << numOfMat << G4endl;
<< "; number of materials " << numOfMat << G4endl;
}
for(size_t iReg = 0; iReg<numRegions; ++iReg) {
const G4Region* curReg = fPAIRegionVector[iReg];
@@ -156,8 +155,8 @@ void G4PAIModel::Initialise(const G4ParticleDefinition* p,
<< " jMat= " << jMat << " " << mat->GetName()
<< G4endl;
*/
if(cutCouple) {
if(fVerbose > 0) {
if(nullptr != cutCouple) {
if(fVerbose > 1) {
G4cout << "Region <" << curReg->GetName() << "> mat <"
<< mat->GetName() << "> CoupleIndex= "
<< cutCouple->GetIndex()
@@ -168,6 +167,7 @@ void G4PAIModel::Initialise(const G4ParticleDefinition* p,
G4bool isnew = true;
if(0 < n) {
for(size_t i=0; i<n; ++i) {
G4cout << i << G4endl;
if(cutCouple == fMaterialCutsCoupleVector[i]) {
isnew = false;
break;
@@ -175,7 +175,7 @@ void G4PAIModel::Initialise(const G4ParticleDefinition* p,
}
}
// initialise data banks
//G4cout << " isNew: " << isnew << " " << cutCouple << G4endl;
// G4cout << " isNew: " << isnew << " " << cutCouple << G4endl;
if(isnew) {
fMaterialCutsCoupleVector.push_back(cutCouple);
fModelData->Initialise(cutCouple, this);
@@ -180,20 +180,11 @@ void G4PAIModelData::Initialise(const G4MaterialCutsCouple* couple,
PAItransferTable->insertAt(i,transferVector);
PAIdEdxTable->insertAt(i,dEdxVector);
//transferVector->SetSpline(true);
//transferVector->FillSecondDerivatives();
//dEdxVector->SetSpline(true);
//dEdxVector->FillSecondDerivatives();
} // end of Tkin loop`
fPAIxscBank.push_back(PAItransferTable);
fPAIdEdxBank.push_back(PAIdEdxTable);
//G4cout << "dEdxMeanVector: " << G4endl;
//G4cout << *dEdxMeanVector << G4endl;
/*
dEdxMeanVector->SetSpline(true);
dEdxMeanVector->FillSecondDerivatives();
*/
fdEdxTable.push_back(dEdxMeanVector);
}
@@ -146,7 +146,7 @@ void G4PAIySection::Initialize( const G4Material* material,
fA3 = G4DataVector(fIntervalNumber+2,0.0);
fA4 = G4DataVector(fIntervalNumber+2,0.0);
for( i = 1; i <= fIntervalNumber; i++ )
for( i = 1; i <= fIntervalNumber; ++i )
{
if ( sandia->GetSandiaMatTablePAI(i-1,0) < 1.*eV )
{
@@ -182,7 +182,7 @@ void G4PAIySection::Initialize( const G4Material* material,
}
if( fVerbose > 0 )
{
for( i = 1; i <= fIntervalNumber; i++ )
for( i = 1; i <= fIntervalNumber; ++i )
{
G4cout<<i<<"\t"<<fEnergyInterval[i]/keV<<"\t"<<fA1[i]<<"\t"<<fA2[i]<<"\t"
<<fA3[i]<<"\t"<<fA4[i]<<"\t"<<G4endl;
@@ -191,7 +191,7 @@ void G4PAIySection::Initialize( const G4Material* material,
if( fVerbose > 0 ) {
G4cout<<"Now checking, if two borders are too close together"<<G4endl;
}
for( i = 1; i < fIntervalNumber; i++ )
for( i = 1; i < fIntervalNumber; ++i )
{
if( fEnergyInterval[i+1]-fEnergyInterval[i] >
1.5*fDelta*(fEnergyInterval[i+1]+fEnergyInterval[i]) ) continue;
@@ -210,7 +210,7 @@ void G4PAIySection::Initialize( const G4Material* material,
}
if( fVerbose > 0 )
{
for( i = 1; i <= fIntervalNumber; i++ )
for( i = 1; i <= fIntervalNumber; ++i )
{
G4cout<<i<<"\t"<<fEnergyInterval[i]/keV<<"\t"<<fA1[i]<<"\t"<<fA2[i]<<"\t"
<<fA3[i]<<"\t"<<fA4[i]<<"\t"<<G4endl;
@@ -228,7 +228,7 @@ void G4PAIySection::Initialize( const G4Material* material,
// Preparation of integral PAI cross section for input betaGammaSq
for( i = 1; i <= fSplineNumber; i++ )
for( i = 1; i <= fSplineNumber; ++i )
{
fDifPAIySection[i] = DifPAIySection(i,betaGammaSq);
@@ -254,13 +254,13 @@ void G4PAIySection::ComputeLowEnergyCof(const G4Material* material)
G4double* thisMaterialZ = new G4double[numberOfElements];
G4double* thisMaterialCof = new G4double[numberOfElements];
for( i = 0; i < numberOfElements; i++ )
for( i = 0; i < numberOfElements; ++i )
{
thisMaterialZ[i] = material->GetElement(i)->GetZ();
sumZ += thisMaterialZ[i];
thisMaterialCof[i] = p0+p1*thisMaterialZ[i]+p2*thisMaterialZ[i]*thisMaterialZ[i];
}
for( i = 0; i < numberOfElements; i++ )
for( i = 0; i < numberOfElements; ++i )
{
sumCof += thisMaterialCof[i]*thisMaterialZ[i]/sumZ;
}
@@ -290,7 +290,7 @@ void G4PAIySection::InitPAI()
IntegralCerenkov();
IntegralPlasmon();
for( i = 0; i<= fSplineNumber; i++)
for( i = 0; i<= fSplineNumber; ++i)
{
fPAItable[i][fRefGammaNumber] = fIntegralPAIySection[i];
@@ -304,7 +304,7 @@ void G4PAIySection::InitPAI()
betaGammaSq = fLorentzFactor[j]*fLorentzFactor[j] - 1;
for(i = 1; i <= fSplineNumber; i++)
for(i = 1; i <= fSplineNumber; ++i)
{
fDifPAIySection[i] = DifPAIySection(i,betaGammaSq);
fdNdxCerenkov[i] = PAIdNdxCerenkov(i,betaGammaSq);
@@ -314,7 +314,7 @@ void G4PAIySection::InitPAI()
IntegralCerenkov();
IntegralPlasmon();
for(i = 0; i <= fSplineNumber; i++)
for(i = 0; i <= fSplineNumber; ++i)
{
fPAItable[i][j] = fIntegralPAIySection[i];
}
@@ -346,7 +346,7 @@ void G4PAIySection::NormShift(G4double betaGammaSq)
j = 1;
for(i=2;i<=fSplineNumber;i++)
for(i=2;i<=fSplineNumber;++i)
{
if(fSplineEnergy[i]<fEnergyInterval[j+1])
{
@@ -409,7 +409,7 @@ void G4PAIySection::SplainPAI(G4double betaGammaSq)
if(fSplineEnergy[i+1] > fEnergyInterval[k+1])
{
k++; // Here next energy point is in next energy interval
i++;
++i;
continue;
}
// Shifting of arrayes for inserting the geometrical
@@ -539,7 +539,7 @@ G4double G4PAIySection::RePartDielectricConst(G4double enb)
x0 = enb;
result = 0;
for(G4int i=1;i<=fIntervalNumber-1;i++)
for(G4int i=1;i<=fIntervalNumber-1;++i)
{
x1 = fEnergyInterval[i];
x2 = fEnergyInterval[i+1];
@@ -67,7 +67,7 @@ G4PEEffectFluoModel::G4PEEffectFluoModel(const G4String& nam)
{
theGamma = G4Gamma::Gamma();
theElectron = G4Electron::Electron();
fminimalEnergy = 1.0*eV;
fminimalEnergy = 1.0*CLHEP::eV;
SetDeexcitationFlag(true);
fParticleChange = nullptr;
fAtomDeexcitation = nullptr;
@@ -89,7 +89,9 @@ void G4PEEffectFluoModel::Initialise(const G4ParticleDefinition*,
const G4DataVector&)
{
fAtomDeexcitation = G4LossTableManager::Instance()->AtomDeexcitation();
if(nullptr == fParticleChange) { fParticleChange = GetParticleChangeForGamma(); }
if(nullptr == fParticleChange) {
fParticleChange = GetParticleChangeForGamma();
}
size_t nmat = G4Material::GetNumberOfMaterials();
fMatEnergyTh.resize(nmat, 0.0);
for(size_t i=0; i<nmat; ++i) {
@@ -352,10 +352,11 @@ void G4PSTARStopping::FindData(G4int j, const G4Material* mat)
void G4PSTARStopping::AddData(const G4float* stop, const G4Material* mat)
{
G4LPhysicsFreeVector* v =
new G4LPhysicsFreeVector(60, T0[0], T0[59]);
for(size_t i=0; i<60; ++i) { v->PutValues(i, T0[i], ((G4double)stop[i])*fac); }
v->SetSpline(true);
G4PhysicsFreeVector* v =
new G4PhysicsFreeVector(60, T0[0], T0[59], true);
for(size_t i=0; i<60; ++i) {
v->PutValues(i, T0[i], ((G4double)stop[i])*fac);
}
v->FillSecondDerivatives();
materials.push_back(mat);
sdata.push_back(v);
@@ -43,8 +43,7 @@
using namespace std;
G4PhotoElectricEffect::G4PhotoElectricEffect(const G4String& processName,
G4ProcessType type):G4VEmProcess (processName, type),
isInitialised(false)
G4ProcessType type):G4VEmProcess (processName, type)
{
SetBuildTableFlag(false);
SetSecondaryParticle(G4Electron::Electron());
@@ -70,7 +69,7 @@ void G4PhotoElectricEffect::InitialiseProcess(const G4ParticleDefinition*)
{
if(!isInitialised) {
isInitialised = true;
if(!EmModel()) { SetEmModel(new G4PEEffectFluoModel()); }
if(nullptr == EmModel()) { SetEmModel(new G4PEEffectFluoModel()); }
G4EmParameters* param = G4EmParameters::Instance();
EmModel()->SetLowEnergyLimit(param->MinKinEnergy());
EmModel()->SetHighEnergyLimit(param->MaxKinEnergy());
@@ -80,11 +79,6 @@ void G4PhotoElectricEffect::InitialiseProcess(const G4ParticleDefinition*)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4PhotoElectricEffect::PrintInfo()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4PhotoElectricEffect::ProcessDescription(std::ostream& out) const
{
out << " Photoelectric effect";
@@ -96,7 +96,7 @@ void G4UniversalFluctuation::InitialiseMe(const G4ParticleDefinition* part)
// Derived quantities
m_Inv_particleMass = 1.0 / particleMass;
m_massrate = electron_mass_c2 * m_Inv_particleMass ;
chargeSquare = q*q;
chargeSquare = q*q;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//---------------------------------------------------------------------------
//
// GEANT4 Class file
@@ -45,13 +44,13 @@
#include "G4WaterStopping.hh"
#include "G4SystemOfUnits.hh"
#include "G4EmCorrections.hh"
#include "G4LPhysicsFreeVector.hh"
#include "G4PhysicsFreeVector.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const G4int G4WaterStopping::Z[17] = {
const G4int Z[17] = {
3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 26};
const G4double G4WaterStopping::A[17] = {
const G4double A[17] = {
7, 9, 11, 12, 14, 16, 19, 20, 23, 24, 27, 28, 31, 32, 35, 40, 56};
G4WaterStopping::G4WaterStopping(G4EmCorrections* corr, G4bool splineFlag)
@@ -91,13 +90,13 @@ void G4WaterStopping::AddData(const G4double* energy,
const G4double* stoppower,
G4double factor)
{
G4LPhysicsFreeVector* pv =
new G4LPhysicsFreeVector(53,energy[0]*MeV,energy[52]*MeV);
G4PhysicsFreeVector* pv =
new G4PhysicsFreeVector(53,energy[0]*CLHEP::MeV,energy[52]*CLHEP::MeV,spline);
dedx.push_back(pv);
for(G4int i=0; i<53; ++i) {
pv->PutValues(i,energy[i]*MeV,stoppower[i]*factor);
pv->PutValues(i,energy[i]*CLHEP::MeV,stoppower[i]*factor);
}
pv->SetSpline(spline);
if(spline) { pv->FillSecondDerivatives(); }
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -106,8 +105,8 @@ void G4WaterStopping::Initialise(G4EmCorrections* corr)
{
//..Reduced energies
static const G4double E[53] = {0.025,0.03,0.04,0.05,0.06,0.07,0.08,0.09,0.1,0.15,0.2,0.25,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1,1.5,2,2.5,3,4,5,6,7,8,9,10,15,20,25,30,40,50,60,70,80,90,100,150,200,250,300,400,500,600,700,800,900,1000};
emin = E[0]*MeV;
static const G4double factor = 1000.*MeV/cm;
emin = E[0]*CLHEP::MeV;
static const G4double factor = 1000.*CLHEP::MeV/CLHEP::cm;
static const G4double G4_WATER_Li[53]={2.3193,2.5198,2.8539,3.1164,3.3203,3.4756,3.5914,3.6755,3.7347,3.8125,3.7349,3.6134,3.4818,3.2258,2.9949,2.7909,2.611,2.4517,2.3103,2.1841,1.7151,1.4139,1.2053,1.0525,0.84417,0.70862,0.61317,0.54214,0.48708,0.44305,0.40697,0.29312,0.23208,0.19364,0.16706,0.13252,0.11092,0.09608,0.08522,0.076915,0.07035,0.065026,0.048615,0.040137,0.034964,0.03149,0.027148,0.024579,0.022911,0.021761,0.020937,0.020327,0.019862};
AddData(E,G4_WATER_Li,factor);
@@ -145,7 +144,7 @@ void G4WaterStopping::Initialise(G4EmCorrections* corr)
static const G4double G4_WATER_Fe [53]={6.5394, 7.3060, 8.7367, 10.0690, 11.3310, 12.5470, 13.7280, 14.8780, 15.9980, 21.1160, 25.4850, 29.1260, 32.0640, 36.1770, 38.6920, 40.2760, 41.2950, 41.9530, 42.3710, 42.6210, 42.5910, 41.6900, 40.5190, 39.2690, 36.8000, 34.5040, 32.4190, 30.5410, 28.8480, 27.3170, 25.9310, 20.6170, 17.0680, 14.5540, 12.6930, 10.1410, 8.4892, 7.3402, 6.4976, 5.8545, 5.3479, 4.9387, 3.6892, 3.0503, 2.6620, 2.4014, 2.0756, 1.8825, 1.7569, 1.6702, 1.6079, 1.5619, 1.5267};
AddData(E,G4_WATER_Fe,factor);
if(corr) {
if(nullptr != corr) {
for(G4int i=0; i<17; ++i) {
corr->AddStoppingData(Z[i], A[i], "G4_WATER", dedx[i]);
}
@@ -65,42 +65,26 @@ G4double G4WentzelOKandVIxSection::FormFactor[] = {0.0};
G4Mutex G4WentzelOKandVIxSection::WentzelOKandVIxSectionMutex = G4MUTEX_INITIALIZER;
#endif
const G4double alpha2 = CLHEP::fine_structure_const*CLHEP::fine_structure_const;
const G4double factB1= 0.5*CLHEP::pi*CLHEP::fine_structure_const;
const G4double numlimit = 0.1;
const G4int nwarnlimit = 50;
using namespace std;
G4WentzelOKandVIxSection::G4WentzelOKandVIxSection(G4bool comb) :
temp(0.,0.,0.),
numlimit(0.1),
nwarnings(0),
nwarnlimit(50),
isCombined(comb),
cosThetaMax(-1.0),
alpha2(fine_structure_const*fine_structure_const)
isCombined(comb)
{
fNistManager = G4NistManager::Instance();
fG4pow = G4Pow::GetInstance();
fMottXSection = nullptr;
theElectron = G4Electron::Electron();
thePositron = G4Positron::Positron();
theProton = G4Proton::Proton();
lowEnergyLimit = 1.0*eV;
G4double p0 = electron_mass_c2*classic_electr_radius;
coeff = twopi*p0*p0;
particle = nullptr;
fNucFormfactor = fExponentialNF;
currentMaterial = nullptr;
factB = factD = formfactA = screenZ = 0.0;
cosTetMaxElec = cosTetMaxNuc = invbeta2 = kinFactor = fMottFactor
= gam0pcmp = pcmp2 = 1.0;
factB1= 0.5*CLHEP::pi*fine_structure_const;
tkin = mom2 = momCM2 = factorA2 = mass = spin = chargeSquare = charge3 = 0.0;
ecut = etag = DBL_MAX;
targetZ = 0;
G4double p0 = CLHEP::electron_mass_c2*CLHEP::classic_electr_radius;
coeff = CLHEP::twopi*p0*p0;
targetMass = CLHEP::proton_mass_c2;
}
@@ -153,15 +137,16 @@ void G4WentzelOKandVIxSection::InitialiseA()
G4MUTEXLOCK(&G4WentzelOKandVIxSection::WentzelOKandVIxSectionMutex);
if(0.0 == ScreenRSquare[0]) {
#endif
G4double a0 = electron_mass_c2/0.88534;
G4double constn = 6.937e-6/(MeV*MeV);
const G4double invmev2 = 1./(CLHEP::MeV*CLHEP::MeV);
G4double a0 = CLHEP::electron_mass_c2/0.88534;
G4double constn = 6.937e-6*invmev2;
G4double fct = G4EmParameters::Instance()->ScreeningFactor();
G4double afact = 0.5*fct*alpha2*a0*a0;
ScreenRSquare[0] = afact;
ScreenRSquare[1] = afact;
ScreenRSquareElec[1] = afact;
FormFactor[1] = 3.097e-6/(MeV*MeV);
FormFactor[1] = 3.097e-6*invmev2;
for(G4int j=2; j<100; ++j) {
G4double x = fG4pow->Z13(j);
@@ -70,40 +70,20 @@
using namespace std;
const G4double invsqrt12 = 1./std::sqrt(12.);
const G4double numlimit = 0.1;
const G4int minNCollisions = 10;
G4WentzelVIModel::G4WentzelVIModel(G4bool comb, const G4String& nam)
: G4VMscModel(nam),
ssFactor(1.05),
invssFactor(1.0),
currentCouple(nullptr),
cosThetaMin(1.0),
cosThetaMax(-1.0),
fSecondMoments(nullptr),
idx2(0),
numlimit(0.1),
singleScatteringMode(false),
isCombined(comb),
useSecondMoment(false)
{
tlimitminfix = 1.e-6*CLHEP::mm;
lowEnergyLimit = 1.0*CLHEP::eV;
SetSingleScatteringFactor(1.25);
invsqrt12 = 1./sqrt(12.);
tlimitminfix = 1.e-6*mm;
lowEnergyLimit = 1.0*eV;
particle = nullptr;
nelments = 5;
xsecn.resize(nelments);
prob.resize(nelments);
wokvi = new G4WentzelOKandVIxSection(isCombined);
fixedCut = -1.0;
minNCollisions = 10;
preKinEnergy = effKinEnergy = tPathLength = zPathLength = lambdaeff
= currentRange = xtsec = cosTetMaxNuc = 0.0;
currentMaterialIndex = 0;
fParticleChange = nullptr;
currentCuts = nullptr;
currentMaterial = nullptr;
wokvi = new G4WentzelOKandVIxSection(isCombined);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -111,7 +91,7 @@ G4WentzelVIModel::G4WentzelVIModel(G4bool comb, const G4String& nam)
G4WentzelVIModel::~G4WentzelVIModel()
{
delete wokvi;
if(fSecondMoments && IsMaster()) {
if(IsMaster()) {
delete fSecondMoments;
fSecondMoments = nullptr;
}
@@ -147,18 +127,26 @@ void G4WentzelVIModel::Initialise(const G4ParticleDefinition* p,
// set values of some data members
fParticleChange = GetParticleChangeForMSC(p);
// Access to materials
const G4ProductionCutsTable* theCoupleTable =
G4ProductionCutsTable::GetProductionCutsTable();
size_t numOfCouples = theCoupleTable->GetTableSize();
nelments = 0;
for(size_t i=0; i<numOfCouples; ++i) {
G4int nelm = theCoupleTable->GetMaterialCutsCouple(i)->GetMaterial()->GetNumberOfElements();
nelments = std::max(nelments, nelm);
}
xsecn.resize(nelments);
prob.resize(nelments);
// build second moment table only if transport table is build
G4PhysicsTable* table = GetCrossSectionTable();
if(useSecondMoment && IsMaster() && table) {
if(useSecondMoment && IsMaster() && nullptr != table) {
//G4cout << "### G4WentzelVIModel::Initialise: build 2nd moment table "
// << table << G4endl;
fSecondMoments =
G4PhysicsTableHelper::PreparePhysicsTable(fSecondMoments);
// Access to materials
const G4ProductionCutsTable* theCoupleTable =
G4ProductionCutsTable::GetProductionCutsTable();
size_t numOfCouples = theCoupleTable->GetTableSize();
G4bool splineFlag = true;
G4PhysicsVector* aVector = nullptr;
@@ -178,8 +166,8 @@ void G4WentzelVIModel::Initialise(const G4ParticleDefinition* p,
DefineMaterial(theCoupleTable->GetMaterialCutsCouple(i));
delete (*fSecondMoments)[i];
if(!aVector) {
aVector = new G4PhysicsLogVector(emin, emax, n);
if(nullptr == aVector) {
aVector = new G4PhysicsLogVector(emin, emax, n, splineFlag);
bVector = aVector;
} else {
bVector = new G4PhysicsVector(*aVector);
@@ -229,7 +217,7 @@ G4double G4WentzelVIModel::ComputeCrossSectionPerAtom(
G4double cross = 0.0;
SetupParticle(p);
if(kinEnergy < lowEnergyLimit) { return cross; }
if(!CurrentCouple()) {
if(nullptr == CurrentCouple()) {
G4Exception("G4WentzelVIModel::ComputeCrossSectionPerAtom", "em0011",
FatalException, " G4MaterialCutsCouple is not defined");
return 0.0;
@@ -270,7 +258,7 @@ G4double G4WentzelVIModel::ComputeTruePathLengthLimit(
{
G4double tlimit = currentMinimalStep;
const G4DynamicParticle* dp = track.GetDynamicParticle();
G4StepPoint* sp = track.GetStep()->GetPreStepPoint();
const G4StepPoint* sp = track.GetStep()->GetPreStepPoint();
G4StepStatus stepStatus = sp->GetStepStatus();
singleScatteringMode = false;
@@ -279,8 +267,8 @@ G4double G4WentzelVIModel::ComputeTruePathLengthLimit(
// << G4endl;
// initialisation for each step, lambda may be computed from scratch
preKinEnergy = dp->GetKineticEnergy();
effKinEnergy = preKinEnergy;
preKinEnergy = dp->GetKineticEnergy();
effKinEnergy = preKinEnergy;
DefineMaterial(track.GetMaterialCutsCouple());
const G4double logPreKinEnergy = dp->GetLogKineticEnergy();
lambdaeff = GetTransportMeanFreePath(particle,preKinEnergy,logPreKinEnergy);
@@ -81,8 +81,7 @@ G4WentzelVIRelModel::G4WentzelVIRelModel() :
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4WentzelVIRelModel::~G4WentzelVIRelModel()
{
}
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -123,7 +122,7 @@ G4double G4WentzelVIRelModel::ComputeCrossSectionPerAtom(
G4double cross = 0.0;
if(p != particle) { SetupParticle(p); }
if(kinEnergy < lowEnergyLimit) { return cross; }
if(!CurrentCouple()) {
if(nullptr == CurrentCouple()) {
G4Exception("G4WentzelVIRelModel::ComputeCrossSectionPerAtom", "em0011",
FatalException, " G4MaterialCutsCouple is not defined");
return cross;
@@ -36,15 +36,13 @@
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
////////////////////////////////////////////////////////////////////////////////////
using namespace std;
//////////////////////////////////////////////////////////////////////////////////
const G4double G4XrayRayleighModel::fCofA = 2.*pi2*Bohr_radius*Bohr_radius;
const G4double G4XrayRayleighModel::fCofR = 8.*pi*classic_electr_radius*classic_electr_radius/3.;
//////////////////////////////////////////////////////////////////////////////////.
//////////////////////////////////////////////////////////////////////////////////
G4XrayRayleighModel::G4XrayRayleighModel(const G4ParticleDefinition*,
const G4String& nam)
@@ -83,7 +81,7 @@ G4XrayRayleighModel::~G4XrayRayleighModel()
}
/////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
void G4XrayRayleighModel::Initialise(const G4ParticleDefinition* particle,
const G4DataVector& cuts)
@@ -102,7 +100,7 @@ void G4XrayRayleighModel::Initialise(const G4ParticleDefinition* particle,
}
/////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
G4double G4XrayRayleighModel::ComputeCrossSectionPerAtom(
const G4ParticleDefinition*,
@@ -150,7 +148,7 @@ G4double G4XrayRayleighModel::ComputeCrossSectionPerAtom(
}
///////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
void G4XrayRayleighModel::SampleSecondaries(std::vector<G4DynamicParticle*>* /*fvect*/,
const G4MaterialCutsCouple* couple,
@@ -73,7 +73,7 @@ G4alphaIonisation::G4alphaIonisation(const G4String& name)
SetProcessSubType(fIonisation);
mass = 0.0;
ratio = 0.0;
eth = 8*MeV;
eth = 8*CLHEP::MeV;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -83,10 +83,9 @@ G4alphaIonisation::~G4alphaIonisation()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4bool G4alphaIonisation::IsApplicable(const G4ParticleDefinition& p)
G4bool G4alphaIonisation::IsApplicable(const G4ParticleDefinition&)
{
return (!p.IsShortLived() &&
std::abs(p.GetPDGCharge()/CLHEP::eplus - 2) < 0.01);
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -113,7 +112,7 @@ void G4alphaIonisation::InitialiseEnergyLossProcess(
// define base particle
const G4ParticleDefinition* theBaseParticle = nullptr;
if(bpart == 0) {
if(bpart == nullptr) {
if(pname != "alpha") { theBaseParticle = G4Alpha::Alpha(); }
} else { theBaseParticle = bpart; }
@@ -123,7 +122,7 @@ void G4alphaIonisation::InitialiseEnergyLossProcess(
SetBaseParticle(theBaseParticle);
SetSecondaryParticle(G4Electron::Electron());
if (!EmModel(0)) { SetEmModel(new G4BraggIonModel()); }
if (nullptr == EmModel(0)) { SetEmModel(new G4BraggIonModel()); }
G4EmParameters* param = G4EmParameters::Instance();
G4double emin = param->MinKinEnergy();
@@ -134,9 +133,11 @@ void G4alphaIonisation::InitialiseEnergyLossProcess(
EmModel(0)->SetHighEnergyLimit(eth);
AddEmModel(1, EmModel(0), new G4IonFluctuations());
if (!FluctModel()) { SetFluctModel(new G4UniversalFluctuation()); }
if (nullptr == FluctModel()) {
SetFluctModel(new G4UniversalFluctuation());
}
if (!EmModel(1)) { SetEmModel(new G4BetheBlochModel()); }
if (nullptr == EmModel(1)) { SetEmModel(new G4BetheBlochModel()); }
EmModel(1)->SetLowEnergyLimit(eth);
EmModel(1)->SetHighEnergyLimit(param->MaxKinEnergy());
AddEmModel(2, EmModel(1), FluctModel());
@@ -147,11 +148,6 @@ void G4alphaIonisation::InitialiseEnergyLossProcess(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4alphaIonisation::PrintInfo()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4alphaIonisation::ProcessDescription(std::ostream& out) const
{
out << " Alpha ionisation";
@@ -98,11 +98,11 @@ using namespace std;
G4eBremParametrizedModel::G4eBremParametrizedModel(const G4ParticleDefinition* p,
const G4String& nam)
: G4VEmModel(nam),
particle(0),
isElectron(true),
particle(nullptr),
fMigdalConstant(classic_electr_radius*electron_Compton_length*electron_Compton_length*4.0*pi),
bremFactor(fine_structure_const*classic_electr_radius*classic_electr_radius*16./3.),
isInitialised(false)
isInitialised(false),
isElectron(true)
{
theGamma = G4Gamma::Gamma();
@@ -118,7 +118,7 @@ G4eBremParametrizedModel::G4eBremParametrizedModel(const G4ParticleDefinition* p
= densityFactor = densityCorr = fMax = fCoulomb = 0.;
InitialiseConstants();
if(p) { SetParticle(p); }
if(nullptr != p) { SetParticle(p); }
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -59,12 +59,12 @@
using namespace std;
G4eBremsstrahlung::G4eBremsstrahlung(const G4String& name):
G4VEnergyLossProcess(name),
isInitialised(false)
G4VEnergyLossProcess(name)
{
SetProcessSubType(fBremsstrahlung);
SetSecondaryParticle(G4Gamma::Gamma());
SetIonisation(false);
SetCrossSectionType(fEmTwoPeaks);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -92,7 +92,7 @@ G4eBremsstrahlung::InitialiseEnergyLossProcess(const G4ParticleDefinition*,
G4double emax = param->MaxKinEnergy();
G4VEmFluctuationModel* fm = nullptr;
if (!EmModel(0)) { SetEmModel(new G4SeltzerBergerModel()); }
if (nullptr == EmModel(0)) { SetEmModel(new G4SeltzerBergerModel()); }
EmModel(0)->SetLowEnergyLimit(emin);
G4double energyLimit = std::min(EmModel(0)->HighEnergyLimit(), GeV);
EmModel(0)->SetHighEnergyLimit(energyLimit);
@@ -101,7 +101,7 @@ G4eBremsstrahlung::InitialiseEnergyLossProcess(const G4ParticleDefinition*,
AddEmModel(1, EmModel(0), fm);
if(emax > energyLimit) {
if (!EmModel(1)) { SetEmModel(new G4eBremsstrahlungRelModel()); }
if (nullptr == EmModel(1)) { SetEmModel(new G4eBremsstrahlungRelModel()); }
EmModel(1)->SetLowEnergyLimit(energyLimit);
EmModel(1)->SetHighEnergyLimit(emax);
EmModel(1)->SetSecondaryThreshold(param->BremsstrahlungTh());
@@ -116,7 +116,7 @@ G4eBremsstrahlung::InitialiseEnergyLossProcess(const G4ParticleDefinition*,
void G4eBremsstrahlung::StreamProcessInfo(std::ostream& out) const
{
if(EmModel(0)) {
if(nullptr != EmModel(0)) {
G4EmParameters* param = G4EmParameters::Instance();
G4double eth = param->BremsstrahlungTh();
out << " LPM flag: " << param->LPM() << " for E > "
@@ -115,22 +115,9 @@ std::vector<G4eBremsstrahlungRelModel::ElementData*> G4eBremsstrahlungRelModel::
G4eBremsstrahlungRelModel::G4eBremsstrahlungRelModel(const G4ParticleDefinition* p,
const G4String& nam)
: G4VEmModel(nam), fIsElectron(true), fIsScatOffElectron(false),
fIsLPMActive(false), fPrimaryParticle(nullptr), fIsUseCompleteScreening(false)
: G4VEmModel(nam)
{
fCurrentIZ = 0;
//
fPrimaryParticleMass = 0.;
fPrimaryKinEnergy = 0.;
fPrimaryTotalEnergy = 0.;
fDensityFactor = 0.;
fDensityCorr = 0.;
fNucTerm = 0.;
fSumTerm = 0.;
//
fPrimaryParticle = nullptr;
fGammaParticle = G4Gamma::Gamma();
fParticleChange = nullptr;
//
fLowestKinEnergy = 1.0*MeV;
SetLowEnergyLimit(fLowestKinEnergy);
@@ -141,9 +128,8 @@ G4eBremsstrahlungRelModel::G4eBremsstrahlungRelModel(const G4ParticleDefinition*
SetLPMFlag(true);
//
SetAngularDistribution(new G4ModifiedTsai());
//SetAngularDistribution(new G4DipBustGenerator());
//
if (p) {
if (nullptr != p) {
SetParticle(p);
}
}
@@ -153,7 +139,7 @@ G4eBremsstrahlungRelModel::~G4eBremsstrahlungRelModel()
if (IsMaster()) {
// clear ElementData container
for (size_t iz = 0; iz < gElementData.size(); ++iz) {
if (gElementData[iz]) {
if (nullptr != gElementData[iz]) {
delete gElementData[iz];
}
}
@@ -170,7 +156,7 @@ G4eBremsstrahlungRelModel::~G4eBremsstrahlungRelModel()
void G4eBremsstrahlungRelModel::Initialise(const G4ParticleDefinition* p,
const G4DataVector& cuts)
{
if (p) {
if (nullptr != p) {
SetParticle(p);
}
fCurrentIZ = 0;
@@ -182,7 +168,9 @@ void G4eBremsstrahlungRelModel::Initialise(const G4ParticleDefinition* p,
InitialiseElementSelectors(p, cuts);
}
}
if (!fParticleChange) { fParticleChange = GetParticleChangeForLoss(); }
if (nullptr == fParticleChange) {
fParticleChange = GetParticleChangeForLoss();
}
if (GetTripletModel()) {
GetTripletModel()->Initialise(p, cuts);
fIsScatOffElectron = true;
@@ -244,7 +232,7 @@ G4eBremsstrahlungRelModel::ComputeDEDXPerVolume(const G4Material* material,
G4double cutEnergy)
{
G4double dedx = 0.0;
if (!fPrimaryParticle) {
if (nullptr == fPrimaryParticle) {
SetParticle(p);
}
if (kineticEnergy < LowEnergyLimit()) {
@@ -331,7 +319,7 @@ G4double G4eBremsstrahlungRelModel::ComputeCrossSectionPerAtom(
G4double maxEnergy)
{
G4double crossSection = 0.0;
if (!fPrimaryParticle) {
if (nullptr == fPrimaryParticle) {
SetParticle(p);
}
if (kineticEnergy < LowEnergyLimit()) {
@@ -123,7 +123,7 @@ void G4eCoulombScatteringModel::Initialise(const G4ParticleDefinition* part,
<< " 1-cos(TetMax)= " << 1. - cosThetaMax << G4endl;
G4cout << "cut[0]= " << (*pCuts)[0] << G4endl;
*/
if(!fParticleChange) {
if(nullptr == fParticleChange) {
fParticleChange = GetParticleChangeForGamma();
}
if(IsMaster() && mass < GeV && part->GetParticleName() != "GenericIon") {
@@ -46,14 +46,11 @@
#include "G4Electron.hh"
#include "G4MollerBhabhaModel.hh"
#include "G4UniversalFluctuation.hh"
#include "G4BohrFluctuations.hh"
#include "G4UnitsTable.hh"
#include "G4EmParameters.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
using namespace std;
G4eIonisation::G4eIonisation(const G4String& name)
: G4VEnergyLossProcess(name),
theElectron(G4Electron::Electron()),
@@ -95,11 +92,11 @@ void G4eIonisation::InitialiseEnergyLossProcess(
{
if(!isInitialised) {
if(part != theElectron) { isElectron = false; }
if (!EmModel(0)) { SetEmModel(new G4MollerBhabhaModel()); }
if (nullptr == EmModel(0)) { SetEmModel(new G4MollerBhabhaModel()); }
G4EmParameters* param = G4EmParameters::Instance();
EmModel(0)->SetLowEnergyLimit(param->MinKinEnergy());
EmModel(0)->SetHighEnergyLimit(param->MaxKinEnergy());
if (!FluctModel()) { SetFluctModel(new G4UniversalFluctuation()); }
if (nullptr == FluctModel()) { SetFluctModel(new G4UniversalFluctuation()); }
AddEmModel(1, EmModel(), FluctModel());
isInitialised = true;
@@ -108,11 +105,6 @@ void G4eIonisation::InitialiseEnergyLossProcess(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4eIonisation::PrintInfo()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4eIonisation::ProcessDescription(std::ostream& out) const
{
out << " Ionisation";
@@ -66,7 +66,7 @@ G4eMultipleScattering::~G4eMultipleScattering()
G4bool G4eMultipleScattering::IsApplicable (const G4ParticleDefinition& p)
{
return (p.GetPDGCharge() != 0.0 && !p.IsShortLived());
return (p.GetPDGCharge() != 0.0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -74,9 +74,9 @@ G4bool G4eMultipleScattering::IsApplicable (const G4ParticleDefinition& p)
void G4eMultipleScattering::InitialiseProcess(const G4ParticleDefinition*)
{
if(isInitialized) { return; }
if(!EmModel(0)) { SetEmModel(new G4UrbanMscModel()); }
if(nullptr == EmModel(0)) { SetEmModel(new G4UrbanMscModel()); }
AddEmModel(1, EmModel(0));
if(EmModel(1)) { AddEmModel(1, EmModel(1)); }
if(nullptr != EmModel(1)) { AddEmModel(1, EmModel(1)); }
isInitialized = true;
}
@@ -36,6 +36,13 @@
// Creation date: 02.08.2004
//
// Modified by Michel Maire, Vladimir Ivanchenko and Daren Sawkey
//
// Introduced Quantum Entanglement April 2021 John Allison
// This is activated by /process/em/QuantumEntanglement
// For e+e- -> gamma gamma, the gammas are "tagged" here
// and must be "analysed" in a Compton scattering process - see, for
// example, G4LivermorePolarizedComptonModel. Otherwise entanglement
// has no effect even if activated.
//
// -------------------------------------------------------------------
@@ -47,25 +54,31 @@
#include "G4PhysicalConstants.hh"
#include "G4MaterialCutsCouple.hh"
#include "G4Gamma.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4eeToTwoGammaModel.hh"
#include "G4EmBiasingManager.hh"
#include "G4EntanglementAuxInfo.hh"
#include "G4eplusAnnihilationEntanglementClipBoard.hh"
#include "G4EmParameters.hh"
#include "G4PhysicsModelCatalog.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
using namespace std;
G4eplusAnnihilation::G4eplusAnnihilation(const G4String& name)
: G4VEmProcess(name), isInitialised(false)
: G4VEmProcess(name)
{
theGamma = G4Gamma::Gamma();
SetIntegral(true);
theElectron = G4Electron::Electron();
SetCrossSectionType(fEmDecreasing);
SetBuildTableFlag(false);
SetStartFromNullFlag(false);
SetSecondaryParticle(theGamma);
SetProcessSubType(fAnnihilation);
enableAtRestDoIt = true;
mainSecondaries = 2;
fEntanglementModelIndex =
G4PhysicsModelCatalog::Register("G4GammaGammaEntanglement");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -95,7 +108,7 @@ void G4eplusAnnihilation::InitialiseProcess(const G4ParticleDefinition*)
{
if(!isInitialised) {
isInitialised = true;
if(!EmModel(0)) { SetEmModel(new G4eeToTwoGammaModel()); }
if(nullptr == EmModel(0)) { SetEmModel(new G4eeToTwoGammaModel()); }
EmModel(0)->SetLowEnergyLimit(MinKinEnergy());
EmModel(0)->SetHighEnergyLimit(MaxKinEnergy());
AddEmModel(1, EmModel(0));
@@ -128,7 +141,7 @@ G4VParticleChange* G4eplusAnnihilation::AtRestDoIt(const G4Track& track,
G4double gammaCut = GetGammaEnergyCut();
model->SampleSecondaries(&secParticles, MaterialCutsCouple(),
track.GetDynamicParticle(), gammaCut);
G4int num0 = secParticles.size();
// splitting or Russian roulette
@@ -144,8 +157,37 @@ G4VParticleChange* G4eplusAnnihilation::AtRestDoIt(const G4Track& track,
}
}
}
// save secondaries
G4int num = secParticles.size();
// Check that entanglement is switched on... (the following flag is
// set by /process/em/QuantumEntanglement).
G4bool entangled = G4EmParameters::Instance()->QuantumEntanglement();
// ...and that we have two gammas with both gammas' energies above
// gammaCut (entanglement is only programmed for e+ e- -> gamma gamma).
G4bool entangledgammagamma = false;
if (entangled) {
if (num == 2) {
entangledgammagamma = true;
for (const auto* p: secParticles) {
if (p->GetDefinition() != theGamma ||
p->GetKineticEnergy() < gammaCut) {
entangledgammagamma = false;
}
}
}
}
// Prepare a shared pointer for psossible use below. If it is used, the
// shared pointer is copied into the tracks through G4EntanglementAuxInfo.
// This ensures the clip board lasts until both tracks are destroyed.
std::shared_ptr<G4eplusAnnihilationEntanglementClipBoard> clipBoard;
if (entangledgammagamma) {
clipBoard = std::make_shared<G4eplusAnnihilationEntanglementClipBoard>();
clipBoard->SetParentParticleDefinition(track.GetDefinition());
}
if(num > 0) {
fParticleChange.SetNumberOfSecondaries(num);
@@ -169,6 +211,17 @@ G4VParticleChange* G4eplusAnnihilation::AtRestDoIt(const G4Track& track,
if (good) {
G4Track* t = new G4Track(dp, time, track.GetPosition());
t->SetTouchableHandle(track.GetTouchableHandle());
if (entangledgammagamma) {
// entangledgammagamma is only true when there are only two gammas
// (See code above where entangledgammagamma is calculated.)
if (i == 0) { // First gamma
clipBoard->SetTrackA(t);
} else if (i == 1) { // Second gamma
clipBoard->SetTrackB(t);
}
t->SetAuxiliaryTrackInformation
(fEntanglementModelIndex,new G4EntanglementAuxInfo(clipBoard));
}
if (biasManager) {
t->SetWeight(weight * biasManager->GetWeight(i));
} else {
@@ -99,12 +99,9 @@ void G4eplusTo2GammaOKVIModel::Initialise(const G4ParticleDefinition* p,
G4double emin = 10*eV;
G4double emax = 100*TeV;
G4int nbins = 20*G4lrint(std::log10(emax/emin));
fCrossSection = new G4PhysicsLogVector(emin, emax, nbins);
fCrossSection3G = new G4PhysicsLogVector(emin, emax, nbins);
f3GProbability = new G4PhysicsLogVector(emin, emax, nbins);
fCrossSection->SetSpline(true);
fCrossSection3G->SetSpline(true);
f3GProbability->SetSpline(true);
fCrossSection = new G4PhysicsLogVector(emin, emax, nbins, true);
fCrossSection3G = new G4PhysicsLogVector(emin, emax, nbins, true);
f3GProbability = new G4PhysicsLogVector(emin, emax, nbins, true);
for(G4int i=0; i<= nbins; ++i) {
G4double e = fCrossSection->Energy(i);
G4double cs2 = ComputeCrossSectionPerElectron(e);
@@ -114,6 +111,9 @@ void G4eplusTo2GammaOKVIModel::Initialise(const G4ParticleDefinition* p,
fCrossSection3G->PutValue(i, cs3);
f3GProbability->PutValue(i, cs3/cs2);
}
fCrossSection->FillSecondDerivatives();
fCrossSection3G->FillSecondDerivatives();
f3GProbability->FillSecondDerivatives();
}
}
// here particle change is set for the triplet model
@@ -61,8 +61,6 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
using namespace std;
G4hCoulombScatteringModel::G4hCoulombScatteringModel(G4bool combined)
: G4VEmModel("hCoulombScattering"),
cosThetaMin(1.0),
@@ -114,7 +112,7 @@ void G4hCoulombScatteringModel::Initialise(const G4ParticleDefinition* part,
} else if(tet >= CLHEP::pi) {
cosThetaMin = -1.0;
} else {
cosThetaMin = cos(tet);
cosThetaMin = std::cos(tet);
}
wokvi->Initialise(part, cosThetaMin);
@@ -135,7 +133,7 @@ void G4hCoulombScatteringModel::Initialise(const G4ParticleDefinition* part,
if(!fParticleChange) {
fParticleChange = GetParticleChangeForGamma();
}
if(IsMaster() && mass < GeV && part->GetParticleName() != "GenericIon") {
if(IsMaster() && mass < CLHEP::GeV && part->GetParticleName() != "GenericIon") {
InitialiseElementSelectors(part, cuts);
}
}
@@ -172,7 +170,7 @@ G4hCoulombScatteringModel::MinPrimaryEnergy(const G4Material* material,
}
G4int A = G4lrint(fNistManager->GetAtomicMassAmu(Z));
G4double targetMass = G4NucleiProperties::GetNuclearMass(A, Z);
G4double t = std::max(cut, 0.5*(cut + sqrt(2*cut*targetMass)));
G4double t = std::max(cut, 0.5*(cut + std::sqrt(2*cut*targetMass)));
return t;
}
@@ -263,7 +261,7 @@ void G4hCoulombScatteringModel::SampleSecondaries(
wokvi->SampleSingleScattering(costmin, costmax, ratio);
// kinematics in the Lab system
G4double ptot = sqrt(kinEnergy*(kinEnergy + 2.0*mass));
G4double ptot = std::sqrt(kinEnergy*(kinEnergy + 2.0*mass));
G4double e1 = mass + kinEnergy;
// Lab. system kinematics along projectile direction
@@ -53,7 +53,6 @@
#include "G4BetheBlochModel.hh"
#include "G4IonFluctuations.hh"
#include "G4UniversalFluctuation.hh"
#include "G4BohrFluctuations.hh"
#include "G4UnitsTable.hh"
#include "G4PionPlus.hh"
#include "G4PionMinus.hh"
@@ -64,8 +63,6 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
using namespace std;
G4hIonisation::G4hIonisation(const G4String& name)
: G4VEnergyLossProcess(name),
isInitialised(false)
@@ -74,7 +71,7 @@ G4hIonisation::G4hIonisation(const G4String& name)
SetSecondaryParticle(G4Electron::Electron());
mass = 0.0;
ratio = 0.0;
eth = 2*MeV;
eth = 2*CLHEP::MeV;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -84,10 +81,9 @@ G4hIonisation::~G4hIonisation()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4bool G4hIonisation::IsApplicable(const G4ParticleDefinition& p)
G4bool G4hIonisation::IsApplicable(const G4ParticleDefinition&)
{
return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 10.0*MeV &&
!p.IsShortLived());
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -157,7 +153,7 @@ void G4hIonisation::InitialiseEnergyLossProcess(
SetDEDXBinning(bin);
}
if (!EmModel(0)) {
if (nullptr == EmModel(0)) {
if(q > 0.0) { SetEmModel(new G4BraggModel()); }
else { SetEmModel(new G4ICRU73QOModel()); }
}
@@ -165,9 +161,9 @@ void G4hIonisation::InitialiseEnergyLossProcess(
EmModel(0)->SetHighEnergyLimit(eth);
AddEmModel(1, EmModel(0), new G4IonFluctuations());
if (!FluctModel()) { SetFluctModel(new G4UniversalFluctuation()); }
if (nullptr == FluctModel()) { SetFluctModel(new G4UniversalFluctuation()); }
if (!EmModel(1)) { SetEmModel(new G4BetheBlochModel()); }
if (nullptr == EmModel(1)) { SetEmModel(new G4BetheBlochModel()); }
EmModel(1)->SetLowEnergyLimit(eth);
EmModel(1)->SetHighEnergyLimit(emax);
AddEmModel(1, EmModel(1), FluctModel());
@@ -178,11 +174,6 @@ void G4hIonisation::InitialiseEnergyLossProcess(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4hIonisation::PrintInfo()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4hIonisation::ProcessDescription(std::ostream& out) const
{
out << " Ionisation";
@@ -66,7 +66,7 @@ G4hMultipleScattering::~G4hMultipleScattering()
G4bool G4hMultipleScattering::IsApplicable (const G4ParticleDefinition& p)
{
return (p.GetPDGCharge() != 0.0 && !p.IsShortLived());
return (p.GetPDGCharge() != 0.0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -74,7 +74,7 @@ G4bool G4hMultipleScattering::IsApplicable (const G4ParticleDefinition& p)
void G4hMultipleScattering::InitialiseProcess(const G4ParticleDefinition*)
{
if(isInitialized) { return; }
if(!EmModel(0)) { SetEmModel(new G4UrbanMscModel()); }
if(nullptr == EmModel(0)) { SetEmModel( new G4UrbanMscModel() ); }
AddEmModel(1, EmModel(0));
isInitialized = true;
}
@@ -78,8 +78,6 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
using namespace std;
G4ionIonisation::G4ionIonisation(const G4String& name)
: G4VEnergyLossProcess(name),
theParticle(nullptr),
@@ -90,7 +88,7 @@ G4ionIonisation::G4ionIonisation(const G4String& name)
SetProcessSubType(fIonisation);
SetSecondaryParticle(G4Electron::Electron());
corr = G4LossTableManager::Instance()->EmCorrections();
eth = 2*MeV;
eth = 2*CLHEP::MeV;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -100,10 +98,9 @@ G4ionIonisation::~G4ionIonisation()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4bool G4ionIonisation::IsApplicable(const G4ParticleDefinition& p)
G4bool G4ionIonisation::IsApplicable(const G4ParticleDefinition&)
{
return (p.GetPDGCharge() != 0.0 && !p.IsShortLived() &&
p.GetParticleType() == "nucleus");
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -112,8 +109,7 @@ G4double G4ionIonisation::MinPrimaryEnergy(const G4ParticleDefinition* p,
const G4Material*,
G4double cut)
{
return
p->GetPDGMass()*(std::sqrt(1. + 0.5*cut/CLHEP::electron_mass_c2) - 1.0);
return p->GetPDGMass()*(std::sqrt(1. + 0.5*cut/CLHEP::electron_mass_c2) - 1.0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -125,7 +121,6 @@ void G4ionIonisation::InitialiseEnergyLossProcess(
const G4ParticleDefinition* ion = G4GenericIon::GenericIon();
if(!isInitialised) {
theParticle = part;
// define base particle
@@ -137,7 +132,7 @@ void G4ionIonisation::InitialiseEnergyLossProcess(
SetBaseParticle(theBaseParticle);
if (!EmModel(0)) { SetEmModel(new G4BraggIonModel()); }
if (nullptr == EmModel(0)) { SetEmModel(new G4BraggIonModel()); }
G4EmParameters* param = G4EmParameters::Instance();
EmModel(0)->SetLowEnergyLimit(param->MinKinEnergy());
@@ -146,12 +141,12 @@ void G4ionIonisation::InitialiseEnergyLossProcess(
eth = (EmModel(0)->HighEnergyLimit())*part->GetPDGMass()/proton_mass_c2;
EmModel(0)->SetHighEnergyLimit(eth);
if (!FluctModel()) { SetFluctModel(new G4IonFluctuations()); }
if (nullptr == FluctModel()) { SetFluctModel(new G4IonFluctuations()); }
AddEmModel(1, EmModel(0), FluctModel());
G4double emax = param->MaxKinEnergy();
if(eth < emax) {
if (!EmModel(1)) { SetEmModel(new G4BetheBlochModel()); }
if (nullptr == EmModel(1)) { SetEmModel(new G4BetheBlochModel()); }
EmModel(1)->SetLowEnergyLimit(eth);
EmModel(1)->SetHighEnergyLimit(emax);
AddEmModel(2, EmModel(1), FluctModel());