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
@@ -116,7 +116,7 @@ G4EnergyLossForExtrapolator::EnergyBeforeStep(G4double kinEnergy,
const G4Material* mat,
const G4ParticleDefinition* part)
{
// G4cout << "G4EnergyLossForExtrapolator::EnergyBeforeStep" << G4endl;
//G4cout << "G4EnergyLossForExtrapolator::EnergyBeforeStep" << G4endl;
G4double kinEnergyFinal = kinEnergy;
if(SetupKinematics(part, mat, kinEnergy)) {
@@ -210,15 +210,10 @@ G4EnergyLossForExtrapolator::SetupKinematics(const G4ParticleDefinition* part,
const G4ParticleDefinition*
G4EnergyLossForExtrapolator::FindParticle(const G4String& name)
{
if(name != currentParticleName) {
currentParticle = G4ParticleTable::GetParticleTable()->FindParticle(name);
currentParticleName = name;
if(nullptr == currentParticle) {
G4cout << "### G4EnergyLossForExtrapolator WARNING: "
<< "FindParticle() fails to find "
<< name << G4endl;
currentParticleName = "";
}
currentParticle = G4ParticleTable::GetParticleTable()->FindParticle(name);
if(nullptr == currentParticle) {
G4cout << "### G4EnergyLossForExtrapolator WARNING: "
<< "FindParticle() fails to find " << name << G4endl;
}
return currentParticle;
}
@@ -335,7 +330,8 @@ G4double G4EnergyLossForExtrapolator::AverageScatteringAngle(
void G4EnergyLossForExtrapolator::Initialisation()
{
if(verbose>0) {
G4cout << "### G4EnergyLossForExtrapolator::Initialisation" << G4endl;
G4cout << "### G4EnergyLossForExtrapolator::Initialisation tables= "
<< tables << G4endl;
}
electron = G4Electron::Electron();
positron = G4Positron::Positron();
@@ -25,41 +25,46 @@
//
#include "G4ErrorEnergyLoss.hh"
#include "G4ErrorPropagatorData.hh"
#include "G4EnergyLossForExtrapolator.hh"
#include "G4ErrorPropagatorData.hh"
//-------------------------------------------------------------------
G4ErrorEnergyLoss::G4ErrorEnergyLoss(const G4String& processName,
G4ProcessType type)
: G4VContinuousProcess(processName, type)
: G4VContinuousProcess(processName, type)
{
if (verboseLevel>2) {
G4cout << GetProcessName() << " is created " << G4endl;
}
theELossForExtrapolator = new G4EnergyLossForExtrapolator;
theStepLimit = 1.;
theStepLimit = 1.*CLHEP::mm;
}
//-------------------------------------------------------------------
void G4ErrorEnergyLoss::InstantiateEforExtrapolator()
{}
//-------------------------------------------------------------------
G4ErrorEnergyLoss::~G4ErrorEnergyLoss()
{
delete theELossForExtrapolator;
}
//-------------------------------------------------------------------
G4bool G4ErrorEnergyLoss::IsApplicable(const G4ParticleDefinition& aParticleType)
{
return (aParticleType.GetPDGCharge() != 0);
}
//-------------------------------------------------------------------
G4VParticleChange*
G4ErrorEnergyLoss::AlongStepDoIt(const G4Track& aTrack, const G4Step& aStep)
{
aParticleChange.Initialize(aTrack);
G4ErrorPropagatorData* g4edata = G4ErrorPropagatorData::GetErrorPropagatorData();
G4ErrorPropagatorData* g4edata = G4ErrorPropagatorData::GetErrorPropagatorData();
G4double kinEnergyStart = aTrack.GetKineticEnergy();
G4double step_length = aStep.GetStepLength();
@@ -68,12 +73,13 @@ G4ErrorEnergyLoss::AlongStepDoIt(const G4Track& aTrack, const G4Step& aStep)
const G4ParticleDefinition* aParticleDef = aTrack.GetDynamicParticle()->GetDefinition();
G4double kinEnergyEnd = kinEnergyStart;
// backward - energy increased
if( g4edata->GetMode() == G4ErrorMode(G4ErrorMode_PropBackwards) ) {
kinEnergyEnd = theELossForExtrapolator->EnergyBeforeStep( kinEnergyStart,
step_length,
aMaterial,
aParticleDef );
G4double kinEnergyHalfStep = kinEnergyStart - (kinEnergyStart-kinEnergyEnd)/2.;
G4double kinEnergyHalfStep = (kinEnergyStart + kinEnergyEnd) * 0.5;
#ifdef G4VERBOSE
if(G4ErrorPropagatorData::verbose() >= 3 )
@@ -87,12 +93,14 @@ G4ErrorEnergyLoss::AlongStepDoIt(const G4Track& aTrack, const G4Step& aStep)
aMaterial,
aParticleDef );
kinEnergyEnd = kinEnergyStart - (kinEnergyHalfStep - kinEnergyEnd );
}else if( g4edata->GetMode() == G4ErrorMode(G4ErrorMode_PropForwards) ) {
// forward - energy decreased
} else {
kinEnergyEnd = theELossForExtrapolator->EnergyAfterStep( kinEnergyStart,
step_length,
aMaterial,
aParticleDef );
G4double kinEnergyHalfStep = kinEnergyStart - (kinEnergyStart-kinEnergyEnd)/2.;
G4double kinEnergyHalfStep = (kinEnergyStart + kinEnergyEnd) * 0.5;
#ifdef G4VERBOSE
if(G4ErrorPropagatorData::verbose() >= 3 )
G4cout << " G4ErrorEnergyLoss BCKD end " << kinEnergyEnd
@@ -129,43 +137,20 @@ G4ErrorEnergyLoss::AlongStepDoIt(const G4Track& aTrack, const G4Step& aStep)
//-------------------------------------------------------------------
G4double G4ErrorEnergyLoss::GetContinuousStepLimit(const G4Track& aTrack,
G4double ,
G4double currentMinimumStep,
G4double& )
{
G4double Step = DBL_MAX;
if( theStepLimit != 1. ) {
G4double kinEnergyStart = aTrack.GetKineticEnergy();
G4double kinEnergyLoss = kinEnergyStart;
const G4Material* aMaterial = aTrack.GetMaterial();
const G4ParticleDefinition* aParticleDef = aTrack.GetDynamicParticle()->GetDefinition();
G4ErrorPropagatorData* g4edata = G4ErrorPropagatorData::GetErrorPropagatorData();
if( g4edata->GetMode() == G4ErrorMode(G4ErrorMode_PropBackwards) ) {
kinEnergyLoss = - kinEnergyStart +
theELossForExtrapolator->EnergyBeforeStep( kinEnergyStart, currentMinimumStep,
aMaterial, aParticleDef );
}else if( g4edata->GetMode() == G4ErrorMode(G4ErrorMode_PropForwards) ) {
kinEnergyLoss = kinEnergyStart -
theELossForExtrapolator->EnergyAfterStep( kinEnergyStart, currentMinimumStep,
aMaterial, aParticleDef );
}
G4double, G4double, G4double& )
{
G4double ekin = aTrack.GetKineticEnergy();
const G4Material* mat = aTrack.GetMaterial();
const G4ParticleDefinition* part =
aTrack.GetDynamicParticle()->GetDefinition();
G4double range = theELossForExtrapolator->ComputeRange(ekin, part, mat);
G4double delta = std::max(range*theFractionLimit, theStepLimit);
#ifdef G4VERBOSE
if(G4ErrorPropagatorData::verbose() >= 3 )
G4cout << " G4ErrorEnergyLoss: currentMinimumStep " <<currentMinimumStep
<< " kinEnergyLoss " << kinEnergyLoss
<< " kinEnergyStart " << kinEnergyStart << G4endl;
#endif
if( kinEnergyLoss / kinEnergyStart > theStepLimit ) {
Step = theStepLimit / (kinEnergyLoss / kinEnergyStart) * currentMinimumStep;
#ifdef G4VERBOSE
if(G4ErrorPropagatorData::verbose() >= 2 )
G4cout << " G4ErrorEnergyLoss: limiting Step " << Step
<< " energy loss fraction " << kinEnergyLoss / kinEnergyStart
<< " > " << theStepLimit << G4endl;
#endif
}
if(G4ErrorPropagatorData::verbose() >= 2 ) {
G4cout << " G4ErrorEnergyLoss: limiting Step " << delta
<< " energy(GeV) " << ekin / CLHEP::GeV
<< " for " << part->GetParticleName() << G4endl;
}
return Step;
#endif
return delta;
}
@@ -78,23 +78,14 @@ using namespace std;
G4MuBetheBlochModel::G4MuBetheBlochModel(const G4ParticleDefinition* p,
const G4String& nam)
: G4VEmModel(nam),
particle(nullptr),
limitKinEnergy(100.*keV),
logLimitKinEnergy(G4Log(limitKinEnergy)),
twoln10(2.0*G4Log(10.0)),
//bg2lim(0.0169),
//taulim(8.4146e-3),
alphaprime(fine_structure_const/twopi)
limitKinEnergy(100.*CLHEP::keV),
logLimitKinEnergy(G4Log(limitKinEnergy)),
twoln10(2.0*G4Log(10.0)),
alphaprime(CLHEP::fine_structure_const/CLHEP::twopi)
{
theElectron = G4Electron::Electron();
corr = G4LossTableManager::Instance()->EmCorrections();
fParticleChange = nullptr;
// initial initialisation of memeber should be overwritten
// by SetParticle
mass = massSquare = ratio = 1.0;
if(p) { SetParticle(p); }
if(nullptr != p) { SetParticle(p); }
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -121,8 +112,10 @@ G4double G4MuBetheBlochModel::MaxSecondaryEnergy(const G4ParticleDefinition*,
void G4MuBetheBlochModel::Initialise(const G4ParticleDefinition* p,
const G4DataVector&)
{
if(p) { SetParticle(p); }
if(!fParticleChange) { fParticleChange = GetParticleChangeForLoss(); }
SetParticle(p);
if(nullptr == fParticleChange) {
fParticleChange = GetParticleChangeForLoss();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -135,7 +128,7 @@ G4double G4MuBetheBlochModel::ComputeCrossSectionPerElectron(
{
G4double cross = 0.0;
G4double tmax = MaxSecondaryEnergy(p, kineticEnergy);
G4double maxEnergy = min(tmax,maxKinEnergy);
G4double maxEnergy = std::min(tmax,maxKinEnergy);
if(cutEnergy < maxEnergy) {
G4double totEnergy = kineticEnergy + mass;
@@ -153,7 +146,7 @@ G4double G4MuBetheBlochModel::ComputeCrossSectionPerElectron(
G4double logstep = logtmax - logtmin;
G4double dcross = 0.0;
for (G4int ll=0; ll<8; ll++)
for (G4int ll=0; ll<8; ++ll)
{
G4double ep = G4Exp(logtmin + xgi[ll]*logstep);
G4double a1 = G4Log(1.0 + 2.0*ep/electron_mass_c2);
@@ -165,9 +158,7 @@ G4double G4MuBetheBlochModel::ComputeCrossSectionPerElectron(
}
cross *= twopi_mc2_rcl2/beta2;
}
// G4cout << "tmin= " << cutEnergy << " tmax= " << tmax
// << " cross= " << cross << G4endl;
@@ -212,7 +203,7 @@ G4double G4MuBetheBlochModel::ComputeDEDXPerVolume(const G4Material* material,
{
G4double tmax = MaxSecondaryEnergy(p, kineticEnergy);
G4double tau = kineticEnergy/mass;
G4double cutEnergy = min(cut,tmax);
G4double cutEnergy = std::min(cut,tmax);
G4double gam = tau + 1.0;
G4double bg2 = tau * (tau+2.0);
G4double beta2 = bg2/(gam*gam);
@@ -235,10 +226,7 @@ G4double G4MuBetheBlochModel::ComputeDEDXPerVolume(const G4Material* material,
// shell correction
dedx -= 2.0*corr->ShellCorrection(p,material,kineticEnergy);
// now compute the total ionization loss
if (dedx < 0.0) dedx = 0.0 ;
dedx = std::max(dedx, 0.0);
// radiative corrections of R. Kokoulin
if (cutEnergy > limitKinEnergy) {
@@ -258,7 +246,7 @@ G4double G4MuBetheBlochModel::ComputeDEDXPerVolume(const G4Material* material,
dedx += dloss*logstep*alphaprime;
}
dedx *= twopi_mc2_rcl2*eDensity/beta2;
dedx *= CLHEP::twopi_mc2_rcl2*eDensity/beta2;
//High order corrections
dedx += corr->HighOrderCorrections(p,material,kineticEnergy,cutEnergy);
@@ -297,7 +285,6 @@ void G4MuBetheBlochModel::SampleSecondaries(vector<G4DynamicParticle*>* vdp,
deltaKinEnergy = minKinEnergy*maxKinEnergy
/(minKinEnergy*(1.0 - q) + maxKinEnergy*q);
f = 1.0 - beta2*deltaKinEnergy/tmax
+ 0.5*deltaKinEnergy*deltaKinEnergy/etot2;
@@ -323,9 +310,9 @@ void G4MuBetheBlochModel::SampleSecondaries(vector<G4DynamicParticle*>* vdp,
G4double cost = deltaKinEnergy * (totEnergy + electron_mass_c2) /
(deltaMomentum * totalMomentum);
G4double sint = sqrt(1.0 - cost*cost);
G4double sint = std::sqrt(1.0 - cost*cost);
G4double phi = twopi * G4UniformRand() ;
G4double phi = CLHEP::twopi * G4UniformRand() ;
G4ThreeVector deltaDirection(sint*cos(phi),sint*sin(phi), cost) ;
G4ThreeVector direction = dp->GetMomentumDirection();
@@ -74,8 +74,7 @@ using namespace std;
G4MuBremsstrahlung::G4MuBremsstrahlung(const G4String& name)
: G4VEnergyLossProcess(name),
lowestKinEnergy(1.*GeV),
isInitialised(false)
lowestKinEnergy(1.*CLHEP::GeV)
{
SetProcessSubType(fBremsstrahlung);
SetSecondaryParticle(G4Gamma::Gamma());
@@ -86,7 +85,7 @@ G4MuBremsstrahlung::G4MuBremsstrahlung(const G4String& name)
G4bool G4MuBremsstrahlung::IsApplicable(const G4ParticleDefinition& p)
{
return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 10.0*MeV);
return (p.GetPDGCharge() != 0.0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -104,28 +103,21 @@ void G4MuBremsstrahlung::InitialiseEnergyLossProcess(
const G4ParticleDefinition*,
const G4ParticleDefinition*)
{
if(!isInitialised) {
if(isInitialised) { return; }
isInitialised = true;
isInitialised = true;
if (nullptr == EmModel(0)) { SetEmModel(new G4MuBremsstrahlungModel()); }
if (!EmModel()) { SetEmModel(new G4MuBremsstrahlungModel()); }
G4VEmFluctuationModel* fm = nullptr;
G4EmParameters* param = G4EmParameters::Instance();
EmModel()->SetLowEnergyLimit(param->MinKinEnergy());
EmModel()->SetHighEnergyLimit(param->MaxKinEnergy());
EmModel()->SetSecondaryThreshold(param->MuHadBremsstrahlungTh());
AddEmModel(1, EmModel(), fm);
}
G4VEmFluctuationModel* fm = nullptr;
G4EmParameters* param = G4EmParameters::Instance();
EmModel(0)->SetLowEnergyLimit(param->MinKinEnergy());
EmModel(0)->SetHighEnergyLimit(param->MaxKinEnergy());
EmModel(0)->SetSecondaryThreshold(param->MuHadBremsstrahlungTh());
AddEmModel(1, EmModel(0), fm);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4MuBremsstrahlung::PrintInfo()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4MuBremsstrahlung::ProcessDescription(std::ostream& out) const
{
out << " Muon bremsstrahlung";
@@ -51,11 +51,6 @@
// 28-02-08 Use precomputed Z^1/3 and Log(A) (V.Ivanchenko)
// 31-05-13 Use element selectors instead of local data structure (V.Ivanchenko)
//
//
// Class Description:
//
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -76,6 +71,7 @@
#include "G4ParticleChangeForLoss.hh"
#include "G4Log.hh"
#include "G4Exp.hh"
#include "G4NistManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -87,39 +83,40 @@ const G4double G4MuBremsstrahlungModel::xgi[] =
const G4double G4MuBremsstrahlungModel::wgi[] =
{0.08566,0.18038,0.23396,0.23396,0.18038,0.08566};
G4double G4MuBremsstrahlungModel::fDN[] = {0.0};
#ifdef G4MULTITHREADED
G4Mutex G4MuBremsstrahlungModel::theMuBremMutex = G4MUTEX_INITIALIZER;
#endif
G4MuBremsstrahlungModel::G4MuBremsstrahlungModel(const G4ParticleDefinition* p,
const G4String& nam)
: G4VEmModel(nam),
particle(nullptr),
sqrte(sqrt(G4Exp(1.))),
bh(202.4),
bh1(446.),
btf(183.),
btf1(1429.),
fParticleChange(nullptr),
lowestKinEnergy(1.0*GeV),
minThreshold(0.9*keV)
lowestKinEnergy(1.0*CLHEP::GeV),
minThreshold(0.9*CLHEP::keV)
{
theGamma = G4Gamma::Gamma();
nist = G4NistManager::Instance();
lowestKinEnergy = 1.*GeV;
mass = rmass = cc = coeff = 1.0;
nist = G4NistManager::Instance();
if(0.0 == fDN[1]) {
for(G4int i=1; i<93; ++i) {
G4double dn = 1.54*nist->GetA27(i);
fDN[i] = dn;
if(1 < i) {
fDN[i] /= std::pow(dn, 1./G4double(i));
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&theMuBremMutex);
if(0.0 == fDN[1]) {
#endif
for(G4int i=1; i<93; ++i) {
G4double dn = 1.54*nist->GetA27(i);
fDN[i] = dn;
if(1 < i) {
fDN[i] /= std::pow(dn, 1./G4double(i));
}
}
#ifdef G4MULTITHREADED
}
G4MUTEXUNLOCK(&theMuBremMutex);
#endif
}
SetAngularDistribution(new G4ModifiedMephi());
if(p) { SetParticle(p); }
if(nullptr != p) { SetParticle(p); }
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -144,10 +141,11 @@ G4double G4MuBremsstrahlungModel::MinPrimaryEnergy(const G4Material*,
void G4MuBremsstrahlungModel::Initialise(const G4ParticleDefinition* p,
const G4DataVector& cuts)
{
if(p) { SetParticle(p); }
SetParticle(p);
// define pointer to G4ParticleChange
if(!fParticleChange) { fParticleChange = GetParticleChangeForLoss(); }
if(nullptr == fParticleChange) {
fParticleChange = GetParticleChangeForLoss();
}
if(IsMaster() && p == particle && lowestKinEnergy < HighEnergyLimit()) {
InitialiseElementSelectors(p, cuts);
@@ -184,7 +182,7 @@ G4double G4MuBremsstrahlungModel::ComputeDEDXPerVolume(
material->GetAtomicNumDensityVector();
// loop for elements in the material
for (size_t i=0; i<material->GetNumberOfElements(); i++) {
for (size_t i=0; i<material->GetNumberOfElements(); ++i) {
G4double loss =
ComputMuBremLoss((*theElementVector)[i]->GetZ(), kineticEnergy, cut);
@@ -259,9 +257,9 @@ G4double G4MuBremsstrahlungModel::ComputeMicroscopicCrossSection(
G4double aa = aaa;
for(G4int l=0; l<kkk; l++)
for(G4int l=0; l<kkk; ++l)
{
for(G4int i=0; i<6; i++)
for(G4int i=0; i<6; ++i)
{
G4double ep = G4Exp(aa + xgi[i]*hhh)*totalEnergy;
cross += ep*wgi[i]*ComputeDMicroscopicCrossSection(tkin, Z, ep);
@@ -79,29 +79,20 @@
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4Electron.hh"
#include "G4MuonPlus.hh"
#include "G4MuonMinus.hh"
#include "G4BraggModel.hh"
#include "G4BetheBlochModel.hh"
#include "G4MuBetheBlochModel.hh"
#include "G4UniversalFluctuation.hh"
#include "G4IonFluctuations.hh"
#include "G4BohrFluctuations.hh"
#include "G4UnitsTable.hh"
#include "G4ICRU73QOModel.hh"
#include "G4EmParameters.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
using namespace std;
G4MuIonisation::G4MuIonisation(const G4String& name)
: G4VEnergyLossProcess(name),
theParticle(nullptr),
theBaseParticle(nullptr),
isInitialised(false)
: G4VEnergyLossProcess(name)
{
mass = ratio = 0;
SetProcessSubType(fIonisation);
SetSecondaryParticle(G4Electron::Electron());
}
@@ -110,7 +101,7 @@ G4MuIonisation::G4MuIonisation(const G4String& name)
G4bool G4MuIonisation::IsApplicable(const G4ParticleDefinition& p)
{
return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 10.0*MeV);
return (p.GetPDGCharge() != 0.0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -119,15 +110,16 @@ G4double G4MuIonisation::MinPrimaryEnergy(const G4ParticleDefinition*,
const G4Material*,
G4double cut)
{
G4double x = 0.5*cut/electron_mass_c2;
G4double x = 0.5*cut/CLHEP::electron_mass_c2;
G4double gam = x*ratio + std::sqrt((1. + x)*(1. + x*ratio*ratio));
return mass*(gam - 1.0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4MuIonisation::InitialiseEnergyLossProcess(const G4ParticleDefinition* part,
const G4ParticleDefinition* bpart)
void
G4MuIonisation::InitialiseEnergyLossProcess(const G4ParticleDefinition* part,
const G4ParticleDefinition* bpart)
{
if(!isInitialised) {
@@ -138,12 +130,12 @@ void G4MuIonisation::InitialiseEnergyLossProcess(const G4ParticleDefinition* par
G4double q = theParticle->GetPDGCharge();
G4EmParameters* param = G4EmParameters::Instance();
G4double elow = 0.2*MeV;
G4double elow = 0.2*CLHEP::MeV;
G4double emax = param->MaxKinEnergy();
G4double ehigh = std::min(1*GeV, emax);
G4double ehigh = std::min(1*CLHEP::GeV, emax);
// Bragg peak model
if (!EmModel(0)) {
if (nullptr == EmModel(0)) {
if(q > 0.0) { SetEmModel(new G4BraggModel()); }
else { SetEmModel(new G4ICRU73QOModel()); }
}
@@ -152,33 +144,30 @@ void G4MuIonisation::InitialiseEnergyLossProcess(const G4ParticleDefinition* par
AddEmModel(1, EmModel(0), new G4IonFluctuations());
// high energy fluctuation model
if (!FluctModel()) { SetFluctModel(new G4UniversalFluctuation()); }
if (nullptr == FluctModel()) {
SetFluctModel(new G4UniversalFluctuation());
}
// moderate energy model
if (!EmModel(1)) { SetEmModel(new G4BetheBlochModel()); }
if (nullptr == EmModel(1)) { SetEmModel(new G4BetheBlochModel()); }
EmModel(1)->SetLowEnergyLimit(elow);
EmModel(1)->SetHighEnergyLimit(ehigh);
AddEmModel(2, EmModel(1), FluctModel());
// high energy model
if(ehigh < emax) {
if (!EmModel(2)) { SetEmModel(new G4MuBetheBlochModel()); }
if (nullptr == EmModel(2)) { SetEmModel(new G4MuBetheBlochModel()); }
EmModel(2)->SetLowEnergyLimit(ehigh);
EmModel(2)->SetHighEnergyLimit(emax);
AddEmModel(3, EmModel(2), FluctModel());
}
ratio = electron_mass_c2/mass;
ratio = CLHEP::electron_mass_c2/mass;
isInitialised = true;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4MuIonisation::PrintInfo()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4MuIonisation::ProcessDescription(std::ostream& out) const
{
out << " Muon ionisation";
@@ -55,15 +55,13 @@ using namespace std;
G4MuMultipleScattering::G4MuMultipleScattering(const G4String& pnam)
: G4VMultipleScattering(pnam)
{
isInitialized = false;
}
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool G4MuMultipleScattering::IsApplicable (const G4ParticleDefinition& p)
G4bool G4MuMultipleScattering::IsApplicable(const G4ParticleDefinition& p)
{
return (p.GetPDGCharge() != 0.0 && !p.IsShortLived());
return (p.GetPDGCharge() != 0.0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -72,7 +70,7 @@ void G4MuMultipleScattering::InitialiseProcess(const G4ParticleDefinition*)
{
// Modification of parameters between runs
if(isInitialized) { return; }
if(!EmModel(0)) { SetEmModel(new G4UrbanMscModel()); }
if(nullptr == EmModel(0)) { SetEmModel(new G4UrbanMscModel()); }
AddEmModel(1, EmModel(0));
isInitialized = true;
}
@@ -78,13 +78,9 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
using namespace std;
G4MuPairProduction::G4MuPairProduction(const G4String& name)
: G4VEnergyLossProcess(name),
theParticle(nullptr),
lowestKinEnergy(1.*GeV),
isInitialised(false)
lowestKinEnergy(1.*GeV)
{
SetProcessSubType(fPairProdByCharged);
SetSecondaryParticle(G4Positron::Positron());
@@ -95,7 +91,7 @@ G4MuPairProduction::G4MuPairProduction(const G4String& name)
G4bool G4MuPairProduction::IsApplicable(const G4ParticleDefinition& p)
{
return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 10.0*MeV);
return (p.GetPDGCharge() != 0.0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -113,24 +109,24 @@ void G4MuPairProduction::InitialiseEnergyLossProcess(
const G4ParticleDefinition* part,
const G4ParticleDefinition*)
{
if (!isInitialised) {
isInitialised = true;
if (isInitialised) { return; }
isInitialised = true;
theParticle = part;
theParticle = part;
lowestKinEnergy = std::max(lowestKinEnergy, part->GetPDGMass()*8.0);
G4MuPairProductionModel* mod = new G4MuPairProductionModel(part);
G4VEmModel* mod = EmModel(0);
if(nullptr == mod) {
mod = new G4MuPairProductionModel(part);
SetEmModel(mod);
lowestKinEnergy = std::max(lowestKinEnergy, part->GetPDGMass()*8.0);
mod->SetLowestKineticEnergy(lowestKinEnergy);
G4VEmFluctuationModel* fm = nullptr;
G4EmParameters* param = G4EmParameters::Instance();
mod->SetLowEnergyLimit(param->MinKinEnergy());
mod->SetHighEnergyLimit(param->MaxKinEnergy());
mod->SetSecondaryThreshold(param->MuHadBremsstrahlungTh());
AddEmModel(1, mod, fm);
}
G4VEmFluctuationModel* fm = nullptr;
G4EmParameters* param = G4EmParameters::Instance();
mod->SetLowEnergyLimit(param->MinKinEnergy());
mod->SetHighEnergyLimit(param->MaxKinEnergy());
mod->SetSecondaryThreshold(param->MuHadBremsstrahlungTh());
AddEmModel(1, mod, fm);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -144,8 +140,8 @@ void G4MuPairProduction::StreamProcessInfo(std::ostream& out) const
if(pv) {
out << " Sampling table " << pv->GetLengthY()
<< "x" << pv->GetLengthX() << "; from "
<< exp(pv->GetY(0))/GeV << " GeV to "
<< exp(pv->GetY(pv->GetLengthY()-1))/TeV
<< std::exp(pv->GetY(0))/GeV << " GeV to "
<< std::exp(pv->GetY(pv->GetLengthY()-1))/TeV
<< " TeV " << G4endl;
break;
}
@@ -157,7 +153,7 @@ void G4MuPairProduction::StreamProcessInfo(std::ostream& out) const
void G4MuPairProduction::ProcessDescription(std::ostream& out) const
{
out << " Pair production";
out << " Electron-positron pair production by muons";
G4VEnergyLossProcess::ProcessDescription(out);
}
@@ -112,32 +112,21 @@ using namespace std;
G4MuPairProductionModel::G4MuPairProductionModel(const G4ParticleDefinition* p,
const G4String& nam)
: G4VEmModel(nam),
particle(nullptr),
factorForCross(4.*fine_structure_const*fine_structure_const
*classic_electr_radius*classic_electr_radius/(3.*pi)),
factorForCross(CLHEP::fine_structure_const*CLHEP::fine_structure_const*
CLHEP::classic_electr_radius*CLHEP::classic_electr_radius*
4./(3.*CLHEP::pi)),
sqrte(sqrt(G4Exp(1.))),
currentZ(0),
fParticleChange(nullptr),
minPairEnergy(4.*electron_mass_c2),
lowestKinEnergy(1.0*GeV),
nYBinPerDecade(4),
nbiny(1000),
nbine(0),
ymin(-5.),
dy(0.005),
fTableToFile(false)
minPairEnergy(4.*CLHEP::electron_mass_c2),
lowestKinEnergy(1.0*CLHEP::GeV)
{
nist = G4NistManager::Instance();
theElectron = G4Electron::Electron();
thePositron = G4Positron::Positron();
particleMass = lnZ = z13 = z23 = 0.;
// setup lowest limit dependent on particle mass
if(p) {
if(nullptr != p) {
SetParticle(p);
lowestKinEnergy = std::max(lowestKinEnergy,p->GetPDGMass()*8.0);
lowestKinEnergy = std::max(lowestKinEnergy,p->GetPDGMass()*8.0);
}
emin = lowestKinEnergy;
emax = 10.*TeV;
@@ -164,7 +153,10 @@ void G4MuPairProductionModel::Initialise(const G4ParticleDefinition* p,
const G4DataVector& cuts)
{
SetParticle(p);
if(!fParticleChange) { fParticleChange = GetParticleChangeForLoss(); }
if(nullptr == fParticleChange) {
fParticleChange = GetParticleChangeForLoss();
}
// for low-energy application this process should not work
if(lowestKinEnergy >= HighEnergyLimit()) { return; }
@@ -181,7 +173,7 @@ void G4MuPairProductionModel::Initialise(const G4ParticleDefinition* p,
}
if(IsMaster() && p == particle) {
if(!fElementData) {
if(nullptr == fElementData) {
fElementData = new G4ElementData();
G4bool dataFile = G4EmParameters::Instance()->RetrieveMuDataFromFile();
if(dataFile) { dataFile = RetrieveTables(); }
@@ -279,8 +271,6 @@ G4double G4MuPairProductionModel::ComputeMicroscopicCrossSection(
G4double cut = std::max(cutEnergy, minPairEnergy);
if (tmax <= cut) { return cross; }
// G4double ak1=6.9 ;
// G4double ak2=1.0 ;
G4double aaa = G4Log(cut);
G4double bbb = G4Log(tmax);
G4int kkk = (G4int)((bbb-aaa)/ak1 + ak2);
@@ -480,7 +470,7 @@ void G4MuPairProductionModel::MakeSamplingTables()
for (size_t it=0; it<=nbine; ++it) {
pv->PutY(it, G4Log(kinEnergy/MeV));
pv->PutY(it, G4Log(kinEnergy/CLHEP::MeV));
G4double maxPairEnergy = MaxSecondaryEnergyForElement(kinEnergy, Z);
/*
G4cout << "it= " << it << " E= " << kinEnergy
@@ -577,7 +567,7 @@ void G4MuPairProductionModel::SampleSecondaries(
//G4cout << "yymin= " << yymin << " yymax= " << yymax << G4endl;
// units should not be used, bacause table was built without
G4double logTkin = G4Log(kinEnergy/MeV);
G4double logTkin = G4Log(kinEnergy/CLHEP::MeV);
// sample e-e+ energy, pair energy first
@@ -731,5 +721,3 @@ G4bool G4MuPairProductionModel::RetrieveTables()
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -200,6 +200,7 @@ void G4TablesForExtrapolator::Initialisation()
}
G4int num = G4Material::GetNumberOfMaterials();
if(nmat == num) { return; }
nmat = num;
nmat = G4Material::GetNumberOfMaterials();
cuts.resize(nmat, DBL_MAX);
couples.resize(nmat, nullptr);
@@ -250,14 +251,15 @@ void G4TablesForExtrapolator::Initialisation()
ComputeMuonDEDX(muonPlus, dedxMuon);
builder->BuildRangeTable(dedxMuon, rangeMuon);
builder->BuildInverseRangeTable(rangeMuon, invRangeMuon);
/*
G4cout << "DEDX MUON" << G4endl
G4cout << *dedxMuon << G4endl;
G4cout << "RANGE MUON" << G4endl
G4cout << *rangeMuon << G4endl;
G4cout << "INVRANGE MUON" << G4endl
G4cout << *invRangeMuon << G4endl;
*/
if(verbose>2) {
G4cout << "DEDX MUON" << G4endl;
G4cout << *dedxMuon << G4endl;
G4cout << "RANGE MUON" << G4endl;
G4cout << *rangeMuon << G4endl;
G4cout << "INVRANGE MUON" << G4endl;
G4cout << *invRangeMuon << G4endl;
}
if(verbose>1) {
G4cout << "### G4TablesForExtrapolator Builds proton tables"
<< G4endl;
@@ -277,8 +279,7 @@ G4PhysicsTable* G4TablesForExtrapolator::PrepareTable(G4PhysicsTable* ptr)
if(nullptr == ptr) { table = new G4PhysicsTable(); }
G4int n = table->length();
for(G4int i=n; i<nmat; ++i) {
G4PhysicsVector* v = new G4PhysicsLogVector(emin, emax, nbins);
v->SetSpline(splineFlag);
G4PhysicsVector* v = new G4PhysicsLogVector(emin, emax, nbins, splineFlag);
table->push_back(v);
}
return table;
@@ -54,13 +54,9 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
using namespace std;
G4ePairProduction::G4ePairProduction(const G4String& name)
: G4VEnergyLossProcess(name),
theParticle(nullptr),
lowestKinEnergy(100.*MeV),
isInitialised(false)
lowestKinEnergy(100.*CLHEP::MeV)
{
SetProcessSubType(fPairProdByCharged);
SetSecondaryParticle(G4Positron::Positron());
@@ -132,7 +128,7 @@ void G4ePairProduction::StreamProcessInfo(std::ostream& out) const
void G4ePairProduction::ProcessDescription(std::ostream& out) const
{
out << " Pair production";
out << " Electron-positron pair production by electron or positron";
G4VEnergyLossProcess::ProcessDescription(out);
}