Import Geant4 5.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 10:15:15 +02:00
parent 37fff30d2e
commit fbd4999cf7
4396 changed files with 56662 additions and 52446 deletions
@@ -29,14 +29,21 @@
// File name: G4MuPairProductionModel
//
// Author: Vladimir Ivanchenko on base of Laszlo Urban code
//
//
// Creation date: 24.06.2002
//
// Modifications: 04.12.2002 Change G4DynamicParticle constructor in PostStep (VI)
// Modifications:
//
// 04-12-02 Change G4DynamicParticle constructor in PostStep (V.Ivanchenko)
// 23-12-02 Change interface in order to move to cut per region (V.Ivanchenko)
// 24-01-03 Fix for compounds (V.Ivanchenko)
// 27-01-03 Make models region aware (V.Ivanchenko)
// 13-02-03 Add model (V.Ivanchenko)
//
// Class Description:
//
// Class Description:
//
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -51,10 +58,11 @@
#include "G4Material.hh"
#include "G4Element.hh"
#include "G4ElementVector.hh"
#include "G4ProductionCutsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// static members
// static members
//
G4double G4MuPairProductionModel::zdat[]={1.,4.,13.,29.,92.};
G4double G4MuPairProductionModel::adat[]={1.01,9.01,26.98,63.55,238.03};
@@ -62,24 +70,21 @@ G4double G4MuPairProductionModel::tdat[]={1.e3,1.e4,1.e5,1.e6,1.e7,1.e8,1.e9,1.e
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4MuPairProductionModel::G4MuPairProductionModel(const G4ParticleDefinition* p)
: G4VEmModel(),
G4MuPairProductionModel::G4MuPairProductionModel(const G4ParticleDefinition* p,
const G4String& nam)
: G4VEmModel(nam),
minPairEnergy(4.*electron_mass_c2),
highKinEnergy(1000000.*TeV),
lowKinEnergy(minPairEnergy),
minThreshold(minPairEnergy),
nzdat(5),
ntdat(8),
NBIN(1000),
oldMaterial(0),
samplingTablesAreFilled(false)
{
partialSumSigma.clear();
}
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4MuPairProductionModel::~G4MuPairProductionModel()
G4MuPairProductionModel::~G4MuPairProductionModel()
{
size_t n = partialSumSigma.size();
if(n > 0) {
@@ -91,58 +96,87 @@ G4MuPairProductionModel::~G4MuPairProductionModel()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4MuPairProductionModel::HighEnergyLimit(const G4ParticleDefinition* p,
const G4Material*)
G4double G4MuPairProductionModel::HighEnergyLimit(const G4ParticleDefinition*)
{
return highKinEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4MuPairProductionModel::LowEnergyLimit(const G4ParticleDefinition* p,
const G4Material*)
G4double G4MuPairProductionModel::LowEnergyLimit(const G4ParticleDefinition*)
{
return lowKinEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4MuPairProductionModel::MinEnergyCut(const G4ParticleDefinition* p,
const G4Material* material)
G4double G4MuPairProductionModel::MinEnergyCut(const G4ParticleDefinition*,
const G4MaterialCutsCouple* couple)
{
G4double eCut = (G4Electron::Electron())->GetEnergyThreshold(material);
G4double pCut = (G4Positron::Positron())->GetEnergyThreshold(material);
G4double x = minPairEnergy;
size_t index = couple->GetIndex();
const G4ProductionCutsTable* theCoupleTable=
G4ProductionCutsTable::GetProductionCutsTable();
G4double eCut = (*(theCoupleTable->GetEnergyCutsVector(1)))[index];
G4double pCut = (*(theCoupleTable->GetEnergyCutsVector(2)))[index];
G4double x = 2.0*electron_mass_c2 + eCut + pCut;
if(x < minPairEnergy) x = minPairEnergy;
/*
if(eCut < highKinEnergy && pCut < highKinEnergy) {
x += eCut + pCut;
} else {
x = 0.5*highKinEnergy;
}
*/
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4bool G4MuPairProductionModel::IsInCharge(const G4ParticleDefinition* p,
const G4Material*)
G4bool G4MuPairProductionModel::IsInCharge(const G4ParticleDefinition* p)
{
return (p == G4MuonMinus::MuonMinus() || p == G4MuonPlus::MuonPlus());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4MuPairProductionModel::Initialise(const G4ParticleDefinition*,
const G4DataVector& cuts)
{
const G4ProductionCutsTable* theCoupleTable=
G4ProductionCutsTable::GetProductionCutsTable();
size_t numOfCouples = theCoupleTable->GetTableSize();
G4double fixedEnergy = sqrt(lowKinEnergy*highKinEnergy);
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, fixedEnergy,
G4std::min(cuts[i], 0.25*highKinEnergy));
partialSumSigma.push_back(dv);
}
if(!samplingTablesAreFilled) MakeSamplingTables();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4MuPairProductionModel::ComputeDEDX(const G4Material* material,
const G4ParticleDefinition* p,
G4double kineticEnergy,
G4double cutEnergy)
G4double cutEnergy)
{
G4double dedx = 0.0;
if(!samplingTablesAreFilled) {
minThreshold = MinEnergyCut(p, material);
MakeSamplingTables();
}
if(kineticEnergy < minPairEnergy) return dedx;
if(minPairEnergy >= cutEnergy) return dedx;
G4double cut = cutEnergy;
if(kineticEnergy <= cutEnergy) cut = kineticEnergy;
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomicNumDensityVector = material->GetAtomicNumDensityVector();
@@ -151,7 +185,7 @@ G4double G4MuPairProductionModel::ComputeDEDX(const G4Material* material,
G4double Z = (*theElementVector)[i]->GetZ();
G4double loss = ComputMuPairLoss(Z, kineticEnergy, cutEnergy);
G4double loss = ComputMuPairLoss(Z, kineticEnergy, cut);
dedx += loss*theAtomicNumDensityVector[i];
}
@@ -161,12 +195,12 @@ G4double G4MuPairProductionModel::ComputeDEDX(const G4Material* material,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4MuPairProductionModel::ComputMuPairLoss(G4double Z,
G4double G4MuPairProductionModel::ComputMuPairLoss(G4double Z,
G4double tkin, G4double cutEnergy)
{
static const
static const
G4double xgi[] ={ 0.0199,0.1017,0.2372,0.4083,0.5917,0.7628,0.8983,0.9801};
static const
static const
G4double wgi[] ={ 0.0506,0.1112,0.1569,0.1813,0.1813,0.1569,0.1112,0.0506};
static const G4double ak1=6.9;
static const G4double ak2=1.0;
@@ -176,20 +210,16 @@ G4double G4MuPairProductionModel::ComputMuPairLoss(G4double Z,
G4double loss = 0.0 ;
if (Z < 1. || cutEnergy < minPairEnergy) return loss;
G4double particleMass = (G4MuonPlus::MuonPlus())->GetPDGMass();
G4double tmax = tkin + particleMass*(1.-0.75*sqrte*z13);
// G4cout << "###DEDX tkin= " << tkin << " tmax= " << tmax << " tmin= " << minPairEnergy << G4endl;
if(tmax < minPairEnergy) tmax = minPairEnergy;
G4double cut = cutEnergy;
if(cut >= tmax) cut = tmax;
if(tmax <= cutEnergy) cut = tmax;
if(cut <= minPairEnergy) return loss;
// calculate the rectricted loss
// calculate the rectricted loss
// numerical integration in log(PairEnergy)
G4double bbb = log(cut) ;
G4int kkk = (G4int)((bbb-aaa)/ak1+ak2);
@@ -201,7 +231,7 @@ G4double G4MuPairProductionModel::ComputMuPairLoss(G4double Z,
for (G4int l=0 ; l<kkk; l++)
{
for (G4int ll=0; ll<8; ll++)
{
G4double ep = exp(x+xgi[ll]*hhh);
@@ -221,25 +251,23 @@ G4double G4MuPairProductionModel::ComputMuPairLoss(G4double Z,
G4double G4MuPairProductionModel::ComputeMicroscopicCrossSection(
G4double tkin,
G4double Z,
G4double A,
G4double A,
G4double cut)
{
{
static const G4double ak1=6.9 ;
static const G4double ak2=1.0 ;
static const G4double sqrte = sqrt(exp(1.)) ;
static const G4double
static const G4double
xgi[]={ 0.0199,0.1017,0.2372,0.4083,0.5917,0.7628,0.8983,0.9801 };
static const G4double
static const G4double
wgi[]={ 0.0506,0.1112,0.1569,0.1813,0.1813,0.1569,0.1112,0.0506 };
G4double z13 = pow(Z,0.333333333);
G4double cross = 0. ;
if(Z < 1.) return cross;
G4double particleMass = (G4MuonPlus::MuonPlus())->GetPDGMass();
G4double tmax = tkin + particleMass*(1.-0.75*sqrte*z13);
if(tmax < minPairEnergy) tmax = minPairEnergy;
if(tmax <= cut) return cross;
@@ -258,13 +286,13 @@ G4double G4MuPairProductionModel::ComputeMicroscopicCrossSection(
for(G4int i=0; i<8; i++)
{
G4double ep = exp(x + xgi[i]*hhh);
cross += ep*wgi[i]*ComputeDMicroscopicCrossSection(tkin, Z, ep);
}
aaa += hhh;
}
cross *=hhh;
cross *=hhh;
if(cross < 0.0) cross = 0.0;
return cross;
@@ -274,9 +302,9 @@ G4double G4MuPairProductionModel::ComputeMicroscopicCrossSection(
G4double G4MuPairProductionModel::ComputeDMicroscopicCrossSection(
G4double tkin,
G4double Z,
G4double Z,
G4double pairEnergy)
// Calculates the differential (D) microscopic cross section
// Calculates the differential (D) microscopic cross section
// using the cross section formula of R.P. Kokoulin (18/01/98)
{
@@ -310,7 +338,7 @@ G4double G4MuPairProductionModel::ComputeDMicroscopicCrossSection(
for (G4int i=0; i<7; i++)
{
G4double ro = 1.-exp(tmn*xgi[i]) ;
cross += wgi[i]*(1.-ro)*ComputeDDMicroscopicCrossSection(tkin,Z,pairEnergy,ro);
// cout << "ro= " << ro << " cross= " << cross << endl;
}
@@ -324,34 +352,34 @@ G4double G4MuPairProductionModel::ComputeDMicroscopicCrossSection(
G4double G4MuPairProductionModel::ComputeDDMicroscopicCrossSection(
G4double tkin,
G4double Z,
G4double Z,
G4double pairEnergy,
G4double asymmetry)
// Calculates the differential (D) microscopic cross section
// Calculates the differential (D) microscopic cross section
// using the cross section formula of R.P. Kokoulin (18/01/98)
{
static const G4double sqrte = sqrt(exp(1.)) ;
G4double bbbtf= 183. ;
G4double bbbh = 202.4 ;
G4double bbbh = 202.4 ;
G4double g1tf = 1.95e-5 ;
G4double g2tf = 5.3e-5 ;
G4double g1h = 4.4e-5 ;
G4double g2h = 4.8e-5 ;
G4double particleMass = (G4MuonPlus::MuonPlus())->GetPDGMass();
G4double totalEnergy = tkin + particleMass;
G4double energyLoss = totalEnergy - pairEnergy;
G4double massratio = particleMass/electron_mass_c2 ;
G4double massratio2 = massratio*massratio ;
G4double z13 = pow(Z,0.333333333);
G4double z23 = z13*z13 ;
G4double c3 = 3.*sqrte*particleMass/4. ;
G4double DDCrossSection = 0. ;
if(energyLoss <= c3*z13) return DDCrossSection ;
G4double c7 = 4.*electron_mass_c2 ;
@@ -393,8 +421,8 @@ G4double G4MuPairProductionModel::ComputeDDMicroscopicCrossSection(
G4double a1 = pairEnergy*pairEnergy/a0 ;
G4double bet = 0.5*a1 ;
G4double xi0 = 0.25*massratio2*a1 ;
G4double del = c8/a0 ;
G4double del = c8/a0 ;
G4double romin = 0. ;
G4double romax = (1.-del)*sqrt(1.-c7/pairEnergy) ;
@@ -409,7 +437,7 @@ G4double G4MuPairProductionModel::ComputeDDMicroscopicCrossSection(
G4double xii = 1./xi ;
G4double xi1 = 1.+xi ;
G4double screen = screen0*xi1/a5 ;
G4double yeu = 5.-a6+4.*bet*a7 ;
G4double yed = 2.*(1.+3.*bet)*log(3.+xii)-a6-a1*(2.-a6) ;
G4double yel = 1.+yeu/yed ;
@@ -444,10 +472,10 @@ G4double G4MuPairProductionModel::ComputeDDMicroscopicCrossSection(
DDCrossSection *= 4.*fine_structure_const*fine_structure_const
*classic_electr_radius*classic_electr_radius/(3.*pi) ;
DDCrossSection *= z2*energyLoss/(totalEnergy*pairEnergy) ;
return DDCrossSection ;
}
@@ -458,74 +486,52 @@ G4double G4MuPairProductionModel::CrossSection(const G4Material* material,
const G4ParticleDefinition* p,
G4double kineticEnergy,
G4double cutEnergy,
G4double maxEnergy)
G4double maxEnergy)
{
G4double cross = 0.0;
if(!samplingTablesAreFilled) {
minThreshold = MinEnergyCut(p, material);
MakeSamplingTables();
}
G4double tmax = G4std::min(maxEnergy, kineticEnergy);
G4double cut = G4std::max(cutEnergy, minThreshold);
if(cut >= tmax) return cross;
if(cutEnergy >= tmax) return cross;
const G4ElementVector* theElementVector = material->GetElementVector() ;
const G4double* theAtomNumDensityVector = material->GetAtomicNumDensityVector();
if(material != oldMaterial) {
oldMaterial = material;
G4double fixedEnergy = sqrt(lowKinEnergy*highKinEnergy);
ComputePartialSumSigma(material, fixedEnergy, cutEnergy);
}
for (size_t i=0; i<material->GetNumberOfElements(); i++) {
G4double Z = (*theElementVector)[i]->GetZ();
G4double A = (*theElementVector)[i]->GetA()/(g/mole) ;
G4double cr = ComputeMicroscopicCrossSection(kineticEnergy, Z, A, cutEnergy);
if(maxEnergy < kineticEnergy) {
cr -= ComputeMicroscopicCrossSection(kineticEnergy, Z, A, maxEnergy);
}
cross += theAtomNumDensityVector[i] * cr;
}
cross += theAtomNumDensityVector[i] * cr;
}
return cross;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4MuPairProductionModel::ComputePartialSumSigma(const G4Material* material,
G4double kineticEnergy,
G4double cut)
G4DataVector* G4MuPairProductionModel::ComputePartialSumSigma(
const G4Material* material,
G4double kineticEnergy,
G4double cut)
// Build the table of cross section per element. The table is built for MATERIALS.
// This table is used by DoIt to select randomly an element in the material.
// This table is used by DoIt to select randomly an element in the material.
{
size_t index = material->GetIndex();
G4int nElements = material->GetNumberOfElements();
const G4ElementVector* theElementVector = material->GetElementVector();
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomNumDensityVector = material->GetAtomicNumDensityVector();
G4DataVector* dv;
if (index >= partialSumSigma.size()) {
dv = new G4DataVector();
partialSumSigma.push_back(dv);
} else {
dv = partialSumSigma[index];
dv->clear();
if(0 == index) samplingTablesAreFilled = false;
}
G4DataVector* dv = new G4DataVector();
G4double cross = 0.0;
for (G4int i=0; i<nElements; i++ ) {
G4double Z = (*theElementVector)[i]->GetZ();
G4double A = (*theElementVector)[i]->GetA()/(g/mole) ;
@@ -533,6 +539,7 @@ void G4MuPairProductionModel::ComputePartialSumSigma(const G4Material* material,
Z, A, cut);
dv->push_back(cross);
}
return dv;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -556,28 +563,28 @@ void G4MuPairProductionModel::MakeSamplingTables()
G4double ymin = -5. ;
G4double ymax = 0. ;
G4double dy = (ymax-ymin)/NBIN ;
G4double dy = (ymax-ymin)/NBIN ;
G4double y = ymin - 0.5*dy ;
G4double yy = ymin - dy ;
G4double x = exp(y);
G4double fac = exp(dy);
G4double dx = exp(yy)*(fac - 1.0);
if(maxPairEnergy > minThreshold) {
G4double c = log(maxPairEnergy/minThreshold) ;
if(maxPairEnergy > minPairEnergy) {
G4double c = log(maxPairEnergy/minPairEnergy) ;
for (G4int i=0 ; i<NBIN; i++)
{
y += dy ;
x *= fac;
dx*= fac;
G4double ep = minThreshold*exp(c*x) ;
G4double ep = minPairEnergy*exp(c*x) ;
CrossSection += ep*dx*ComputeDMicroscopicCrossSection(
kineticEnergy, atomicNumber, ep);
ya[i]=y ;
proba[iz][it][i] = CrossSection ;
}
} else {
@@ -588,9 +595,9 @@ void G4MuPairProductionModel::MakeSamplingTables()
proba[iz][it][i] = 0.0 ;
}
}
ya[NBIN]=0. ;
proba[iz][it][NBIN] = CrossSection ;
if(CrossSection > 0.)
@@ -608,27 +615,38 @@ void G4MuPairProductionModel::MakeSamplingTables()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4std::vector<G4DynamicParticle*>* G4MuPairProductionModel::SampleSecondary(
const G4Material* aMaterial,
G4DynamicParticle* G4MuPairProductionModel::SampleSecondary(
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double,
G4double)
{
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4std::vector<G4DynamicParticle*>* G4MuPairProductionModel::SampleSecondaries(
const G4MaterialCutsCouple* couple,
const G4DynamicParticle* aDynamicParticle,
G4double minEnergy,
G4double maxEnergy)
G4double maxEnergy)
{
static const G4double esq = sqrt(exp(1.));
G4double kineticEnergy = aDynamicParticle->GetKineticEnergy();
G4double particleMass = aDynamicParticle->GetDefinition()->GetPDGMass();
G4ParticleMomentum ParticleDirection =
G4double particleMass = aDynamicParticle->GetDefinition()->GetPDGMass();
G4ParticleMomentum ParticleDirection =
aDynamicParticle->GetMomentumDirection();
// select randomly one element constituing the material
const G4Element* anElement = SelectRandomAtom(aMaterial);
// select randomly one element constituing the material
const G4Element* anElement = SelectRandomAtom(couple);
// limits of the energy sampling
G4double totalEnergy = kineticEnergy + particleMass ;
//G4double TotalMomentum = sqrt(KineticEnergy*(TotalEnergy+particleMass)) ;
G4double Z3 = anElement->GetIonisation()->GetZ3() ;
G4double maxPairEnergy = totalEnergy-0.75*esq*particleMass*Z3 ;
if(maxPairEnergy > maxEnergy) maxPairEnergy = maxEnergy;
if(maxPairEnergy > maxEnergy) maxPairEnergy = maxEnergy;
// check against insufficient energy
if(minEnergy >= maxPairEnergy) return 0;
@@ -671,7 +689,7 @@ G4std::vector<G4DynamicParticle*>* G4MuPairProductionModel::SampleSecondary(
{
G4double xc = log(minEnergy/minPairEnergy)/log(maxPairEnergy/minPairEnergy) ;
yc = log(xc) ;
iy = -1 ;
do {
iy += 1 ;
@@ -681,7 +699,7 @@ G4std::vector<G4DynamicParticle*>* G4MuPairProductionModel::SampleSecondary(
G4double norm = proba[izz][itt][iy] ;
G4double r = norm+G4UniformRand()*(1.-norm) ;
iy -= 1 ;
do {
iy += 1 ;
@@ -704,9 +722,9 @@ G4std::vector<G4DynamicParticle*>* G4MuPairProductionModel::SampleSecondary(
r = rmax * (-1.+2.*G4UniformRand()) ;
// compute energies from PairEnergy,r
G4double ElectronEnergy=(1.-r)*PairEnergy/2. ;
G4double ElectronEnergy=(1.-r)*PairEnergy/2. ;
G4double PositronEnergy=(1.+r)*PairEnergy/2. ;
// angles of the emitted particles ( Z - axis along the parent particle)
// (mean theta for the moment)
G4double Teta = electron_mass_c2/totalEnergy ;
@@ -721,12 +739,12 @@ G4std::vector<G4DynamicParticle*>* G4MuPairProductionModel::SampleSecondary(
ElectronMomentum = sqrt(ElectKineEnergy*(ElectronEnergy+electron_mass_c2));
G4ThreeVector ElectDirection ( dirx, diry, dirz );
ElectDirection.rotateUz(ParticleDirection);
// create G4DynamicParticle object for the particle1
ElectDirection.rotateUz(ParticleDirection);
// create G4DynamicParticle object for the particle1
G4DynamicParticle* aParticle1= new G4DynamicParticle();
aParticle1->SetDefinition(G4Electron::Electron());
aParticle1->SetMomentumDirection(ElectDirection);
aParticle1->SetMomentumDirection(ElectDirection);
aParticle1->SetKineticEnergy(ElectKineEnergy);
@@ -734,12 +752,12 @@ G4std::vector<G4DynamicParticle*>* G4MuPairProductionModel::SampleSecondary(
PositronMomentum = sqrt(PositKineEnergy*(PositronEnergy+electron_mass_c2));
G4ThreeVector PositDirection ( -dirx, -diry, dirz );
PositDirection.rotateUz(ParticleDirection);
// create G4DynamicParticle object for the particle2
PositDirection.rotateUz(ParticleDirection);
// create G4DynamicParticle object for the particle2
G4DynamicParticle* aParticle2= new G4DynamicParticle();
aParticle2->SetDefinition(G4Positron::Positron());
aParticle2->SetMomentumDirection(PositDirection);
aParticle2->SetMomentumDirection(PositDirection);
aParticle2->SetKineticEnergy(PositKineEnergy);
@@ -753,16 +771,17 @@ G4std::vector<G4DynamicParticle*>* G4MuPairProductionModel::SampleSecondary(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
const G4Element* G4MuPairProductionModel::SelectRandomAtom(
const G4Material* material) const
const G4MaterialCutsCouple* couple) const
{
// select randomly 1 element within the material
const G4Material* material = couple->GetMaterial();
G4int nElements = material->GetNumberOfElements();
const G4ElementVector* theElementVector = material->GetElementVector();
if(1 == nElements) return (*theElementVector)[0];
else if(1 > nElements) return 0;
else if(1 > nElements) return 0;
G4DataVector* dv = partialSumSigma[material->GetIndex()];
G4DataVector* dv = partialSumSigma[couple->GetIndex()];
G4double rval = G4UniformRand()*((*dv)[nElements-1]);
for (G4int i=0; i<nElements; i++) {
if (rval <= (*dv)[i]) return (*theElementVector)[i];