Import Geant4 8.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 14:36:02 +02:00
parent d93e1e39a9
commit 8a51e0bc40
5471 changed files with 99628 additions and 55248 deletions
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4BetheBlochModel.cc,v 1.6 2005/04/12 18:12:41 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4BetheBlochModel.cc,v 1.7 2005/08/18 15:05:13 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// -------------------------------------------------------------------
//
@@ -93,7 +93,7 @@ void G4BetheBlochModel::Initialise(const G4ParticleDefinition* p,
{
if(!particle) SetParticle(p);
G4String pname = particle->GetParticleName();
if(particle->GetParticleType() == "nucleus" &&
if(particle->GetParticleType() == "nucleus" &&
pname != "deuteron" && pname != "triton") isIon = true;
if(pParticleChange)
@@ -193,14 +193,14 @@ G4double G4BetheBlochModel::CrossSectionPerVolume(const G4Material* material,
vector<G4DynamicParticle*>* G4BetheBlochModel::SampleSecondaries(
const G4MaterialCutsCouple*,
const G4DynamicParticle* dp,
G4double minEnergy,
G4double minKinEnergy,
G4double maxEnergy)
{
G4double kineticEnergy = dp->GetKineticEnergy();
G4double tmax = MaxSecondaryEnergy(dp->GetDefinition(),kineticEnergy);
G4double maxKinEnergy = min(maxEnergy,tmax);
G4double minKinEnergy = min(minEnergy,maxKinEnergy);
if(minKinEnergy >= maxKinEnergy) return 0;
G4double totEnergy = kineticEnergy + mass;
G4double etot2 = totEnergy*totEnergy;
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4BetheHeitlerModel.cc,v 1.3 2005/05/12 11:06:43 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4BetheHeitlerModel.cc,v 1.7 2005/12/05 16:44:43 maire Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// -------------------------------------------------------------------
//
@@ -36,6 +36,9 @@
//
// Modifications:
// 18-04-05 Use G4ParticleChangeForGamma (V.Ivantchenko)
// 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)
//
// Class Description:
//
@@ -61,7 +64,7 @@ G4BetheHeitlerModel::G4BetheHeitlerModel(const G4ParticleDefinition*,
const G4String& nam)
: G4VEmModel(nam),
theCrossSectionTable(0),
nbins(100)
nbins(200)
{
theGamma = G4Gamma::Gamma();
thePositron = G4Positron::Positron();
@@ -195,17 +198,18 @@ std::vector<G4DynamicParticle*>* G4BetheHeitlerModel::SampleSecondaries(
G4double epsil ;
G4double epsil0 = electron_mass_c2/GammaEnergy ;
if(epsil0 > 1.0) return 0;
// do it fast if GammaEnergy < 2. MeV
static const G4double Egsmall=2.*MeV;
if (GammaEnergy < Egsmall) {
if (GammaEnergy < Egsmall) {
epsil = epsil0 + (0.5-epsil0)*G4UniformRand();
epsil = epsil0 + (0.5-epsil0)*G4UniformRand();
} else {
} else {
// now comes the case with GammaEnergy >= 2. MeV
// select randomly one element constituing the material
// select randomly one element constituing the material
const G4Element* anElement = SelectRandomAtom(aMaterial, theGamma, GammaEnergy);
// Extract Coulomb factor for this Element
@@ -222,7 +226,7 @@ std::vector<G4DynamicParticle*>* G4BetheHeitlerModel::SampleSecondaries(
G4double epsilmin = max(epsil0,epsil1) , epsilrange = 0.5 - epsilmin;
//
// sample the energy rate of the created electron (or positron)
// sample the energy rate of the created electron (or positron)
//
//G4double epsil, screenvar, greject ;
G4double screenvar, greject ;
@@ -253,7 +257,7 @@ std::vector<G4DynamicParticle*>* G4BetheHeitlerModel::SampleSecondaries(
//
G4double ElectTotEnergy, PositTotEnergy;
if (RandBit::shootBit()) {
if (G4UniformRand() > 0.5) {
ElectTotEnergy = (1.-epsil)*GammaEnergy;
PositTotEnergy = epsil*GammaEnergy;
@@ -314,6 +318,8 @@ std::vector<G4DynamicParticle*>* G4BetheHeitlerModel::SampleSecondaries(
fvect->push_back(aParticle1);
fvect->push_back(aParticle2);
// kill incident photon
fParticleChange->SetProposedKineticEnergy(0.);
fParticleChange->ProposeTrackStatus(fStopAndKill);
return fvect;
@@ -21,7 +21,7 @@
// ********************************************************************
//
// $Id: G4BohrFluctuations.cc,v 1.3 2005/05/01 20:26:24 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
// -------------------------------------------------------------------
//
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4BraggIonModel.cc,v 1.6 2005/05/30 08:46:58 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4BraggIonModel.cc,v 1.10 2005/11/29 07:58:42 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// -------------------------------------------------------------------
//
@@ -36,6 +36,7 @@
//
// Modifications:
// 11-05-05 Major optimisation of internal interfaces (V.Ivantchenko)
// 29-11-05 Do not use G4Alpha class (V.Ivantchenko)
//
// Class Description:
@@ -53,7 +54,6 @@
#include "G4BraggIonModel.hh"
#include "Randomize.hh"
#include "G4Electron.hh"
#include "G4Alpha.hh"
#include "G4ParticleChangeForLoss.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -70,7 +70,7 @@ G4BraggIonModel::G4BraggIonModel(const G4ParticleDefinition* p, const G4String&
highKinEnergy = 2.0*MeV;
lowKinEnergy = 0.0*MeV;
lowestKinEnergy = 1.0*keV;
HeMass = G4Alpha::Alpha()->GetPDGMass();
HeMass = 3.72742*GeV;
rateMassHe2p = HeMass/proton_mass_c2;
massFactor = 1000.*amu_c2/HeMass;
theZieglerFactor = eV*cm2*1.0e-15;
@@ -97,7 +97,7 @@ void G4BraggIonModel::Initialise(const G4ParticleDefinition* p,
{
if(p != particle) SetParticle(p);
G4String pname = particle->GetParticleName();
if(particle->GetParticleType() == "nucleus" &&
if(particle->GetParticleType() == "nucleus" &&
pname != "deuteron" && pname != "triton") isIon = true;
if(pParticleChange)
@@ -176,12 +176,12 @@ G4double G4BraggIonModel::CrossSectionPerVolume(const G4Material* material,
std::vector<G4DynamicParticle*>* G4BraggIonModel::SampleSecondaries(
const G4MaterialCutsCouple*,
const G4DynamicParticle* dp,
G4double minEnergy,
G4double xmin,
G4double maxEnergy)
{
G4double tmax = MaxSecondaryKinEnergy(dp);
G4double xmax = min(tmax, maxEnergy);
G4double xmin = min(xmax, minEnergy);
if(xmin >= xmax) return 0;
G4double kineticEnergy = dp->GetKineticEnergy();
G4double energy = kineticEnergy + mass;
@@ -242,28 +242,20 @@ std::vector<G4DynamicParticle*>* G4BraggIonModel::SampleSecondaries(
G4bool G4BraggIonModel::HasMaterial(const G4Material* material)
{
const size_t numberOfMolecula = 11 ;
SetMoleculaNumber(numberOfMolecula) ;
G4String chFormula = material->GetChemicalFormula() ;
// ICRU Report N49, 1993. Power's model for He.
const size_t numberOfMolecula = 30 ;
SetMoleculaNumber(numberOfMolecula) ;
static G4String nameMol[numberOfMolecula] = {
"H_2", "Be-Solid", "C-Solid", "Graphite", "N_2",
"O_2", "Al-Solid", "Si-Solid", "Ar-Solid", "Cu-Solid",
"Ge", "W-Solid", "Au-Solid", "Pb-Solid", "C_2H_2",
"CO_2", "Cellulose-Nitrat", "C_2H_4", "LiF",
"CH_4", "Nylon", "Polycarbonate", "(CH_2)_N-Polyetilene", "PMMA",
"(C_8H_8)_N", "SiO_2", "CsI", "H_2O", "H_2O-Gas"} ;
// Special treatment for water in gas state
const G4State theState = material->GetState() ;
if( theState == kStateGas && "H_2O" == chFormula)
chFormula = G4String("H_2O-Gas");
// ICRU Report N49, 1993. Ziegler model for He.
static G4String molName[numberOfMolecula] = {
"CaF_2", "Cellulose_Nitrate", "LiF", "Policarbonate",
"(C_2H_4)_N-Polyethylene", "(C_2H_4)_N-Polymethly_Methacralate",
"Polysterene", "SiO_2", "NaI", "H_2O",
"Graphite" } ;
// Search for the material in the table
for (size_t i=0; i<numberOfMolecula; i++) {
if (chFormula == nameMol[i]) {
if (chFormula == molName[i]) {
SetMoleculaNumber(i) ;
return true ;
}
@@ -274,79 +266,70 @@ G4bool G4BraggIonModel::HasMaterial(const G4Material* material)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4BraggIonModel::StoppingPower(const G4Material* material,
G4double kineticEnergy)
G4double kineticEnergy)
{
G4double ionloss = 0.0 ;
if (iMolecula < 30) {
// The data and the fit from:
// ICRU Report N49, 1993. Ziegler's model for protons.
// Proton kinetic energy for parametrisation (keV/amu)
if (iMolecula < 11) {
// The data and the fit from:
// ICRU Report N49, 1993. Ziegler's model for alpha
// He energy in internal units of parametrisation formula (MeV)
G4double T = kineticEnergy*rateMassHe2p/MeV ;
static G4double c[30][7] = {
{8.0080, 3.6287, 23.0700, 14.9900, 0.8507, 0.60, 2.0
},{ 13.3100, 3.7432, 39.4130, 12.1990, 1.0950, 0.38, 1.4
},{ 22.7240, 3.6040, 47.1810, 17.5490, 0.9040, 0.40, 1.4
},{ 24.4040, 2.4032, 48.9440, 27.9730, 1.2933, 0.40, 1.6
},{ 58.4719, 1.5115, 77.6421, 102.490, 1.5811, 0.50, 2.0
},{ 60.5408, 1.6297, 91.7601, 94.1260, 1.3662, 0.50, 2.0
},{ 48.4480, 6.4323, 59.2890, 18.3810, 0.4937, 0.48, 1.6
},{ 59.0346, 5.1305, 47.0866, 30.0857, 0.3500, 0.60, 2.0
},{ 71.8691, 2.8250, 51.1658, 57.1235, 0.4477, 0.60, 2.0
},{ 78.3520, 4.0961, 136.731, 28.4470, 1.0621, 0.52, 1.2
},{ 120.553, 1.5374, 49.8740, 82.2980, 0.8733, 0.45, 1.6
},{ 249.896, 0.6996, -37.274, 248.592, 1.1052, 0.50, 1.5
},{ 246.698, 0.6219, -58.391, 292.921, 0.8186, 0.56, 1.8
},{ 248.563, 0.6235, -36.8968, 306.960, 1.3214, 0.50, 2.0
},{ 25.5860, 1.7125, 154.723, 118.620, 2.2580, 0.50, 2.0
},{ 138.294, 25.6413, 231.873, 17.3780, 0.3218, 0.58, 1.3
},{ 83.2091, 1.1294, 135.7457, 190.865, 2.3461, 0.50, 2.0
},{ 263.542, 1.4754, 1541.446, 781.898, 1.9209, 0.40, 2.0
},{ 59.5545, 1.5354, 132.1523, 153.3537, 2.0262, 0.50, 2.0
},{ 31.7380, 19.820, 125.2100, 6.8910, 0.7242, 0.50, 1.1
},{ 31.7549, 1.5682, 97.4777, 106.0774, 2.3204, 0.50, 2.0
},{ 230.465, 4.8967, 1845.320, 358.641, 1.0774, 0.46, 1.2
},{ 423.444, 5.3761, 1189.114, 319.030, 0.7652, 0.48, 1.5
},{ 86.3410, 3.3322, 91.0433, 73.1091, 0.4650, 0.50, 2.0
},{ 146.105, 9.4344, 515.1500, 82.8860, 0.6239, 0.55, 1.5
},{ 238.050, 5.6901, 372.3575, 146.1835, 0.3992, 0.50, 2.0
},{ 124.2338, 2.6730, 133.8175, 99.4109, 0.7776, 0.50, 2.0
},{ 221.723, 1.5415, 87.7315, 192.5266, 1.0742, 0.50, 2.0
},{ 26.7537, 1.3717, 90.8007, 77.1587, 2.3264, 0.50, 2.0
},{ 37.6121, 1.8052, 73.0250, 66.2070, 1.4038, 0.50, 2.0} };
static G4double a[11][5] = {
{9.43672, 0.54398, 84.341, 1.3705, 57.422},
{67.1503, 0.41409, 404.512, 148.97, 20.99},
{5.11203, 0.453, 36.718, 50.6, 28.058},
{61.793, 0.48445, 361.537, 57.889, 50.674},
{7.83464, 0.49804, 160.452, 3.192, 0.71922},
{19.729, 0.52153, 162.341, 58.35, 25.668},
{26.4648, 0.50112, 188.913, 30.079, 16.509},
{7.8655, 0.5205, 63.96, 51.32, 67.775},
{8.8965, 0.5148, 339.36, 1.7205, 0.70423},
{2.959, 0.53255, 34.247, 60.655, 15.153},
{3.80133, 0.41590, 12.9966, 117.83, 242.28} };
G4double a1,a2 ;
// Free electron gas model
static G4double atomicWeight[11] = {
101.96128, 44.0098, 16.0426, 28.0536, 42.0804,
104.1512, 44.665, 60.0843, 18.0152, 18.0152, 12.0};
G4int i = iMolecula;
// Free electron gas model
if ( T < 0.001 ) {
G4double T0 = 0.001 ;
a1 = 1.0 - exp(-c[iMolecula][1]*pow(T0,-2.0+c[iMolecula][5])) ;
a2 = (c[iMolecula][0]*log(T0)/T0 + c[iMolecula][2]/T0) *
exp(-c[iMolecula][4]*pow(T0,-c[iMolecula][6])) +
c[iMolecula][3]/(T0*T0) ;
G4double slow = a[i][0] ;
G4double shigh = log( 1.0 + a[i][3]*1000.0 + a[i][4]*0.001 )
* a[i][2]*1000.0 ;
ionloss = slow*shigh / (slow + shigh) ;
ionloss *= sqrt(T*1000.0) ;
ionloss *= sqrt(T/T0) ;
// Main parametrisation
// Main parametrisation
} else {
a1 = 1.0 - exp(-c[iMolecula][1]*pow(T,-2.0+c[iMolecula][5])) ;
a2 = (c[iMolecula][0]*log(T)/T + c[iMolecula][2]/T) *
exp(-c[iMolecula][4]*pow(T,-c[iMolecula][6])) +
c[iMolecula][3]/(T*T) ;
G4double slow = a[i][0] * pow((T*1000.0), a[i][1]) ;
G4double shigh = log( 1.0 + a[i][3]/T + a[i][4]*T ) * a[i][2]/T ;
ionloss = slow*shigh / (slow + shigh) ;
/*
G4cout << "## " << i << ". T= " << T << " slow= " << slow
<< " a0= " << a[i][0] << " a1= " << a[i][1]
<< " shigh= " << shigh
<< " dedx= " << ionloss << " q^2= " << HeEffChargeSquare(z, T*MeV) << G4endl;
*/
}
// He effective charge
G4double z = (material->GetTotNbOfElectPerVolume()) /
(material->GetTotNbOfAtomsPerVolume()) ;
ionloss = a1*a2 / HeEffChargeSquare(z, T) ;
if ( ionloss < 0.0) ionloss = 0.0 ;
}
return ionloss ;
// He effective charge
G4double aa = atomicWeight[iMolecula];
ionloss /= (HeEffChargeSquare(0.5*aa, T)*aa);
// pure material (normally not the case for this function)
} else if(1 == (material->GetNumberOfElements())) {
G4double z = material->GetZ() ;
ionloss = ElectronicStoppingPower( z, kineticEnergy ) ;
}
return ionloss;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -513,17 +496,9 @@ G4double G4BraggIonModel::DEDX(const G4Material* material,
// compaund material with parametrisation
if( HasMaterial(material) ) {
eloss = StoppingPower(material, kineticEnergy)
* (material->GetTotNbOfAtomsPerVolume());
if(1 < numberOfElements) {
G4int nAtoms = 0;
eloss = StoppingPower(material, kineticEnergy)*
material->GetDensity()/amu;
const G4int* theAtomsVector = material->GetAtomsVector();
for (G4int iel=0; iel<numberOfElements; iel++) {
nAtoms += theAtomsVector[iel];
}
eloss /= nAtoms;
}
// pure material
} else if(1 == numberOfElements) {
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4BraggModel.cc,v 1.8 2005/05/12 11:06:43 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4BraggModel.cc,v 1.11 2005/10/18 18:46:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// -------------------------------------------------------------------
//
@@ -31,7 +31,7 @@
// File name: G4BraggModel
//
// Author: Vladimir Ivanchenko
//
//
// Creation date: 03.01.2002
//
// Modifications:
@@ -43,6 +43,7 @@
// 04-06-03 Fix compilation warnings (V.Ivanchenko)
// 12-09-04 Add lowestKinEnergy and change order of if in DEDX method (V.Ivanchenko)
// 11-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
// 16-06-05 Fix problem of chemical formula (V.Ivantchenko)
// Class Description:
//
@@ -101,9 +102,9 @@ void G4BraggModel::Initialise(const G4ParticleDefinition* p,
if(particle->GetParticleType() == "nucleus" &&
pname != "deuteron" && pname != "triton") isIon = true;
if(pParticleChange)
if(pParticleChange)
fParticleChange = reinterpret_cast<G4ParticleChangeForLoss*>(pParticleChange);
else
else
fParticleChange = new G4ParticleChangeForLoss();
}
@@ -173,12 +174,12 @@ G4double G4BraggModel::CrossSectionPerVolume(
vector<G4DynamicParticle*>* G4BraggModel::SampleSecondaries(
const G4MaterialCutsCouple*,
const G4DynamicParticle* dp,
G4double tmin,
G4double xmin,
G4double maxEnergy)
{
G4double tmax = MaxSecondaryKinEnergy(dp);
G4double xmax = min(tmax, maxEnergy);
G4double xmin = min(xmax,tmin);
if(xmin >= xmax) return 0;
G4double kineticEnergy = dp->GetKineticEnergy();
G4double energy = kineticEnergy + mass;
@@ -289,11 +290,14 @@ G4double G4BraggModel::StoppingPower(const G4Material* material,
{1.286E+1, 1.462E+1, 5.625E+3, 2.621E+3, 3.512E-2},
{3.229E+1, 3.696E+1, 8.918E+3, 3.244E+3, 1.273E-1},
{1.604E+1, 1.825E+1, 6.967E+3, 2.307E+3, 3.775E-2},
{8.049E+0, 9.099E+0, 9.257E+3, 3.846E+2, 1.007E-2},
{8.049E+0, 9.099E+0, 9.257E+3, 3.846E+2, 1.007E-2},
{4.015E+0, 4.542E+0, 3.955E+3, 4.847E+2, 7.904E-3},
{4.571E+0, 5.173E+0, 4.346E+3, 4.779E+2, 8.572E-3},
{2.631E+0, 2.601E+0, 1.701E+3, 1.279E+3, 1.638E-2} };
static G4double atomicWeight[11] = {
101.96128, 44.0098, 16.0426, 28.0536, 42.0804,
104.1512, 44.665, 60.0843, 18.0152, 18.0152, 12.0};
if ( T < 10.0 ) {
ionloss = a[iMolecula][0] * sqrt(T) ;
@@ -307,7 +311,7 @@ G4double G4BraggModel::StoppingPower(const G4Material* material,
if ( ionloss < 0.0) ionloss = 0.0 ;
if ( 10 == iMolecula ) {
if (T < 100.0) {
if (T < 100.0) {
ionloss *= (1.0+0.023+0.0066*log10(T));
}
else if (T < 700.0) {
@@ -317,6 +321,7 @@ G4double G4BraggModel::StoppingPower(const G4Material* material,
ionloss *=(1.0+0.089-0.0248*log10(700.-99.));
}
}
ionloss /= atomicWeight[iMolecula];
// pure material (normally not the case for this function)
} else if(1 == (material->GetNumberOfElements())) {
@@ -481,21 +486,13 @@ G4double G4BraggModel::DEDX(const G4Material* material,
const G4int numberOfElements = material->GetNumberOfElements();
const G4double* theAtomicNumDensityVector =
material->GetAtomicNumDensityVector();
// compaund material with parametrisation
if( HasMaterial(material) ) {
eloss = StoppingPower(material, kineticEnergy)
* (material->GetTotNbOfAtomsPerVolume());
if(1 < numberOfElements) {
G4int nAtoms = 0;
const G4int* theAtomsVector = material->GetAtomsVector();
for (G4int iel=0; iel<numberOfElements; iel++) {
nAtoms += theAtomsVector[iel];
}
eloss /= nAtoms;
}
eloss = StoppingPower(material, kineticEnergy)*
material->GetDensity()/amu;
// pure material
} else if(1 == numberOfElements) {
@@ -21,7 +21,7 @@
// ********************************************************************
//
// $Id: G4ComptonScattering.cc,v 1.24 2005/05/04 16:16:12 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//
//------------ G4ComptonScattering physics process -----------------------------
@@ -21,7 +21,7 @@
// ********************************************************************
//
// $Id: G4ComptonScattering52.cc,v 1.1 2005/05/04 16:16:12 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//
//------------ G4ComptonScattering52 physics process -----------------------------
@@ -21,7 +21,7 @@
// ********************************************************************
//
// $Id: G4GammaConversion.cc,v 1.24 2005/05/04 16:16:12 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//
//------------------ G4GammaConversion physics process -------------------------
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4GammaConversion52.cc,v 1.1 2005/05/04 16:16:12 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4GammaConversion52.cc,v 1.2 2005/11/16 15:23:02 maire Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
//------------------ G4GammaConversion52 physics process -------------------------
// by Michel Maire, 24 May 1996
@@ -57,6 +57,7 @@
// 21-03-02 DoIt: correction of the e+e- angular distribution (bug 363) mma
// 08-11-04 Remove of Store/Retrieve tables (V.Ivantchenko)
// 04-05-05 Add 52 to class name (V.Ivanchenko)
// 16-11-05 replace shootBit() by G4UniformRand() mma
// -----------------------------------------------------------------------------
#include "G4GammaConversion52.hh"
@@ -386,7 +387,7 @@ G4VParticleChange* G4GammaConversion52::PostStepDoIt(const G4Track& aTrack,
//
G4double ElectTotEnergy, PositTotEnergy;
if (RandBit::shootBit())
if (G4UniformRand() > 0.5)
{
ElectTotEnergy = (1.-epsil)*GammaEnergy;
PositTotEnergy = epsil*GammaEnergy;
@@ -22,7 +22,7 @@
//
//
// $Id: G4InitXscPAI.cc,v 1.8 2005/05/03 08:07:41 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// G4InitXscPAI.cc -- class implementation file
@@ -21,7 +21,7 @@
// ********************************************************************
//
// $Id: G4IonFluctuations.cc,v 1.2 2004/12/01 19:37:14 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
// -------------------------------------------------------------------
//
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4KleinNishinaCompton.cc,v 1.5 2005/04/18 17:31:38 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4KleinNishinaCompton.cc,v 1.6 2005/08/11 10:03:33 maire Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// -------------------------------------------------------------------
//
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4MollerBhabhaModel.cc,v 1.20 2005/04/12 18:12:41 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4MollerBhabhaModel.cc,v 1.22 2005/08/18 15:05:13 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// -------------------------------------------------------------------
//
@@ -42,6 +42,8 @@
// 27-01-03 Make models region aware (V.Ivanchenko)
// 13-02-03 Add name (V.Ivanchenko)
// 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
// 25-07-05 Add protection in calculation of recoil direction for the case
// of complete energy transfer from e+ to e- (V.Ivanchenko)
//
//
// Class Description:
@@ -250,9 +252,8 @@ std::vector<G4DynamicParticle*>* G4MollerBhabhaModel::SampleSecondaries(
G4double tmin,
G4double maxEnergy)
{
std::vector<G4DynamicParticle*>* vdp = new std::vector<G4DynamicParticle*>;
G4double tmax = std::min(maxEnergy, MaxSecondaryKinEnergy(dp));
if(tmin > tmax) tmin = tmax;
if(tmin >= tmax) return 0;
G4double kineticEnergy = dp->GetKineticEnergy();
G4double energy = kineticEnergy + electron_mass_c2;
@@ -338,7 +339,8 @@ std::vector<G4DynamicParticle*>* G4MollerBhabhaModel::SampleSecondaries(
sqrt(deltaKinEnergy * (deltaKinEnergy + 2.0*electron_mass_c2));
G4double cost = deltaKinEnergy * (energy + electron_mass_c2) /
(deltaMomentum * totalMomentum);
G4double sint = sqrt(1.0 - cost*cost);
G4double sint = 1.0 - cost*cost;
if(sint > 0.0) sint = sqrt(sint);
G4double phi = twopi * G4UniformRand() ;
@@ -347,12 +349,16 @@ std::vector<G4DynamicParticle*>* G4MollerBhabhaModel::SampleSecondaries(
// primary change
kineticEnergy -= deltaKinEnergy;
G4ThreeVector dir = totalMomentum*direction - deltaMomentum*deltaDirection;
direction = dir.unit();
fParticleChange->SetProposedKineticEnergy(kineticEnergy);
fParticleChange->SetProposedMomentumDirection(direction);
if(kineticEnergy > DBL_MIN) {
G4ThreeVector dir = totalMomentum*direction - deltaMomentum*deltaDirection;
direction = dir.unit();
fParticleChange->SetProposedMomentumDirection(direction);
}
// create G4DynamicParticle object for delta ray
std::vector<G4DynamicParticle*>* vdp = new std::vector<G4DynamicParticle*>;
G4DynamicParticle* delta = new G4DynamicParticle(theElectron,
deltaDirection,deltaKinEnergy);
vdp->push_back(delta);
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4MscModel.cc,v 1.8 2005/05/12 11:06:43 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4MscModel.cc,v 1.9 2005/10/04 08:42:51 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// -------------------------------------------------------------------
//
@@ -36,7 +36,7 @@
//
// Modifications:
//
// 27-03-03 Move model part from G4MultipleScattering (V.Ivanchenko)
// 27-03-03 Move model part from G4MultipleScattering80 (V.Ivanchenko)
// 23-05-03 important change in angle distribution for muons/hadrons
// the central part now is similar to the Highland parametrization +
// minor correction in angle sampling algorithm (for all particles)
@@ -68,7 +68,11 @@
//
// 03-11-04 precision problem for very high energy ions and small stepsize
// solved in SampleCosineTheta (L.Urban).
// 15-04-05 optimize internal interface - add SampleSecondaries method (V.Ivanchenko)
// 15-04-05 optimize internal interface
// add SampleSecondaries method (V.Ivanchenko)
// 11-08-05 computation of lateral correlation added (L.Urban)
// 02-10-05 nuclear size correction computation removed, the correction
// included in the (theoretical) tabulated values (L.Urban)
//
// Class Description:
@@ -80,8 +84,8 @@
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4MscModel.hh"
#include "Randomize.hh"
@@ -92,20 +96,17 @@
#include "G4TransportationManager.hh"
#include "G4Navigator.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
using namespace std;
G4MscModel::G4MscModel(G4double& m_dtrl, G4double& m_NuclCorrPar,
G4double& m_FactPar, G4double& m_factail,
G4bool& m_samplez, const G4String& nam)
G4MscModel::G4MscModel(G4double m_dtrl,G4double m_factail,
G4bool m_samplez, const G4String& nam)
: G4VEmModel(nam),
taubig(8.0),
tausmall(1.e-20),
taulim(1.e-6),
dtrl(m_dtrl),
NuclCorrPar (m_NuclCorrPar),
FactPar(m_FactPar),
factail(m_factail),
samplez(m_samplez),
isInitialized(false)
@@ -114,35 +115,34 @@ G4MscModel::G4MscModel(G4double& m_dtrl, G4double& m_NuclCorrPar,
currentRange = 0. ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4MscModel::~G4MscModel()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MscModel::Initialise(const G4ParticleDefinition* p,
const G4DataVector&)
{
if(isInitialized) return;
// set values of some data members
sigmafactor = twopi*classic_electr_radius*classic_electr_radius;
particle = p;
mass = particle->GetPDGMass();
charge = particle->GetPDGCharge()/eplus;
b = 1. ;
xsi = 3.00 ;
if(pParticleChange)
fParticleChange = reinterpret_cast<G4ParticleChangeForMSC*>(pParticleChange);
if (pParticleChange)
fParticleChange = reinterpret_cast<G4ParticleChangeForMSC*>(pParticleChange);
else
fParticleChange = new G4ParticleChangeForMSC();
fParticleChange = new G4ParticleChangeForMSC();
navigator = G4TransportationManager::GetTransportationManager()
->GetNavigatorForTracking();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MscModel::CrossSectionPerVolume(const G4Material* material,
const G4ParticleDefinition* p,
@@ -161,10 +161,9 @@ G4double G4MscModel::CrossSectionPerVolume(const G4Material* material,
{
G4double atomicNumber = (*theElementVector)[iel]->GetZ();
G4double atomicWeight = (*theElementVector)[iel]->GetA();
sigma += NbOfAtomsPerVolume[iel]*ComputeTransportCrossSection(p,
sigma += NbOfAtomsPerVolume[iel]*ComputeCrossSectionPerAtom(p,
kineticEnergy,atomicNumber,atomicWeight);
}
sigma *= sigmafactor;
// Calculate lambda
if ( sigma > 0.0) sigma = 1.0/sigma;
else sigma = DBL_MAX;
@@ -172,121 +171,139 @@ G4double G4MscModel::CrossSectionPerVolume(const G4Material* material,
return sigma;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MscModel::ComputeTransportCrossSection(
G4double G4MscModel::ComputeCrossSectionPerAtom(
const G4ParticleDefinition* part,
G4double KineticEnergy,
G4double AtomicNumber,
G4double AtomicWeight)
G4double AtomicNumber,G4double,
G4double, G4double)
{
const G4double epsfactor = 2.*electron_mass_c2*electron_mass_c2*
Bohr_radius*Bohr_radius/(hbarc*hbarc);
const G4double epsmin = 1.e-4 , epsmax = 1.e10;
const G4double sigmafactor = twopi*classic_electr_radius*classic_electr_radius;
const G4double epsfactor = 2.*electron_mass_c2*electron_mass_c2*
Bohr_radius*Bohr_radius/(hbarc*hbarc);
const G4double epsmin = 1.e-4 , epsmax = 1.e10;
const G4double Zdat[15] = { 4., 6.,13.,20.,26.,29.,32.,38.,47.,
50.,56.,64.,74.,79.,82. };
const G4double Zdat[15] = { 4., 6., 13., 20., 26., 29., 32., 38., 47.,
50., 56., 64., 74., 79., 82. };
const G4double Tdat[23] = {0.0001*MeV,0.0002*MeV,0.0004*MeV,0.0007*MeV,
0.001*MeV,0.002*MeV,0.004*MeV,0.007*MeV,
0.01*MeV,0.02*MeV,0.04*MeV,0.07*MeV,
0.1*MeV,0.2*MeV,0.4*MeV,0.7*MeV,
1.*MeV,2.*MeV,4.*MeV,7.*MeV,10.*MeV,20.*MeV,
10000.0*MeV};
const G4double Tdat[22] = { 100*eV, 200*eV, 400*eV, 700*eV,
1*keV, 2*keV, 4*keV, 7*keV,
10*keV, 20*keV, 40*keV, 70*keV,
100*keV, 200*keV, 400*keV, 700*keV,
1*MeV, 2*MeV, 4*MeV, 7*MeV,
10*MeV, 20*MeV};
// corr. factors for e-/e+ lambda
G4double celectron[15][23] =
// corr. factors for e-/e+ lambda for T <= Tlim
G4double celectron[15][22] =
{{1.125,1.072,1.051,1.047,1.047,1.050,1.052,1.054,
1.054,1.057,1.062,1.069,1.075,1.090,1.105,1.111,
1.112,1.108,1.100,1.093,1.089,1.087,0.7235 },
1.112,1.108,1.100,1.093,1.089,1.087 },
{1.408,1.246,1.143,1.096,1.077,1.059,1.053,1.051,
1.052,1.053,1.058,1.065,1.072,1.087,1.101,1.108,
1.109,1.105,1.097,1.090,1.086,1.082,0.7925 },
1.109,1.105,1.097,1.090,1.086,1.082 },
{2.833,2.268,1.861,1.612,1.486,1.309,1.204,1.156,
1.136,1.114,1.106,1.106,1.109,1.119,1.129,1.132,
1.131,1.124,1.113,1.104,1.099,1.098,0.9147 },
1.131,1.124,1.113,1.104,1.099,1.098 },
{3.879,3.016,2.380,2.007,1.818,1.535,1.340,1.236,
1.190,1.133,1.107,1.099,1.098,1.103,1.110,1.113,
1.112,1.105,1.096,1.089,1.085,1.098,0.9700 },
1.112,1.105,1.096,1.089,1.085,1.098 },
{6.937,4.330,2.886,2.256,1.987,1.628,1.395,1.265,
1.203,1.122,1.080,1.065,1.061,1.063,1.070,1.073,
1.073,1.070,1.064,1.059,1.056,1.056,1.0022 },
1.073,1.070,1.064,1.059,1.056,1.056 },
{9.616,5.708,3.424,2.551,2.204,1.762,1.485,1.330,
1.256,1.155,1.099,1.077,1.070,1.068,1.072,1.074,
1.074,1.070,1.063,1.059,1.056,1.052,1.0158 },
1.074,1.070,1.063,1.059,1.056,1.052 },
{11.72,6.364,3.811,2.806,2.401,1.884,1.564,1.386,
1.300,1.180,1.112,1.082,1.073,1.066,1.068,1.069,
1.068,1.064,1.059,1.054,1.051,1.050,1.0284 },
1.068,1.064,1.059,1.054,1.051,1.050 },
{18.08,8.601,4.569,3.183,2.662,2.025,1.646,1.439,
1.339,1.195,1.108,1.068,1.053,1.040,1.039,1.039,
1.039,1.037,1.034,1.031,1.030,1.036,1.0515 },
1.039,1.037,1.034,1.031,1.030,1.036 },
{18.22,10.48,5.333,3.713,3.115,2.367,1.898,1.631,
1.498,1.301,1.171,1.105,1.077,1.048,1.036,1.033,
1.031,1.028,1.024,1.022,1.021,1.024,1.0834 },
1.031,1.028,1.024,1.022,1.021,1.024 },
{14.14,10.65,5.710,3.929,3.266,2.453,1.951,1.669,
1.528,1.319,1.178,1.106,1.075,1.040,1.027,1.022,
1.020,1.017,1.015,1.013,1.013,1.020,1.0937 },
1.020,1.017,1.015,1.013,1.013,1.020 },
{14.11,11.73,6.312,4.240,3.478,2.566,2.022,1.720,
1.569,1.342,1.186,1.102,1.065,1.022,1.003,0.997,
0.995,0.993,0.993,0.993,0.993,1.011,1.1140 },
0.995,0.993,0.993,0.993,0.993,1.011 },
{22.76,20.01,8.835,5.287,4.144,2.901,2.219,1.855,
1.677,1.410,1.224,1.121,1.073,1.014,0.986,0.976,
0.974,0.972,0.973,0.974,0.975,0.987,1.1410 },
0.974,0.972,0.973,0.974,0.975,0.987 },
{50.77,40.85,14.13,7.184,5.284,3.435,2.520,2.059,
1.837,1.512,1.283,1.153,1.091,1.010,0.969,0.954,
0.950,0.947,0.949,0.952,0.954,0.963,1.1750 },
0.950,0.947,0.949,0.952,0.954,0.963 },
{65.87,59.06,15.87,7.570,5.567,3.650,2.682,2.182,
1.939,1.579,1.325,1.178,1.108,1.014,0.965,0.947,
0.941,0.938,0.940,0.944,0.946,0.954,1.1922 },
0.941,0.938,0.940,0.944,0.946,0.954 },
{55.60,47.34,15.92,7.810,5.755,3.767,2.760,2.239,
1.985,1.609,1.343,1.188,1.113,1.013,0.960,0.939,
0.933,0.930,0.933,0.936,0.939,0.949,1.2026 }};
G4double cpositron[15][23] = {
0.933,0.930,0.933,0.936,0.939,0.949 }};
G4double cpositron[15][22] = {
{2.589,2.044,1.658,1.446,1.347,1.217,1.144,1.110,
1.097,1.083,1.080,1.086,1.092,1.108,1.123,1.131,
1.131,1.126,1.117,1.108,1.103,1.100,0.7235 },
1.131,1.126,1.117,1.108,1.103,1.100 },
{3.904,2.794,2.079,1.710,1.543,1.325,1.202,1.145,
1.122,1.096,1.089,1.092,1.098,1.114,1.130,1.137,
1.138,1.132,1.122,1.113,1.108,1.102,0.7925 },
1.138,1.132,1.122,1.113,1.108,1.102 },
{7.970,6.080,4.442,3.398,2.872,2.127,1.672,1.451,
1.357,1.246,1.194,1.179,1.178,1.188,1.201,1.205,
1.203,1.190,1.173,1.159,1.151,1.145,0.9147 },
1.203,1.190,1.173,1.159,1.151,1.145 },
{9.714,7.607,5.747,4.493,3.815,2.777,2.079,1.715,
1.553,1.353,1.253,1.219,1.211,1.214,1.225,1.228,
1.225,1.210,1.191,1.175,1.166,1.174,0.9700 },
1.225,1.210,1.191,1.175,1.166,1.174 },
{17.97,12.95,8.628,6.065,4.849,3.222,2.275,1.820,
1.624,1.382,1.259,1.214,1.202,1.202,1.214,1.219,
1.217,1.203,1.184,1.169,1.160,1.151,1.0022 },
1.217,1.203,1.184,1.169,1.160,1.151 },
{24.83,17.06,10.84,7.355,5.767,3.707,2.546,1.996,
1.759,1.465,1.311,1.252,1.234,1.228,1.238,1.241,
1.237,1.222,1.201,1.184,1.174,1.159,1.0158 },
1.237,1.222,1.201,1.184,1.174,1.159 },
{23.26,17.15,11.52,8.049,6.375,4.114,2.792,2.155,
1.880,1.535,1.353,1.281,1.258,1.247,1.254,1.256,
1.252,1.234,1.212,1.194,1.183,1.170,1.0284 },
1.252,1.234,1.212,1.194,1.183,1.170 },
{22.33,18.01,12.86,9.212,7.336,4.702,3.117,2.348,
2.015,1.602,1.385,1.297,1.268,1.251,1.256,1.258,
1.254,1.237,1.214,1.195,1.185,1.179,1.0515 },
1.254,1.237,1.214,1.195,1.185,1.179 },
{33.91,24.13,15.71,10.80,8.507,5.467,3.692,2.808,
2.407,1.873,1.564,1.425,1.374,1.330,1.324,1.320,
1.312,1.288,1.258,1.235,1.221,1.205,1.0834 },
1.312,1.288,1.258,1.235,1.221,1.205 },
{32.14,24.11,16.30,11.40,9.015,5.782,3.868,2.917,
2.490,1.925,1.596,1.447,1.391,1.342,1.332,1.327,
1.320,1.294,1.264,1.240,1.226,1.214,1.0937 },
1.320,1.294,1.264,1.240,1.226,1.214 },
{29.51,24.07,17.19,12.28,9.766,6.238,4.112,3.066,
2.602,1.995,1.641,1.477,1.414,1.356,1.342,1.336,
1.328,1.302,1.270,1.245,1.231,1.233,1.1140 },
1.328,1.302,1.270,1.245,1.231,1.233 },
{38.19,30.85,21.76,15.35,12.07,7.521,4.812,3.498,
2.926,2.188,1.763,1.563,1.484,1.405,1.382,1.371,
1.361,1.330,1.294,1.267,1.251,1.239,1.1410 },
1.361,1.330,1.294,1.267,1.251,1.239 },
{49.71,39.80,27.96,19.63,15.36,9.407,5.863,4.155,
3.417,2.478,1.944,1.692,1.589,1.480,1.441,1.423,
1.409,1.372,1.330,1.298,1.280,1.258,1.1750 },
1.409,1.372,1.330,1.298,1.280,1.258 },
{59.25,45.08,30.36,20.83,16.15,9.834,6.166,4.407,
3.641,2.648,2.064,1.779,1.661,1.531,1.482,1.459,
1.442,1.400,1.354,1.319,1.299,1.272,1.1922 },
1.442,1.400,1.354,1.319,1.299,1.272 },
{56.38,44.29,30.50,21.18,16.51,10.11,6.354,4.542,
3.752,2.724,2.116,1.817,1.692,1.554,1.499,1.474,
1.456,1.412,1.364,1.328,1.307,1.282,1.2026 }};
1.456,1.412,1.364,1.328,1.307,1.282 }};
//data/corrections for T > Tlim
G4double Tlim = 10.*MeV;
G4double beta2lim = Tlim*(Tlim+2.*electron_mass_c2)/
((Tlim+electron_mass_c2)*(Tlim+electron_mass_c2));
G4double bg2lim = Tlim*(Tlim+2.*electron_mass_c2)/
(electron_mass_c2*electron_mass_c2);
G4double sig0[15] = {0.2672*barn, 0.5922*barn, 2.653*barn, 6.235*barn,
11.69*barn , 13.24*barn , 16.12*barn, 23.00*barn ,
35.13*barn , 39.95*barn , 50.85*barn, 67.19*barn ,
91.15*barn , 104.4*barn , 113.1*barn};
G4double hecorr[15] = {120.70, 117.50, 105.00, 92.92, 79.23, 74.510, 68.29,
57.39, 41.97, 36.14, 24.53, 10.21, -7.855, -16.84,
-22.30};
G4double sigma;
if (part != particle ) {
@@ -329,31 +346,9 @@ G4double G4MscModel::ComputeTransportCrossSection(
sigma *= ChargeSquare*AtomicNumber*AtomicNumber/(beta2*bg2);
// nuclear size effect correction for high energy
// ( a simple approximation at present)
G4double corrnuclsize,a,w1,w2,w;
// interpolate in AtomicNumber and beta2
G4double c1,c2,cc1,cc2,corr;
G4double x0 = 1. - NuclCorrPar*mass/(KineticEnergy*
exp(log(AtomicWeight/(g/mole))/3.));
if ( x0 < -1. || eKineticEnergy <= 10.*MeV)
{
x0 = -1.;
corrnuclsize = 1.;
}
else
{
a = 1.+1./eps;
if (eps > epsmax) w1=log(2.*eps)+1./eps-3./(8.*eps*eps);
else w1=log((a+1.)/(a-1.))-2./(a+1.);
w = 1./((1.-x0)*eps);
if (w < epsmin) w2=-log(w)-1.+2.*w-1.5*w*w;
else w2 = log((a-x0)/(a-1.))-(1.-x0)/(a-x0);
corrnuclsize = w1/w2;
corrnuclsize = exp(-FactPar*mass/KineticEnergy)*
(corrnuclsize-1.)+1.;
}
// interpolate in AtomicNumber and beta2
// get bin number in Z
G4int iZ = 14;
while ((iZ>=0)&&(Zdat[iZ]>=AtomicNumber)) iZ -= 1;
@@ -362,22 +357,26 @@ G4double G4MscModel::ComputeTransportCrossSection(
G4double Z1 = Zdat[iZ];
G4double Z2 = Zdat[iZ+1];
G4double ratZ = (AtomicNumber-Z1)/(Z2-Z1);
G4double ratZ = (AtomicNumber-Z1)*(AtomicNumber+Z1)/
((Z2-Z1)*(Z2+Z1));
// get bin number in T (beta2)
G4int iT = 22;
while ((iT>=0)&&(Tdat[iT]>=eKineticEnergy)) iT -= 1;
if(iT==22) iT = 21;
if(iT==-1) iT = 0 ;
if(eKineticEnergy <= Tlim)
{
// get bin number in T (beta2)
G4int iT = 21;
while ((iT>=0)&&(Tdat[iT]>=eKineticEnergy)) iT -= 1;
if(iT==21) iT = 20;
if(iT==-1) iT = 0 ;
// calculate betasquare values
G4double T = Tdat[iT], E = T + electron_mass_c2;
G4double b2small = T*(E+electron_mass_c2)/(E*E);
T = Tdat[iT+1]; E = T + electron_mass_c2;
G4double b2big = T*(E+electron_mass_c2)/(E*E);
G4double ratb2 = (beta2-b2small)/(b2big-b2small);
G4double c1,c2,cc1,cc2,corr;
if (charge < 0.)
// calculate betasquare values
G4double T = Tdat[iT], E = T + electron_mass_c2;
G4double b2small = T*(E+electron_mass_c2)/(E*E);
T = Tdat[iT+1]; E = T + electron_mass_c2;
G4double b2big = T*(E+electron_mass_c2)/(E*E);
G4double ratb2 = (beta2-b2small)/(b2big-b2small);
if (charge < 0.)
{
c1 = celectron[iZ][iT];
c2 = celectron[iZ+1][iT];
@@ -388,10 +387,10 @@ G4double G4MscModel::ComputeTransportCrossSection(
cc2 = c1+ratZ*(c2-c1);
corr = cc1+ratb2*(cc2-cc1);
sigma /= corr;
}
if (charge > 0.)
sigma *= sigmafactor/corr;
}
else
{
c1 = cpositron[iZ][iT];
c2 = cpositron[iZ+1][iT];
@@ -402,19 +401,27 @@ G4double G4MscModel::ComputeTransportCrossSection(
cc2 = c1+ratZ*(c2-c1);
corr = cc1+ratb2*(cc2-cc1);
sigma /= corr;
}
// nucl. size correction for particles other than e+/e- only at present !!!!
if((particle->GetParticleName() != "e-") &&
(particle->GetParticleName() != "e+") )
sigma /= corrnuclsize;
sigma *= sigmafactor/corr;
}
}
else
{
c1 = bg2lim*sig0[iZ]*(1.+hecorr[iZ]*(beta2-beta2lim))/bg2;
c2 = bg2lim*sig0[iZ+1]*(1.+hecorr[iZ+1]*(beta2-beta2lim))/bg2;
if((AtomicNumber >= Z1) && (AtomicNumber <= Z2))
sigma = c1+ratZ*(c2-c1) ;
else if(AtomicNumber < Z1)
sigma = AtomicNumber*AtomicNumber*c1/(Z1*Z1);
else if(AtomicNumber > Z2)
sigma = AtomicNumber*AtomicNumber*c2/(Z2*Z2);
}
return sigma;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MscModel::GeomPathLength(
G4PhysicsTable* theLambdaTable,
@@ -437,9 +444,11 @@ G4double G4MscModel::GeomPathLength(
currentRadLength = couple->GetMaterial()->GetRadlen();
lambda0 = lambda;
lambdaeff = lambda0;
par1 = -1. ;
par2 = par3 = 0. ;
tPathLength = truePathLength;
zPathLength = tPathLength;
// this correction needed to run MSC with eIoni and eBrem inactivated
// and makes no harm for a normal run
@@ -448,7 +457,7 @@ G4double G4MscModel::GeomPathLength(
G4double tau = tPathLength/lambda0 ;
if (tau <= tausmall) return tPathLength;
if ((tau <= tausmall) || (tPathLength < stepmin)) return tPathLength;
G4double zmean = tPathLength;
if (tPathLength < range*dtrl) {
@@ -476,7 +485,7 @@ G4double G4MscModel::GeomPathLength(
}
// sample z
G4double zPathLength = zmean ;
zPathLength = zmean ;
G4double zt = zmean/tPathLength ;
if (tPathLength >= stepmin && samplez && zt > 0.5 && zt < ztmax)
{
@@ -494,13 +503,13 @@ G4double G4MscModel::GeomPathLength(
return zPathLength ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MscModel::TrueStepLength(G4double geomStepLength)
{
G4double trueLength = geomStepLength;
trueLength = geomStepLength;
if(geomStepLength > lambda0*tausmall)
zPathLength = geomStepLength;
if((geomStepLength > lambda0*tausmall) && (geomStepLength >= stepmin))
{
if(par1 < 0.)
trueLength = -lambda0*log(1.-geomStepLength/lambda0) ;
@@ -517,10 +526,12 @@ G4double G4MscModel::TrueStepLength(G4double geomStepLength)
if(trueLength > currentRange) trueLength = currentRange ;
if(trueLength < geomStepLength) trueLength = geomStepLength;
tPathLength = trueLength;
return trueLength;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
std::vector<G4DynamicParticle*>* G4MscModel::SampleSecondaries(
const G4MaterialCutsCouple*,
@@ -550,33 +561,69 @@ std::vector<G4DynamicParticle*>* G4MscModel::SampleSecondaries(
<< G4endl;
*/
if (latDisplasment && safety > 0.0) {
if (latDisplasment) {
G4double r = SampleDisplacement();
if (r > safety) r = safety;
if(r > 0.)
{
G4double latcorr = LatCorrelation();
if(latcorr > r) latcorr = r;
// sample direction of lateral displacement
G4double phi = twopi*G4UniformRand();
G4double dirx = std::cos(phi);
G4double diry = std::sin(phi);
// sample direction of lateral displacement
// compute it from the lateral correlation
G4double Phi = 0.;
if(std::abs(r*sth) < latcorr)
Phi = twopi*G4UniformRand();
else
Phi = phi-std::acos(latcorr/(r*sth));
if(Phi < 0.) Phi += twopi;
G4ThreeVector newPosition(dirx,diry,0.0);
newPosition.rotateUz(oldDirection);
dirx = std::cos(Phi);
diry = std::sin(Phi);
// compute new endpoint of the Step
newPosition *= r;
newPosition += *(fParticleChange->GetProposedPosition());
G4ThreeVector latDirection(dirx,diry,0.0);
latDirection.rotateUz(oldDirection);
navigator->LocateGlobalPointWithinVolume(newPosition);
G4ThreeVector Position = *(fParticleChange->GetProposedPosition());
G4double fac = 0.;
if(r < safety)
{
//normal case, no need to check safety
fac = 1.;
}
else
{
// ******* we do not have track info at this level ***********
// ******* so navigator is called at boundary too ************
navigator->LocateGlobalPointWithinVolume(Position);
const G4double cstep = safety ;
G4double newsafety = safety;
phi = navigator->ComputeStep(Position,latDirection,
cstep,newsafety);
if(r < newsafety)
fac = 1.;
else
fac = newsafety/r ;
}
if(fac > 0.)
{
// compute new endpoint of the Step
G4ThreeVector newPosition = Position+fac*r*latDirection;
fParticleChange->ProposePosition(newPosition);
navigator->LocateGlobalPointWithinVolume(newPosition);
fParticleChange->ProposePosition(newPosition);
}
}
}
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MscModel::SampleCosineTheta(G4double trueStepLength, G4double KineticEnergy)
G4double G4MscModel::SampleCosineTheta(G4double trueStepLength,
G4double KineticEnergy)
{
G4double cth = 1. ;
G4double tau = trueStepLength/lambda0 ;
@@ -588,9 +635,10 @@ G4double G4MscModel::SampleCosineTheta(G4double trueStepLength, G4double Kinetic
tau = taubig ;
currentTau = tau ;
lambdaeff = trueStepLength/currentTau;
if(trueStepLength < stepmin)
cth = exp(-tau) ;
cth = exp(-currentTau) ;
else
{
if (tau >= taubig) cth = -1.+2.*G4UniformRand();
@@ -607,7 +655,7 @@ G4double G4MscModel::SampleCosineTheta(G4double trueStepLength, G4double Kinetic
G4double xx0 = trueStepLength/currentRadLength;
G4double betacp = sqrt(currentKinEnergy*(currentKinEnergy+2.*mass)*
KineticEnergy*(KineticEnergy+2.*mass)/
((currentKinEnergy+mass)*(KineticEnergy+mass))) ;
((currentKinEnergy+mass)*(KineticEnergy+mass)));
G4double theta0 = c_highland*Q*exp(corr_highland*log(xx0))/betacp ;
if(theta0 > taulim) a = 0.5/(1.-cos(theta0)) ;
@@ -715,7 +763,7 @@ G4double G4MscModel::SampleCosineTheta(G4double trueStepLength, G4double Kinetic
return cth ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MscModel::SampleDisplacement()
{
@@ -723,9 +771,10 @@ G4double G4MscModel::SampleDisplacement()
const G4double kappapl1 = kappa+1.;
const G4double kappami1 = kappa-1.;
G4double rmean = 0.0;
if (currentTau >= tausmall) {
if ((currentTau >= tausmall) && (tPathLength > stepmin)) {
if (currentTau < taulim) {
rmean = kappa*currentTau*currentTau*currentTau*(1.-kappapl1*currentTau*0.25)/6. ;
rmean = kappa*currentTau*currentTau*currentTau*
(1.-kappapl1*currentTau*0.25)/6. ;
} else {
G4double etau = 0.0;
@@ -734,13 +783,45 @@ G4double G4MscModel::SampleDisplacement()
rmean = -exp(rmean)/(kappa*kappami1);
rmean += currentTau-kappapl1/kappa+kappa*etau/kappami1;
}
if (rmean>0.) rmean = 2.*lambda0*sqrt(rmean/3.0);
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));
}
return rmean;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MscModel::LatCorrelation()
{
const G4double kappa = 2.5;
const G4double kappami1 = kappa-1.;
G4double latcorr = 0.;
if((currentTau >= tausmall) && (tPathLength > stepmin))
{
if(currentTau < taulim)
latcorr = lambdaeff*kappa*currentTau*currentTau*
(1.-(kappa+1.)*currentTau/3.)/3.;
else
{
G4double etau = 0.;
if(currentTau < taubig) etau = exp(-currentTau);
latcorr = -kappa*currentTau;
latcorr = exp(latcorr)/kappami1;
latcorr += 1.-kappa*etau/kappami1 ;
latcorr *= 2.*lambdaeff/3. ;
}
}
return latcorr;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,748 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4MscModel71.cc,v 1.1 2005/10/03 01:09:57 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
//
// File name: G4MscModel71
//
// Author: Laszlo Urban
//
// Creation date: 03.03.2001
//
// Modifications:
//
// 27-03-03 Move model part from G4MultipleScattering (V.Ivanchenko)
// 23-05-03 important change in angle distribution for muons/hadrons
// the central part now is similar to the Highland parametrization +
// minor correction in angle sampling algorithm (for all particles)
// (L.Urban)
// 30-05-03 misprint in SampleCosineTheta corrected(L.Urban)
// 27-03-03 Rename (V.Ivanchenko)
// 05-08-03 angle distribution has been modified (L.Urban)
// 06-11-03 precision problems solved for high energy (PeV) particles
// change in the tail of the angular distribution
// highKinEnergy is set to 100 PeV (L.Urban)
//
// 10-11-03 highKinEnergy is set back to 100 TeV, some tail tuning +
// cleaning (L.Urban)
// 26-11-03 correction in TrueStepLength :
// trueLength <= currentRange (L.Urban)
// 01-03-04 signature changed in SampleCosineTheta,
// energy dependence calculations has been simplified,
// 11-03-04 corrections in GeomPathLength,TrueStepLength,
// SampleCosineTheta
// 23-04-04 true -> geom and geom -> true transformation has been
// rewritten, changes in the angular distribution (L.Urban)
// 19-07-04 correction in SampleCosineTheta in order to avoid
// num. precision problems at high energy/small step(L.Urban)
// 17-08-04 changes in the angle distribution (slightly modified
// Highland formula for the width of the central part,
// changes in the numerical values of some other parameters)
// ---> approximately step independent distribution (L.Urban)
// 21-09-04 change in the tail of the angular distribution (L.Urban)
//
// 03-11-04 precision problem for very high energy ions and small stepsize
// solved in SampleCosineTheta (L.Urban).
// 15-04-05 optimize internal interface - add SampleSecondaries method (V.Ivanchenko)
// 03-10-05 Model is freezed with the name McsModel71 (V.Ivanchenko)
//
// Class Description:
//
// Implementation of the model of multiple scattering based on
// H.W.Lewis Phys Rev 78 (1950) 526 and others
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4MscModel71.hh"
#include "Randomize.hh"
#include "G4Electron.hh"
#include "G4LossTableManager.hh"
#include "G4PhysicsTable.hh"
#include "G4ParticleChangeForMSC.hh"
#include "G4TransportationManager.hh"
#include "G4Navigator.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
using namespace std;
G4MscModel71::G4MscModel71(G4double& m_dtrl, G4double& m_NuclCorrPar,
G4double& m_FactPar, G4double& m_factail,
G4bool& m_samplez, const G4String& nam)
: G4VEmModel(nam),
taubig(8.0),
tausmall(1.e-20),
taulim(1.e-6),
dtrl(m_dtrl),
NuclCorrPar (m_NuclCorrPar),
FactPar(m_FactPar),
factail(m_factail),
samplez(m_samplez),
isInitialized(false)
{
stepmin = 1.e-6*mm;
currentRange = 0. ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4MscModel71::~G4MscModel71()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4MscModel71::Initialise(const G4ParticleDefinition* p,
const G4DataVector&)
{
if(isInitialized) return;
// set values of some data members
sigmafactor = twopi*classic_electr_radius*classic_electr_radius;
particle = p;
mass = particle->GetPDGMass();
charge = particle->GetPDGCharge()/eplus;
b = 1. ;
xsi = 3.00 ;
if(pParticleChange)
fParticleChange = reinterpret_cast<G4ParticleChangeForMSC*>(pParticleChange);
else
fParticleChange = new G4ParticleChangeForMSC();
navigator = G4TransportationManager::GetTransportationManager()
->GetNavigatorForTracking();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4MscModel71::CrossSectionPerVolume(const G4Material* material,
const G4ParticleDefinition* p,
G4double kineticEnergy,
G4double,
G4double)
{
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* NbOfAtomsPerVolume = material->GetVecNbOfAtomsPerVolume();
G4int NumberOfElements = material->GetNumberOfElements();
// loop for element in the material
G4double sigma = 0.0;
for (G4int iel=0; iel<NumberOfElements; iel++)
{
G4double atomicNumber = (*theElementVector)[iel]->GetZ();
G4double atomicWeight = (*theElementVector)[iel]->GetA();
sigma += NbOfAtomsPerVolume[iel]*ComputeTransportCrossSection(p,
kineticEnergy,atomicNumber,atomicWeight);
}
sigma *= sigmafactor;
// Calculate lambda
if ( sigma > 0.0) sigma = 1.0/sigma;
else sigma = DBL_MAX;
return sigma;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4MscModel71::ComputeTransportCrossSection(
const G4ParticleDefinition* part,
G4double KineticEnergy,
G4double AtomicNumber,
G4double AtomicWeight)
{
const G4double epsfactor = 2.*electron_mass_c2*electron_mass_c2*
Bohr_radius*Bohr_radius/(hbarc*hbarc);
const G4double epsmin = 1.e-4 , epsmax = 1.e10;
const G4double Zdat[15] = { 4., 6.,13.,20.,26.,29.,32.,38.,47.,
50.,56.,64.,74.,79.,82. };
const G4double Tdat[23] = {0.0001*MeV,0.0002*MeV,0.0004*MeV,0.0007*MeV,
0.001*MeV,0.002*MeV,0.004*MeV,0.007*MeV,
0.01*MeV,0.02*MeV,0.04*MeV,0.07*MeV,
0.1*MeV,0.2*MeV,0.4*MeV,0.7*MeV,
1.*MeV,2.*MeV,4.*MeV,7.*MeV,10.*MeV,20.*MeV,
10000.0*MeV};
// corr. factors for e-/e+ lambda
G4double celectron[15][23] =
{{1.125,1.072,1.051,1.047,1.047,1.050,1.052,1.054,
1.054,1.057,1.062,1.069,1.075,1.090,1.105,1.111,
1.112,1.108,1.100,1.093,1.089,1.087,0.7235 },
{1.408,1.246,1.143,1.096,1.077,1.059,1.053,1.051,
1.052,1.053,1.058,1.065,1.072,1.087,1.101,1.108,
1.109,1.105,1.097,1.090,1.086,1.082,0.7925 },
{2.833,2.268,1.861,1.612,1.486,1.309,1.204,1.156,
1.136,1.114,1.106,1.106,1.109,1.119,1.129,1.132,
1.131,1.124,1.113,1.104,1.099,1.098,0.9147 },
{3.879,3.016,2.380,2.007,1.818,1.535,1.340,1.236,
1.190,1.133,1.107,1.099,1.098,1.103,1.110,1.113,
1.112,1.105,1.096,1.089,1.085,1.098,0.9700 },
{6.937,4.330,2.886,2.256,1.987,1.628,1.395,1.265,
1.203,1.122,1.080,1.065,1.061,1.063,1.070,1.073,
1.073,1.070,1.064,1.059,1.056,1.056,1.0022 },
{9.616,5.708,3.424,2.551,2.204,1.762,1.485,1.330,
1.256,1.155,1.099,1.077,1.070,1.068,1.072,1.074,
1.074,1.070,1.063,1.059,1.056,1.052,1.0158 },
{11.72,6.364,3.811,2.806,2.401,1.884,1.564,1.386,
1.300,1.180,1.112,1.082,1.073,1.066,1.068,1.069,
1.068,1.064,1.059,1.054,1.051,1.050,1.0284 },
{18.08,8.601,4.569,3.183,2.662,2.025,1.646,1.439,
1.339,1.195,1.108,1.068,1.053,1.040,1.039,1.039,
1.039,1.037,1.034,1.031,1.030,1.036,1.0515 },
{18.22,10.48,5.333,3.713,3.115,2.367,1.898,1.631,
1.498,1.301,1.171,1.105,1.077,1.048,1.036,1.033,
1.031,1.028,1.024,1.022,1.021,1.024,1.0834 },
{14.14,10.65,5.710,3.929,3.266,2.453,1.951,1.669,
1.528,1.319,1.178,1.106,1.075,1.040,1.027,1.022,
1.020,1.017,1.015,1.013,1.013,1.020,1.0937 },
{14.11,11.73,6.312,4.240,3.478,2.566,2.022,1.720,
1.569,1.342,1.186,1.102,1.065,1.022,1.003,0.997,
0.995,0.993,0.993,0.993,0.993,1.011,1.1140 },
{22.76,20.01,8.835,5.287,4.144,2.901,2.219,1.855,
1.677,1.410,1.224,1.121,1.073,1.014,0.986,0.976,
0.974,0.972,0.973,0.974,0.975,0.987,1.1410 },
{50.77,40.85,14.13,7.184,5.284,3.435,2.520,2.059,
1.837,1.512,1.283,1.153,1.091,1.010,0.969,0.954,
0.950,0.947,0.949,0.952,0.954,0.963,1.1750 },
{65.87,59.06,15.87,7.570,5.567,3.650,2.682,2.182,
1.939,1.579,1.325,1.178,1.108,1.014,0.965,0.947,
0.941,0.938,0.940,0.944,0.946,0.954,1.1922 },
{55.60,47.34,15.92,7.810,5.755,3.767,2.760,2.239,
1.985,1.609,1.343,1.188,1.113,1.013,0.960,0.939,
0.933,0.930,0.933,0.936,0.939,0.949,1.2026 }};
G4double cpositron[15][23] = {
{2.589,2.044,1.658,1.446,1.347,1.217,1.144,1.110,
1.097,1.083,1.080,1.086,1.092,1.108,1.123,1.131,
1.131,1.126,1.117,1.108,1.103,1.100,0.7235 },
{3.904,2.794,2.079,1.710,1.543,1.325,1.202,1.145,
1.122,1.096,1.089,1.092,1.098,1.114,1.130,1.137,
1.138,1.132,1.122,1.113,1.108,1.102,0.7925 },
{7.970,6.080,4.442,3.398,2.872,2.127,1.672,1.451,
1.357,1.246,1.194,1.179,1.178,1.188,1.201,1.205,
1.203,1.190,1.173,1.159,1.151,1.145,0.9147 },
{9.714,7.607,5.747,4.493,3.815,2.777,2.079,1.715,
1.553,1.353,1.253,1.219,1.211,1.214,1.225,1.228,
1.225,1.210,1.191,1.175,1.166,1.174,0.9700 },
{17.97,12.95,8.628,6.065,4.849,3.222,2.275,1.820,
1.624,1.382,1.259,1.214,1.202,1.202,1.214,1.219,
1.217,1.203,1.184,1.169,1.160,1.151,1.0022 },
{24.83,17.06,10.84,7.355,5.767,3.707,2.546,1.996,
1.759,1.465,1.311,1.252,1.234,1.228,1.238,1.241,
1.237,1.222,1.201,1.184,1.174,1.159,1.0158 },
{23.26,17.15,11.52,8.049,6.375,4.114,2.792,2.155,
1.880,1.535,1.353,1.281,1.258,1.247,1.254,1.256,
1.252,1.234,1.212,1.194,1.183,1.170,1.0284 },
{22.33,18.01,12.86,9.212,7.336,4.702,3.117,2.348,
2.015,1.602,1.385,1.297,1.268,1.251,1.256,1.258,
1.254,1.237,1.214,1.195,1.185,1.179,1.0515 },
{33.91,24.13,15.71,10.80,8.507,5.467,3.692,2.808,
2.407,1.873,1.564,1.425,1.374,1.330,1.324,1.320,
1.312,1.288,1.258,1.235,1.221,1.205,1.0834 },
{32.14,24.11,16.30,11.40,9.015,5.782,3.868,2.917,
2.490,1.925,1.596,1.447,1.391,1.342,1.332,1.327,
1.320,1.294,1.264,1.240,1.226,1.214,1.0937 },
{29.51,24.07,17.19,12.28,9.766,6.238,4.112,3.066,
2.602,1.995,1.641,1.477,1.414,1.356,1.342,1.336,
1.328,1.302,1.270,1.245,1.231,1.233,1.1140 },
{38.19,30.85,21.76,15.35,12.07,7.521,4.812,3.498,
2.926,2.188,1.763,1.563,1.484,1.405,1.382,1.371,
1.361,1.330,1.294,1.267,1.251,1.239,1.1410 },
{49.71,39.80,27.96,19.63,15.36,9.407,5.863,4.155,
3.417,2.478,1.944,1.692,1.589,1.480,1.441,1.423,
1.409,1.372,1.330,1.298,1.280,1.258,1.1750 },
{59.25,45.08,30.36,20.83,16.15,9.834,6.166,4.407,
3.641,2.648,2.064,1.779,1.661,1.531,1.482,1.459,
1.442,1.400,1.354,1.319,1.299,1.272,1.1922 },
{56.38,44.29,30.50,21.18,16.51,10.11,6.354,4.542,
3.752,2.724,2.116,1.817,1.692,1.554,1.499,1.474,
1.456,1.412,1.364,1.328,1.307,1.282,1.2026 }};
G4double sigma;
if (part != particle ) {
particle = part;
mass = particle->GetPDGMass();
charge = particle->GetPDGCharge()/eplus;
}
G4double Z23 = 2.*log(AtomicNumber)/3.; Z23 = exp(Z23);
// correction if particle .ne. e-/e+
// compute equivalent kinetic energy
// lambda depends on p*beta ....
G4double eKineticEnergy = KineticEnergy;
if((particle->GetParticleName() != "e-") &&
(particle->GetParticleName() != "e+") )
{
G4double TAU = KineticEnergy/mass ;
G4double c = mass*TAU*(TAU+2.)/(electron_mass_c2*(TAU+1.)) ;
G4double w = c-2. ;
G4double tau = 0.5*(w+sqrt(w*w+4.*c)) ;
eKineticEnergy = electron_mass_c2*tau ;
}
G4double ChargeSquare = charge*charge;
G4double eTotalEnergy = eKineticEnergy + electron_mass_c2 ;
G4double beta2 = eKineticEnergy*(eTotalEnergy+electron_mass_c2)
/(eTotalEnergy*eTotalEnergy);
G4double bg2 = eKineticEnergy*(eTotalEnergy+electron_mass_c2)
/(electron_mass_c2*electron_mass_c2);
G4double eps = epsfactor*bg2/Z23;
if (eps<epsmin) sigma = 2.*eps*eps;
else if(eps<epsmax) sigma = log(1.+2.*eps)-2.*eps/(1.+2.*eps);
else sigma = log(2.*eps)-1.+1./eps;
sigma *= ChargeSquare*AtomicNumber*AtomicNumber/(beta2*bg2);
// nuclear size effect correction for high energy
// ( a simple approximation at present)
G4double corrnuclsize,a,w1,w2,w;
G4double x0 = 1. - NuclCorrPar*mass/(KineticEnergy*
exp(log(AtomicWeight/(g/mole))/3.));
if ( x0 < -1. || eKineticEnergy <= 10.*MeV)
{
x0 = -1.;
corrnuclsize = 1.;
}
else
{
a = 1.+1./eps;
if (eps > epsmax) w1=log(2.*eps)+1./eps-3./(8.*eps*eps);
else w1=log((a+1.)/(a-1.))-2./(a+1.);
w = 1./((1.-x0)*eps);
if (w < epsmin) w2=-log(w)-1.+2.*w-1.5*w*w;
else w2 = log((a-x0)/(a-1.))-(1.-x0)/(a-x0);
corrnuclsize = w1/w2;
corrnuclsize = exp(-FactPar*mass/KineticEnergy)*
(corrnuclsize-1.)+1.;
}
// interpolate in AtomicNumber and beta2
// get bin number in Z
G4int iZ = 14;
while ((iZ>=0)&&(Zdat[iZ]>=AtomicNumber)) iZ -= 1;
if (iZ==14) iZ = 13;
if (iZ==-1) iZ = 0 ;
G4double Z1 = Zdat[iZ];
G4double Z2 = Zdat[iZ+1];
G4double ratZ = (AtomicNumber-Z1)/(Z2-Z1);
// get bin number in T (beta2)
G4int iT = 22;
while ((iT>=0)&&(Tdat[iT]>=eKineticEnergy)) iT -= 1;
if(iT==22) iT = 21;
if(iT==-1) iT = 0 ;
// calculate betasquare values
G4double T = Tdat[iT], E = T + electron_mass_c2;
G4double b2small = T*(E+electron_mass_c2)/(E*E);
T = Tdat[iT+1]; E = T + electron_mass_c2;
G4double b2big = T*(E+electron_mass_c2)/(E*E);
G4double ratb2 = (beta2-b2small)/(b2big-b2small);
G4double c1,c2,cc1,cc2,corr;
if (charge < 0.)
{
c1 = celectron[iZ][iT];
c2 = celectron[iZ+1][iT];
cc1 = c1+ratZ*(c2-c1);
c1 = celectron[iZ][iT+1];
c2 = celectron[iZ+1][iT+1];
cc2 = c1+ratZ*(c2-c1);
corr = cc1+ratb2*(cc2-cc1);
sigma /= corr;
}
if (charge > 0.)
{
c1 = cpositron[iZ][iT];
c2 = cpositron[iZ+1][iT];
cc1 = c1+ratZ*(c2-c1);
c1 = cpositron[iZ][iT+1];
c2 = cpositron[iZ+1][iT+1];
cc2 = c1+ratZ*(c2-c1);
corr = cc1+ratb2*(cc2-cc1);
sigma /= corr;
}
// nucl. size correction for particles other than e+/e- only at present !!!!
if((particle->GetParticleName() != "e-") &&
(particle->GetParticleName() != "e+") )
sigma /= corrnuclsize;
return sigma;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4MscModel71::GeomPathLength(
G4PhysicsTable* theLambdaTable,
const G4MaterialCutsCouple* couple,
const G4ParticleDefinition* theParticle,
G4double& T0,
G4double lambda,
G4double range,
G4double truePathLength)
{
// do the true -> geom transformation
const G4double ztmax = 101./103. ;
if (theParticle != particle ) {
particle = theParticle;
mass = particle->GetPDGMass();
charge = particle->GetPDGCharge()/eplus;
}
currentKinEnergy = T0;
currentRange = range ;
currentRadLength = couple->GetMaterial()->GetRadlen();
lambda0 = lambda;
par1 = -1. ;
par2 = par3 = 0. ;
tPathLength = truePathLength;
// this correction needed to run MSC with eIoni and eBrem inactivated
// and makes no harm for a normal run
if(tPathLength > range)
tPathLength = range ;
G4double tau = tPathLength/lambda0 ;
if (tau <= tausmall) return tPathLength;
G4double zmean = tPathLength;
if (tPathLength < range*dtrl) {
zmean = lambda0*(1.-exp(-tau));
if(tau < taulim) zmean = tPathLength*(1.-0.5*tPathLength/lambda0) ;
} else if(T0 < mass) {
par1 = 1./range ;
par2 = 1./(par1*lambda0) ;
par3 = 1.+par2 ;
zmean = (1.-exp(par3*log(1.-tPathLength/range)))/(par1*par3) ;
} else {
G4LossTableManager* theManager = G4LossTableManager::Instance();
G4double T1 = theManager->GetEnergy(particle,range-tPathLength,couple);
G4double lambda1 ;
if (theLambdaTable) {
G4bool bb;
lambda1 = ((*theLambdaTable)[couple->GetIndex()])->GetValue(T1,bb);
} else {
lambda1 = CrossSection(couple,particle,T1,0.0,1.0);
}
par1 = (lambda0-lambda1)/(lambda0*tPathLength) ;
par2 = 1./(par1*lambda0) ;
par3 = 1.+par2 ;
zmean = (1.-exp(par3*log(lambda1/lambda0)))/(par1*par3) ;
}
// sample z
G4double zPathLength = zmean ;
G4double zt = zmean/tPathLength ;
if (tPathLength >= stepmin && samplez && zt > 0.5 && zt < ztmax)
{
G4double cz = 0.5*(3.*zt-1.)/(1.-zt) ;
G4double cz1 = 1.+cz ;
G4double u0 = cz/cz1 ;
G4double u,grej ;
do {
u = exp(log(G4UniformRand())/cz1) ;
grej = exp(cz*log(u/u0))*(1.-u)/(1.-u0) ;
} while (grej < G4UniformRand()) ;
zPathLength = tPathLength*u ;
}
return zPathLength ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4MscModel71::TrueStepLength(G4double geomStepLength)
{
G4double trueLength = geomStepLength;
trueLength = geomStepLength;
if(geomStepLength > lambda0*tausmall)
{
if(par1 < 0.)
trueLength = -lambda0*log(1.-geomStepLength/lambda0) ;
else
{
if(par1*par3*geomStepLength < 1.)
trueLength = (1.-exp(log(1.-par1*par3*geomStepLength)/par3))/par1 ;
else
trueLength = currentRange ;
}
}
if(trueLength > tPathLength) trueLength = tPathLength;
if(trueLength > currentRange) trueLength = currentRange ;
if(trueLength < geomStepLength) trueLength = geomStepLength;
return trueLength;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
std::vector<G4DynamicParticle*>* G4MscModel71::SampleSecondaries(
const G4MaterialCutsCouple*,
const G4DynamicParticle* dynParticle,
G4double truestep,
G4double safety)
{
G4double kineticEnergy = dynParticle->GetKineticEnergy();
if(kineticEnergy <= 0.0) return 0;
G4double cth = SampleCosineTheta(truestep,kineticEnergy);
G4double sth = sqrt((1.0 - cth)*(1.0 + cth));
G4double phi = twopi*G4UniformRand();
G4double dirx = sth*cos(phi);
G4double diry = sth*sin(phi);
G4ThreeVector oldDirection = dynParticle->GetMomentumDirection();
G4ThreeVector newDirection(dirx,diry,cth);
newDirection.rotateUz(oldDirection);
fParticleChange->ProposeMomentumDirection(newDirection);
/*
const G4ParticleDefinition* pd = dynParticle->GetDefinition();
G4cout << "G4MscModel71: Sample secondary; E(MeV)= " << kineticEnergy/MeV
<< " MeV; step(mm)= " << truestep/mm
<< ", safety(mm)= " << safety/mm << " " << pd->GetParticleName()
<< G4endl;
*/
if (latDisplasment && safety > 0.0) {
G4double r = SampleDisplacement();
if (r > safety) r = safety;
// sample direction of lateral displacement
G4double phi = twopi*G4UniformRand();
G4double dirx = std::cos(phi);
G4double diry = std::sin(phi);
G4ThreeVector newPosition(dirx,diry,0.0);
newPosition.rotateUz(oldDirection);
// compute new endpoint of the Step
newPosition *= r;
newPosition += *(fParticleChange->GetProposedPosition());
navigator->LocateGlobalPointWithinVolume(newPosition);
fParticleChange->ProposePosition(newPosition);
}
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4MscModel71::SampleCosineTheta(G4double trueStepLength, G4double KineticEnergy)
{
G4double cth = 1. ;
G4double tau = trueStepLength/lambda0 ;
if(trueStepLength >= currentRange*dtrl)
if(par1*trueStepLength < 1.)
tau = -par2*log(1.-par1*trueStepLength) ;
else
tau = taubig ;
currentTau = tau ;
if(trueStepLength < stepmin)
cth = exp(-tau) ;
else
{
if (tau >= taubig) cth = -1.+2.*G4UniformRand();
else if (tau >= tausmall)
{
G4double a ;
// for all particles take the width of the central part
// from a parametrization similar to the Highland formula
// ( Highland formula: Particle Physics Booklet, July 2002, eq. 26.10)
// here : theta0 = 13.6*MeV*Q*(t/X0)**0.555/(beta*cp)
const G4double c_highland = 13.6*MeV, corr_highland=0.555 ;
G4double Q = std::abs(charge) ;
G4double xx0 = trueStepLength/currentRadLength;
G4double betacp = sqrt(currentKinEnergy*(currentKinEnergy+2.*mass)*
KineticEnergy*(KineticEnergy+2.*mass)/
((currentKinEnergy+mass)*(KineticEnergy+mass))) ;
G4double theta0 = c_highland*Q*exp(corr_highland*log(xx0))/betacp ;
if(theta0 > taulim) a = 0.5/(1.-cos(theta0)) ;
else a = 1.0/(theta0*theta0) ;
G4double xmeanth = exp(-tau);
G4double xmeanth1 = 1.-xmeanth ;
if(currentTau < taulim) xmeanth1 = tau ;
const G4double x1fac1 = exp(-xsi) ;
const G4double x1fac2 = (1.-(1.+xsi)*x1fac1)/(1.-x1fac1) ;
const G4double x1fac3 = 1.3 ;
G4double ea,eaa,xmean1 ;
G4double c = 2.,b1 = 2., bx = 2.,
eb1 = b1, ebx = b1, xmean2 = 0. ;
G4double prob = 1., qprob ;
G4double x0 = 1.-xsi/a;
G4double oneminusx0=xsi/a ;
G4double oneplusx0=2.+xsi/a ;
G4double f1x0=1., f2x0=1. ;
const G4double tau0 = 0.10 ;
if(tau > tau0)
{
// 1 model function
a = 1./xmeanth1 ;
ea = exp(-2.*a) ;
eaa= 1.-ea ;
xmean1 = 1.-1./a+2.*ea/eaa ;
prob = 1. ;
qprob = 1. ;
}
else if (x0 <= -1.)
{
// 2 model fuctions only
// in order to have xmean1 > xmeanth -> qprob < 1
x0 = -1.;
if( a < 1./xmeanth1)
a = 1./xmeanth1 ;
oneminusx0 = 1.-x0 ;
oneplusx0 = 1.+x0 ;
ea = exp(-a*oneminusx0);
eaa = 1.-ea ;
xmean1 = 1.-1./a+oneminusx0*ea/eaa ;
qprob = xmeanth/xmean1 ;
}
else
{
// 3 model fuctions
// in order to have xmean1 > xmeanth
if((1.-x1fac2/a) < xmeanth)
{
a = x1fac3*x1fac2/xmeanth1 ;
x0 = 1.-xsi/a ;
oneminusx0=xsi/a ;
oneplusx0=2.-xsi/a ;
}
ea = x1fac1 ;
eaa = 1.-ea ;
xmean1 = 1.-x1fac2/a ;
const G4double fctail = factail*1.0 ;
c = 2.+fctail*tau ;
G4double c1 = c-1. ;
G4double c2 = c-2. ;
if(c2 == 0.) c2 = fctail*tausmall ;
b = 1.+(c-xsi)/a ;
b1 = b+1. ;
bx = c/a ;
eb1=exp((c1)*log(b1)) ;
ebx=exp((c1)*log(bx)) ;
xmean2 = (x0*eb1+ebx-(eb1*bx-b1*ebx)/c2)/(eb1-ebx) ;
f1x0 = a*ea/eaa ;
f2x0 = c1*eb1*ebx/(eb1-ebx)/
exp(c*log(bx)) ;
// from continuity at x=x0
prob = f2x0/(f1x0+f2x0) ;
// from xmean = xmeanth
qprob = (f1x0+f2x0)*xmeanth/(f2x0*xmean1+f1x0*xmean2) ;
}
// sampling of costheta
if (G4UniformRand() < qprob)
{
if (G4UniformRand() < prob)
cth = 1.+log(ea+G4UniformRand()*eaa)/a ;
else
cth = b-b1*bx/exp(log(ebx-G4UniformRand()*(ebx-eb1))/(c-1.)) ;
}
else
{
cth = -1.+2.*G4UniformRand();
}
}
}
return cth ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4MscModel71::SampleDisplacement()
{
const G4double kappa = 2.5;
const G4double kappapl1 = kappa+1.;
const G4double kappami1 = kappa-1.;
G4double rmean = 0.0;
if (currentTau >= tausmall) {
if (currentTau < taulim) {
rmean = kappa*currentTau*currentTau*currentTau*(1.-kappapl1*currentTau*0.25)/6. ;
} else {
G4double etau = 0.0;
if (currentTau<taubig) etau = exp(-currentTau);
rmean = -kappa*currentTau;
rmean = -exp(rmean)/(kappa*kappami1);
rmean += currentTau-kappapl1/kappa+kappa*etau/kappami1;
}
if (rmean>0.) rmean = 2.*lambda0*sqrt(rmean/3.0);
else rmean = 0.;
}
return rmean;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4MultipleScattering.cc,v 1.27 2005/04/15 14:41:13 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4MultipleScattering.cc,v 1.45 2005/12/11 08:34:18 urban Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// -----------------------------------------------------------------------------
// 16/05/01 value of cparm changed , L.Urban
@@ -41,7 +41,7 @@
// 27-09-01 value of data member factlim changed, L.Urban
// 31-10-01 big fixed in PostStepDoIt,L.Urban
// 17-04-02 NEW angle distribution + boundary algorithm modified, L.Urban
// 22-04-02 boundary algorithm modified -> important improvement in timing (L.Urban)
// 22-04-02 boundary algorithm modified -> important improvement in timing
// 24-04-02 some minor changes in boundary algorithm, L.Urban
// 06-05-02 bug fixed in GetContinuousStepLimit, L.Urban
// 24-05-02 changes in angle distribution and boundary algorithm, L.Urban
@@ -65,6 +65,31 @@
// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivantchenko)
// 07-02-05 correction in order to have a working Setsamplez function (L.Urban)
// 15-04-05 optimize internal interface (V.Ivanchenko)
// 12-09-05 new TruePathLengthLimit - facrange works for every track from
// start, geometry also influences the limit
// 02-10-05 conditions limiting the step are finalized + code cleaning (L.Urban)
// 03-10-05 weaker step limitation for Tkin > Tlimit (L.Urban)
// 05-10-05 value of data member tlimitmin has been changed (L.Urban)
// 06-10-05 correction in TruePathLengthLimit, timing improved.(L.Urban)
// 07-10-05 bug fixed in TruePathLengthLimit (L.Urban)
// 11-10-05 change in TruePathLengthLimit conditions,slightly better
// timing and much weaker cut dependence (L.Urban)
// 13-10-05 move SetFacrange(0.02) from InitialiseProcess to constructor
// 23-10-05 new Boolean data member prec (false ~ 7.1 like, true new step
// limit in TruePathLengthLimit, L.Urban)
// 25-10-05 prec renamed to steppingAlgorithm, set function triggers
// 'default' facrange too, true - 0.02, false - 0.2 (L.Urban)
// 26-10-05 the above is put in the function MscStepLimitation() (mma)
// 05-11-05 tlimitmin = facrange*rungecut (instead of a fixed value)L.Urban
// 13-11-05 some code cleaning, slightly better timing (L.Urban)
// 01-12-05 add control on verbosity in SetMscStepLimitation
// 06-12-05 tlimitmin = facrange*rangecut(e-) for every particle
// 07-12-05 volume name World removed, rangecut computed using index
// instead of particle name L.Urban
// 08-12-05 world is now: navigator->GetWorldVolume() L.Urban
// 11-12-05 data member rangecut removed, steplimit does not depend
// on cut any more (L.Urban)
//
// -----------------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -72,35 +97,42 @@
#include "G4MultipleScattering.hh"
#include "G4MscModel.hh"
#include "G4TransportationManager.hh"
#include "G4Navigator.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
using namespace std;
G4MultipleScattering::G4MultipleScattering(const G4String& processName)
: G4VMultipleScattering(processName),
totBins(120),
facrange(0.199),
dtrl(0.05),
NuclCorrPar (0.0615),
FactPar(0.40),
factail(1.0),
cf(1.001),
stepnolastmsc(-1000000),
nsmallstep(5),
samplez(true),
boundary(true),
isInitialized(false)
: G4VMultipleScattering(processName)
{
lowKineticEnergy = 0.1*keV;
highKineticEnergy= 100.*TeV;
lowKineticEnergy = 0.1*keV;
highKineticEnergy = 100.*TeV;
totBins = 120;
Tkinlimit = 2.*MeV;
facrange = 0.02;
tlimit = 1.e10*mm;
tlimitmin = 1.e-7*mm;
tlimitmin = 1.e-3*mm;
geombig = 1.e50*mm;
geommin = 5.e-6*mm;
facgeom = 4.;
safety = 0.*mm;
facsafety = 0.20;
dtrl = 0.05;
factail = 1.0;
steppingAlgorithm = true;
samplez = false;
boundary = true;
isInitialized = false;
SetBinning(totBins);
SetMinKinEnergy(lowKineticEnergy);
SetMaxKinEnergy(highKineticEnergy);
SetLateralDisplasmentFlag(true);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -110,7 +142,28 @@ G4MultipleScattering::~G4MultipleScattering()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MultipleScattering::InitialiseProcess(const G4ParticleDefinition* particle)
G4bool G4MultipleScattering::IsApplicable (const G4ParticleDefinition& p)
{
return (p.GetPDGCharge() != 0.0 && !p.IsShortLived());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MultipleScattering::MscStepLimitation(G4bool algorithm, G4double factor)
{
steppingAlgorithm = algorithm;
if (factor > 0.) SetFacrange(factor);
else { if (algorithm) SetFacrange(0.02); else SetFacrange(0.2);}
if(verboseLevel > 1)
G4cout << "Stepping algorithm is set to " << steppingAlgorithm
<< " with facrange = " << facrange << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MultipleScattering::InitialiseProcess
(const G4ParticleDefinition* particle)
{
if(isInitialized) return;
@@ -118,58 +171,122 @@ void G4MultipleScattering::InitialiseProcess(const G4ParticleDefinition* particl
boundary = false;
SetLateralDisplasmentFlag(false);
SetBuildLambdaTable(false);
Setsamplez(false) ;
} else {
SetLateralDisplasmentFlag(true);
SetBuildLambdaTable(true);
}
G4MscModel* em = new G4MscModel(dtrl,NuclCorrPar,FactPar,factail,samplez);
// compute Tlimit for particle
Tlimit = Tkinlimit*electron_mass_c2/particle->GetPDGMass();
G4MscModel* em = new G4MscModel(dtrl,factail,samplez);
em->SetLateralDisplasmentFlag(LateralDisplasmentFlag());
em->SetLowEnergyLimit(lowKineticEnergy);
em->SetHighEnergyLimit(highKineticEnergy);
AddEmModel(1, em);
isInitialized = true;
navigator = G4TransportationManager::GetTransportationManager()
->GetNavigatorForTracking();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MultipleScattering::TruePathLengthLimit(const G4Track& track,
G4double& lambda,
G4double currentMinimalStep)
G4double& lambda,
G4double currentMinimalStep)
{
G4double tPathLength = currentMinimalStep;
G4double range = CurrentRange() ;
// special treatment near boundaries ?
if (boundary) {
// standard version
//
if (steppingAlgorithm)
{
safety = track.GetStep()->GetPreStepPoint()->GetSafety() ;
if((track.GetStep()->GetPreStepPoint()->GetStepStatus() ==
fGeomBoundary)
|| (track.GetCurrentStepNumber() == 1))
{
// not so strong step restriction above Tlimit
G4double facr = facrange;
if(track.GetKineticEnergy() > Tlimit)
facr *= track.GetKineticEnergy()/Tlimit;
G4int stepno = track.GetCurrentStepNumber() ;
// first step
if (stepno == 1) {
stepnolastmsc = -1000000 ;
tlimit = 1.e10;
} else if (stepno > 1) {
// constraint from the physics
if (range > lambda) tlimit = facr*range;
else tlimit = facr*lambda;
if (track.GetStep()->GetPreStepPoint()->GetStepStatus() == fGeomBoundary) {
stepnolastmsc = stepno;
// if : diff.treatment for small/not small Z
G4double range = CurrentRange();
if (range > lambda) tlimit = facrange*range;
else tlimit = facrange*lambda;
if(tlimit < tlimitmin) tlimit = tlimitmin;
if(tPathLength > tlimit) tPathLength = tlimit;
} else if (stepno > stepnolastmsc && stepno - stepnolastmsc < nsmallstep
&& tPathLength > tlimit) {
tlimit *= cf;
tPathLength = tlimit;
G4double geomlimit = GeomLimit(track);
// constraint from the geometry (if tlimit above is too big)
if ((geomlimit > geommin) && (tlimit > geomlimit/facgeom))
{
if(track.GetStep()->GetPreStepPoint()->GetStepStatus() ==
fGeomBoundary)
tlimit = geomlimit/facgeom;
else
tlimit = 2.*geomlimit/facgeom;
}
//lower limit for tlimit
if(tlimit < tlimitmin) tlimit = tlimitmin;
}
if(track.GetCurrentStepNumber() == 1)
{
// range <= safety ---> particle is not able to leave volume
if(range <= safety)
return currentMinimalStep;
//if track starts far from boundaries increase tlimit!
if(tlimit < facsafety*safety)
tlimit = facsafety*safety ;
}
// range <= safety ---> particle is not able to leave volume
if(range <= safety)
return currentMinimalStep;
if(tPathLength > tlimit) tPathLength = tlimit;
}
// version similar to 7.1 (needed for some experiments)
//
else
{
if(track.GetCurrentStepNumber() == 1)
tlimit = geombig;
if (track.GetStep()->GetPreStepPoint()->GetStepStatus() ==
fGeomBoundary)
{
if (range > lambda) tlimit = facrange*range;
else tlimit = facrange*lambda;
if(tlimit < tlimitmin) tlimit = tlimitmin;
}
if(tPathLength > tlimit) tPathLength = tlimit;
}
return tPathLength;
return tPathLength ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MultipleScattering::GeomLimit(const G4Track& track)
{
G4double geomlimit = geombig;
// no geomlimit for the World volume
if((track.GetVolume() != 0) &&
(track.GetVolume() != navigator->GetWorldVolume()))
{
const G4double cstep = geombig;
navigator->LocateGlobalPointWithinVolume(
track.GetStep()->GetPreStepPoint()->GetPosition());
geomlimit = navigator->ComputeStep(
track.GetStep()->GetPreStepPoint()->GetPosition(),
track.GetMomentumDirection(),
cstep,
safety);
if(geomlimit < geommin) geomlimit = geommin;
}
return geomlimit;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -177,8 +294,9 @@ G4double G4MultipleScattering::TruePathLengthLimit(const G4Track& track,
void G4MultipleScattering::PrintInfo()
{
if(boundary) {
G4cout << " Boundary algorithm is active with facrange= "
G4cout << " Boundary/stepping algorithm is active with facrange= "
<< facrange
<< " Step limitation " << steppingAlgorithm
<< G4endl;
}
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4MultipleScattering52.cc,v 1.3 2005/05/03 08:07:41 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
// -----------------------------------------------------------------------------
// 16/05/01 value of cparm changed , L.Urban
@@ -0,0 +1,188 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4MultipleScattering71.cc,v 1.1 2005/10/03 01:09:57 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// -----------------------------------------------------------------------------
// 16/05/01 value of cparm changed , L.Urban
// 18/05/01 V.Ivanchenko Clean up against Linux ANSI compilation
// 07/08/01 new methods Store/Retrieve PhysicsTable (mma)
// 23-08-01 new angle and z distribution,energy dependence reduced,
// Store,Retrieve methods commented out temporarily, L.Urban
// 27-08-01 in BuildPhysicsTable:aParticleType.GetParticleName()=="mu+" (mma)
// 28-08-01 GetContinuousStepLimit and AlongStepDoIt moved from .icc file (mma)
// 03-09-01 value of data member factlim changed, L.Urban
// 10-09-01 small change in GetContinuousStepLimit, L.Urban
// 11-09-01 G4MultipleScatteringx put as default G4MultipleScattering
// store/retrieve physics table reactivated (mma)
// 13-09-01 corr. in ComputeTransportCrossSection, L.Urban
// 14-09-01 protection in GetContinuousStepLimit, L.Urban
// 17-09-01 migration of Materials to pure STL (mma)
// 27-09-01 value of data member factlim changed, L.Urban
// 31-10-01 big fixed in PostStepDoIt,L.Urban
// 17-04-02 NEW angle distribution + boundary algorithm modified, L.Urban
// 22-04-02 boundary algorithm modified -> important improvement in timing (L.Urban)
// 24-04-02 some minor changes in boundary algorithm, L.Urban
// 06-05-02 bug fixed in GetContinuousStepLimit, L.Urban
// 24-05-02 changes in angle distribution and boundary algorithm, L.Urban
// 11-06-02 bug fixed in ComputeTransportCrossSection, L.Urban
// 12-08-02 bug fixed in PostStepDoIt (lateral displacement), L.Urban
// 15-08-02 new angle distribution, L.Urban
// 26-09-02 angle distribution + boundary algorithm modified, L.Urban
// 15-10-02 temporary fix for proton scattering
// 30-10-02 modified angle distribution,mods in boundary algorithm,
// changes in data members, L.Urban
// 11-12-02 precision problem in ComputeTransportCrossSection
// for small Tkin/for heavy particles cured from L.Urban
// 20-01-03 Migrade to cut per region (V.Ivanchenko)
// 05-02-03 changes in data members, new sampling for geom.
// path length, step dependence reduced with new
// method
// 28-03-03 Move to model design (V.Ivanchenko)
// 08-08-03 STD substitute standard (V.Ivanchenko)
// 23-04-04 value of data member dtrl changed from 0.15 to 0.05 (L.Urban)
// 17-08-04 name of facxsi changed to factail (L.Urban)
// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivantchenko)
// 07-02-05 correction in order to have a working Setsamplez function (L.Urban)
// 15-04-05 optimize internal interface (V.Ivanchenko)
// 03-10-05 Process is freezed with the name 71 (V.Ivanchenko)
// -----------------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4MultipleScattering71.hh"
#include "G4MscModel71.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
using namespace std;
G4MultipleScattering71::G4MultipleScattering71(const G4String& processName)
: G4VMultipleScattering(processName),
totBins(120),
facrange(0.199),
dtrl(0.05),
NuclCorrPar (0.0615),
FactPar(0.40),
factail(1.0),
cf(1.001),
stepnolastmsc(-1000000),
nsmallstep(5),
samplez(true),
boundary(true),
isInitialized(false)
{
lowKineticEnergy = 0.1*keV;
highKineticEnergy= 100.*TeV;
tlimit = 1.e10*mm;
tlimitmin = 1.e-7*mm;
SetBinning(totBins);
SetMinKinEnergy(lowKineticEnergy);
SetMaxKinEnergy(highKineticEnergy);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4MultipleScattering71::~G4MultipleScattering71()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MultipleScattering71::InitialiseProcess(const G4ParticleDefinition* particle)
{
if(isInitialized) return;
if (particle->GetParticleType() == "nucleus") {
boundary = false;
SetLateralDisplasmentFlag(false);
SetBuildLambdaTable(false);
Setsamplez(false) ;
} else {
SetLateralDisplasmentFlag(true);
SetBuildLambdaTable(true);
}
G4MscModel71* em = new G4MscModel71(dtrl,NuclCorrPar,FactPar,factail,samplez);
em->SetLateralDisplasmentFlag(LateralDisplasmentFlag());
em->SetLowEnergyLimit(lowKineticEnergy);
em->SetHighEnergyLimit(highKineticEnergy);
AddEmModel(1, em);
isInitialized = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MultipleScattering71::TruePathLengthLimit(const G4Track& track,
G4double& lambda,
G4double currentMinimalStep)
{
G4double tPathLength = currentMinimalStep;
// special treatment near boundaries ?
if (boundary) {
G4int stepno = track.GetCurrentStepNumber() ;
// first step
if (stepno == 1) {
stepnolastmsc = -1000000 ;
tlimit = 1.e10;
} else if (stepno > 1) {
if (track.GetStep()->GetPreStepPoint()->GetStepStatus() == fGeomBoundary) {
stepnolastmsc = stepno;
// if : diff.treatment for small/not small Z
G4double range = CurrentRange();
if (range > lambda) tlimit = facrange*range;
else tlimit = facrange*lambda;
if(tlimit < tlimitmin) tlimit = tlimitmin;
if(tPathLength > tlimit) tPathLength = tlimit;
} else if (stepno > stepnolastmsc && stepno - stepnolastmsc < nsmallstep
&& tPathLength > tlimit) {
tlimit *= cf;
tPathLength = tlimit;
}
}
}
return tPathLength;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MultipleScattering71::PrintInfo()
{
if(boundary) {
G4cout << " Boundary algorithm is active with facrange= "
<< facrange
<< G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -574,6 +574,9 @@ G4PAIModel::SampleSecondaries( const G4MaterialCutsCouple* matCC,
G4double pSquare = kineticEnergy*(totalEnergy+particleMass);
G4double deltaTkin = GetPostStepTransfer(scaledTkin);
// G4cout<<"G4PAIModel::SampleSecondaries; deltaKIn = "<<deltaTkin/keV<<" keV "<<G4endl;
if( deltaTkin <= 0. )
{
G4cout<<"Tkin of secondary e- <= 0."<<G4endl;
@@ -794,7 +797,7 @@ G4double G4PAIModel::SampleFluctuations( const G4Material* material,
else lambda = DBL_MAX;
while(numb)
{
stepDelta = RandExponential::shoot(lambda);
stepDelta = CLHEP::RandExponential::shoot(lambda);
stepSum += stepDelta;
if(stepSum >= step) break;
numOfCollisions++;
@@ -812,7 +815,7 @@ G4double G4PAIModel::SampleFluctuations( const G4Material* material,
if(position >= (*(*fPAItransferTable)(iPlace))(iTransfer)) break ;
}
omega = GetEnergyTransfer(iPlace,position,iTransfer);
// G4cout<<omega/keV<<"\t";
// G4cout<<"G4PAIModel::SampleFluctuations, omega = "<<omega/keV<<" keV; "<<"\t";
loss += omega;
numOfCollisions-- ;
}
@@ -826,13 +829,13 @@ G4double G4PAIModel::SampleFluctuations( const G4Material* material,
{
meanNumber =((*(*fPAItransferTable)(iPlace+1))(0)-dNdxCut2)*step*charge2;
if( meanNumber < 0. ) meanNumber = 0. ;
// numOfCollisions = RandPoisson::shoot(meanNumber) ;
// numOfCollisions = CLHEP::RandPoisson::shoot(meanNumber) ;
// numOfCollisions = G4Poisson(meanNumber) ;
if( meanNumber > 0.) lambda = step/meanNumber;
else lambda = DBL_MAX;
while(numb)
{
stepDelta = RandExponential::shoot(lambda);
stepDelta = CLHEP::RandExponential::shoot(lambda);
stepSum += stepDelta;
if(stepSum >= step) break;
numOfCollisions++;
@@ -878,7 +881,7 @@ G4double G4PAIModel::SampleFluctuations( const G4Material* material,
else lambda = DBL_MAX;
while(numb)
{
stepDelta = RandExponential::shoot(lambda);
stepDelta = CLHEP::RandExponential::shoot(lambda);
stepSum += stepDelta;
if(stepSum >= step) break;
numOfCollisions++;
@@ -912,7 +915,7 @@ G4double G4PAIModel::SampleFluctuations( const G4Material* material,
}
}
}
// G4cout<<"PAIModel AlongStepLoss = "<<loss/keV<<" keV"<<G4endl ;
// G4cout<<"PAIModel AlongStepLoss = "<<loss/keV<<" keV, on step = "<<step/mm<<" mm"<<G4endl ;
if(loss > Tkin) loss=Tkin;
return loss ;
@@ -1075,7 +1075,7 @@ G4PAIPhotonModel::GetAlongStepTransfer( G4PhysicsTable* pTable,
else lambda = DBL_MAX;
while(numb)
{
stepDelta = RandExponential::shoot(lambda);
stepDelta = CLHEP::RandExponential::shoot(lambda);
stepSum += stepDelta;
if(stepSum >= step) break;
numOfCollisions++;
@@ -1105,12 +1105,12 @@ G4PAIPhotonModel::GetAlongStepTransfer( G4PhysicsTable* pTable,
{
meanNumber = ((*(*pTable)(iPlace+1))(0) - dNdxCut2)*cof;
if( meanNumber < 0. ) meanNumber = 0. ;
// numOfCollisions = RandPoisson::shoot(meanNumber) ;
// numOfCollisions = CLHEP::RandPoisson::shoot(meanNumber) ;
if( meanNumber > 0.) lambda = step/meanNumber;
else lambda = DBL_MAX;
while(numb)
{
stepDelta = RandExponential::shoot(lambda);
stepDelta = CLHEP::RandExponential::shoot(lambda);
stepSum += stepDelta;
if(stepSum >= step) break;
numOfCollisions++;
@@ -1148,12 +1148,12 @@ G4PAIPhotonModel::GetAlongStepTransfer( G4PhysicsTable* pTable,
meanNumber=( ((*(*pTable)(iPlace))(0)-dNdxCut1)*W1 +
((*(*pTable)(iPlace+1))(0)-dNdxCut2)*W2 )*cof;
if(meanNumber<0.0) meanNumber = 0.0;
// numOfCollisions = RandPoisson::shoot(meanNumber) ;
// numOfCollisions = CLHEP::RandPoisson::shoot(meanNumber) ;
if( meanNumber > 0.) lambda = step/meanNumber;
else lambda = DBL_MAX;
while(numb)
{
stepDelta = RandExponential::shoot(lambda);
stepDelta = CLHEP::RandExponential::shoot(lambda);
stepSum += stepDelta;
if(stepSum >= step) break;
numOfCollisions++;
@@ -22,7 +22,7 @@
//
//
// $Id: G4PAIxSection.cc,v 1.20 2004/12/01 19:37:15 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// G4PAIxSection.cc -- class implementation file
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4PEEffectModel.cc,v 1.2 2005/05/02 12:44:18 maire Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4PEEffectModel.cc,v 1.4 2005/12/05 16:44:43 maire Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// -------------------------------------------------------------------
//
@@ -36,6 +36,8 @@
//
// Modifications:
//
// 04.12.05 : SetProposedKineticEnergy(0.) for the killed photon (mma)
//
// Class Description:
//
// -------------------------------------------------------------------
@@ -73,13 +75,14 @@ G4PEEffectModel::~G4PEEffectModel()
void G4PEEffectModel::Initialise(const G4ParticleDefinition*,
const G4DataVector&)
{
if(isInitialized) return;
if(pParticleChange)
fParticleChange = reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange);
if (isInitialized) return;
if (pParticleChange)
fParticleChange =
reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange);
else
fParticleChange = new G4ParticleChangeForGamma();
fParticleChange = new G4ParticleChangeForGamma();
fminimalEnergy = 1.0*eV;
fminimalEnergy = 1.0*eV;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -129,8 +132,9 @@ std::vector<G4DynamicParticle*>* G4PEEffectModel::SampleSecondaries(
theElectron,ElecDirection, ElecKineEnergy);
fvect->push_back(aParticle);
}
fParticleChange->ProposeTrackStatus(fStopAndKill);
fParticleChange->SetProposedKineticEnergy(0.);
fParticleChange->ProposeTrackStatus(fStopAndKill);
fParticleChange->ProposeLocalEnergyDeposit(bindingEnergy);
return fvect;
}
@@ -21,7 +21,7 @@
// ********************************************************************
//
// $Id: G4PhotoElectricEffect.cc,v 1.34 2005/05/04 16:16:12 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//
//------------------ G4PhotoElectricEffect physics process -------------------------
@@ -22,7 +22,7 @@
//
//
// $Id: G4PhotoElectricEffect52.cc,v 1.1 2005/05/04 16:16:12 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -22,7 +22,7 @@
//
//
// $Id: G4PolarizedComptonScattering.cc,v 1.14 2005/05/04 16:16:12 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//
//---------- G4PolarizedComptonScattering physics process ----------------------
@@ -21,7 +21,7 @@
// ********************************************************************
//
// $Id: G4SCProcessorStand.cc,v 1.2 2004/12/01 19:37:15 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
// -------------------------------------------------------------------
//
@@ -22,7 +22,7 @@
//
//
// $Id: G4SynchrotronRadiation.cc,v 1.12 2004/12/01 19:37:15 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4UniversalFluctuation.cc,v 1.4 2005/05/03 13:37:43 urban Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4UniversalFluctuation.cc,v 1.7 2005/10/17 13:01:05 urban Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// -------------------------------------------------------------------
//
@@ -46,6 +46,9 @@
// 07-02-05 define problim = 5.e-3 (mma)
// 03-05-05 conditions of Gaussian fluctuation changed (bugfix)
// + smearing for very small loss (L.Urban)
// 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)
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -160,7 +163,6 @@ G4double G4UniversalFluctuation::SampleFluctuations(const G4Material* material,
e2Fluct = material->GetIonisation()->GetEnergy2fluct();
e1LogFluct = material->GetIonisation()->GetLogEnergy1fluct();
e2LogFluct = material->GetIonisation()->GetLogEnergy2fluct();
rateFluct = material->GetIonisation()->GetRateionexcfluct();
ipotFluct = material->GetIonisation()->GetMeanExcitationEnergy();
ipotLogFluct = material->GetIonisation()->GetLogMeanExcEnergy();
lastMaterial = material;
@@ -168,14 +170,17 @@ G4double G4UniversalFluctuation::SampleFluctuations(const G4Material* material,
G4double a1 = 0. , a2 = 0., a3 = 0. ;
G4double p1,p2,p3;
G4double rate = rateFluct ;
// 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;
if(w2 > ipotLogFluct)
{
G4double C = meanLoss*(1.-rateFluct)/(w2-ipotLogFluct);
G4double C = meanLoss*(1.-rate)/(w2-ipotLogFluct);
a1 = C*f1Fluct*(w2-e1LogFluct)/e1Fluct;
a2 = C*f2Fluct*(w2-e2LogFluct)/e2Fluct;
if(a2 < 0.)
@@ -190,7 +195,8 @@ G4double G4UniversalFluctuation::SampleFluctuations(const G4Material* material,
rate = 1. ;
}
a3 = rate*meanLoss*(tmax-ipotFluct)/(ipotFluct*tmax*log(w1));
if(tmax > ipotFluct)
a3 = rate*meanLoss*(tmax-ipotFluct)/(ipotFluct*tmax*log(w1));
G4double suma = a1+a2+a3;
@@ -269,7 +275,9 @@ G4double G4UniversalFluctuation::SampleFluctuations(const G4Material* material,
//
G4double e0 = material->GetIonisation()->GetEnergy0fluct();
a3 = meanLoss*(tmax-e0)/(tmax*e0*log(tmax/e0));
if(tmax <= e0) return meanLoss;
else a3 = meanLoss*(tmax-e0)/(tmax*e0*log(tmax/e0));
if (a3 > alim)
{
siga=sqrt(a3);
@@ -22,7 +22,7 @@
//
//
// $Id: G4VeEnergyLoss.cc,v 1.34 2004/12/01 19:37:15 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
// -----------------------------------------------------------------------------
@@ -22,7 +22,7 @@
//
//
// $Id: G4VhEnergyLoss.cc,v 1.48 2004/12/01 19:37:15 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
// -----------------------------------------------------------------------------
@@ -21,7 +21,7 @@
// ********************************************************************
//
// $Id: G4eBremsstrahlung.cc,v 1.42 2005/04/08 12:39:58 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
// -------------------------------------------------------------------
//
@@ -22,7 +22,7 @@
//
//
// $Id: G4eBremsstrahlung52.cc,v 1.5 2005/05/03 08:07:41 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// ------------ G4eBremsstrahlung52 physics process --------
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4eBremsstrahlungModel.cc,v 1.25 2005/05/03 08:07:41 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4eBremsstrahlungModel.cc,v 1.28 2005/10/08 20:31:22 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// -------------------------------------------------------------------
//
@@ -45,6 +45,7 @@
// 09-05-03 Fix problem of supression function + optimise sampling (V.Ivanchenko)
// 20-05-04 Correction to ensure unit independence (L.Urban)
// 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
// 03-08-05 Add extra protection at initialisation (V.Ivantchenko)
//
// Class Description:
//
@@ -126,19 +127,25 @@ void G4eBremsstrahlungModel::Initialise(const G4ParticleDefinition* p,
lowKinEnergy = LowEnergyLimit();
const G4ProductionCutsTable* theCoupleTable=
G4ProductionCutsTable::GetProductionCutsTable();
size_t numOfCouples = theCoupleTable->GetTableSize();
for (size_t ii=0; ii<partialSumSigma.size(); ii++){
G4DataVector* a=partialSumSigma[ii];
if ( a ) delete a;
}
partialSumSigma.clear();
for (size_t i=0; i<numOfCouples; i++) {
const G4MaterialCutsCouple* couple = theCoupleTable->GetMaterialCutsCouple(i);
const G4Material* material = couple->GetMaterial();
G4DataVector* dv = ComputePartialSumSigma(material, 0.5*highKinEnergy,
if(theCoupleTable) {
G4int numOfCouples = theCoupleTable->GetTableSize();
for (size_t ii=0; ii<partialSumSigma.size(); ii++){
G4DataVector* a=partialSumSigma[ii];
if ( a ) delete a;
}
partialSumSigma.clear();
if(numOfCouples>0) {
for (G4int i=0; i<numOfCouples; i++) {
const G4MaterialCutsCouple* couple = theCoupleTable->GetMaterialCutsCouple(i);
const G4Material* material = couple->GetMaterial();
G4DataVector* dv = ComputePartialSumSigma(material, 0.5*highKinEnergy,
min(cuts[i], 0.25*highKinEnergy));
partialSumSigma.push_back(dv);
partialSumSigma.push_back(dv);
}
}
}
if(pParticleChange)
fParticleChange = reinterpret_cast<G4ParticleChangeForLoss*>(pParticleChange);
@@ -629,10 +636,9 @@ std::vector<G4DynamicParticle*>* G4eBremsstrahlungModel::SampleSecondaries(
// A modified version of the random number techniques of Butcher & Messel is used
// (Nuc Phys 20(1960),15).
{
std::vector<G4DynamicParticle*>* newp = new std::vector<G4DynamicParticle*>;
G4double kineticEnergy = dp->GetKineticEnergy();
G4double tmax = min(maxEnergy, kineticEnergy);
if(tmin > tmax) tmin = tmax;
if(tmin >= tmax) return 0;
//
// GEANT4 internal units.
@@ -814,12 +820,18 @@ std::vector<G4DynamicParticle*>* G4eBremsstrahlungModel::SampleSecondaries(
G4ThreeVector gammaDirection(sint*cos(phi),sint*sin(phi), cos(theta));
gammaDirection.rotateUz(direction);
kineticEnergy -= gammaEnergy;
fParticleChange->SetProposedKineticEnergy(kineticEnergy);
// create G4DynamicParticle object for the Gamma
std::vector<G4DynamicParticle*>* newp = new std::vector<G4DynamicParticle*>;
G4DynamicParticle* g = new G4DynamicParticle(theGamma,gammaDirection,gammaEnergy);
newp->push_back(g);
G4double totMomentum = sqrt(kineticEnergy*(totalEnergy + electron_mass_c2));
G4ThreeVector dir = totMomentum*direction - gammaEnergy*gammaDirection;
direction = dir.unit();
fParticleChange->SetProposedMomentumDirection(direction);
fParticleChange->SetProposedKineticEnergy(kineticEnergy - gammaEnergy);
return newp;
}
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4eIonisation.cc,v 1.41 2005/05/01 20:26:24 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4eIonisation.cc,v 1.48 2005/10/02 16:38:11 maire Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// -------------------------------------------------------------------
//
@@ -59,6 +59,8 @@
// 12-11-03 G4EnergyLossSTD -> G4EnergyLossProcess (V.Ivanchenko)
// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivantchenko)
// 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
// 12-08-05 SetStepLimits(0.2, 0.1*mm) (mma)
// 02-09-05 Return SetStepLimits(1, 1*mm) (V.Ivantchenko)
//
// -------------------------------------------------------------------
//
@@ -106,9 +108,13 @@ void G4eIonisation::InitialiseEnergyLossProcess(const G4ParticleDefinition* part
//flucModel = new G4BohrFluctuations();
G4VEmModel* em = new G4MollerBhabhaModel();
em->SetLowEnergyLimit(0.1*keV);
em->SetHighEnergyLimit(100.0*TeV);
em->SetLowEnergyLimit(100*eV);
em->SetHighEnergyLimit(100*TeV);
AddEmModel(1, em, flucModel);
SetStepLimits(0.2, 1*mm);
SetIntegral(true);
isInitialised = true;
}
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4eIonisation52.cc,v 1.4 2004/12/01 19:37:15 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//--------------- G4eIonisation52 physics process --------------------------------
// by Laszlo Urban, 20 March 1997
@@ -21,7 +21,7 @@
// ********************************************************************
//
// $Id: G4eeToTwoGammaModel.cc,v 1.8 2005/04/29 18:02:35 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
// -------------------------------------------------------------------
//
@@ -21,7 +21,7 @@
// ********************************************************************
//
// $Id: G4eplusAnnihilation.cc,v 1.22 2005/05/12 11:06:43 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
// -------------------------------------------------------------------
//
@@ -22,7 +22,7 @@
//
//
// $Id: G4eplusAnnihilation52.cc,v 1.1 2005/05/04 16:16:12 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4hIonisation.cc,v 1.56 2005/04/08 12:39:58 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4hIonisation.cc,v 1.61 2005/10/02 16:38:11 maire Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// -------------------------------------------------------------------
//
@@ -31,7 +31,7 @@
// File name: G4hIonisation
//
// Author: Laszlo Urban
//
//
// Creation date: 30.05.1997
//
// Modifications:
@@ -69,6 +69,7 @@
// 27-05-04 Set integral to be a default regime (V.Ivanchenko)
// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivantchenko)
// 24-03-05 Optimize internal interfaces (V.Ivantchenko)
// 12-08-05 SetStepLimits(0.2, 0.1*mm) (mma)
//
// -------------------------------------------------------------------
//
@@ -140,7 +141,8 @@ void G4hIonisation::InitialiseEnergyLossProcess(const G4ParticleDefinition* part
em1->SetHighEnergyLimit(100.0*TeV);
AddEmModel(2, em1, flucModel);
SetStepLimits(0.2, 1.0*mm);
SetStepLimits(0.2, 1*mm);
SetIntegral(true);
isInitialised = true;
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4hIonisation52.cc,v 1.4 2004/12/01 19:37:16 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//---------------- G4hIonisation52 physics process -------------------------------
// by Laszlo Urban, 30 May 1997
@@ -21,7 +21,7 @@
// ********************************************************************
//
// $Id: G4ionIonisation.cc,v 1.33 2005/04/08 12:39:58 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
// -------------------------------------------------------------------
//