Import Geant4 8.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:07:44 +02:00
parent fe73f43734
commit 75c7fd177d
764 changed files with 45230 additions and 95238 deletions
@@ -1,4 +1,4 @@
$Id: History,v 1.269 2006/12/04 12:45:25 vnivanch Exp $
$Id: History,v 1.299 2007/04/24 12:03:24 vnivanch Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,12 +17,117 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
23 April 07: V.Ivanchenko (emstand-V08-02-13)
- G4UrbanMscModel - L.Urban: stepping near to boundaries has been
changed back in order to have small steps
with single scattering before+after boundary
for skin > 1.
12 April 07: V.Ivanchenko
- G4UrbanMscModel - use unique G4SafetyHelper; clean up logic in
ComputeTruePathLengthLimit.
04 April 07: V.Ivanchenko (emstand-V08-02-12)
- G4UniversalFluctuation - L.Urban:correction of the algorithm
in order to have better width.
The width of the energy loss distribution
agree rather well with the data.
24 April 07: V.Ivanchenko (emstand-V08-02-11a)
- G4MultipleScattering - set default skin=0 for 8.3
22 March 07: V.Ivanchenko (emstand-V08-02-11)
- G4MultipleScattering - use skin parameter from the base class
- G4UniversalFluctuation - L.Urban: minor optimisation
20 March 07: V.Ivanchenko (emstand-V08-02-10)
- G4hMultipleScattering - remove SetSkin method, which is implemented
in the base class - allowing skin>0
- G4UniversalFluctuation- L.Urban: 'GLANDZ' part of the fluct. model
has been completely rewritten, there is no
separate very small loss regime any more.
The effect of this update is the far better
stability of the result against the changes
in the cut and changes in the stepsize.
- G4eBremsstrahlungModel - add reinitialisation of LPM flag (VI)
24 February 07: V.Ivanchenko (emstand-V08-02-09)
- G4MultipleScattering - remove SetSkin method, which is implemented
in the base class - allowing skin>0
03 March 07
- G4UrbanMscModel - single scattering allowed near to boundaries only,
not everywhere
24 February 07: V.Ivanchenko (emstand-V08-02-08)
- G4UrbanMscModel - L.Urban step reduction before boundary for
geomlimit<geombig only
23 February 07: V.Ivanchenko (emstand-V08-02-07)
- G4hIonisation - remove dependence on K+ and K- particles
- G4BetheHeitlerModel - for any initial energy select atom of the material
on which conversion occur (needed for
polarisation library)
- G4UrbanMscModel - use tPathLength inside ComputeStep instead of geombig
15-Feb-07:
- G4UrbanMscModel - L.Urban: small steps with single scattering before and
after boundary for skin > 1, for skin=0 and skin=1
it works as earlier
15 February 07: mma (emstand-V08-02-06)
- G4eBremsstrahlungModel: correct LPMconstant by factor 2, thanks to G. Depaola
13 February 07: V.Ivanchenko (emstand-V08-02-05)
12 February 07:
- G4UrbanMscModel - L.Urban: stepping algorithm changed for skin=0,
now there are 3 stepping mode :
stepping a la 7.1
skin=0 designed for high energy simulations with
or without magnetic field
skin=1 designed for 'precision' simulations
without magnetic field (default)
06 February 07: V.Ivanchenko (emstand-V08-02-04)
- G4UrbanMscModel - L.Urban : fix in the single scattering code for heavy
particles, now the code can be used with
skin=1 e+/e- and for heavy particles as well.
- G4MultipleScattering - allow reinicialisation of model parameters between runs
- G4UrbanMscModel - V.Ivanchenko add extra protection inside SampleDisplacement
move SetMscStepLimitation from header to source
and add inside extra initialisation
L.Urban add protection for case when energy loss
inactivated; fix computation of skindepth value
29 January 07: V.Ivanchenko (emstand-V08-02-03)
- G4UrbanMscModel - V.Ivanchenko add protections agains NaN values
in two places: protection of lateral displacement,
sampling of theta when tau = 0;
add protection inside ComputeTrueStepLength for
the case very small (zero) geometry length
true length set equal to geometry length
19 January 07: V.Ivanchenko (emstand-V08-02-02)
- G4UrbanMscModel - L.Urban add protection inside lateral displacement
sampling against case TrueStepLength < GeomStepLength
18 January 07: V.Ivanchenko (emstand-V08-02-01)
- Fix crash in PrintInfo methods
- G4UrbanMscModel - remove Locate call to navigator
15 January 07: mma (emstand-V08-02-00)
- use SetEmModel(index) add SetFluctModel() from G4VEnergyLossProcess
in eIonisation, hIonisation, ionIonisation, eBremstrahlung
04 Dec 06: V.Ivanchenko (emstand-V08-01-16)
- G4UrbanMscModel - fix in ComputeTruePathLengthLimit stepmin=1.e-6*mm
(L.Urban)
23 Nov 06: V.Ivanchenko (emstand-V08-01-15)
- G4MultipleScattering - ste default skin=1 only for e+-,
- G4MultipleScattering - set default skin=1 only for e+-,
for all other particles default skin=0
20 Nov 06: V.Ivanchenko (emstand-V08-01-14)
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4MollerBhabhaModel.hh,v 1.17 2006/08/28 17:44:36 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4MollerBhabhaModel.hh,v 1.18 2007/01/17 09:17:56 maire Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// -------------------------------------------------------------------
//
@@ -43,6 +43,7 @@
// 24-01-03 Make models region aware (V.Ivanchenko)
// 13-02-03 Add name (V.Ivanchenko)
// 06-02-06 ComputeCrossSectionPerElectron, ComputeCrossSectionPerAtom (mma)
// 14-01-07 promote SetParticle() from private to protected (mma)
//
// Class Description:
@@ -109,23 +110,22 @@ protected:
G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
G4double kinEnergy);
void SetParticle(const G4ParticleDefinition* p);
const G4ParticleDefinition* particle;
G4ParticleDefinition* theElectron;
G4ParticleChangeForLoss* fParticleChange;
G4bool isElectron;
G4double twoln10;
G4double lowLimit;
private:
void SetParticle(const G4ParticleDefinition* p);
// hide assignment operator
G4MollerBhabhaModel & operator=(const G4MollerBhabhaModel &right);
G4MollerBhabhaModel(const G4MollerBhabhaModel&);
G4double twoln10;
G4double lowLimit;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4MultipleScattering.hh,v 1.32 2006/10/24 11:38:12 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4MultipleScattering.hh,v 1.34 2007/03/22 07:59:25 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// -----------------------------------------------------------------------------
//
@@ -77,6 +77,7 @@
// 13-10-06 data member factail removed, new data member skin
// together with set function, data member tkinlimit
// changed to lambdalimit (L.Urban)
// 07-03-07 remove method SetSkin, because it is now in the base class (VI)
//
//------------------------------------------------------------------------------
//
@@ -134,10 +135,6 @@ public: // with description
// connected with step size reduction due to geometry
void SetFacgeom(G4double val) { facgeom=val;};
// set msc parameter skin
// if skin <= 0 --> no single scattering at boundary
void SetSkin(G4double val) { skin=val;};
protected:
// This function initialise models
@@ -154,7 +151,6 @@ private: // data members
G4double lambdalimit;
G4double facrange;
G4double facgeom;
G4double skin;
G4double dtrl;
G4bool steppingAlgorithm;
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4UniversalFluctuation.hh,v 1.3 2006/06/29 19:51:44 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4UniversalFluctuation.hh,v 1.4 2007/03/20 13:13:03 urban Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// -------------------------------------------------------------------
//
@@ -98,7 +98,6 @@ private:
// data members to speed up the fluctuation calculation
G4double ipotFluct;
G4double electronDensity;
// G4double zeff;
G4double f1Fluct;
G4double f2Fluct;
@@ -108,15 +107,14 @@ private:
G4double e1LogFluct;
G4double e2LogFluct;
G4double ipotLogFluct;
G4double e0;
G4double minNumberInteractionsBohr;
G4double theBohrBeta2;
G4double minLoss;
G4double problim;
G4double sumalim;
G4double alim;
G4double nmaxCont1;
G4double nmaxCont2;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4UrbanMscModel.hh,v 1.15 2006/11/20 06:57:57 urban Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4UrbanMscModel.hh,v 1.23.2.1 2007/05/02 14:59:43 gunter Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// -------------------------------------------------------------------
//
@@ -71,6 +71,9 @@
// function ComputeTheta0,
// single scattering modified allowing not small
// angles as well (L.Urban)
// 31-01-07 code cleaning (L.Urban)
// 06-02-07 Move SetMscStepLimitation method into the source (VI)
// 15-02-07 new data member : smallstep (L.Urban)
//
//
// Class Description:
@@ -140,6 +143,8 @@ public:
void SetMscStepLimitation(G4bool, G4double);
void SetSkin(G4double);
private:
G4double SampleCosineTheta(G4double trueStepLength, G4double KineticEnergy);
@@ -176,7 +181,6 @@ private:
G4double dtrl;
G4double lambdalimit;
G4double llimit;
G4double facrange;
G4double frscaling1,frscaling2;
G4double tlimit;
@@ -184,12 +188,11 @@ private:
G4double tlimitminfix;
G4double tnow;
G4double nstepmax;
G4double tgeom;
G4double geombig;
G4double geommin;
G4double geomlimit;
G4double facgeom;
G4double skin,skindepth,skindepth1;
G4double skin,skindepth,smallstep;
G4double presafety;
G4double facsafety;
@@ -197,7 +200,6 @@ private:
G4double lambdaeff;
G4double tPathLength;
G4double zPathLength;
G4double geomLength;
G4double par1,par2,par3 ;
G4double stepmin ;
@@ -216,6 +218,8 @@ private:
G4bool isInitialized;
G4bool inside;
G4bool insideskin;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -230,10 +234,9 @@ void G4UrbanMscModel::SetLateralDisplasmentFlag(G4bool val)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline
void G4UrbanMscModel::SetMscStepLimitation(G4bool alg, G4double factor)
{
steppingAlgorithm = alg;
facrange = factor;
void G4UrbanMscModel::SetSkin(G4double val)
{
skin = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -262,7 +265,6 @@ void G4UrbanMscModel::SetParticle(const G4ParticleDefinition* p)
particle = p;
mass = p->GetPDGMass();
charge = p->GetPDGCharge()/eplus;
llimit = lambdalimit;
}
}
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4eIonisation.hh,v 1.32 2006/06/29 19:52:08 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4eIonisation.hh,v 1.33 2007/01/17 09:17:56 maire Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// -------------------------------------------------------------------
//
@@ -77,7 +77,6 @@
class G4Material;
class G4ParticleDefinition;
class G4VEmFluctuationModel;
class G4eIonisation : public G4VEnergyLossProcess
{
@@ -115,7 +114,6 @@ private:
const G4ParticleDefinition* theElectron;
const G4ParticleDefinition* particle;
G4VEmFluctuationModel* flucModel;
G4bool isElectron;
G4bool isInitialised;
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4hIonisation.hh,v 1.34 2006/06/29 19:52:28 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4hIonisation.hh,v 1.35 2007/01/17 09:17:56 maire Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// -------------------------------------------------------------------
//
@@ -83,7 +83,6 @@
#include "G4EmCorrections.hh"
class G4Material;
class G4VEmFluctuationModel;
class G4hIonisation : public G4VEnergyLossProcess
{
@@ -130,7 +129,6 @@ private:
const G4ParticleDefinition* theParticle;
const G4ParticleDefinition* theBaseParticle;
G4VEmFluctuationModel* flucModel;
G4EmCorrections* corr;
G4bool isInitialised;
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4hMultipleScattering.hh,v 1.1 2006/10/26 11:04:38 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4hMultipleScattering.hh,v 1.2 2007/03/20 15:40:59 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// -----------------------------------------------------------------------------
//
@@ -34,9 +34,10 @@
//
// Author: Laszlo Urban
//
// Creation date: 24.10.2006 cloned from G4MultipleScattering
// Creation date: 24.10.2006 cloned from G4MultipleScattering by VI
//
// Modifications:
// 20.03.07 Remove local parameter skin (V.Ivanchenko)
//
//
//------------------------------------------------------------------------------
@@ -94,10 +95,6 @@ public: // with description
// connected with step size reduction due to geometry
void SetFacgeom(G4double val) { facgeom=val;};
// set msc parameter skin
// if skin <= 0 --> no single scattering at boundary
void SetSkin(G4double val) { skin=val;};
protected:
// This function initialise models
@@ -114,7 +111,6 @@ private: // data members
G4double lambdalimit;
G4double facrange;
G4double facgeom;
G4double skin;
G4double dtrl;
G4bool steppingAlgorithm;
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ionIonisation.hh,v 1.41 2006/06/29 19:52:34 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4ionIonisation.hh,v 1.42 2007/01/17 09:17:56 maire Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// -------------------------------------------------------------------
//
@@ -73,7 +73,6 @@
#include "G4EmCorrections.hh"
class G4Material;
class G4VEmFluctuationModel;
class G4PhysicsVector;
class G4BraggIonModel;
@@ -131,7 +130,6 @@ private:
G4ionIonisation(const G4ionIonisation&);
G4ionEffectiveCharge* effCharge;
G4VEmFluctuationModel* flucModel;
G4EmCorrections* corr;
// cash
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4BetheHeitlerModel.cc,v 1.9 2006/06/29 19:52:40 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4BetheHeitlerModel.cc,v 1.10 2007/02/20 17:06:35 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// -------------------------------------------------------------------
//
@@ -42,6 +42,8 @@
// 24-06-05 Increase number of bins to 200 (V.Ivantchenko)
// 16-11-05 replace shootBit() by G4UniformRand() mma
// 04-12-05 SetProposedKineticEnergy(0.) for the killed photon (mma)
// 20-02-20 SelectRandomElement is called for any initial gamma energy
// in order to have selected element for polarized model (VI)
//
// Class Description:
//
@@ -208,14 +210,15 @@ std::vector<G4DynamicParticle*>* G4BetheHeitlerModel::SampleSecondaries(
// do it fast if GammaEnergy < 2. MeV
static const G4double Egsmall=2.*MeV;
// select randomly one element constituing the material
const G4Element* anElement = SelectRandomAtom(aMaterial, theGamma, GammaEnergy);
if (GammaEnergy < Egsmall) {
epsil = epsil0 + (0.5-epsil0)*G4UniformRand();
} else {
// now comes the case with GammaEnergy >= 2. MeV
// select randomly one element constituing the material
const G4Element* anElement = SelectRandomAtom(aMaterial, theGamma, GammaEnergy);
// Extract Coulomb factor for this Element
G4double FZ = 8.*(anElement->GetIonisation()->GetlogZ3());
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4MollerBhabhaModel.cc,v 1.28 2006/08/28 17:44:36 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4MollerBhabhaModel.cc,v 1.29 2007/01/17 09:17:56 maire Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// -------------------------------------------------------------------
//
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4MultipleScattering.cc,v 1.58 2006/11/23 10:07:42 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4MultipleScattering.cc,v 1.64 2007/04/24 12:00:16 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// -----------------------------------------------------------------------------
//
@@ -118,6 +118,7 @@
// there is no z sampling by default (L.Urban)
// 23-10-06 skin = 1 by default (L.Urban)
// 23-11-06 skin = 1 by default for e+-, 0 for other particles (VI)
// 12-02-07 skin can be changed via UI command, default skin=1 (VI)
//
// -----------------------------------------------------------------------------
//
@@ -144,10 +145,6 @@ G4MultipleScattering::G4MultipleScattering(const G4String& processName)
dtrl = 0.05;
lambdalimit = 1.*mm;
facgeom = 2.5;
// there is no single scattering for this skin <= 0
// to have single scattering at boundary
// skin should be > 0 !
skin = 0.0;
steppingAlgorithm = true;
samplez = false ;
@@ -158,6 +155,7 @@ G4MultipleScattering::G4MultipleScattering(const G4String& processName)
SetMaxKinEnergy(highKineticEnergy);
SetLateralDisplasmentFlag(true);
SetSkin(0.0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -191,26 +189,37 @@ void G4MultipleScattering::InitialiseProcess(const G4ParticleDefinition* p)
{
if(isInitialized) {
mscUrban->SetMscStepLimitation(steppingAlgorithm, facrange);
if (p->GetParticleType() != "nucleus") {
mscUrban->SetLateralDisplasmentFlag(LateralDisplasmentFlag());
mscUrban->SetSkin(Skin());
}
return;
}
G4String part_name = p->GetParticleName();
if(part_name == "e-" || part_name == "e+") skin = 1.0;
if (p->GetParticleType() == "nucleus") {
SetLateralDisplasmentFlag(false);
SetBuildLambdaTable(false);
SetSkin(0.0);
} else {
SetBuildLambdaTable(true);
}
mscUrban = new G4UrbanMscModel(facrange,dtrl,lambdalimit,
facgeom,skin,
facgeom,Skin(),
samplez,steppingAlgorithm);
mscUrban->SetLateralDisplasmentFlag(LateralDisplasmentFlag());
mscUrban->SetLowEnergyLimit(lowKineticEnergy);
mscUrban->SetHighEnergyLimit(highKineticEnergy);
AddEmModel(1,mscUrban);
isInitialized = true;
/*
G4cout << "G4MultipleScattering::InitialiseProcess for "
<< p->GetParticleName()
<< " skin= " << Skin()
<< " SA= " << steppingAlgorithm
<< G4endl;
*/
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4UniversalFluctuation.cc,v 1.8 2006/06/29 19:53:32 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4UniversalFluctuation.cc,v 1.13 2007/03/21 15:23:45 urban Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// -------------------------------------------------------------------
//
@@ -52,6 +52,9 @@
// 03-10-05 energy dependent rate -> cut dependence of the
// distribution is much weaker (L.Urban)
// 17-10-05 correction for very small loss (L.Urban)
// 20-03-07 'GLANDZ' part rewritten completely, no 'very small loss'
// regime any more (L.Urban)
// 21-03-07 optimization in ionization part (L.Urban)
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -75,12 +78,9 @@ G4UniversalFluctuation::G4UniversalFluctuation(const G4String& nam)
minNumberInteractionsBohr(10.0),
theBohrBeta2(50.0*keV/proton_mass_c2),
minLoss(10.*eV),
problim(5.e-3),
alim(10.),
nmaxCont1(4.),
nmaxCont2(16.)
{
sumalim = -log(problim);
lastMaterial = 0;
}
@@ -168,142 +168,104 @@ G4double G4UniversalFluctuation::SampleFluctuations(const G4Material* material,
e2LogFluct = material->GetIonisation()->GetLogEnergy2fluct();
ipotFluct = material->GetIonisation()->GetMeanExcitationEnergy();
ipotLogFluct = material->GetIonisation()->GetLogMeanExcEnergy();
e0 = material->GetIonisation()->GetEnergy0fluct();
lastMaterial = material;
}
G4double a1 = 0. , a2 = 0., a3 = 0. ;
G4double p1,p2,p3;
// cut and material dependent rate --------------------------------
G4double rate = 0.173+0.027*log(tmax/ipotFluct) ;
if(rate < 0.) rate = 0. ;
if(rate > 1.) rate = 1. ;
G4double w1 = tmax/ipotFluct;
G4double w2 = log(2.*electron_mass_c2*beta2*gam2)-beta2;
// cut and material dependent rate
G4double rate = 1.0;
if(tmax > ipotFluct) {
G4double w2 = log(2.*electron_mass_c2*beta2*gam2)-beta2;
if(w2 > ipotLogFluct)
{
G4double C = meanLoss*(1.-rate)/(w2-ipotLogFluct);
a1 = C*f1Fluct*(w2-e1LogFluct)/e1Fluct;
a2 = C*f2Fluct*(w2-e2LogFluct)/e2Fluct;
if(a2 < 0.)
{
a1 = 0. ;
a2 = 0. ;
rate = 1. ;
if(w2 > ipotLogFluct && w2 > e2LogFluct) {
rate = 0.03+0.23*log(log(tmax/ipotFluct));
G4double C = meanLoss*(1.-rate)/(w2-ipotLogFluct);
a1 = C*f1Fluct*(w2-e1LogFluct)/e1Fluct;
a2 = C*f2Fluct*(w2-e2LogFluct)/e2Fluct;
}
}
else
{
rate = 1. ;
}
if(tmax > ipotFluct)
a3 = rate*meanLoss*(tmax-ipotFluct)/(ipotFluct*tmax*log(w1));
G4double w1 = tmax/e0;
if(tmax > e0)
a3 = rate*meanLoss*(tmax-e0)/(e0*tmax*log(w1));
G4double suma = a1+a2+a3;
// Glandz regime
//
if (suma > sumalim)
{
p1 = 0., p2 = 0 ;
if((a1+a2) > 0.)
{
// excitation type 1
if (a1>alim) {
siga=sqrt(a1) ;
p1 = max(0.,G4RandGauss::shoot(a1,siga)+0.5);
} else {
p1 = G4double(G4Poisson(a1));
}
// excitation type 2
if (a2>alim) {
siga=sqrt(a2) ;
p2 = max(0.,G4RandGauss::shoot(a2,siga)+0.5);
} else {
p2 = G4double(G4Poisson(a2));
}
loss = p1*e1Fluct+p2*e2Fluct;
//'nearly' Gaussian fluctuation if a1>nmaxCont2&&a2>nmaxCont2&&a3>nmaxCont2
G4double emean = 0.;
G4double sig2e = 0., sige = 0.;
G4double p1 = 0., p2 = 0., p3 = 0.;
// smearing to avoid unphysical peaks
if (p2 > 0.)
loss += (1.-2.*G4UniformRand())*e2Fluct;
else if (loss>0.)
loss += (1.-2.*G4UniformRand())*e1Fluct;
if (loss < 0.) loss = 0.0;
}
// ionisation
if (a3 > 0.) {
if (a3>alim) {
siga=sqrt(a3) ;
p3 = max(0.,G4RandGauss::shoot(a3,siga)+0.5);
} else {
p3 = G4double(G4Poisson(a3));
}
G4double lossc = 0.;
if (p3 > 0) {
G4double na = 0.;
G4double alfa = 1.;
if (p3 > nmaxCont2) {
G4double rfac = p3/(nmaxCont2+p3);
G4double namean = p3*rfac;
G4double sa = nmaxCont1*rfac;
na = G4RandGauss::shoot(namean,sa);
if (na > 0.) {
alfa = w1*(nmaxCont2+p3)/(w1*nmaxCont2+p3);
G4double alfa1 = alfa*log(alfa)/(alfa-1.);
G4double ea = na*ipotFluct*alfa1;
G4double sea = ipotFluct*sqrt(na*(alfa-alfa1*alfa1));
lossc += G4RandGauss::shoot(ea,sea);
}
}
if (p3 > na) {
w2 = alfa*ipotFluct;
G4double w = (tmax-w2)/tmax;
G4int nb = G4int(p3-na);
for (G4int k=0; k<nb; k++) lossc += w2/(1.-w*G4UniformRand());
}
}
loss += lossc;
}
return loss;
}
// suma < sumalim; very small energy loss;
//
G4double e0 = material->GetIonisation()->GetEnergy0fluct();
if(tmax <= e0) return meanLoss;
else a3 = meanLoss*(tmax-e0)/(tmax*e0*log(tmax/e0));
if (a3 > alim)
// excitation of type 1
if(a1 > nmaxCont2)
{
siga=sqrt(a3);
p3 = max(0.,G4RandGauss::shoot(a3,siga)+0.5);
} else {
p3 = G4double(G4Poisson(a3));
emean += a1*e1Fluct;
sig2e += a1*e1Fluct*e1Fluct;
}
if (p3 > 0.) {
G4double w = (tmax-e0)/tmax;
G4double corrfac = 1.;
if (p3 > nmaxCont2) {
corrfac = p3/nmaxCont2;
p3 = nmaxCont2;
}
G4int ip3 = (G4int)p3;
for (G4int i=0; i<ip3; i++) loss += 1./(1.-w*G4UniformRand());
loss *= e0*corrfac;
// smearing for losses near to e0
if(p3 <= 2.)
loss += e0*(1.-2.*G4UniformRand()) ;
}
return loss;
else if(a1 > 0.)
{
p1 = G4double(G4Poisson(a1));
loss += p1*e1Fluct;
if(p1 > 0.)
loss += (1.-2.*G4UniformRand())*e1Fluct;
}
// excitation of type 2
if(a2 > nmaxCont2)
{
emean += a2*e2Fluct;
sig2e += a2*e2Fluct*e2Fluct;
}
else if(a2 > 0.)
{
p2 = G4double(G4Poisson(a2));
loss += p2*e2Fluct;
if(p2 > 0.)
loss += (1.-2.*G4UniformRand())*e2Fluct;
}
// ionisation
G4double lossc = 0.;
if(a3 > 0.)
{
p3 = a3;
G4double alfa = 1.;
if(a3 > nmaxCont2)
{
alfa = w1*(nmaxCont2+a3)/(w1*nmaxCont2+a3);
G4double alfa1 = alfa*log(alfa)/(alfa-1.);
G4double namean = a3*w1*(alfa-1.)/((w1-1.)*alfa);
emean += namean*e0*alfa1;
sig2e += e0*e0*namean*(alfa-alfa1*alfa1);
p3 = a3-namean;
}
G4double w2 = alfa*e0;
G4double w = (tmax-w2)/tmax;
G4double scale = 1.;
G4int nb = 0;
if(p3 < nmaxCont2)
nb = G4Poisson(p3);
else
{
nb = G4Poisson(nmaxCont2);
scale = p3/nmaxCont2;
}
if(nb > 0)
for (G4int k=0; k<nb; k++) lossc += scale*w2/(1.-w*G4UniformRand());
}
if(emean > 0.)
{
sige = sqrt(sig2e);
loss += max(0.,G4RandGauss::shoot(emean,sige));
}
loss += lossc;
return loss;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4UrbanMscModel.cc,v 1.26 2006/12/04 05:53:24 urban Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4UrbanMscModel.cc,v 1.47 2007/03/07 15:44:42 urban Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// -------------------------------------------------------------------
//
@@ -114,6 +114,26 @@
// 20-11-06 bugfix in single scattering part of SampleCosineTheta,
// single scattering just before boundary crossing now (L.Urban)
// 04-12-06 fix in ComputeTruePathLengthLimit (L.Urban)
// 17-01-07 remove LocatePoint from GeomLimit method (V.Ivanchenko)
// 19-01-07 fix of true < geom problem (L.Urban)
// 25-01-07 add protections from NaN vaues and for zero geometry step (VI)
// 31-01-07 correction in SampleCosineTheta: screening parameter
// corrected in single/plural scattering +
// code cleaning (L.Urban)
// 01-02-07 restore logic inside ComputeTrueStepLength (V.Ivanchenko)
// 06-02-07 Move SetMscStepLimitation method into the source, add there
// reinitialisation of some private members, add protection inside
// SampleDisplacement(VI)
// 07-02-07 fix single scattering for heavy particles, now skin=1 can be used
// for heavy particles as well (L.Urban)
// 08-02-07 randomization of tlimit removed (L.Urban)
// 11-02-07 modified stepping algorithm for skin=0
// 15-02-07 new data member: smallstep, small steps with single scattering
// before + after boundary for skin > 1
// 23-02-07 use tPathLength inside ComputeStep instead of geombig
// 24-02-07 step reduction before boundary for 'small' geomlimit only
// 03-03-07 single scattering around boundaries only (L.Urban)
// 07-03-07 bugfix in ComputeTruePathLengthLimit (for skin > 0.) (L.Urban)
//
// Class Description:
@@ -161,18 +181,17 @@ G4UrbanMscModel::G4UrbanMscModel(G4double m_facrange, G4double m_dtrl,
tausmall = 1.e-20;
taulim = 1.e-6;
currentTau = taulim;
stepmin = 1.e-6*mm;
skindepth = (skin-1)*stepmin;
skindepth1 = skindepth+stepmin;
tlimitminfix = 1.e-6*mm;
stepmin = tlimitminfix;
skindepth = skin*stepmin;
smallstep = 1.e10;
currentRange = 0. ;
frscaling2 = 0.25;
frscaling1 = 1.-frscaling2;
tlimit = 1.e10*mm;
tlimitmin = 10.e-6*mm;
tlimitminfix = 10.e-6*mm;
tnow = 10.e-6*mm;
tlimitmin = 10.*tlimitminfix;
tnow = 10.*tlimitminfix;
nstepmax = 25.;
tgeom = 1.e50*mm;
geombig = 1.e50*mm;
geommin = 1.e-3*mm;
geomlimit = geombig;
@@ -182,6 +201,8 @@ G4UrbanMscModel::G4UrbanMscModel(G4double m_facrange, G4double m_dtrl,
particle = 0;
theManager = G4LossTableManager::Instance();
inside = false;
insideskin = false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -213,6 +234,21 @@ void G4UrbanMscModel::Initialise(const G4ParticleDefinition* p,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4UrbanMscModel::SetMscStepLimitation(G4bool alg, G4double factor)
{
steppingAlgorithm = alg;
facrange = factor;
// reinitialisation
stepmin = tlimitminfix;
skindepth = skin*stepmin;
tlimitmin = 10.*tlimitminfix;
tnow = 10.*tlimitminfix;
inside = false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4UrbanMscModel::ComputeCrossSectionPerAtom(
const G4ParticleDefinition* part,
G4double KineticEnergy,
@@ -479,117 +515,191 @@ G4double G4UrbanMscModel::ComputeTruePathLengthLimit(
tPathLength = currentRange;
G4StepPoint* sp = track.GetStep()->GetPreStepPoint();
presafety = sp->GetSafety();
G4StepStatus stepStatus = sp->GetStepStatus();
G4int stepNumber = track.GetCurrentStepNumber();
if(stepNumber == 1) insideskin = false;
// standard version
//
if (steppingAlgorithm)
{
if((stepNumber > 1) && inside)
return tPathLength;
//compute geomlimit and presafety
GeomLimit(track);
if((stepStatus == fGeomBoundary) || (stepNumber == 1))
//for precise simulation for the case without magnatic field
// small step(s) + single/plural scattering around boundaries
if(skin > 0.)
{
if((stepNumber == 1) && (currentRange < presafety))
if((stepNumber > 1) && inside)
return tPathLength;
//compute geomlimit and presafety
GeomLimit(track);
insideskin = false;
smallstep += 1.;
if((stepStatus == fGeomBoundary) || (stepNumber == 1))
{
stepmin = 1.e-6*mm;
inside = true;
return tPathLength;
}
else
inside = false;
if(stepNumber == 1) smallstep = 1.e10;
else smallstep = 1.;
// facrange scaling in lambda
// not so strong step restriction above llimit
G4double facr = facrange;
if(lambda0 > llimit)
facr *= frscaling1+frscaling2*lambda0/llimit;
// constraint from the physics
if (currentRange > lambda0) tlimit = facr*currentRange;
else tlimit = facr*lambda0;
// constraint from the geometry (if tlimit above is too big)
tgeom = geombig;
if(geomlimit > geommin)
{
if(stepStatus == fGeomBoundary)
tgeom = geomlimit/facgeom;
if((stepNumber == 1) && (currentRange < presafety))
{
stepmin = tlimitminfix;
inside = true;
return tPathLength;
}
else
tgeom = 2.*geomlimit/facgeom;
inside = false;
// facrange scaling in lambda
// not so strong step restriction above lambdalimit
G4double facr = facrange;
if(lambda0 > lambdalimit)
facr *= frscaling1+frscaling2*lambda0/lambdalimit;
// constraint from the physics
if (currentRange > lambda0) tlimit = facr*currentRange;
else tlimit = facr*lambda0;
// constraint from the geometry (if tlimit above is too big)
G4double tgeom = geombig;
if(geomlimit > geommin)
{
if(stepStatus == fGeomBoundary)
tgeom = geomlimit/facgeom;
else
tgeom = 2.*geomlimit/facgeom;
}
//define stepmin here (it depends on lambda!)
//rough estimation of lambda_elastic/lambda_transport
G4double rat = currentKinEnergy/MeV ;
rat = 1.e-3/(rat*(10.+rat)) ;
//stepmin ~ lambda_elastic
stepmin = rat*lambda0;
skindepth = skin*stepmin;
//define tlimitmin
tlimitmin = lambda0/nstepmax;
if(tlimitmin < stepmin) tlimitmin = 1.01*stepmin;
if(tlimitmin < tlimitminfix) tlimitmin = tlimitminfix;
//lower limit for tlimit
if(tlimit < tlimitmin) tlimit = tlimitmin;
//check against geometry limit
if(tlimit > tgeom) tlimit = tgeom;
//if track starts far from boundaries increase tlimit!
if(tlimit < facsafety*presafety)
tlimit = facsafety*presafety ;
}
//define stepmin here (it depends on lambda!)
//rough estimation of lambda_elastic/lambda_transport
G4double rat = currentKinEnergy/MeV ;
rat = 1.e-3/(rat*(10.+rat)) ;
//stepmin ~ lambda_elastic
stepmin = rat*lambda0;
skindepth = (skin-1.)*stepmin;
skindepth1 = skindepth+stepmin;
if(stepmin > tgeom) stepmin = tgeom;
if(currentRange < presafety)
{
inside = true;
return tPathLength;
}
//define tlimitmin
tlimitmin = lambda0/nstepmax;
if(tlimitmin < stepmin) tlimitmin = 1.01*stepmin;
if(tlimitmin < tlimitminfix) tlimitmin = tlimitminfix;
// shortcut
if((tPathLength < tlimit) &&
(tPathLength < presafety))
return tPathLength;
//lower limit for tlimit
if(tlimit < tlimitmin) tlimit = tlimitmin;
//check against geometry limit
if(tlimit > tgeom) tlimit = tgeom;
//if track starts far from boundaries increase tlimit!
//if track far from boundaries increase tPathLength
tnow = tlimit;
if(tlimit < facsafety*presafety)
tlimit = facsafety*presafety ;
tnow = facsafety*presafety ;
// "randomize" tlimit
tlimit *= 0.5+G4UniformRand();
}
if(currentRange < presafety)
{
inside = true;
return tPathLength;
}
// shortcut
if((tPathLength < tlimit) &&
(tPathLength < presafety))
return tPathLength;
//if track far from boundaries increase tPathLength
tnow = tlimit;
if(tlimit < facsafety*presafety)
tnow = facsafety*presafety ;
// step reduction near to boundary
if(skindepth >= 0.)
{
if(geomlimit > skindepth)
// step reduction near to boundary
if(smallstep < skin)
{
if(tnow > geomlimit-skindepth)
tnow = geomlimit-skindepth;
tnow = stepmin;
insideskin = true;
}
else
{
if(tnow > stepmin)
tnow = stepmin;
else if(geomlimit < geombig)
{
if(geomlimit > skindepth)
{
if(tnow > geomlimit-0.999*skindepth)
tnow = geomlimit-0.999*skindepth;
}
else
{
insideskin = true;
if(tnow > stepmin)
tnow = stepmin;
}
}
if(tnow < stepmin)
tnow = stepmin;
if(tPathLength > tnow)
tPathLength = tnow ;
}
// for 'normal' simulation with or without magnetic field
// there no small step/single scattering at boundaries
else
{
if((stepNumber > 1) && inside)
return tPathLength;
if(tnow < stepmin)
tnow = stepmin;
// compute presafety again if presafety <= 0 and no boundary
// i.e. when it is needed for optimization purposes
if((stepStatus != fGeomBoundary) && (presafety <= 0.))
{
presafety = safetyHelper->ComputeSafety(sp->GetPosition());
if(currentRange < presafety)
{
stepmin = tlimitminfix;
inside = true;
return tPathLength;
}
else
inside = false;
}
if(tPathLength > tnow)
tPathLength = tnow ;
if((stepStatus == fGeomBoundary) || (stepNumber == 1))
{
if(stepNumber == 1)
insideskin = false;
// facrange scaling in lambda
// not so strong step restriction above lambdalimit
G4double facr = facrange;
if(lambda0 > lambdalimit)
facr *= frscaling1+frscaling2*lambda0/lambdalimit;
// constraint from the physics
if (currentRange > lambda0) tlimit = facr*currentRange;
else tlimit = facr*lambda0;
//lower limit for tlimit
tlimitmin = lambda0/nstepmax;
if(tlimitmin < tlimitminfix) tlimitmin = tlimitminfix;
if(tlimit < tlimitmin) tlimit = tlimitmin;
//if track starts far from boundaries increase tlimit!
if(tlimit < facsafety*presafety)
tlimit = facsafety*presafety ;
}
if(currentRange < presafety)
{
inside = true;
return tPathLength;
}
// shortcut
if((tPathLength < tlimit) &&
(tPathLength < presafety))
return tPathLength;
if(tPathLength > tlimit) tPathLength = tlimit;
}
}
// version similar to 7.1 (needed for some experiments)
@@ -597,14 +707,15 @@ G4double G4UrbanMscModel::ComputeTruePathLengthLimit(
{
if(stepNumber == 1)
tlimit = geombig;
if (stepStatus == fGeomBoundary)
{
if (currentRange > lambda0) tlimit = facrange*currentRange;
else tlimit = facrange*lambda0;
if(tlimit < tlimitmin) tlimit = tlimitmin;
if(tPathLength > tlimit) tPathLength = tlimit;
}
if(tPathLength > tlimit) tPathLength = tlimit;
}
return tPathLength ;
@@ -620,14 +731,14 @@ void G4UrbanMscModel::GeomLimit(const G4Track& track)
if((track.GetVolume() != 0) &&
(track.GetVolume() != navigator->GetWorldVolume()))
{
const G4double cstep = geombig;
navigator->LocateGlobalPointWithinVolume(
track.GetStep()->GetPreStepPoint()->GetPosition());
const G4double cstep = tPathLength;
geomlimit = navigator->ComputeStep(
track.GetStep()->GetPreStepPoint()->GetPosition(),
track.GetMomentumDirection(),
cstep,
presafety);
// G4cout << "!!!G4UrbanMscModel::GeomLimit presafety= " << presafety
// << " limit= " << geomlimit << G4endl;
}
}
@@ -635,14 +746,16 @@ void G4UrbanMscModel::GeomLimit(const G4Track& track)
G4double G4UrbanMscModel::ComputeGeomPathLength(G4double)
{
// do the true -> geom transformation
lambdaeff = lambda0;
par1 = -1. ;
par2 = par3 = 0. ;
// do the true -> geom transformation
zPathLength = tPathLength;
// z = t for very small tPathLength
if(tPathLength < tlimitminfix) return zPathLength;
// this correction needed to run MSC with eIoni and eBrem inactivated
// and makes no harm for a normal run
if(tPathLength > currentRange)
@@ -650,10 +763,10 @@ G4double G4UrbanMscModel::ComputeGeomPathLength(G4double)
G4double tau = tPathLength/lambda0 ;
if ((tau <= tausmall) || (tPathLength <= stepmin)) {
geomLength = tPathLength;
if(geomLength > lambda0) geomLength = lambda0;
return geomLength;
if ((tau <= tausmall) || insideskin) {
zPathLength = tPathLength;
if(zPathLength > lambda0) zPathLength = lambda0;
return zPathLength;
}
G4double zmean = tPathLength;
@@ -709,10 +822,9 @@ G4double G4UrbanMscModel::ComputeGeomPathLength(G4double)
}
}
geomLength = zPathLength;
if(geomLength > lambda0) geomLength = lambda0;
if(zPathLength > lambda0) zPathLength = lambda0;
return geomLength;
return zPathLength;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -720,29 +832,30 @@ G4double G4UrbanMscModel::ComputeGeomPathLength(G4double)
G4double G4UrbanMscModel::ComputeTrueStepLength(G4double geomStepLength)
{
// step defined other than transportation
if(geomStepLength == geomLength && tPathLength <= currentRange)
if(geomStepLength == zPathLength && tPathLength <= currentRange)
return tPathLength;
// recalculation
G4double trueLength = geomStepLength;
// t = z for very small step
zPathLength = geomStepLength;
if((geomStepLength > lambda0*tausmall) && (geomStepLength > stepmin))
tPathLength = geomStepLength;
if(geomStepLength < tlimitminfix) return tPathLength;
// recalculation
if((geomStepLength > lambda0*tausmall) && !insideskin)
{
if(par1 < 0.)
trueLength = -lambda0*log(1.-geomStepLength/lambda0) ;
tPathLength = -lambda0*log(1.-geomStepLength/lambda0) ;
else
{
if(par1*par3*geomStepLength < 1.)
trueLength = (1.-exp(log(1.-par1*par3*geomStepLength)/par3))/par1 ;
tPathLength = (1.-exp(log(1.-par1*par3*geomStepLength)/par3))/par1 ;
else
trueLength = currentRange ;
tPathLength = currentRange;
}
}
if(trueLength < geomStepLength) trueLength = geomStepLength;
if(tPathLength < geomStepLength) tPathLength = geomStepLength;
tPathLength = trueLength;
return trueLength;
return tPathLength;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -780,7 +893,7 @@ std::vector<G4DynamicParticle*>* G4UrbanMscModel::SampleSecondaries(
G4double safety)
{
G4double kineticEnergy = dynParticle->GetKineticEnergy();
if((kineticEnergy <= 0.0) || (truestep <= 0.)) return 0;
if((kineticEnergy <= 0.0) || (truestep <= tlimitminfix)) return 0;
G4double cth = SampleCosineTheta(truestep,kineticEnergy);
G4double sth = sqrt((1.0 - cth)*(1.0 + cth));
@@ -796,6 +909,13 @@ std::vector<G4DynamicParticle*>* G4UrbanMscModel::SampleSecondaries(
if (latDisplasment) {
G4double r = SampleDisplacement();
/*
G4cout << "G4UrbanMscModel::SampleSecondaries: e(MeV)= " << kineticEnergy
<< " sinTheta= " << sth << " r(mm)= " << r
<< " trueStep(mm)= " << truestep
<< " geomStep(mm)= " << zPathLength
<< G4endl;
*/
if(r > 0.)
{
G4double latcorr = LatCorrelation();
@@ -826,10 +946,8 @@ std::vector<G4DynamicParticle*>* G4UrbanMscModel::SampleSecondaries(
else
{
// ******* we do not have track info at this level ***********
// ******* so navigator is called at boundary too ************
G4double newsafety= -100.; // = safety;
// newsafety= navigator->ComputeSafety(Position);
newsafety= safetyHelper->ComputeSafety(Position);
// ******* so safety is computed at boundary too ************
G4double newsafety = safetyHelper->ComputeSafety(Position);
safety= newsafety;
if(r < newsafety)
fac = 1.;
@@ -842,7 +960,6 @@ std::vector<G4DynamicParticle*>* G4UrbanMscModel::SampleSecondaries(
// compute new endpoint of the Step
G4ThreeVector newPosition = Position+fac*r*latDirection;
// navigator->LocateGlobalPointWithinVolume(newPosition);
safetyHelper->ReLocateWithinVolume(newPosition);
fParticleChange->ProposePosition(newPosition);
@@ -863,20 +980,17 @@ G4double G4UrbanMscModel::SampleCosineTheta(G4double trueStepLength,
Zeff = couple->GetMaterial()->GetTotNbOfElectPerVolume()/
couple->GetMaterial()->GetTotNbOfAtomsPerVolume() ;
if((trueStepLength <= stepmin) && (skin > 0.) &&
(geomlimit <= skindepth1))
if(insideskin)
{
//no scattering, single or plural scattering
// just before boundary crossing only (for skin > 0)
G4double mean = trueStepLength/stepmin ;
cth = 1.;
G4int n = G4Poisson(mean);
if(n > 0)
{
G4double tm = KineticEnergy/mass;
// ascr - screening parameter, factor 0.025 comes from
// requirement of 'smooth' transition msc -> single scattering
G4double ascr = 0.025*exp(log(Zeff)/3.)/(137.*sqrt(tm*(tm+2.)));
G4double tm = KineticEnergy/electron_mass_c2;
// ascr - screening parameter
G4double ascr = exp(log(Zeff)/3.)/(137.*sqrt(tm*(tm+2.)));
G4double ascr1 = 1.+0.5*ascr*ascr;
G4double bp1=ascr1+1.;
G4double bm1=ascr1-1.;
@@ -899,11 +1013,13 @@ G4double G4UrbanMscModel::SampleCosineTheta(G4double trueStepLength,
}
else
{
if(trueStepLength >= currentRange*dtrl)
if(par1*trueStepLength < 1.)
tau = -par2*log(1.-par1*trueStepLength) ;
else
tau = taubig ;
if(trueStepLength >= currentRange*dtrl)
if(par1*trueStepLength < 1.)
tau = -par2*log(1.-par1*trueStepLength) ;
// for the case if ioni/brems are inactivated
// see the corresponding condition in ComputeGeomPathLength
else if(1.-KineticEnergy/currentKinEnergy > taulim)
tau = taubig ;
currentTau = tau ;
lambdaeff = trueStepLength/currentTau;
@@ -996,7 +1112,7 @@ G4double G4UrbanMscModel::SampleDisplacement()
const G4double kappapl1 = kappa+1.;
const G4double kappami1 = kappa-1.;
G4double rmean = 0.0;
if ((currentTau >= tausmall) && (tPathLength > stepmin)) {
if ((currentTau >= tausmall) && !insideskin) {
if (currentTau < taulim) {
rmean = kappa*currentTau*currentTau*currentTau*
(1.-kappapl1*currentTau*0.25)/6. ;
@@ -1010,10 +1126,15 @@ G4double G4UrbanMscModel::SampleDisplacement()
}
if (rmean>0.) rmean = 2.*lambdaeff*sqrt(rmean/3.0);
else rmean = 0.;
}
// check: z*z+r*r <= t*t should be satisfied
if(rmean*rmean > (tPathLength-zPathLength)*(tPathLength+zPathLength))
rmean = sqrt((tPathLength-zPathLength)*(tPathLength+zPathLength));
// protection against z > t ...........................
if(rmean > 0.) {
G4double zt = (tPathLength-zPathLength)*(tPathLength+zPathLength);
if(zt <= 0.)
rmean = 0.;
else if(rmean*rmean > zt)
rmean = sqrt(zt);
}
return rmean;
}
@@ -1026,7 +1147,7 @@ G4double G4UrbanMscModel::LatCorrelation()
const G4double kappami1 = kappa-1.;
G4double latcorr = 0.;
if((currentTau >= tausmall) && (tPathLength > stepmin))
if((currentTau >= tausmall) && !insideskin)
{
if(currentTau < taulim)
latcorr = lambdaeff*kappa*currentTau*currentTau*
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4eBremsstrahlung.cc,v 1.44 2006/06/29 19:53:43 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4eBremsstrahlung.cc,v 1.46 2007/01/18 12:17:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// -------------------------------------------------------------------
//
@@ -67,6 +67,7 @@
// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivantchenko)
// 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
// 22-05-06 Use gammaThreshold from manager (V.Ivantchenko)
// 15-01-07 use SetEmModel() from G4VEnergyLossProcess (mma)
//
// -------------------------------------------------------------------
//
@@ -106,23 +107,22 @@ G4eBremsstrahlung::~G4eBremsstrahlung()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4eBremsstrahlung::InitialiseEnergyLossProcess(const G4ParticleDefinition* p,
const G4ParticleDefinition*)
void G4eBremsstrahlung::InitialiseEnergyLossProcess(
const G4ParticleDefinition* p,
const G4ParticleDefinition*)
{
gammaThreshold = G4LossTableManager::Instance()->BremsstrahlungTh();
if(!isInitialised) {
isInitialised = true;
particle = p;
SetSecondaryParticle(G4Gamma::Gamma());
SetIonisation(false);
//G4VEmFluctuationModel* fm = 0;
G4VEmFluctuationModel* fm = new G4UniversalFluctuation();
G4VEmModel* em = new G4eBremsstrahlungModel();
em->SetLowEnergyLimit(0.1*keV);
em->SetHighEnergyLimit(100.0*TeV);
AddEmModel(1, em, fm);
if (!EmModel()) SetEmModel(new G4eBremsstrahlungModel());
EmModel()->SetLowEnergyLimit (100*eV);
EmModel()->SetHighEnergyLimit(100*TeV);
if (!FluctModel()) SetFluctModel(new G4UniversalFluctuation());
AddEmModel(1, EmModel(), FluctModel());
isInitialised = true;
}
}
@@ -130,12 +130,13 @@ void G4eBremsstrahlung::InitialiseEnergyLossProcess(const G4ParticleDefinition*
void G4eBremsstrahlung::PrintInfo()
{
G4cout << " Total cross sections from a parametrisation"
<< " based on the EEDL data library. "
<< G4endl
<< " Good description from 1 KeV to 100 GeV, "
<< "log scale extrapolation above 100 GeV."
<< G4endl;
if(EmModel())
G4cout << " Total cross sections and sampling from "
<< EmModel()->GetName() << " model"
<< " (based on the EEDL data library) "
<< "\n Good description from 1 KeV to 100 GeV, "
<< "log scale extrapolation above 100 GeV."
<< G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4eBremsstrahlungModel.cc,v 1.35 2006/08/29 14:00:25 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4eBremsstrahlungModel.cc,v 1.37 2007/02/15 10:37:37 maire Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// -------------------------------------------------------------------
//
@@ -52,6 +52,7 @@
// 07-02-06 public function ComputeCrossSectionPerAtom() (mma)
// 21-03-06 Fix problem of initialisation in case when cuts are not defined (VI)
// 27-03-06 Fix calculation of fl parameter at low energy (energy loss) (VI)
// 15-02-07 correct LPMconstant by a factor 2, thanks to G. Depaola (mma)
//
// Class Description:
//
@@ -87,7 +88,7 @@ G4eBremsstrahlungModel::G4eBremsstrahlungModel(const G4ParticleDefinition* p,
lowKinEnergy(1.0*keV),
probsup(1.0),
MigdalConstant(classic_electr_radius*electron_Compton_length*electron_Compton_length/pi),
LPMconstant(fine_structure_const*electron_mass_c2*electron_mass_c2/(8.*pi*hbarc)),
LPMconstant(fine_structure_const*electron_mass_c2*electron_mass_c2/(4.*pi*hbarc)),
theLPMflag(true)
{
if(p) SetParticle(p);
@@ -792,8 +793,7 @@ std::vector<G4DynamicParticle*>* G4eBremsstrahlungModel::SampleSecondaries(
<< " e= " << kineticEnergy
<< G4endl;
}
*/
*/
} while( greject < G4UniformRand()*grejmax );
} else {
@@ -814,7 +814,18 @@ std::vector<G4DynamicParticle*>* G4eBremsstrahlungModel::SampleSecondaries(
*/
} while( greject < G4UniformRand()*grejmax );
}
/*
if(x > 0.999) {
G4cout << "### G4eBremsstrahlungModel Warning: e= " << kineticEnergy
<< " tlow= " << tlow
<< " x= " << x
<< " greject= " << greject
<< " grejmax= " << grejmax
<< " migdal= " << migdal
<< G4endl;
// if(x >= 1.0) G4Exception("X=1");
}
*/
gammaEnergy = x*kineticEnergy;
if (theLPMflag) {
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4eIonisation.cc,v 1.50 2006/06/29 19:53:51 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4eIonisation.cc,v 1.52 2007/01/18 12:17:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// -------------------------------------------------------------------
//
@@ -65,6 +65,7 @@
// 12-08-05 SetStepLimits(0.2, 0.1*mm) (mma)
// 02-09-05 Return SetStepLimits(1, 1*mm) (V.Ivantchenko)
// 10-01-06 SetStepLimits -> SetStepFunction (V.Ivantchenko)
// 14-01-07 use SetEmModel() and SetFluctModel() from G4VEnergyLossProcess (mma)
//
// -------------------------------------------------------------------
//
@@ -111,15 +112,12 @@ void G4eIonisation::InitialiseEnergyLossProcess(
if(!isInitialised) {
if(part == G4Positron::Positron()) isElectron = false;
SetSecondaryParticle(theElectron);
flucModel = new G4UniversalFluctuation();
//flucModel = new G4BohrFluctuations();
G4VEmModel* em = new G4MollerBhabhaModel();
em->SetLowEnergyLimit(100*eV);
em->SetHighEnergyLimit(100*TeV);
AddEmModel(1, em, flucModel);
if (!EmModel()) SetEmModel(new G4MollerBhabhaModel());
EmModel()->SetLowEnergyLimit (100*eV);
EmModel()->SetHighEnergyLimit(100*TeV);
if (!FluctModel()) SetFluctModel(new G4UniversalFluctuation());
AddEmModel(1, EmModel(), FluctModel());
isInitialised = true;
}
}
@@ -128,9 +126,11 @@ void G4eIonisation::InitialiseEnergyLossProcess(
void G4eIonisation::PrintInfo()
{
G4cout << " Delta cross sections from Moller+Bhabha, "
<< "good description from 1 KeV to 100 GeV."
<< G4endl;
if(EmModel())
G4cout << " Delta cross sections and sampling from "
<< EmModel()->GetName() << " model"
<< "\n Good description from 1 KeV to 100 GeV."
<< G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4hIonisation.cc,v 1.65 2006/06/29 19:54:01 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4hIonisation.cc,v 1.68 2007/02/23 14:54:00 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// -------------------------------------------------------------------
//
@@ -74,7 +74,9 @@
// 24-03-05 Optimize internal interfaces (V.Ivantchenko)
// 12-08-05 SetStepLimits(0.2, 0.1*mm) (mma)
// 10-01-06 SetStepLimits -> SetStepFunction (V.Ivanchenko)
// 26-05-06 scale negative particles from pi- and pbar, positive from pi+ and p (VI)
// 26-05-06 scale negative particles from pi- and pbar,
// positive from pi+ and p (VI)
// 14-01-07 use SetEmModel() and SetFluctModel() from G4VEnergyLossProcess (mma)
//
// -------------------------------------------------------------------
//
@@ -92,8 +94,6 @@
#include "G4UnitsTable.hh"
#include "G4PionPlus.hh"
#include "G4PionMinus.hh"
#include "G4KaonPlus.hh"
#include "G4KaonMinus.hh"
#include "G4LossTableManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -133,19 +133,19 @@ void G4hIonisation::InitialiseEnergyLossProcess(
theParticle = part;
if(part == bpart ||
part == G4Proton::Proton() ||
part == G4AntiProton::AntiProton() ||
part == G4PionPlus::PionPlus() ||
part == G4PionMinus::PionMinus() ) theBaseParticle = 0;
G4String pname = part->GetParticleName();
// standard base particles
if(part == bpart || pname == "proton" ||
pname == "anti_proton" || pname == "pi+" || pname == "pi-" )
theBaseParticle = 0;
// select base particle
else if(bpart == 0) {
if(part == G4KaonPlus::KaonPlus())
theBaseParticle = G4PionPlus::PionPlus();
else if(part == G4KaonMinus::KaonMinus())
theBaseParticle = G4PionMinus::PionMinus();
else if(part->GetPDGCharge() > 0.0)
theBaseParticle = G4Proton::Proton();
if(pname == "kaon+") theBaseParticle = G4PionPlus::PionPlus();
else if(pname == "kaon-") theBaseParticle = G4PionMinus::PionMinus();
else if(part->GetPDGCharge() > 0.0) theBaseParticle = G4Proton::Proton();
else theBaseParticle = G4AntiProton::AntiProton();
} else theBaseParticle = bpart;
@@ -157,18 +157,17 @@ void G4hIonisation::InitialiseEnergyLossProcess(
massratio = 1.0;
if(theBaseParticle) massratio = theBaseParticle->GetPDGMass()/mass;
G4VEmModel* em = new G4BraggModel();
em->SetLowEnergyLimit(0.1*keV);
if (!EmModel(1)) SetEmModel(new G4BraggModel(),1);
EmModel(1)->SetLowEnergyLimit(100*eV);
eth = 2.0*MeV*mass/proton_mass_c2;
em->SetHighEnergyLimit(eth);
EmModel(1)->SetHighEnergyLimit(eth);
if (!FluctModel()) SetFluctModel(new G4UniversalFluctuation());
AddEmModel(1, EmModel(1), FluctModel());
flucModel = new G4UniversalFluctuation();
AddEmModel(1, em, flucModel);
G4VEmModel* em1 = new G4BetheBlochModel();
em1->SetLowEnergyLimit(eth);
em1->SetHighEnergyLimit(100.0*TeV);
AddEmModel(2, em1, flucModel);
if (!EmModel(2)) SetEmModel(new G4BetheBlochModel(),2);
EmModel(2)->SetLowEnergyLimit(eth);
EmModel(2)->SetHighEnergyLimit(100*TeV);
AddEmModel(2, EmModel(2), FluctModel());
isInitialised = true;
}
@@ -177,11 +176,14 @@ void G4hIonisation::InitialiseEnergyLossProcess(
void G4hIonisation::PrintInfo()
{
G4cout << " Scaling relation is used to proton dE/dx and range"
<< G4endl
<< " Bether-Bloch model for Escaled > " << eth << " MeV, ICRU49 "
<< "parametrisation for protons below."
<< G4endl;
if(EmModel(1) && EmModel(2))
G4cout << " Scaling relation is used from proton dE/dx and range."
<< "\n Delta cross sections and sampling from "
<< EmModel(2)->GetName() << " model for scaled energy > "
<< eth/MeV << " MeV"
<< "\n Parametrisation from "
<< EmModel(1)->GetName() << " for protons below."
<< G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4hMultipleScattering.cc,v 1.1 2006/10/26 11:04:39 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4hMultipleScattering.cc,v 1.3 2007/03/20 15:40:59 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// -----------------------------------------------------------------------------
//
@@ -37,6 +37,8 @@
// Creation date: 24.10.2006 cloned from G4MultipleScattering
//
// Modified:
// 12-02-07 skin can be changed via UI command (VI)
// 20.03.07 Remove local parameter skin, set facgeom=0.1(V.Ivanchenko)
//
// -----------------------------------------------------------------------------
//
@@ -62,11 +64,7 @@ G4hMultipleScattering::G4hMultipleScattering(const G4String& processName)
facrange = 0.2;
dtrl = 0.05;
lambdalimit = 1.*mm;
facgeom = 0.5;
// there is no single scattering for this skin <= 0
// to have single scattering at boundary
// skin should be > 0 !
skin = 0.;
facgeom = 0.1;
steppingAlgorithm = false;
samplez = false ;
@@ -77,6 +75,7 @@ G4hMultipleScattering::G4hMultipleScattering(const G4String& processName)
SetMaxKinEnergy(highKineticEnergy);
SetLateralDisplasmentFlag(true);
SetSkin(0.0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -110,17 +109,22 @@ void G4hMultipleScattering::InitialiseProcess(const G4ParticleDefinition* p)
{
if(isInitialized) {
mscUrban->SetMscStepLimitation(steppingAlgorithm, facrange);
if (p->GetParticleType() != "nucleus") {
mscUrban->SetLateralDisplasmentFlag(LateralDisplasmentFlag());
mscUrban->SetSkin(Skin());
}
return;
}
if (p->GetParticleType() == "nucleus") {
SetLateralDisplasmentFlag(false);
SetBuildLambdaTable(false);
SetSkin(0.0);
} else {
SetBuildLambdaTable(true);
}
mscUrban = new G4UrbanMscModel(facrange,dtrl,lambdalimit,
facgeom,skin,
facgeom,Skin(),
samplez,steppingAlgorithm);
mscUrban->SetLateralDisplasmentFlag(LateralDisplasmentFlag());
mscUrban->SetLowEnergyLimit(lowKineticEnergy);
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ionIonisation.cc,v 1.37 2006/06/29 19:54:05 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4ionIonisation.cc,v 1.39 2007/01/18 12:17:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// -------------------------------------------------------------------
//
@@ -51,6 +51,7 @@
// 10-01-06 SetStepLimits -> SetStepFunction (V.Ivantchenko)
// 10-05-06 Add a possibility to download user data (V.Ivantchenko)
// 13-05-06 Add data for light ion stopping in water (V.Ivantchenko)
// 14-01-07 use SetEmModel() and SetFluctModel() from G4VEnergyLossProcess (mma)
//
//
// -------------------------------------------------------------------
@@ -66,7 +67,6 @@
#include "G4BraggIonModel.hh"
#include "G4BetheBlochModel.hh"
#include "G4IonFluctuations.hh"
#include "G4UniversalFluctuation.hh"
#include "G4UnitsTable.hh"
#include "G4LossTableManager.hh"
#include "G4WaterStopping.hh"
@@ -117,21 +117,20 @@ void G4ionIonisation::InitialiseEnergyLossProcess(
if(theBaseParticle) baseMass = theBaseParticle->GetPDGMass();
else baseMass = theParticle->GetPDGMass();
if (!EmModel(1)) SetEmModel(new G4BraggIonModel(),1);
EmModel(1)->SetLowEnergyLimit(100*eV);
eth = 2.0*MeV;
EmModel(1)->SetHighEnergyLimit(eth);
if (!FluctModel()) SetFluctModel(new G4IonFluctuations());
AddEmModel(1, EmModel(1), FluctModel());
flucModel = new G4IonFluctuations();
if (!EmModel(2)) SetEmModel(new G4BetheBlochModel(),2);
EmModel(2)->SetLowEnergyLimit(eth);
EmModel(2)->SetHighEnergyLimit(100*TeV);
AddEmModel(2, EmModel(2), FluctModel());
eth = 2.0*MeV;
G4BraggIonModel* theBraggModel = new G4BraggIonModel();
theBraggModel->SetLowEnergyLimit(0.1*keV);
theBraggModel->SetHighEnergyLimit(eth);
AddEmModel(1, theBraggModel, flucModel);
G4VEmModel* em1 = new G4BetheBlochModel();
em1->SetLowEnergyLimit(eth);
em1->SetHighEnergyLimit(100.0*TeV);
AddEmModel(2, em1, flucModel);
effCharge = corr->GetIonEffectiveCharge(theBraggModel);
effCharge = corr->GetIonEffectiveCharge(EmModel(1));
G4WaterStopping ws(corr);
isInitialised = true;
@@ -141,14 +140,19 @@ void G4ionIonisation::InitialiseEnergyLossProcess(
void G4ionIonisation::PrintInfo()
{
G4cout << " Scaling relation is used to proton dE/dx and range"
<< G4endl
<< " Bether-Bloch model for Escaled > " << eth << " MeV, ICRU49 "
<< "parametrisation for alpha particles below.";
if(stopDataActive)
G4cout << G4endl << " Stopping Power data for " << corr->GetNumberOfStoppingVectors()
<< " ion/material pairs are used.";
G4cout << G4endl;
if(EmModel(1) && EmModel(2))
G4cout << " Scaling relation is used from proton dE/dx and range."
<< "\n Delta cross sections and sampling from "
<< EmModel(2)->GetName() << " model for scaled energy > "
<< eth/MeV << " MeV"
<< "\n Parametrisation from "
<< EmModel(1)->GetName() << " for protons below."
<< G4endl;
if (stopDataActive)
G4cout << "\n Stopping Power data for "
<< corr->GetNumberOfStoppingVectors()
<< " ion/material pairs are used."
<< G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....