Import Geant4 10.5.1 source tree

This commit is contained in:
Gabriele Cosmo
2019-04-17 10:39:02 +02:00
parent a7fdc52004
commit 28a70706e0
661 changed files with 55791 additions and 106984 deletions
@@ -16,13 +16,16 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
---------------------------------------------------------
11 Mar 2019: G. Cosmo (emadjoint-V10-04-00)
-Fixed typos in printouts and comments.
06 Nov 2017: V. Ivanchenko (emadjoint-V10-03-01)
-Extended correction of occurence of FPE in G4AdjointForcedInteractionForGamma.
-Extended correction of occurrence of FPE in G4AdjointForcedInteractionForGamma.
-G4eAdjointMultipleScattering - change index of the default accourding to recent
modifications in emutils
27 Jan 2017: L. Desorgher (emadjoint-V10-03-00)
-Correction of occurence of FPE in G4AdjointForcedInteractionForGamma.
-Correction of occurrence of FPE in G4AdjointForcedInteractionForGamma.
27 Octb 2016: L. Desorgher (emadjoint-V10-02-03)
-Correction in G4AdjointForcedInteractionForGamma to avoid high weight of forced gamma
@@ -43,7 +43,7 @@
//-------------------------------------------------------------
// Documentation:
// Is responsible for the management of all adjoint cross sections matrices, and for the computation of the total forward and adjoint cross sections.
// Total adjoint and forward cross sections are needed to correct the weight of a particle after a tracking step or after the occurence of a reverse reaction.
// Total adjoint and forward cross sections are needed to correct the weight of a particle after a tracking step or after the occurrence of a reverse reaction.
// It is also used to sample an adjoint secondary from a given adjoint cross section matrix.
//
#ifndef G4AdjointCSManager_h
@@ -39,7 +39,7 @@
//
// -January 2009. L. Desorgher
// Put a higher limit on the CS to avoid a high rate of Inverse Photo e- effect at low energy. The very high adjoint CS of the reverse
// photo electric reaction produce a high rate of reverse photo electric reaction in the inner side of a shielding for eaxmple, the correction of this occurence
// photo electric reaction produce a high rate of reverse photo electric reaction in the inner side of a shielding for eaxmple, the correction of this occurrence
// by weight correction in the StepDoIt method is not statistically sufficient at small energy. The problem is partially solved by setting an higher CS limit
// and compensating it by an extra weight correction factor. However when coupling it with other reverse processes the reverse photo-electric is still
// the source of very occasional high weight that decrease the efficiency of the computation. A way to solve this problemn is still needed but is difficult
@@ -16,6 +16,16 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
21 March 2018: V.Ivantchenko (emhighenergy-V10-04-03)
21 March 2019: V.Ivantchenko
- G4GammaConversionToMuons - fixed low-energy part of the model by adding
of intermediate limit 5*MuMass, below which an approximation of
x-section similar to the Bethe-Heitler model is used; fixed bug
in energy sampling for low-energy
01 March 2019: V.Ivantchenko
- G4mplIonisation, G4mplIonisationWithDeltaModel - added low limit
for delta-electron production threshold (fixing problem #2126)
17 Sept 2018: D.Sawkey (emhighenergy-V10-04-02)
- G4eeToHadrons, G4eeToHadronsMultiModel, G4hBremsstrahlung, G4hPairProduction,
G4hhIonisation, G4mplIonisation: automatic documentation format now rST
@@ -124,6 +124,7 @@ private:
G4double Mmuon;
G4double Rc;
G4double LimitEnergy; // energy limit for accurate x-section
G4double LowestEnergyLimit ; // low energy limit of the tables
G4double HighestEnergyLimit ; // high energy limit of the tables
@@ -72,6 +72,9 @@ public:
virtual G4bool IsApplicable(const G4ParticleDefinition& p) override;
virtual G4double MinPrimaryEnergy(const G4ParticleDefinition* p,
const G4Material*, G4double cut) final;
// Print out of the class parameters
virtual void PrintInfo() override;
@@ -81,7 +84,7 @@ public:
protected:
virtual void InitialiseEnergyLossProcess(const G4ParticleDefinition*,
const G4ParticleDefinition*) override;
const G4ParticleDefinition*) override;
private:
@@ -91,7 +94,6 @@ private:
G4double magneticCharge;
G4bool isInitialised;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -60,7 +60,7 @@ class G4mplIonisationWithDeltaModel : public G4VEmModel, public G4VEmFluctuation
public:
explicit G4mplIonisationWithDeltaModel(G4double mCharge,
const G4String& nam = "mplIonisationWithDelta");
const G4String& nam = "mplIonisationWithDelta");
virtual ~G4mplIonisationWithDeltaModel();
@@ -68,9 +68,9 @@ public:
const G4DataVector&) override;
virtual G4double ComputeDEDXPerVolume(const G4Material*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy) override;
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy) override;
virtual G4double ComputeCrossSectionPerElectron(
const G4ParticleDefinition*,
@@ -86,10 +86,10 @@ public:
G4double maxEnergy) override;
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double maxEnergy) override;
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double maxEnergy) override;
virtual G4double SampleFluctuations(const G4MaterialCutsCouple*,
@@ -103,6 +103,9 @@ public:
G4double tmax,
G4double length) override;
virtual G4double MinEnergyCut(const G4ParticleDefinition*,
const G4MaterialCutsCouple* couple) override;
void SetParticle(const G4ParticleDefinition* p);
protected:
@@ -112,7 +115,8 @@ protected:
private:
G4double ComputeDEDXAhlen(const G4Material* material, G4double bg2, G4double cut);
G4double ComputeDEDXAhlen(const G4Material* material, G4double bg2,
G4double cut);
// hide assignment operator
G4mplIonisationWithDeltaModel &
@@ -120,7 +124,7 @@ private:
G4mplIonisationWithDeltaModel(const G4mplIonisationWithDeltaModel&) = delete;
const G4ParticleDefinition* monopole;
G4ParticleDefinition* theElectron;
G4ParticleDefinition* theElectron;
G4ParticleChangeForLoss* fParticleChange;
G4double mass;
@@ -136,7 +140,6 @@ private:
G4double pi_hbarc2_over_mc2;
static std::vector<G4double>* dedx0;
};
#endif
@@ -56,8 +56,9 @@ G4GammaConversionToMuons::G4GammaConversionToMuons(const G4String& processName,
: G4VDiscreteProcess (processName, type),
Mmuon(G4MuonPlus::MuonPlus()->GetPDGMass()),
Rc(elm_coupling/Mmuon),
LowestEnergyLimit (4.*Mmuon), // 4*Mmuon
HighestEnergyLimit(1e21*eV), // ok to 1e21eV=1e12GeV, then LPM suppression
LimitEnergy (5.*Mmuon),
LowestEnergyLimit (2.*Mmuon),
HighestEnergyLimit(1e12*GeV), // ok to 1e12GeV, then LPM suppression
CrossSecFactor(1.)
{
SetProcessSubType(fGammaConversionToMuMu);
@@ -116,12 +117,19 @@ G4GammaConversionToMuons::ComputeMeanFreePath(G4double GammaEnergy,
const G4double* NbOfAtomsPerVolume = aMaterial->GetVecNbOfAtomsPerVolume();
G4double SIGMA = 0.0;
G4double fact = 1.0;
G4double e = GammaEnergy;
// low energy approximation as in Bethe-Heitler model
if(e < LimitEnergy) {
G4double y = (e - LowestEnergyLimit)/(LimitEnergy - LowestEnergyLimit);
fact = y*y;
e = LimitEnergy;
}
for ( size_t i=0 ; i < aMaterial->GetNumberOfElements(); ++i)
{
SIGMA += NbOfAtomsPerVolume[i] *
ComputeCrossSectionPerAtom(GammaEnergy,
(*theElementVector)[i]->GetZasInt());
SIGMA += NbOfAtomsPerVolume[i] * fact *
ComputeCrossSectionPerAtom(e, (*theElementVector)[i]->GetZasInt());
}
return (SIGMA > 0.0) ? 1./SIGMA : DBL_MAX;
}
@@ -147,7 +155,7 @@ G4double G4GammaConversionToMuons::ComputeCrossSectionPerAtom(
// Total cross section parametrisation from H.Burkhardt
// It gives a good description at any energy (from 0 to 10**21 eV)
{
if(Egam <= LowestEnergyLimit) return 0.0; // below threshold return 0
if(Egam < LimitEnergy) return 0.0; // below threshold return 0
G4double CrossSection = 0.0;
G4NistManager* nist = G4NistManager::Instance();
@@ -235,11 +243,11 @@ G4VParticleChange* G4GammaConversionToMuons::PostStepDoIt(
G4double C2Term2=electron_mass_c2/(183.*Zthird*Mmuon);
G4double GammaMuonInv=Mmuon/Egam;
G4double sqrtx=sqrt(.25-GammaMuonInv);
G4double xmax=.5+sqrtx;
G4double xmin=.5-sqrtx;
// generate xPlus according to the differential cross section by rejection
G4double xmin=(Egam < LimitEnergy) ? GammaMuonInv : .5-sqrt(.25-GammaMuonInv);
G4double xmax=1.-xmin;
G4double Ds2=(Dn*sqrte-2.);
G4double sBZ=sqrte*B*Zthird/electron_mass_c2;
G4double LogWmaxInv=1./G4Log(Winfty*(1.+2.*Ds2*GammaMuonInv)
@@ -247,15 +255,14 @@ G4VParticleChange* G4GammaConversionToMuons::PostStepDoIt(
G4double xPlus,xMinus,xPM,result,W;
G4int nn = 0;
const G4int nmax = 1000;
do
{ xPlus=xmin+G4UniformRand()*(xmax-xmin);
do {
xPlus=xmin+G4UniformRand()*(xmax-xmin);
xMinus=1.-xPlus;
xPM=xPlus*xMinus;
G4double del=Mmuon*Mmuon/(2.*Egam*xPM);
W=Winfty*(1.+Ds2*del/Mmuon)/(1.+sBZ*del);
if(W<=1. || nn > nmax) { break; } // to avoid negative cross section at xmin
G4double xxp=1.-4./3.*xPM; // the main xPlus dependence
result=xxp*G4Log(W)*LogWmaxInv;
result=(xxp > 0.) ? xxp*G4Log(W)*LogWmaxInv : 0.0;
if(result>1.) {
G4cout << "G4GammaConversionToMuons::PostStepDoIt WARNING:"
<< " in dSigxPlusGen, result=" << result << " > 1" << G4endl;
@@ -83,8 +83,21 @@ G4bool G4mplIonisation::IsApplicable(const G4ParticleDefinition&)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4mplIonisation::MinPrimaryEnergy(const G4ParticleDefinition* mpl,
const G4Material*,
G4double cut)
{
G4double x = 0.5*cut/electron_mass_c2;
G4double mass = mpl->GetPDGMass();
G4double ratio = electron_mass_c2/mass;
G4double gam = x*ratio + std::sqrt((1. + x)*(1. + x*ratio*ratio));
return mass*(gam - 1.0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4mplIonisation::InitialiseEnergyLossProcess(const G4ParticleDefinition* p,
const G4ParticleDefinition*)
const G4ParticleDefinition*)
{
if(isInitialised) { return; }
@@ -62,6 +62,7 @@
#include "G4ProductionCutsTable.hh"
#include "G4MaterialCutsCouple.hh"
#include "G4Log.hh"
#include "G4Pow.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -70,10 +71,10 @@ using namespace std;
std::vector<G4double>* G4mplIonisationWithDeltaModel::dedx0 = nullptr;
G4mplIonisationWithDeltaModel::G4mplIonisationWithDeltaModel(G4double mCharge,
const G4String& nam)
const G4String& nam)
: G4VEmModel(nam),G4VEmFluctuationModel(nam),
magCharge(mCharge),
twoln10(log(100.0)),
twoln10(std::log(100.0)),
betalow(0.01),
betalim(0.1),
beta2lim(betalim*betalim),
@@ -88,7 +89,7 @@ G4mplIonisationWithDeltaModel::G4mplIonisationWithDeltaModel(G4double mCharge,
fParticleChange = nullptr;
theElectron = G4Electron::Electron();
G4cout << "### Monopole ionisation model with d-electron production, Gmag= "
<< magCharge/eplus << G4endl;
<< magCharge/eplus << G4endl;
monopole = nullptr;
mass = 0.0;
}
@@ -118,7 +119,7 @@ void G4mplIonisationWithDeltaModel::SetParticle(const G4ParticleDefinition* p)
void
G4mplIonisationWithDeltaModel::Initialise(const G4ParticleDefinition* p,
const G4DataVector&)
const G4DataVector&)
{
if(!monopole) { SetParticle(p); }
if(!fParticleChange) { fParticleChange = GetParticleChangeForLoss(); }
@@ -129,27 +130,37 @@ G4mplIonisationWithDeltaModel::Initialise(const G4ParticleDefinition* p,
G4int numOfCouples = theCoupleTable->GetTableSize();
G4int n = dedx0->size();
if(n < numOfCouples) { dedx0->resize(numOfCouples); }
G4Pow* g4calc = G4Pow::GetInstance();
// initialise vector
for(G4int i=0; i<numOfCouples; ++i) {
const G4Material* material =
theCoupleTable->GetMaterialCutsCouple(i)->GetMaterial();
theCoupleTable->GetMaterialCutsCouple(i)->GetMaterial();
G4double eDensity = material->GetElectronDensity();
G4double vF = electron_Compton_length*pow(3.*pi*pi*eDensity,0.3333333333);
G4double vF = electron_Compton_length*g4calc->A13(3.*pi*pi*eDensity);
(*dedx0)[i] = pi_hbarc2_over_mc2*eDensity*nmpl*nmpl*
(G4Log(2*vF/fine_structure_const) - 0.5)/vF;
(G4Log(2*vF/fine_structure_const) - 0.5)/vF;
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double
G4mplIonisationWithDeltaModel::MinEnergyCut(const G4ParticleDefinition*,
const G4MaterialCutsCouple* couple)
{
return couple->GetMaterial()->GetIonisation()->GetMeanExcitationEnergy();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double
G4mplIonisationWithDeltaModel::ComputeDEDXPerVolume(const G4Material* material,
const G4ParticleDefinition* p,
G4double kineticEnergy,
G4double maxEnergy)
const G4ParticleDefinition* p,
G4double kineticEnergy,
G4double maxEnergy)
{
if(!monopole) { SetParticle(p); }
G4double tmax = MaxSecondaryEnergy(p,kineticEnergy);
@@ -162,7 +173,6 @@ G4mplIonisationWithDeltaModel::ComputeDEDXPerVolume(const G4Material* material,
G4double beta = sqrt(beta2);
// low-energy asymptotic formula
//G4double dedx = dedxlim*beta*material->GetDensity();
G4double dedx = (*dedx0)[CurrentCouple()->GetIndex()]*beta;
// above asymptotic
@@ -173,8 +183,6 @@ G4mplIonisationWithDeltaModel::ComputeDEDXPerVolume(const G4Material* material,
dedx = ComputeDEDXAhlen(material, bg2, cutEnergy);
} else {
//G4double dedx1 = dedxlim*betalow*material->GetDensity();
G4double dedx1 = (*dedx0)[CurrentCouple()->GetIndex()]*betalow;
G4double dedx2 = ComputeDEDXAhlen(material, bg2lim, cutEnergy);
@@ -191,15 +199,15 @@ G4mplIonisationWithDeltaModel::ComputeDEDXPerVolume(const G4Material* material,
G4double
G4mplIonisationWithDeltaModel::ComputeDEDXAhlen(const G4Material* material,
G4double bg2,
G4double cutEnergy)
G4double bg2,
G4double cutEnergy)
{
G4double eDensity = material->GetElectronDensity();
G4double eexc = material->GetIonisation()->GetMeanExcitationEnergy();
// Ahlen's formula for nonconductors, [1]p157, f(5.7)
G4double dedx =
0.5*(log(2.0 * electron_mass_c2 * bg2*cutEnergy / (eexc*eexc)) - 1.0);
0.5*(G4Log(2.0*electron_mass_c2*bg2*cutEnergy/(eexc*eexc)) -1.0);
// Kazama et al. cross-section correction
G4double k = 0.406;
@@ -217,7 +225,7 @@ G4mplIonisationWithDeltaModel::ComputeDEDXAhlen(const G4Material* material,
// now compute the total ionization loss
dedx *= pi_hbarc2_over_mc2 * eDensity * nmpl * nmpl;
if (dedx < 0.0) { dedx = 0.; }
dedx = std::max(dedx, 0.0);
return dedx;
}
@@ -226,18 +234,16 @@ G4mplIonisationWithDeltaModel::ComputeDEDXAhlen(const G4Material* material,
G4double
G4mplIonisationWithDeltaModel::ComputeCrossSectionPerElectron(
const G4ParticleDefinition* p,
G4double kineticEnergy,
G4double cut,
G4double maxKinEnergy)
G4double kineticEnergy,
G4double cut,
G4double maxKinEnergy)
{
if(!monopole) { SetParticle(p); }
G4double cross = 0.0;
G4double tmax = MaxSecondaryEnergy(p, kineticEnergy);
G4double maxEnergy = std::min(tmax,maxKinEnergy);
G4double maxEnergy = std::min(tmax, maxKinEnergy);
G4double cutEnergy = std::max(LowEnergyLimit(), cut);
if(cutEnergy < maxEnergy) {
cross = (0.5/cutEnergy - 0.5/maxEnergy)*pi_hbarc2_over_mc2 * nmpl * nmpl;
}
G4double cross = (cutEnergy < maxEnergy)
? (0.5/cutEnergy - 0.5/maxEnergy)*pi_hbarc2_over_mc2 * nmpl * nmpl : 0.0;
return cross;
}
@@ -245,11 +251,11 @@ G4mplIonisationWithDeltaModel::ComputeCrossSectionPerElectron(
G4double
G4mplIonisationWithDeltaModel::ComputeCrossSectionPerAtom(
const G4ParticleDefinition* p,
G4double kineticEnergy,
G4double Z, G4double,
G4double cutEnergy,
G4double maxEnergy)
const G4ParticleDefinition* p,
G4double kineticEnergy,
G4double Z, G4double,
G4double cutEnergy,
G4double maxEnergy)
{
G4double cross =
Z*ComputeCrossSectionPerElectron(p,kineticEnergy,cutEnergy,maxEnergy);
@@ -260,10 +266,10 @@ G4mplIonisationWithDeltaModel::ComputeCrossSectionPerAtom(
void
G4mplIonisationWithDeltaModel::SampleSecondaries(vector<G4DynamicParticle*>* vdp,
const G4MaterialCutsCouple*,
const G4DynamicParticle* dp,
G4double minKinEnergy,
G4double maxEnergy)
const G4MaterialCutsCouple*,
const G4DynamicParticle* dp,
G4double minKinEnergy,
G4double maxEnergy)
{
G4double kineticEnergy = dp->GetKineticEnergy();
G4double tmax = MaxSecondaryEnergy(dp->GetDefinition(),kineticEnergy);
@@ -272,8 +278,8 @@ G4mplIonisationWithDeltaModel::SampleSecondaries(vector<G4DynamicParticle*>* vdp
if(minKinEnergy >= maxKinEnergy) { return; }
//G4cout << "G4mplIonisationWithDeltaModel::SampleSecondaries: E(GeV)= "
// << kineticEnergy/GeV << " M(GeV)= " << mass/GeV
// << " tmin(MeV)= " << minKinEnergy/MeV << G4endl;
// << kineticEnergy/GeV << " M(GeV)= " << mass/GeV
// << " tmin(MeV)= " << minKinEnergy/MeV << G4endl;
G4double totEnergy = kineticEnergy + mass;
G4double etot2 = totEnergy*totEnergy;
@@ -290,7 +296,7 @@ G4mplIonisationWithDeltaModel::SampleSecondaries(vector<G4DynamicParticle*>* vdp
sqrt(deltaKinEnergy * (deltaKinEnergy + 2.0*electron_mass_c2));
G4double cost = deltaKinEnergy * (totEnergy + electron_mass_c2) /
(deltaMomentum * totMomentum);
if(cost > 1.0) { cost = 1.0; }
cost = std::min(cost, 1.0);
G4double sint = sqrt((1.0 - cost)*(1.0 + cost));
@@ -318,11 +324,11 @@ G4mplIonisationWithDeltaModel::SampleSecondaries(vector<G4DynamicParticle*>* vdp
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4mplIonisationWithDeltaModel::SampleFluctuations(
const G4MaterialCutsCouple* couple,
const G4DynamicParticle* dp,
G4double tmax,
G4double length,
G4double meanLoss)
const G4MaterialCutsCouple* couple,
const G4DynamicParticle* dp,
G4double tmax,
G4double length,
G4double meanLoss)
{
G4double siga = Dispersion(couple->GetMaterial(),dp,tmax,length);
G4double loss = meanLoss;
@@ -349,9 +355,9 @@ G4double G4mplIonisationWithDeltaModel::SampleFluctuations(
G4double
G4mplIonisationWithDeltaModel::Dispersion(const G4Material* material,
const G4DynamicParticle* dp,
G4double tmax,
G4double length)
const G4DynamicParticle* dp,
G4double tmax,
G4double length)
{
G4double siga = 0.0;
G4double tau = dp->GetKineticEnergy()/mass;
@@ -369,7 +375,7 @@ G4mplIonisationWithDeltaModel::Dispersion(const G4Material* material,
G4double
G4mplIonisationWithDeltaModel::MaxSecondaryEnergy(const G4ParticleDefinition*,
G4double kinEnergy)
G4double kinEnergy)
{
G4double tau = kinEnergy/mass;
return 2.0*electron_mass_c2*tau*(tau + 2.);
@@ -16,6 +16,9 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
05.02.2019 S. Incerti, emlowen-V10-04-13
- Fix Bugzill 2089
22.10.2018 F. Longo, emlowen-V10-04-12
- Fix Bugzilla 2089
@@ -55,9 +55,9 @@ class G4PenelopeOscillator
//I need to overload the following operators: > < == =
G4PenelopeOscillator& operator=(const G4PenelopeOscillator&);
int operator==(const G4PenelopeOscillator&) const;
int operator>(const G4PenelopeOscillator&) const;
int operator<(const G4PenelopeOscillator&) const;
G4bool operator==(const G4PenelopeOscillator&) const;
G4bool operator>(const G4PenelopeOscillator&) const;
G4bool operator<(const G4PenelopeOscillator&) const;
//Setters and getters
G4double GetHartreeFactor() {return hartreeFactor;};
@@ -75,28 +75,28 @@ G4PenelopeOscillator& G4PenelopeOscillator::operator=(const G4PenelopeOscillator
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
int G4PenelopeOscillator::operator==(const G4PenelopeOscillator& right) const
G4bool G4PenelopeOscillator::operator==(const G4PenelopeOscillator& right) const
{
//Oscillator are ordered according to the ionisation energy. They are considered to be
//equal if the ionisation energy is the same
return (ionisationEnergy == right.ionisationEnergy) ? 1 : 0;
return (ionisationEnergy == right.ionisationEnergy) ? true : false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
int G4PenelopeOscillator::operator>(const G4PenelopeOscillator& right) const
G4bool G4PenelopeOscillator::operator>(const G4PenelopeOscillator& right) const
{
//Oscillator are ordered according to the ionisation energy.
return (ionisationEnergy > right.ionisationEnergy) ? 1 : 0;
return (ionisationEnergy > right.ionisationEnergy) ? true : false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
int G4PenelopeOscillator::operator<(const G4PenelopeOscillator& right) const
G4bool G4PenelopeOscillator::operator<(const G4PenelopeOscillator& right) const
{
//Oscillator are ordered according to the ionisation energy.
return (ionisationEnergy < right.ionisationEnergy) ? 1 : 0;
return (ionisationEnergy < right.ionisationEnergy) ? true : false;
}
@@ -257,7 +257,7 @@ G4PhotoElectricAngularGeneratorPolarized::DSigmaKshellGavrila1959(
+ (1-sqrtOneBeta2)/(4*beta2*oneBetaCosTheta*oneBetaCosTheta) * (beta/oneBeta2 - 2/oneBeta2 * cosTheta * cosPhi2 +
(1-sqrtOneBeta2)/oneBeta2_to_3_2 * cosTheta - beta * (1-sqrtOneBeta2)/oneBeta2_to_3_2);
dsigma = ( firstTerm*(1-pi*fine_structure_const/beta) + secondTerm*(pi*fine_structure_const) );
dsigma = ( firstTerm*(1-pi*fine_structure_const/beta) + secondTerm*(pi*fine_structure_const) )*std::sin(theta);
return dsigma;
}
@@ -16,9 +16,12 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
07 February 19: V.Ivanchenko (emmuons-V10-04-06)
- G4MuMultipleSacttering - reduced length of printout (fix problem #2105)
17 September 18: D.Sawkey (emmuons-V10-04-05)
- G4MuMultipleScattering, G4MuPairProduction, G4eePairProduction, G4MuBremsstrahlung,
G4MuIonisation: automatic documenation format now rST
- G4MuMultipleScattering, G4MuPairProduction, G4eePairProduction,
G4MuBremsstrahlung, G4MuIonisation: automatic documenation format now rST
22 August 18: V.Ivant (emmuons-V10-04-04)
- G4EnergyLossForExtrapolator - fixed MT initialisation and destruction
@@ -82,9 +82,9 @@ void G4MuMultipleScattering::InitialiseProcess(const G4ParticleDefinition*)
void G4MuMultipleScattering::StreamProcessInfo(std::ostream& out) const
{
out << " RangeFactor= " << RangeFactor()
<< ", step limit type: " << StepLimitType()
<< ", lateralDisplacement: " << LateralDisplasmentFlag()
<< ", polarAngleLimit(deg)= " << PolarAngleLimit()/degree
<< ", stepLimType: " << StepLimitType()
<< ", latDisp: " << LateralDisplasmentFlag()
<< ", polarAngLim(deg)= " << PolarAngleLimit()/degree
<< G4endl;
}
@@ -17,6 +17,26 @@ committal in the CVS repository !
----------------------------------------------------------
09 April 19: V.Ivanchenko (emstand-V10-04-55)
- G4IonCoulombScatteringModel, G4eSingleCoulombScatteringModel,
G4hCoulombScatteringModel - fixed kinematics for low kinetic energy
of primary (problem #2152)
01 March 19: V.Ivanchenko
- G4BetheBlochModel - code clean-up, removed tabs, some empty lines
07 February 19: V.Ivanchenko
- G4eMultipleSacttering, G4hMultipleScattering - reduced
length of printouts (fix problem #2105)
31 January 19: V.Ivanchenko
- G4ModifiedTsai, G4SauterGavrilaAngularDistribution - reduced
length of names for these generators (fix problem #2105)
15 January 19: V.Ivanchenko
- G4eplusTo2GammaOKVIModel - fixed crash at initialisation
26 November 18: V.Ivanchenko (emstand-V10-04-54)
- G4WentzelOKandVIxSection - fixed destructor
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
@@ -169,7 +168,7 @@ void G4BetheBlochModel::SetupParameters()
if(particle->GetLeptonNumber() == 0) {
G4int iz = G4lrint(q);
if(iz <= 1) {
formfact = (spin == 0.0 && mass < GeV) ? 1.181e-6 : 1.548e-6;
formfact = (spin == 0.0 && mass < GeV) ? 1.181e-6 : 1.548e-6;
} else {
G4double x = nist->GetA27(iz);
formfact = 3.969e-6*x*x;
@@ -271,23 +270,23 @@ G4double G4BetheBlochModel::ComputeDEDXPerVolume(const G4Material* material,
if(material != currentMaterial) {
currentMaterial = material;
baseMaterial = material->GetBaseMaterial()
? material->GetBaseMaterial() : material;
? material->GetBaseMaterial() : material;
iICRU90 = fICRU90->GetIndex(baseMaterial);
}
if(iICRU90 >= 0) {
G4double e = kineticEnergy*proton_mass_c2/mass;
G4double dedx = 0.0;
if(chargeSquare > 1.1 && e < fAlphaTlimit) {
dedx = fICRU90->GetElectronicDEDXforAlpha(iICRU90, e)
*material->GetDensity()*0.25;
dedx = fICRU90->GetElectronicDEDXforAlpha(iICRU90, e)
*material->GetDensity()*0.25;
} else if(chargeSquare < 1.1 && e < fProtonTlimit) {
dedx = fICRU90->GetElectronicDEDXforProton(iICRU90, e)
*material->GetDensity();
dedx = fICRU90->GetElectronicDEDXforProton(iICRU90, e)
*material->GetDensity();
}
if(dedx > 0.0) {
dedx += (G4Log(xc) + (1.0 - xc)*beta2)*twopi_mc2_rcl2
*eDensity/beta2;
return std::max(chargeSquare*dedx, 0.0);
if(cutEnergy < tmax) {
dedx += (G4Log(xc) + (1.0 - xc)*beta2)*twopi_mc2_rcl2
*eDensity/beta2;
return std::max(chargeSquare*dedx, 0.0);
}
}
}
@@ -144,8 +144,6 @@ G4double G4IonCoulombScatteringModel::ComputeCrossSectionPerAtom(
ioncross->SetupKinematic(kinEnergy, tmass);
ioncross->SetupTarget(Z, kinEnergy, heavycorr);
cross = ioncross->NuclearCrossSection();
//cout<< "..........cross "<<G4BestUnit(cross,"Surface") <<endl;
return cross;
}
@@ -158,9 +156,7 @@ void G4IonCoulombScatteringModel::SampleSecondaries(
G4double, G4double)
{
G4double kinEnergy = dp->GetKineticEnergy();
DefineMaterial(couple);
SetupParticle(dp->GetDefinition());
// Choose nucleus
@@ -171,38 +167,42 @@ void G4IonCoulombScatteringModel::SampleSecondaries(
G4double mass2 = G4NucleiProperties::GetNuclearMass(ia, iz);
ioncross->SetupKinematic(kinEnergy, mass2);
ioncross->SetupTarget(currentElement->GetZ(), kinEnergy, heavycorr);
//scattering angle, z1 == (1-cost)
G4double z1 = ioncross->SampleCosineTheta();
if(z1 > 2.0) { z1 = 2.0; }
else if(z1 < 0.0) { z1 = 0.0; }
/*
G4cout << "Sample: " << particle->GetParticleName()
<< " mass(GeV)= " << mass/GeV
<< " Ekin(MeV)= " << kinEnergy << " cost= " << 1. - z1 << G4endl;
G4cout << " Z= " << iz << " A= " << ia
<< " mass(GeV)= " << mass2/GeV << G4endl;
*/
G4double cost = 1.0 - z1;
G4double sint = sqrt(z1*(1.0 + cost));
G4double phi = twopi * G4UniformRand();
// kinematics in the Lab system
G4double ptot = dp->GetTotalMomentum();
G4double e1 = dp->GetTotalEnergy();
G4double ptot = sqrt(kinEnergy*(kinEnergy + 2.0*mass));
G4double e1 = mass + kinEnergy;
// Lab. system kinematics along projectile direction
G4LorentzVector v0 = G4LorentzVector(0, 0, ptot, e1);
G4double bet = ptot/(e1 + mass2);
G4double gam = 1.0/sqrt((1.0 - bet)*(1.0 + bet));
G4LorentzVector v0 = G4LorentzVector(0, 0, ptot, e1+mass2);
G4LorentzVector v1 = G4LorentzVector(0, 0, ptot, e1);
G4ThreeVector bst = v0.boostVector();
v1.boost(-bst);
// CM projectile
G4double momCM = gam*(ptot - bet*e1);
G4double eCM = gam*(e1 - bet*ptot);
G4double momCM = v1.pz();
// Momentum after scattering of incident particle
G4double pxCM = momCM*sint*cos(phi);
G4double pyCM = momCM*sint*sin(phi);
G4double pzCM = momCM*cost;
v1.setX(momCM*sint*cos(phi));
v1.setY(momCM*sint*sin(phi));
v1.setZ(momCM*cost);
// CM--->Lab
G4LorentzVector v1(pxCM , pyCM, gam*(pzCM + bet*eCM), gam*(eCM + bet*pzCM));
v1.boost(bst);
// Rotate to global system
G4ThreeVector dir = dp->GetMomentumDirection();
@@ -213,7 +213,7 @@ void G4IonCoulombScatteringModel::SampleSecondaries(
// recoil v0 energy is kinetic
v0 -= v1;
G4double trec = v0.e();
G4double trec = std::max(v0.e() - mass2, 0.0);
G4double edep = 0.0;
G4double tcut = recoilThreshold;
@@ -241,6 +241,8 @@ void G4IonCoulombScatteringModel::SampleSecondaries(
finalT = 0.0;
}
edep = std::max(edep, 0.0);
//G4cout << "Efinal(MeV)= " << finalT << " Edep(MeV)= " << edep
// << " Trec(MeV)= " << trec << G4endl;
fParticleChange->SetProposedKineticEnergy(finalT);
fParticleChange->ProposeLocalEnergyDeposit(edep);
}
@@ -63,7 +63,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4ModifiedTsai::G4ModifiedTsai(const G4String&)
: G4VEmAngularDistribution("AngularGenUrban")
: G4VEmAngularDistribution("ModifiedTsai")
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -46,7 +46,7 @@
#include "Randomize.hh"
G4SauterGavrilaAngularDistribution::G4SauterGavrilaAngularDistribution()
: G4VEmAngularDistribution("AngularGenSauterGavrila")
: G4VEmAngularDistribution("SauterGavrila")
{}
G4SauterGavrilaAngularDistribution::~G4SauterGavrilaAngularDistribution()
@@ -85,8 +85,8 @@ void G4eMultipleScattering::InitialiseProcess(const G4ParticleDefinition*)
void G4eMultipleScattering::StreamProcessInfo(std::ostream& out) const
{
out << " RangeFactor= " << RangeFactor()
<< ", stepLimitType: " << StepLimitType()
<< ", latDisplacement: " << LateralDisplasmentFlag();
<< ", stepLimType: " << StepLimitType()
<< ", latDisp: " << LateralDisplasmentFlag();
if(StepLimitType() == fUseDistanceToBoundary) {
out << ", skin= " << Skin() << ", geomFactor= " << GeomFactor();
}
@@ -206,9 +206,8 @@ void G4eSingleCoulombScatteringModel::SampleSecondaries(
// Choose nucleus
//last two :cutEnergy= min e kinEnergy=max
currentElement = SelectRandomAtom(couple,particle,
kinEnergy,cutEnergy,kinEnergy);
currentElement = SelectRandomAtom(couple, particle, kinEnergy,
cutEnergy, kinEnergy);
G4double Z = currentElement->GetZ();
G4int iz = G4int(Z);
G4int ia = SelectIsotopeNumber(currentElement);
@@ -227,23 +226,24 @@ void G4eSingleCoulombScatteringModel::SampleSecondaries(
G4double phi = twopi* G4UniformRand();
// kinematics in the Lab system
G4double ptot = dp->GetTotalMomentum();
G4double e1 = dp->GetTotalEnergy();
G4double ptot = sqrt(kinEnergy*(kinEnergy + 2.0*mass));
G4double e1 = mass + kinEnergy;
// Lab. system kinematics along projectile direction
G4LorentzVector v0 = G4LorentzVector(0, 0, ptot, e1);
G4double bet = ptot/(v0.e() + mass2);
G4double gam = 1.0/sqrt((1.0 - bet)*(1.0 + bet));
G4LorentzVector v0 = G4LorentzVector(0, 0, ptot, e1+mass2);
G4LorentzVector v1 = G4LorentzVector(0, 0, ptot, e1);
G4ThreeVector bst = v0.boostVector();
v1.boost(-bst);
// CM projectile
G4double momCM = v1.pz();
// Momentum after scattering of incident particle
v1.setX(momCM*sint*cos(phi));
v1.setY(momCM*sint*sin(phi));
v1.setZ(momCM*cost);
//CM Projectile
G4double momCM = gam*(ptot - bet*e1);
G4double eCM = gam*(e1 - bet*ptot);
//energy & momentum after scattering of incident particle
G4double pxCM = momCM*sint*cos(phi);
G4double pyCM = momCM*sint*sin(phi);
G4double pzCM = momCM*cost;
//CM--->Lab
G4LorentzVector v1(pxCM , pyCM, gam*(pzCM + bet*eCM), gam*(eCM + bet*pzCM));
// CM--->Lab
v1.boost(bst);
// Rotate to global system
G4ThreeVector dir = dp->GetMomentumDirection();
@@ -254,7 +254,7 @@ void G4eSingleCoulombScatteringModel::SampleSecondaries(
// recoil
v0 -= v1;
G4double trec = v0.e();
G4double trec = std::max(v0.e() - mass2, 0.0);
G4double edep = 0.0;
G4double tcut = recoilThreshold;
@@ -92,15 +92,16 @@ void G4eplusTo2GammaOKVIModel::Initialise(const G4ParticleDefinition* p,
f3GModel->Initialise(p, cuts);
fCuts = &cuts;
fGammaTh = G4EmParameters::Instance()->LowestTripletEnergy();
f3GModel->SetDelta(fDelta);
if(IsMaster()) {
if(!fCrossSection) {
f3GModel->SetDelta(fDelta);
G4double emin = 10*eV;
G4double emax = 100*TeV;
G4int nbins = 20*G4lrint(std::log10(emax/emin));
fCrossSection = new G4PhysicsLogVector(emin, emax, nbins);
f3GProbability= new G4PhysicsLogVector(emin, emax, nbins);
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);
@@ -266,24 +266,24 @@ void G4hCoulombScatteringModel::SampleSecondaries(
wokvi->SampleSingleScattering(costmin, costmax, ratio);
// kinematics in the Lab system
G4double ptot = dp->GetTotalMomentum();
G4double e1 = dp->GetTotalEnergy();
G4double ptot = sqrt(kinEnergy*(kinEnergy + 2.0*mass));
G4double e1 = mass + kinEnergy;
// Lab. system kinematics along projectile direction
G4LorentzVector v0 = G4LorentzVector(0, 0, ptot, e1 + mass2);
G4double bet = ptot/v0.e();
G4double gam = 1.0/sqrt((1.0 - bet)*(1.0 + bet));
G4LorentzVector v0 = G4LorentzVector(0, 0, ptot, e1+mass2);
G4LorentzVector v1 = G4LorentzVector(0, 0, ptot, e1);
G4ThreeVector bst = v0.boostVector();
v1.boost(-bst);
// CM projectile
G4double momCM = gam*(ptot - bet*e1);
G4double eCM = gam*(e1 - bet*ptot);
// energy & momentum after scattering of incident particle
G4double pxCM = momCM*newDirection.x();
G4double pyCM = momCM*newDirection.y();
G4double pzCM = momCM*newDirection.z();
G4double momCM = v1.pz();
// Momentum after scattering of incident particle
v1.setX(momCM*newDirection.x());
v1.setY(momCM*newDirection.y());
v1.setZ(momCM*newDirection.z());
// CM--->Lab
G4LorentzVector v1(pxCM , pyCM, gam*(pzCM + bet*eCM), gam*(eCM + bet*pzCM));
v1.boost(bst);
G4ThreeVector dir = dp->GetMomentumDirection();
newDirection = v1.vect().unit();
@@ -293,7 +293,7 @@ void G4hCoulombScatteringModel::SampleSecondaries(
// recoil
v0 -= v1;
G4double trec = v0.e() - mass2;
G4double trec = std::max(v0.e() - mass2, 0.0);
G4double edep = 0.0;
G4double tcut = recoilThreshold;
@@ -84,8 +84,8 @@ void G4hMultipleScattering::InitialiseProcess(const G4ParticleDefinition*)
void G4hMultipleScattering::StreamProcessInfo(std::ostream& out) const
{
out << " RangeFactor= " << RangeFactor()
<< ", stepLimitType: " << StepLimitType()
<< ", latDisplacement: " << LateralDisplasmentFlag();
<< ", stepLimType: " << StepLimitType()
<< ", latDisp: " << LateralDisplasmentFlag();
if(StepLimitType() == fUseDistanceToBoundary) {
out << ", skin= " << Skin() << ", geomFactor= " << GeomFactor();
}
@@ -16,6 +16,31 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
13 March 19: M.Asai (emutils-V10-04-27)
- G4EmParametersMessenger: Defining unit categories for UI commands
that take units.
11 March 19: G.Cosmo (emutils-V10-04-26)
- Fixed typos in printouts in G4EmParametersMessenger.
04 March 19: D.Sawkey
- G4EmBiasingManager, G4VEmProcess, G4VEnergyLossProcess - fix
weights for biasing. Should be like version 10.4 now for range cut,
splitting, roulette
18 February 19: D.Sawkey
- G4VEmProcess, G4VEnergyLossProcess - make printout information
more compact
13 February 19: D.Sawkey
- G4EmBiasingManager: fix incorrect weights with brem splitting
introduced in 10.5 (problem #2125)
31 January 19: V.Ivanchenko
- G4VEnergyLossProcess, G4VEmProcess, G4VMultipleScattering,
G4EmModelManager - make info printout at intialisation more
compact (fix problem #2105)
29 October 18: D.Sawkey (emutils-V10-04-25)
- G4EmBiasingManager - fix Valgrind warning
@@ -144,14 +144,14 @@ private:
G4int index,
G4double tcut);
void ApplyDirectionalSplitting(std::vector<G4DynamicParticle*>& vd,
G4double ApplyDirectionalSplitting(std::vector<G4DynamicParticle*>& vd,
const G4Track& track,
G4VEmModel* currentModel,
G4int index,
G4double tcut,
G4ParticleChangeForGamma* partChange);
void ApplyDirectionalSplitting(std::vector<G4DynamicParticle*>& vd,
G4double ApplyDirectionalSplitting(std::vector<G4DynamicParticle*>& vd,
const G4Track& track,
G4VEmModel* currentModel,
G4int index,
@@ -187,8 +187,6 @@ private:
G4double currentStepLimit;
G4bool startTracking;
G4double fWeight;
G4bool fDirectionalSplitting;
G4ThreeVector fDirectionalSplittingTarget;
G4double fDirectionalSplittingRadius;
@@ -76,8 +76,7 @@ class G4VEmProcess : public G4VDiscreteProcess
{
public:
G4VEmProcess(const G4String& name,
G4ProcessType type = fElectromagnetic);
G4VEmProcess(const G4String& name, G4ProcessType type = fElectromagnetic);
virtual ~G4VEmProcess();
@@ -76,7 +76,6 @@ G4EmBiasingManager::G4EmBiasingManager()
fDirectionalSplittingRadius = 0.;
fDirectionalSplittingTarget = G4ThreeVector(0.,0.,0.);
fDirectionalSplittingWeights.clear();
fWeight = 1.;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -304,7 +303,7 @@ G4EmBiasingManager::ApplySecondaryBiasing(
G4double safety)
{
G4int index = idxSecBiasedCouple[coupleIdx];
fWeight = 1.0;
G4double weight = 1.;
if(0 <= index) {
size_t n = vd.size();
@@ -322,18 +321,17 @@ G4EmBiasingManager::ApplySecondaryBiasing(
// Russian Roulette
} else if(1 == nsplit) {
fWeight = ApplyRussianRoulette(vd, index);
weight = ApplyRussianRoulette(vd, index);
// Splitting
} else {
if (fDirectionalSplitting) {
ApplyDirectionalSplitting(vd, track, currentModel, index, tcut);
fWeight = 1.;
weight = ApplyDirectionalSplitting(vd, track, currentModel, index, tcut);
} else {
G4double tmpEnergy = pPartChange->GetProposedKineticEnergy();
G4ThreeVector tmpMomDir = pPartChange->GetProposedMomentumDirection();
fWeight = ApplySplitting(vd, track, currentModel, index, tcut);
weight = ApplySplitting(vd, track, currentModel, index, tcut);
pPartChange->SetProposedKineticEnergy(tmpEnergy);
pPartChange->ProposeMomentumDirection(tmpMomDir);
@@ -341,7 +339,7 @@ G4EmBiasingManager::ApplySecondaryBiasing(
}
}
}
return fWeight;
return weight;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -358,7 +356,7 @@ G4EmBiasingManager::ApplySecondaryBiasing(
G4double safety)
{
G4int index = idxSecBiasedCouple[coupleIdx];
fWeight = 1.0;
G4double weight = 1.;
if(0 <= index) {
size_t n = vd.size();
@@ -376,19 +374,18 @@ G4EmBiasingManager::ApplySecondaryBiasing(
// Russian Roulette
} else if(1 == nsplit) {
fWeight = ApplyRussianRoulette(vd, index);
weight = ApplyRussianRoulette(vd, index);
// Splitting
} else {
if (fDirectionalSplitting) {
ApplyDirectionalSplitting(vd, track, currentModel,
weight = ApplyDirectionalSplitting(vd, track, currentModel,
index, tcut, pPartChange);
fWeight = 1.;
} else {
G4double tmpEnergy = pPartChange->GetProposedKineticEnergy();
G4ThreeVector tmpMomDir = pPartChange->GetProposedMomentumDirection();
fWeight = ApplySplitting(vd, track, currentModel, index, tcut);
weight = ApplySplitting(vd, track, currentModel, index, tcut);
pPartChange->SetProposedKineticEnergy(tmpEnergy);
pPartChange->ProposeMomentumDirection(tmpMomDir);
@@ -396,7 +393,7 @@ G4EmBiasingManager::ApplySecondaryBiasing(
}
}
}
return fWeight;
return weight;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -406,7 +403,7 @@ G4EmBiasingManager::ApplySecondaryBiasing(std::vector<G4Track*>& track,
G4int coupleIdx)
{
G4int index = idxSecBiasedCouple[coupleIdx];
fWeight = 1.0;
G4double weight = 1.;
if(0 <= index) {
size_t n = track.size();
@@ -419,9 +416,9 @@ G4EmBiasingManager::ApplySecondaryBiasing(std::vector<G4Track*>& track,
// Russian Roulette only
if(1 == nsplit) {
fWeight = secBiasedWeight[index];
weight = secBiasedWeight[index];
for(size_t k=0; k<n; ++k) {
if(G4UniformRand()*fWeight > 1.0) {
if(G4UniformRand()*weight > 1.0) {
const G4Track* t = track[k];
delete t;
track[k] = 0;
@@ -430,7 +427,7 @@ G4EmBiasingManager::ApplySecondaryBiasing(std::vector<G4Track*>& track,
}
}
}
return fWeight;
return weight;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -486,11 +483,11 @@ G4EmBiasingManager::ApplySplitting(std::vector<G4DynamicParticle*>& vd,
{
// method is applied only if 1 secondary created PostStep
// in the case of many secondaries there is a contradiction
fWeight = 1.0;
G4double weight = 1.;
size_t n = vd.size();
G4double w = secBiasedWeight[index];
if(1 != n || 1.0 <= w) { return fWeight; }
if(1 != n || 1.0 <= w) { return weight; }
G4double trackWeight = track.GetWeight();
const G4DynamicParticle* dynParticle = track.GetDynamicParticle();
@@ -500,7 +497,7 @@ G4EmBiasingManager::ApplySplitting(std::vector<G4DynamicParticle*>& vd,
// double splitting is suppressed
if(1 < nsplit && trackWeight>w) {
fWeight = w;
weight = w;
if(nsplit > (G4int)tmpSecondaries.size()) {
tmpSecondaries.reserve(nsplit);
}
@@ -515,12 +512,12 @@ G4EmBiasingManager::ApplySplitting(std::vector<G4DynamicParticle*>& vd,
}
}
}
return fWeight;
return weight;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void
G4double
G4EmBiasingManager::ApplyDirectionalSplitting(
std::vector<G4DynamicParticle*>& vd,
const G4Track& track,
@@ -537,8 +534,8 @@ G4EmBiasingManager::ApplyDirectionalSplitting(
fDirectionalSplittingWeights.clear();
if(1.0 <= w) {
fDirectionalSplittingWeights.push_back(fWeight);
return;
fDirectionalSplittingWeights.push_back(weight);
return weight;
}
G4double trackWeight = track.GetWeight();
@@ -570,14 +567,14 @@ G4EmBiasingManager::ApplyDirectionalSplitting(
if (sec->GetParticleDefinition() == theGamma) {
if (CheckDirection(pos, sec->GetMomentumDirection())) {
vd.push_back(sec);
fDirectionalSplittingWeights.push_back(weight);
fDirectionalSplittingWeights.push_back(1.);
} else if (G4UniformRand() < w) {
vd.push_back(sec);
fDirectionalSplittingWeights.push_back(1.0);
fDirectionalSplittingWeights.push_back(1./weight);
}
} else if (k==0) { // not gamma
vd.push_back(sec);
fDirectionalSplittingWeights.push_back(1.);
fDirectionalSplittingWeights.push_back(1./weight);
}
}
@@ -597,7 +594,7 @@ G4EmBiasingManager::ApplyDirectionalSplitting(
partChange->GetProposedMomentumDirection(),
partChange->GetProposedKineticEnergy());
vd.push_back(dp);
fDirectionalSplittingWeights.push_back(weight);
fDirectionalSplittingWeights.push_back(1.);
}
} else if (G4UniformRand()<w) { // not going to target. play RR.
if (!foundPrimaryParticle) {
@@ -610,7 +607,7 @@ G4EmBiasingManager::ApplyDirectionalSplitting(
partChange->GetProposedMomentumDirection(),
partChange->GetProposedKineticEnergy());
vd.push_back(dp);
fDirectionalSplittingWeights.push_back(1.0);
fDirectionalSplittingWeights.push_back(1./weight);
}
}
}
@@ -621,26 +618,29 @@ G4EmBiasingManager::ApplyDirectionalSplitting(
partChange->ProposeMomentumDirection(primaryMomdir);
} else {
for (size_t i = 0; i < vd.size(); ++i) {
fDirectionalSplittingWeights.push_back(trackWeight);
fDirectionalSplittingWeights.push_back(1.);
}
}
return;
return weight;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmBiasingManager::GetWeight(G4int i)
{
// normally return 1. If a directionally split particle survives RR,
// return 1./(splitting factor)
if (fDirectionalSplittingWeights.size() >= (unsigned int)(i+1) ) {
return fDirectionalSplittingWeights[i];
}
else {
return fWeight;
G4double w = fDirectionalSplittingWeights[i];
fDirectionalSplittingWeights[i] = 1.; // ensure it's not used again
return w;
} else {
return 1.;
}
}
void
G4double
G4EmBiasingManager::ApplyDirectionalSplitting(
std::vector<G4DynamicParticle*>& vd,
const G4Track& track,
@@ -648,7 +648,7 @@ G4EmBiasingManager::ApplyDirectionalSplitting(
G4int index,
G4double tcut)
{
// Do nothing with primary
// primary is not a gamma. Do nothing with primary
G4double weight = 1.0;
G4double w = secBiasedWeight[index];
@@ -656,7 +656,7 @@ G4EmBiasingManager::ApplyDirectionalSplitting(
fDirectionalSplittingWeights.clear();
if(1.0 <= w) {
fDirectionalSplittingWeights.push_back(weight);
return;
return weight;
}
G4double trackWeight = track.GetWeight();
@@ -681,17 +681,17 @@ G4EmBiasingManager::ApplyDirectionalSplitting(
for (auto sec : tmpSecondaries) {
if (CheckDirection(pos, sec->GetMomentumDirection())) {
vd.push_back(sec);
fDirectionalSplittingWeights.push_back(weight);
fDirectionalSplittingWeights.push_back(1.);
} else if (G4UniformRand()<w) {
vd.push_back(sec);
fDirectionalSplittingWeights.push_back(1.0);
fDirectionalSplittingWeights.push_back(1./weight);
}
}
} // end of loop over nsplit
} else { // no splitting was done; still need weights
for (size_t i = 0; i < vd.size(); ++i) {
fDirectionalSplittingWeights.push_back(trackWeight);
fDirectionalSplittingWeights.push_back(1.0);
}
}
return;
return weight;
}
@@ -35,32 +35,7 @@
//
// Creation date: 07.05.2002
//
// Modifications:
//
// 23-12-02 V.Ivanchenko change interface in order to move
// to cut per region
// 20-01-03 Migrade to cut per region (V.Ivanchenko)
// 24-01-03 Make models region aware (V.Ivanchenko)
// 13-02-03 The set of models is defined for region (V.Ivanchenko)
// 06-03-03 Fix in energy intervals for models (V.Ivanchenko)
// 13-04-03 Add startFromNull (V.Ivanchenko)
// 13-05-03 Add calculation of precise range (V.Ivanchenko)
// 16-07-03 Replace G4Material by G4MaterialCutCouple in dE/dx and CrossSection
// calculation (V.Ivanchenko)
// 21-07-03 Add UpdateEmModel method (V.Ivanchenko)
// 03-11-03 Substitute STL vector for G4RegionModels (V.Ivanchenko)
// 26-01-04 Fix in energy range conditions (V.Ivanchenko)
// 24-03-05 Remove check or IsInCharge (V.Ivanchenko)
// 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
// 18-08-05 Fix cut for e+e- pair production (V.Ivanchenko)
// 29-11-05 Add protection for arithmetic operations with cut=DBL_MAX (V.Ivanchenko)
// 20-01-06 Introduce G4EmTableType and reducing number of methods (VI)
// 13-05-06 Add GetModel by index method (VI)
// 15-03-07 Add maxCutInRange (V.Ivanchenko)
// 12-04-07 Add verbosity at destruction (V.Ivanchenko)
// 08-04-08 Fixed and simplified initialisation of G4RegionModel (VI)
// 03-08-09 Create internal vectors only it is needed (VI)
// 14-07-11 Use pointer to the vector of cuts and not local copy (VI)
// Modifications: V.Ivanchenko
//
// Class Description:
//
@@ -392,10 +367,6 @@ G4EmModelManager::Initialise(const G4ParticleDefinition* p,
// this model has lower order parameter than possible
// other models, with which there may be intersections
// so, appliction area of such models may be reduced
//G4cout << "tmin= " << tmin << " tmax= "
// << tmax << " push= " << push << " idx= " << idx <<G4endl;
//G4cout << "n= " << n << " eLow[0]= " << eLow[0] << " eLow[n-1]= " << eLow[n-1]
// << " eHigh[0]= " << eHigh[0] << " eHigh[n-1]= " << eHigh[n-1] << G4endl;
// insert below the first model
if (tmax <= eLow[0]) {
@@ -507,7 +478,8 @@ G4EmModelManager::Initialise(const G4ParticleDefinition* p,
eLow[n] = eHigh[n-1];
if(1 < verboseLevel) {
G4cout << "### New G4RegionModels set with " << n << " models for region <";
G4cout << "### New G4RegionModels set with " << n
<< " models for region <";
if (region) { G4cout << region->GetName(); }
G4cout << "> Elow(MeV)= ";
for(G4int iii=0; iii<=n; ++iii) {G4cout << eLow[iii]/MeV << " ";}
@@ -815,10 +787,10 @@ void G4EmModelManager::DumpModelList(std::ostream& out, G4int verb)
std::min(r->LowEdgeEnergy(j+1),model->HighEnergyActivationLimit());
if(emax > emin) {
out << std::setw(20);
out << model->GetName() << " : Emin= "
<< std::setw(8) << G4BestUnit(emin,"Energy")
<< " Emax= "
<< std::setw(8) << G4BestUnit(emax,"Energy");
out << model->GetName() << " : Emin="
<< std::setw(5) << G4BestUnit(emin,"Energy")
<< " Emax="
<< std::setw(5) << G4BestUnit(emax,"Energy");
G4PhysicsTable* table = model->GetCrossSectionTable();
if(table) {
size_t kk = table->size();
@@ -826,18 +798,18 @@ void G4EmModelManager::DumpModelList(std::ostream& out, G4int verb)
G4PhysicsVector* v = (*table)[k];
if(v) {
G4int nn = v->GetVectorLength() - 1;
out << " Table with " << nn << " bins Emin= "
<< std::setw(6) << G4BestUnit(v->Energy(0),"Energy")
<< " Emax= "
<< std::setw(6) << G4BestUnit(v->Energy(nn),"Energy");
out << " Nbins=" << nn << " "
<< std::setw(3) << G4BestUnit(v->Energy(0),"Energy")
<< " - "
<< std::setw(3) << G4BestUnit(v->Energy(nn),"Energy");
break;
}
}
}
G4VEmAngularDistribution* an = model->GetAngularDistribution();
if(an) { out << " " << an->GetName(); }
if(an) { out << " " << an->GetName(); }
if(fluoFlag && model->DeexcitationFlag()) {
out << " FluoActive";
out << " Fluo";
}
out << G4endl;
}
@@ -289,7 +289,7 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
labCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
mscfCmd = new G4UIcmdWithADouble("/process/msc/FactorForAngleLimit",this);
mscfCmd->SetGuidance("Set factor for computation of a limit for -t (invariant trasfer)");
mscfCmd->SetGuidance("Set factor for computation of a limit for -t (invariant transfer)");
mscfCmd->SetParameterName("Fact",true);
mscfCmd->SetRange("Fact>0");
mscfCmd->SetDefaultValue(1.);
@@ -471,6 +471,7 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
StepFuncCmd->SetGuidance("Set the energy loss step limitation parameters for e+-.");
StepFuncCmd->SetGuidance(" dRoverR : max Range variation per step");
StepFuncCmd->SetGuidance(" finalRange: range for final step");
StepFuncCmd->SetGuidance(" unit : unit of finalRange");
StepFuncCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
G4UIparameter* dRoverRPrm = new G4UIparameter("dRoverR",'d',false);
@@ -482,7 +483,7 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
StepFuncCmd->SetParameter(finalRangePrm);
G4UIparameter* unitPrm = new G4UIparameter("unit",'s',true);
unitPrm->SetDefaultValue("mm");
unitPrm->SetDefaultUnit("mm");
StepFuncCmd->SetParameter(unitPrm);
StepFuncCmd1 = new G4UIcommand("/process/eLoss/StepFunctionMuHad",this);
@@ -555,19 +556,22 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
fiCmd->SetParameter(regNam);
G4UIparameter* tlength = new G4UIparameter("tlength",'d',false);
tlength->SetParameterRange("tlength>0");
fiCmd->SetParameter(tlength);
G4UIparameter* unitT = new G4UIparameter("unitT",'s',true);
unitT->SetDefaultUnit("mm");
fiCmd->SetParameter(unitT);
G4UIparameter* flagT = new G4UIparameter("tflag",'s',true);
G4UIparameter* flagT = new G4UIparameter("tflag",'b',true);
flagT->SetDefaultValue(true);
fiCmd->SetParameter(flagT);
bsCmd = new G4UIcommand("/process/em/setSecBiasing",this);
bsCmd->SetGuidance("Set bremsstrahlung or delta-e- splitting/Russian roullette per region.");
bsCmd->SetGuidance("Set bremsstrahlung or delta-e- splitting/Russian roulette per region.");
bsCmd->SetGuidance(" bProcNam : process name");
bsCmd->SetGuidance(" bRegNam : region name");
bsCmd->SetGuidance(" bFactor : number of splitted gamma or probability of Russian roulette");
bsCmd->SetGuidance(" bFactor : number of split gamma or probability of Russian roulette");
bsCmd->SetGuidance(" bEnergy : max energy of a secondary for this biasing method");
bsCmd->SetGuidance(" bUnit : energy unit");
bsCmd->AvailableForStates(G4State_Idle,G4State_Idle);
@@ -585,6 +589,7 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
bsCmd->SetParameter(bEnergy);
G4UIparameter* bUnit = new G4UIparameter("bUnit",'s',true);
bUnit->SetDefaultUnit("MeV");
bsCmd->SetParameter(bUnit);
dirSplitCmd = new G4UIcmdWithABool("/process/em/setDirectionalSplitting",this);
@@ -606,7 +611,7 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
nffCmd->AvailableForStates(G4State_PreInit);
tripletCmd = new G4UIcmdWithAnInteger("/process/gconv/conversionType",this);
tripletCmd->SetGuidance("gamma conversion triplet/nuclear genaration type:");
tripletCmd->SetGuidance("gamma conversion triplet/nuclear generation type:");
tripletCmd->SetGuidance("0 - (default) both triplet and nuclear");
tripletCmd->SetGuidance("1 - force nuclear");
tripletCmd->SetGuidance("2 - force triplet");
@@ -401,8 +401,8 @@ void G4VEmProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
for(G4int i=0; i<numberOfModels; ++i) {
G4VEmModel* mod = GetModelByIndex(i, printing);
G4VEmModel* mod0= masterProc->GetModelByIndex(i, printing);
//G4cout << i << ". " << mod << " " << mod0 << " "
// << particle->GetParticleName() << G4endl;
//G4cout << i << ". " << mod << " " << mod0 << " "
// << particle->GetParticleName() << G4endl;
mod->InitialiseLocal(particle, mod0);
}
// master thread
@@ -424,8 +424,8 @@ void G4VEmProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
num == "kaon+" || num == "kaon-" ||
num == "alpha" || num == "anti_proton" ||
num == "GenericIon"|| num == "alpha++" ||
num == "alpha+" || num == "helium" ||
num == "hydrogen")))
num == "alpha+" || num == "helium" ||
num == "hydrogen")))
{
StreamInfo(G4cout, part);
}
@@ -542,33 +542,33 @@ void G4VEmProcess::StreamInfo(std::ostream& out,
out << std::setprecision(6);
out << G4endl << indent << GetProcessName() << ": ";
if (!rst) {
out << " for " << part.GetParticleName();
out << " for " << part.GetParticleName();
if (integral) { out << ","; }
}
if(integral) { out << " integral: 1 "; }
if(applyCuts) { out << ", applyCuts: 1 "; }
out << " SubType= " << GetProcessSubType();;
if(biasFactor != 1.0) { out << " BiasingFactor= " << biasFactor; }
out << " BuildTable= " << buildLambdaTable << G4endl;
if(integral) { out << " integral:1 "; }
if(applyCuts) { out << " applyCuts:1 "; }
out << " SubType=" << GetProcessSubType();
if(biasFactor != 1.0) { out << " BiasingFactor= " << biasFactor; }
out << " BuildTable=" << buildLambdaTable << G4endl;
if(buildLambdaTable) {
if(particle == &part) {
size_t length = theLambdaTable->length();
for(size_t i=0; i<length; ++i) {
G4PhysicsVector* v = (*theLambdaTable)[i];
if(v) {
out << " Lambda table from ";
G4double emin = v->Energy(0);
G4double emax = v->GetMaxEnergy();
G4int nbin = v->GetVectorLength() - 1;
if(emin > minKinEnergy) { out << "threshold "; }
else { out << G4BestUnit(emin,"Energy"); }
out << " to "
<< G4BestUnit(emax,"Energy")
<< ", " << G4lrint(nbin/std::log10(emax/emin))
<< " bins per decade, spline: "
<< splineFlag << G4endl;
break;
}
G4PhysicsVector* v = (*theLambdaTable)[i];
if(v) {
out << " Lambda table from ";
G4double emin = v->Energy(0);
G4double emax = v->GetMaxEnergy();
G4int nbin = v->GetVectorLength() - 1;
if(emin > minKinEnergy) { out << "threshold "; }
else { out << G4BestUnit(emin,"Energy"); }
out << " to "
<< G4BestUnit(emax,"Energy")
<< ", " << G4lrint(nbin/std::log10(emax/emin))
<< " bins/decade, spline: "
<< splineFlag << G4endl;
break;
}
}
} else {
out << " Used Lambda table of "
@@ -579,16 +579,16 @@ void G4VEmProcess::StreamInfo(std::ostream& out,
if(particle == &part) {
size_t length = theLambdaTablePrim->length();
for(size_t i=0; i<length; ++i) {
G4PhysicsVector* v = (*theLambdaTablePrim)[i];
if(v) {
out << " LambdaPrime table from "
<< G4BestUnit(v->Energy(0),"Energy")
<< " to "
<< G4BestUnit(v->GetMaxEnergy(),"Energy")
<< " in " << v->GetVectorLength()-1
<< " bins " << G4endl;
break;
}
G4PhysicsVector* v = (*theLambdaTablePrim)[i];
if(v) {
out << " LambdaPrime table from "
<< G4BestUnit(v->Energy(0),"Energy")
<< " to "
<< G4BestUnit(v->GetMaxEnergy(),"Energy")
<< " in " << v->GetVectorLength()-1
<< " bins " << G4endl;
break;
}
}
} else {
out << " Used LambdaPrime table of "
@@ -844,7 +844,7 @@ G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
G4Track* t = new G4Track(dp, time, track.GetPosition());
t->SetTouchableHandle(track.GetTouchableHandle());
if (biasManager) {
t->SetWeight(biasManager->GetWeight(i));
t->SetWeight(weight * biasManager->GetWeight(i));
} else {
t->SetWeight(weight);
}
@@ -861,12 +861,12 @@ G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
} else {
t->SetCreatorModelIndex(biasID);
}
/*
/*
G4cout << "Secondary(post step) has weight " << t->GetWeight()
<< ", Ekin= " << t->GetKineticEnergy()/MeV << " MeV "
<< GetProcessName() << " fluoID= " << fluoID
<< " augerID= " << augerID <<G4endl;
*/
<< ", Ekin= " << t->GetKineticEnergy()/MeV << " MeV "
<< GetProcessName() << " fluoID= " << fluoID
<< " augerID= " << augerID <<G4endl;
*/
} else {
delete dp;
edep += e;
@@ -889,8 +889,8 @@ G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4bool G4VEmProcess::StorePhysicsTable(const G4ParticleDefinition* part,
const G4String& directory,
G4bool ascii)
const G4String& directory,
G4bool ascii)
{
G4bool yes = true;
if(!isTheMaster) { return yes; }
@@ -938,7 +938,7 @@ G4bool G4VEmProcess::StorePhysicsTable(const G4ParticleDefinition* part,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4bool G4VEmProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
const G4String& directory,
const G4String& directory,
G4bool ascii)
{
if(1 < verboseLevel) {
@@ -1027,8 +1027,8 @@ G4VEmProcess::CrossSectionPerVolume(G4double kineticEnergy,
SelectModel(kineticEnergy, currentCoupleIndex);
if(currentModel) {
cross = fFactor*currentModel->CrossSectionPerVolume(currentMaterial,
currentParticle,
kineticEnergy);
currentParticle,
kineticEnergy);
}
}
return std::max(cross, 0.0);
@@ -677,7 +677,7 @@ void G4VEnergyLossProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
num == "kaon+" || num == "kaon-" ||
num == "alpha" || num == "anti_proton" ||
num == "GenericIon"|| num == "alpha++" ||
num == "alpha+" )))
num == "alpha+" )))
{
StreamInfo(G4cout, part);
}
@@ -887,8 +887,8 @@ void G4VEnergyLossProcess::StreamInfo(std::ostream& out,
G4String indent = (rst ? " " : "");
out << std::setprecision(6);
out << G4endl << indent << GetProcessName() << ": ";
if (!rst) out << " for " << part.GetParticleName();
out << " SubType= " << GetProcessSubType() << G4endl
if (!rst) out << " for " << part.GetParticleName();
out << " SubType=" << GetProcessSubType() << G4endl
<< " dE/dx and range tables from "
<< G4BestUnit(minKinEnergy,"Energy")
<< " to " << G4BestUnit(maxKinEnergy,"Energy")
@@ -896,33 +896,33 @@ void G4VEnergyLossProcess::StreamInfo(std::ostream& out,
<< " Lambda tables from threshold to "
<< G4BestUnit(maxKinEnergy,"Energy")
<< ", " << theParameters->NumberOfBinsPerDecade()
<< " bins per decade, spline: "
<< " bins/decade, spline: "
<< theParameters->Spline()
<< G4endl;
if(theRangeTableForLoss && isIonisation) {
out << " finalRange(mm)= " << finalRange/mm
<< ", dRoverRange= " << dRoverRange
<< ", integral: " << integral
<< ", fluct: " << lossFluctuationFlag
<< ", linLossLimit= " << linLossLimit
<< G4endl;
out << " StepFunction=(" << dRoverRange << ", "
<< finalRange/mm << " mm)"
<< ", integ: " << integral
<< ", fluct: " << lossFluctuationFlag
<< ", linLossLim= " << linLossLimit
<< G4endl;
}
StreamProcessInfo(out);
modelManager->DumpModelList(out, verboseLevel);
if(theCSDARangeTable && isIonisation) {
out << " CSDA range table up"
<< " to " << G4BestUnit(maxKinEnergyCSDA,"Energy")
<< " in " << nBinsCSDA << " bins" << G4endl;
<< " to " << G4BestUnit(maxKinEnergyCSDA,"Energy")
<< " in " << nBinsCSDA << " bins" << G4endl;
}
if(nSCoffRegions>0 && isIonisation) {
out << " Subcutoff sampling in " << nSCoffRegions
<< " regions" << G4endl;
<< " regions" << G4endl;
}
if(2 < verboseLevel) {
out << " DEDXTable address= " << theDEDXTable << G4endl;
if(theDEDXTable && isIonisation) out << (*theDEDXTable) << G4endl;
out << "non restricted DEDXTable address= "
<< theDEDXunRestrictedTable << G4endl;
<< theDEDXunRestrictedTable << G4endl;
if(theDEDXunRestrictedTable && isIonisation) {
out << (*theDEDXunRestrictedTable) << G4endl;
}
@@ -933,11 +933,13 @@ void G4VEnergyLossProcess::StreamInfo(std::ostream& out,
if(theCSDARangeTable && isIonisation) {
out << (*theCSDARangeTable) << G4endl;
}
out << " RangeTableForLoss address= " << theRangeTableForLoss << G4endl;
out << " RangeTableForLoss address= " << theRangeTableForLoss
<< G4endl;
if(theRangeTableForLoss && isIonisation) {
out << (*theRangeTableForLoss) << G4endl;
}
out << " InverseRangeTable address= " << theInverseRangeTable << G4endl;
out << " InverseRangeTable address= " << theInverseRangeTable
<< G4endl;
if(theInverseRangeTable && isIonisation) {
out << (*theInverseRangeTable) << G4endl;
}
@@ -1029,7 +1031,7 @@ G4double G4VEnergyLossProcess::AlongStepGetPhysicalInteractionLength(
G4double finR = (rndmStepFlag) ? std::min(finalRange,
currentCouple->GetProductionCuts()->GetProductionCut(1)) : finalRange;
x = (fRange > finR) ?
fRange*dRoverRange + finR*(1.0 - dRoverRange)*(2.0 - finR/fRange) : fRange;
fRange*dRoverRange + finR*(1.0-dRoverRange)*(2.0-finR/fRange) : fRange;
// if(particle->GetPDGMass() > 0.9*GeV)
/*
G4cout<<GetProcessName()<<": e= "<<preStepKinEnergy
@@ -1643,7 +1645,7 @@ G4VParticleChange* G4VEnergyLossProcess::PostStepDoIt(const G4Track& track,
G4Track* t = new G4Track(secParticles[i], time, track.GetPosition());
t->SetTouchableHandle(track.GetTouchableHandle());
if (biasManager) {
t->SetWeight(biasManager->GetWeight(i));
t->SetWeight(weight * biasManager->GetWeight(i));
} else {
t->SetWeight(weight);
}
@@ -317,7 +317,7 @@ void G4VMultipleScattering::BuildPhysicsTable(const G4ParticleDefinition& part)
G4VMscModel* msc = static_cast<G4VMscModel*>(GetModelByIndex(i));
if(!msc) { continue; }
G4VMscModel* msc0=
static_cast<G4VMscModel*>(masterProcess->GetModelByIndex(i));
static_cast<G4VMscModel*>(masterProcess->GetModelByIndex(i));
msc->SetCrossSectionTable(msc0->GetCrossSectionTable(), false);
msc->InitialiseLocal(firstParticle, msc0);
}
@@ -333,7 +333,7 @@ void G4VMultipleScattering::BuildPhysicsTable(const G4ParticleDefinition& part)
num == "kaon+" || num == "kaon-" ||
num == "alpha" || num == "anti_proton" ||
num == "GenericIon" || num == "alpha+" ||
num == "alpha++" )))
num == "alpha++" )))
{
StreamInfo(G4cout, part);
}
@@ -353,8 +353,8 @@ void G4VMultipleScattering::StreamInfo(std::ostream& outFile,
{
G4String indent = (rst ? " " : "");
outFile << G4endl << indent << GetProcessName() << ": ";
if (!rst) outFile << " for " << part.GetParticleName();
outFile << " SubType= " << GetProcessSubType() << G4endl;
if (!rst) outFile << " for " << part.GetParticleName();
outFile << " SubType= " << GetProcessSubType() << G4endl;
StreamProcessInfo(outFile);
modelManager->DumpModelList(outFile, verboseLevel);
}
@@ -380,9 +380,9 @@ void G4VMultipleScattering::StartTracking(G4Track* track)
for(G4int i=0; i<numberOfModels; ++i) {
/*
G4cout << "Next model " << i << " " << msc
<< " Emin= " << msc->LowEnergyLimit()
<< " Emax= " << msc->HighEnergyLimit()
<< " Eact= " << msc->LowEnergyActivationLimit() << G4endl;
<< " Emin= " << msc->LowEnergyLimit()
<< " Emax= " << msc->HighEnergyLimit()
<< " Eact= " << msc->LowEnergyActivationLimit() << G4endl;
*/
G4VEmModel* msc = GetModelByIndex(i);
msc->StartTracking(track);
@@ -510,16 +510,16 @@ G4VMultipleScattering::AlongStepDoIt(const G4Track& track, const G4Step& step)
if(r2 > minDisplacement2) {
fPositionChanged = true;
G4double dispR = std::sqrt(r2);
G4double dispR = std::sqrt(r2);
G4double postSafety =
sFact*safetyHelper->ComputeSafety(fNewPosition, dispR);
sFact*safetyHelper->ComputeSafety(fNewPosition, dispR);
//G4cout<<" R= "<< dispR<<" postSafety= "<<postSafety<<G4endl;
// far away from geometry boundary
if(postSafety > 0.0 && dispR <= postSafety) {
fNewPosition += displacement;
//near the boundary
//near the boundary
} else {
// displaced point is definitely within the volume
//G4cout<<" R= "<<dispR<<" postSafety= "<<postSafety<<G4endl;
@@ -543,72 +543,73 @@ G4VMultipleScattering::AlongStepDoIt(const G4Track& track, const G4Step& step)
<< G4endl;
*/
// check if it is possible to shift to the boundary
// and the shift is not large
// and the shift is not large
if(safetyHelper->RecheckDistanceToCurrentBoundary(fNewPosition,
fNewDirection, maxshift, &dist, &safety)
&& std::abs(dist) < maxshift) {
/*
G4cout << "##MSC after Recheck dist= " << dist
<< " postsafety= " << postSafety
<< " t= " << tPathLength
<< " g= " << geomLength
<< " p= " << physStepLimit
<< G4endl;
*/
// shift is positive
if(dist >= 0.0) {
tPathLength *= (1.0 + dist/geomLength);
fNewPosition += dist*fNewDirection;
&& std::abs(dist) < maxshift) {
/*
G4cout << "##MSC after Recheck dist= " << dist
<< " postsafety= " << postSafety
<< " t= " << tPathLength
<< " g= " << geomLength
<< " p= " << physStepLimit
<< G4endl;
*/
// shift is positive
if(dist >= 0.0) {
tPathLength *= (1.0 + dist/geomLength);
fNewPosition += dist*fNewDirection;
// shift is negative cannot be larger than geomLength
} else {
maxshift = std::min(maxshift, geomLength);
if(0.0 < maxshift + dist) {
const G4ThreeVector& postpoint = step.GetPostStepPoint()->GetPosition();
G4ThreeVector point = fNewPosition + dist*fNewDirection;
G4double R2 = (postpoint - point).mag2();
G4double newdist = dist;
// check not more than 10 extra boundaries
for(G4int i=0; i<10; ++i) {
dist = 0.0;
if(safetyHelper->RecheckDistanceToCurrentBoundary(
point, fNewDirection, maxshift, &dist, &safety)
&& std::abs(newdist + dist) < maxshift) {
point += dist*fNewDirection;
G4double R2new = (postpoint - point).mag2();
//G4cout << "Backward i= " << i << " dist= " << dist
// << " R2= " << R2new << G4endl;
if(dist >= 0.0 || R2new > R2) { break; }
R2 = R2new;
fNewPosition = point;
newdist += dist;
} else {
break;
}
}
tPathLength *= (1.0 + newdist/geomLength);
// shift on boundary is not possible for negative disp
} else {
fNewPosition += displacement*(postSafety/dispR - 1.0);
}
}
// shift on boundary is not possible for any disp
} else {
fNewPosition += displacement*(postSafety/dispR - 1.0);
}
// reduced displacement
} else if(postSafety > geomMin) {
fNewPosition += displacement*(postSafety/dispR);
// shift is negative cannot be larger than geomLength
} else {
maxshift = std::min(maxshift, geomLength);
if(0.0 < maxshift + dist) {
const G4ThreeVector& postpoint =
step.GetPostStepPoint()->GetPosition();
G4ThreeVector point = fNewPosition + dist*fNewDirection;
G4double R2 = (postpoint - point).mag2();
G4double newdist = dist;
// check not more than 10 extra boundaries
for(G4int i=0; i<10; ++i) {
dist = 0.0;
if(safetyHelper->RecheckDistanceToCurrentBoundary(
point, fNewDirection, maxshift, &dist, &safety)
&& std::abs(newdist + dist) < maxshift) {
point += dist*fNewDirection;
G4double R2new = (postpoint - point).mag2();
//G4cout << "Backward i= " << i << " dist= " << dist
// << " R2= " << R2new << G4endl;
if(dist >= 0.0 || R2new > R2) { break; }
R2 = R2new;
fNewPosition = point;
newdist += dist;
} else {
break;
}
}
tPathLength *= (1.0 + newdist/geomLength);
// shift on boundary is not possible for negative disp
} else {
fNewPosition += displacement*(postSafety/dispR - 1.0);
}
}
// shift on boundary is not possible for any disp
} else {
fNewPosition += displacement*(postSafety/dispR - 1.0);
}
// reduced displacement
} else if(postSafety > geomMin) {
fNewPosition += displacement*(postSafety/dispR);
// very small postSafety
} else {
fPositionChanged = false;
}
}
if(fPositionChanged) {
safetyHelper->ReLocateWithinVolume(fNewPosition);
fParticleChange.ProposePosition(fNewPosition);
}
if(fPositionChanged) {
safetyHelper->ReLocateWithinVolume(fNewPosition);
fParticleChange.ProposePosition(fNewPosition);
}
}
}
}
@@ -16,6 +16,10 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
15 March 19: D. Sawkey (xrays-V10-04-06)
- G4Cerenkov: increase protection against infinite loops
(backport of xrays-V10-05-00)
20 September 18: D. Sawkey (xrays-V10-04-05)
- G4Cerenkov, G4Scintillation. Reset fNumPhotons to 0 correctly each step.
Fixes bug 2056.
@@ -552,8 +552,9 @@ G4double G4Cerenkov::PostStepGetPhysicalInteractionLength(
G4double Step = Range - RangeMin;
// If the step is smaller than 1e-16 mm, it may happen that the particle
// does not move. See bug 1992.
if (Step < 1.e-16*mm) return StepLimit;
// does not move. See bug 1992.
// 2019-03-11: change to 1e-15
if (Step < 1.e-15*mm) return StepLimit;
if (Step < StepLimit) StepLimit = Step;
// If user has defined an average maximum number of photons to