Import Geant4 6.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 10:41:53 +02:00
parent 4aea781e80
commit 96686e0c8f
6560 changed files with 153347 additions and 238155 deletions
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4MuPairProductionModel.cc,v 1.11 2003/06/16 17:01:50 gunter Exp $
// GEANT4 tag $Name: geant4-05-02 $
// $Id: G4MuPairProductionModel.cc,v 1.13 2003/10/21 13:30:05 maire Exp $
// GEANT4 tag $Name: geant4-06-00 $
//
// -------------------------------------------------------------------
//
@@ -42,6 +42,8 @@
// 27-01-03 Make models region aware (V.Ivanchenko)
// 13-02-03 Add model (V.Ivanchenko)
// 06-06-03 Fix in cross section calculation for high energy (V.Ivanchenko)
// 20-10-03 2*xi in ComputeDDMicroscopicCrossSection (R.Kokoulin)
// 8 integration points in ComputeDMicroscopicCrossSection
//
// Class Description:
@@ -49,8 +51,8 @@
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4MuPairProductionModel.hh"
#include "G4Electron.hh"
@@ -69,9 +71,10 @@
//
G4double G4MuPairProductionModel::zdat[]={1.,4.,13.,29.,92.};
G4double G4MuPairProductionModel::adat[]={1.01,9.01,26.98,63.55,238.03};
G4double G4MuPairProductionModel::tdat[]={1.e3,1.e4,1.e5,1.e6,1.e7,1.e8,1.e9,1.e10};
G4double G4MuPairProductionModel::tdat[]={1.e3,1.e4,1.e5,1.e6,1.e7,1.e8,
1.e9,1.e10};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4MuPairProductionModel::G4MuPairProductionModel(const G4ParticleDefinition*,
const G4String& nam)
@@ -83,9 +86,9 @@ G4MuPairProductionModel::G4MuPairProductionModel(const G4ParticleDefinition*,
ntdat(8),
NBIN(1000),
samplingTablesAreFilled(false)
{}
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4MuPairProductionModel::~G4MuPairProductionModel()
{
@@ -97,109 +100,108 @@ G4MuPairProductionModel::~G4MuPairProductionModel()
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuPairProductionModel::HighEnergyLimit(const G4ParticleDefinition*)
{
return highKinEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuPairProductionModel::LowEnergyLimit(const G4ParticleDefinition*)
{
return lowKinEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuPairProductionModel::MinEnergyCut(const G4ParticleDefinition*,
const G4MaterialCutsCouple* couple)
const G4MaterialCutsCouple* couple)
{
size_t index = couple->GetIndex();
const G4ProductionCutsTable* theCoupleTable=
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;
G4double x = 2*electron_mass_c2 + eCut + pCut;
if(x < minPairEnergy) x = minPairEnergy;
/*
if(eCut < highKinEnergy && pCut < highKinEnergy) {
x += eCut + pCut;
} else {
x = 0.5*highKinEnergy;
}
*/
//// 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)
{
return (p == G4MuonMinus::MuonMinus() || p == G4MuonPlus::MuonPlus());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuPairProductionModel::Initialise(const G4ParticleDefinition*,
const G4DataVector& cuts)
{
const G4ProductionCutsTable* theCoupleTable=
const G4ProductionCutsTable* theCoupleTable =
G4ProductionCutsTable::GetProductionCutsTable();
size_t numOfCouples = theCoupleTable->GetTableSize();
G4double fixedEnergy = sqrt(lowKinEnergy*highKinEnergy);
for (size_t ii=0; ii<partialSumSigma.size(); ii++){
for (size_t ii=0; ii<partialSumSigma.size(); ii++) {
G4DataVector* a=partialSumSigma[ii];
if ( a ) delete a;
if ( a ) delete a;
}
partialSumSigma.clear();
for (size_t i=0; i<numOfCouples; i++) {
const G4MaterialCutsCouple* couple = theCoupleTable->GetMaterialCutsCouple(i);
const G4MaterialCutsCouple* couple=theCoupleTable->GetMaterialCutsCouple(i);
const G4Material* material = couple->GetMaterial();
G4DataVector* dv = ComputePartialSumSigma(material, fixedEnergy,
std::min(cuts[i], 0.25*highKinEnergy));
partialSumSigma.push_back(dv);
}
if(!samplingTablesAreFilled) MakeSamplingTables();
if (!samplingTablesAreFilled) MakeSamplingTables();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuPairProductionModel::ComputeDEDX(const G4Material* material,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy)
G4double
G4MuPairProductionModel::ComputeDEDX(const G4MaterialCutsCouple* couple,
const G4ParticleDefinition*,
G4double kineticEnergy, G4double cutEnergy)
{
G4double dedx = 0.0;
if(minPairEnergy >= cutEnergy) return dedx;
if (minPairEnergy >= cutEnergy) return dedx;
G4double cut = cutEnergy;
if(kineticEnergy <= cutEnergy) cut = kineticEnergy;
if (kineticEnergy <= cutEnergy) cut = kineticEnergy;
const G4Material* material = couple->GetMaterial();
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomicNumDensityVector = material->GetAtomicNumDensityVector();
const G4double* theAtomicNumDensityVector =
material->GetAtomicNumDensityVector();
// loop for elements in the material
for (size_t i=0; i<material->GetNumberOfElements(); i++) {
G4double Z = (*theElementVector)[i]->GetZ();
G4double loss = ComputMuPairLoss(Z, kineticEnergy, cut);
dedx += loss*theAtomicNumDensityVector[i];
G4double Z = (*theElementVector)[i]->GetZ();
G4double loss = ComputMuPairLoss(Z, kineticEnergy, cut);
dedx += loss*theAtomicNumDensityVector[i];
}
if(dedx < 0.) dedx = 0.;
if (dedx < 0.) dedx = 0.;
return dedx;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuPairProductionModel::ComputMuPairLoss(G4double Z,
G4double tkin, G4double cutEnergy)
G4double
G4MuPairProductionModel::ComputMuPairLoss(G4double Z,
G4double tkin, G4double cutEnergy)
{
static const
G4double xgi[] ={ 0.0199,0.1017,0.2372,0.4083,0.5917,0.7628,0.8983,0.9801};
@@ -211,45 +213,39 @@ G4double G4MuPairProductionModel::ComputMuPairLoss(G4double Z,
static const G4double aaa = log(minPairEnergy);
G4double z13 = pow(Z,0.333333333);
G4double loss = 0.0 ;
G4double loss = 0.0;
G4double particleMass = (G4MuonPlus::MuonPlus())->GetPDGMass();
G4double tmax = tkin + particleMass*(1.-0.75*sqrte*z13);
// G4cout << "###DEDX tkin= " << tkin << " tmax= " << tmax << " tmin= " << minPairEnergy << G4endl;
G4double cut = cutEnergy;
if(tmax <= cutEnergy) cut = tmax;
if(cut <= minPairEnergy) return loss;
// calculate the rectricted loss
// numerical integration in log(PairEnergy)
G4double bbb = log(cut) ;
G4double bbb = log(cut);
G4int kkk = (G4int)((bbb-aaa)/ak1+ak2);
if(kkk > 8) kkk = 8;
G4double hhh = (bbb-aaa)/(G4double)kkk ;
if (kkk > 8) kkk = 8;
G4double hhh = (bbb-aaa)/(G4double)kkk;
G4double x = aaa;
// G4cout << "###DEDX tkin= " << tkin << " cut= " << cut << " kkk= " << kkk << G4endl;
for (G4int l=0 ; l<kkk; l++)
{
for (G4int ll=0; ll<8; ll++)
{
G4double ep = exp(x+xgi[ll]*hhh);
// G4cout << "ep= " << ep << G4endl;
loss += wgi[ll]*ep*ep*ComputeDMicroscopicCrossSection(tkin, Z, ep);
}
x += hhh;
}
loss *= hhh ;
// cout << "### tmax= " << tmax << " hhh= " << hhh << " loss= " << loss << endl;
loss *= hhh;
if (loss < 0.) loss = 0.;
return loss ;
return loss;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuPairProductionModel::ComputeMicroscopicCrossSection(
G4double tkin,
@@ -259,7 +255,7 @@ G4double G4MuPairProductionModel::ComputeMicroscopicCrossSection(
{
static const G4double ak1=6.9 ;
static const G4double ak2=1.0 ;
static const G4double sqrte = sqrt(exp(1.)) ;
static const G4double sqrte = sqrt(exp(1.));
static const G4double
xgi[]={ 0.0199,0.1017,0.2372,0.4083,0.5917,0.7628,0.8983,0.9801 };
static const G4double
@@ -271,7 +267,7 @@ G4double G4MuPairProductionModel::ComputeMicroscopicCrossSection(
G4double particleMass = (G4MuonPlus::MuonPlus())->GetPDGMass();
G4double tmax = tkin + particleMass*(1.-0.75*sqrte*z13);
if(tmax <= cut) return cross;
if (tmax <= cut) return cross;
G4double aaa = log(cut);
G4double bbb = log(tmax);
@@ -282,11 +278,9 @@ G4double G4MuPairProductionModel::ComputeMicroscopicCrossSection(
for(G4int l=0; l<kkk; l++)
{
for(G4int i=0; i<8; i++)
{
G4double ep = exp(x + xgi[i]*hhh);
cross += ep*wgi[i]*ComputeDMicroscopicCrossSection(tkin, Z, ep);
}
x += hhh;
@@ -294,10 +288,6 @@ G4double G4MuPairProductionModel::ComputeMicroscopicCrossSection(
cross *=hhh;
if(cross < 0.0) cross = 0.0;
/*
G4cout << "###Cross tkin= " << tkin << " cut= " << cut << " kkk= " << kkk
<< " cross= " << cross << G4endl;
*/
return cross;
}
@@ -310,7 +300,6 @@ G4double G4MuPairProductionModel::ComputeDMicroscopicCrossSection(
// Calculates the differential (D) microscopic cross section
// using the cross section formula of R.P. Kokoulin (18/01/98)
{
static const G4double
xgi[] ={ 0.0199,0.1017,0.2372,0.4083,0.5917,0.7628,0.8983,0.9801 };
@@ -326,22 +315,17 @@ G4double G4MuPairProductionModel::ComputeDMicroscopicCrossSection(
G4double b = 4.*electron_mass_c2/pairEnergy;
G4double tmn = (b+2.*a*(1.-b))/(1.+(1.-a)*sqrt(1.-b));
if(tmn <= 0.) return cross;
tmn = log(tmn);
// Gaussian integration in ln(1-ro) ( with 8 points)
for (G4int i=0; i<7; i++)
for (G4int i=0; i<8; i++)
{
G4double ro = 1.-exp(tmn*xgi[i]) ;
cross += wgi[i]*(1.-ro)*ComputeDDMicroscopicCrossSection(tkin,Z,pairEnergy,ro);
// cout << "ro= " << ro << " cross= " << cross << endl;
G4double ro = 1.-exp(tmn*xgi[i]);
cross += wgi[i]*(1.-ro)*ComputeDDMicroscopicCrossSection(
tkin,Z,pairEnergy,ro);
}
cross *= -tmn ;
cross *= -tmn;
return cross;
}
@@ -376,32 +360,20 @@ G4double G4MuPairProductionModel::ComputeDDMicroscopicCrossSection(
G4double c3 = 3.*sqrte*particleMass/4. ;
G4double DDCrossSection = 0. ;
if (energyLoss <= c3*z13) return DDCrossSection;
if(energyLoss <= c3*z13) return DDCrossSection ;
G4double c7 = 4.*electron_mass_c2 ;
G4double c8 = 6.*particleMass*particleMass ;
G4double alf = c7/pairEnergy ;
G4double a3 = 1. - alf ;
if(a3 <= 0.) return DDCrossSection ;
G4double c7 = 4.*electron_mass_c2;
G4double c8 = 6.*particleMass*particleMass;
G4double alf = c7/pairEnergy;
G4double a3 = 1. - alf;
if (a3 <= 0.) return DDCrossSection;
// zeta calculation
G4double bbb,g1,g2,zeta1,zeta2,zeta,z2 ;
if( Z < 1.5 )
{
bbb = bbbh ;
g1 = g1h ;
g2 = g2h ;
}
else
{
bbb = bbbtf ;
g1 = g1tf ;
g2 = g2tf ;
}
G4double bbb,g1,g2,zeta1,zeta2,zeta,z2;
if( Z < 1.5 ) { bbb = bbbh ; g1 = g1h ; g2 = g2h ; }
else { bbb = bbbtf; g1 = g1tf; g2 = g2tf; }
zeta1 = 0.073 * log(totalEnergy/(particleMass+g1*z23*totalEnergy))-0.26 ;
if( zeta1 > 0.)
if ( zeta1 > 0.)
{
zeta2 = 0.058*log(totalEnergy/(particleMass+g2*z13*totalEnergy))-0.14 ;
zeta = zeta1/zeta2 ;
@@ -411,19 +383,19 @@ G4double G4MuPairProductionModel::ComputeDDMicroscopicCrossSection(
zeta = 0. ;
}
z2 = Z*(Z+zeta) ;
z2 = Z*(Z+zeta);
G4double screen0 = 2.*electron_mass_c2*sqrte*bbb/(z13*pairEnergy) ;
G4double a0 = totalEnergy*energyLoss ;
G4double a1 = pairEnergy*pairEnergy/a0 ;
G4double bet = 0.5*a1 ;
G4double xi0 = 0.25*massratio2*a1 ;
G4double del = c8/a0 ;
G4double screen0 = 2.*electron_mass_c2*sqrte*bbb/(z13*pairEnergy);
G4double a0 = totalEnergy*energyLoss;
G4double a1 = pairEnergy*pairEnergy/a0;
G4double bet = 0.5*a1;
G4double xi0 = 0.25*massratio2*a1;
G4double del = c8/a0;
G4double romin = 0. ;
G4double romax = (1.-del)*sqrt(1.-c7/pairEnergy) ;
G4double romax = (1.-del)*sqrt(1.-c7/pairEnergy);
if((asymmetry < romin) || (asymmetry > romax)) return DDCrossSection ;
if((asymmetry < romin) || (asymmetry > romax)) return DDCrossSection;
G4double a4 = 1.-asymmetry ;
G4double a5 = a4*(2.-a4) ;
@@ -440,103 +412,96 @@ G4double G4MuPairProductionModel::ComputeDDMicroscopicCrossSection(
G4double yel = 1.+yeu/yed ;
G4double ale=log(bbb/z13*sqrt(xi1*yel)/(1.+screen*yel)) ;
G4double cre = 0.5*log(1.+2.25/(massratio2*z23)*xi1*yel) ;
G4double be ;
if(xi <= 1.e3)
be = ((2.+a6)*(1.+bet)+xi*a9)*log(1.+xii)+(a5-bet)/xi1-a9;
else
be = (3.-a6+a1*a7)/(2.+xi) ;
G4double fe = (ale-cre)*be ;
if( fe < 0.)
fe = 0. ;
G4double be;
if (xi <= 1.e3) be = ((2.+a6)*(1.+bet)+xi*a9)*log(1.+xii)+(a5-bet)/xi1-a9;
else be = (3.-a6+a1*a7)/(2*xi);
G4double fe = (ale-cre)*be;
if ( fe < 0.) fe = 0. ;
G4double ymu = 4.+a6 +3.*bet*a7 ;
G4double ymd = a7*(1.5+a1)*log(3.+xi)+1.-1.5*a6 ;
G4double ym1 = 1.+ymu/ymd ;
G4double alm_crm = log(bbb*massratio/(1.5*z23*(1.+screen*ym1))) ;
G4double a10,bm ;
if( xi >= 1.e-3)
G4double alm_crm = log(bbb*massratio/(1.5*z23*(1.+screen*ym1)));
G4double a10,bm;
if ( xi >= 1.e-3)
{
a10 = (1.+a1)*a5 ;
bm = (a7*(1.+1.5*bet)-a10*xii)*log(xi1)+xi*(a5-bet)/xi1+a10 ;
bm = (a7*(1.+1.5*bet)-a10*xii)*log(xi1)+xi*(a5-bet)/xi1+a10;
}
else
bm = (5.-a6+bet*a9)*(xi/2.) ;
G4double fm = alm_crm*bm ;
if( fm < 0.)
fm = 0. ;
bm = (5.-a6+bet*a9)*(xi/2.);
G4double fm = alm_crm*bm;
if ( fm < 0.) fm = 0. ;
DDCrossSection = (fe+fm/massratio2) ;
DDCrossSection = (fe+fm/massratio2);
DDCrossSection *= 4.*fine_structure_const*fine_structure_const
*classic_electr_radius*classic_electr_radius/(3.*pi) ;
*classic_electr_radius*classic_electr_radius/(3.*pi);
DDCrossSection *= z2*energyLoss/(totalEnergy*pairEnergy) ;
DDCrossSection *= z2*energyLoss/(totalEnergy*pairEnergy);
return DDCrossSection ;
return DDCrossSection;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuPairProductionModel::CrossSection(const G4Material* material,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy,
G4double maxEnergy)
G4double
G4MuPairProductionModel::CrossSection(const G4MaterialCutsCouple* couple,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy, G4double maxEnergy)
{
G4double cross = 0.0;
G4double tmax = std::min(maxEnergy, kineticEnergy);
if(cutEnergy >= tmax) return cross;
if (cutEnergy >= tmax) return cross;
const G4ElementVector* theElementVector = material->GetElementVector() ;
const G4double* theAtomNumDensityVector = material->GetAtomicNumDensityVector();
const G4Material* material = couple->GetMaterial();
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomNumDensityVector=material->GetAtomicNumDensityVector();
for (size_t i=0; i<material->GetNumberOfElements(); i++) {
G4double Z = (*theElementVector)[i]->GetZ();
G4double cr = ComputeMicroscopicCrossSection(kineticEnergy, Z, cutEnergy);
if(maxEnergy < kineticEnergy) {
if (maxEnergy < kineticEnergy) {
cr -= ComputeMicroscopicCrossSection(kineticEnergy, Z, maxEnergy);
}
cross += theAtomNumDensityVector[i] * cr;
}
//G4cout << "e= " << kineticEnergy << " sigma= " << cross << G4endl;
return cross;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4DataVector* G4MuPairProductionModel::ComputePartialSumSigma(
const G4Material* material,
G4double kineticEnergy,
G4double cut)
// Build the table of cross section per element. The table is built for MATERIALS.
// Build the table of cross section per element.
// This table is used by DoIt to select randomly an element in the material.
{
G4int nElements = material->GetNumberOfElements();
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomNumDensityVector = material->GetAtomicNumDensityVector();
const G4double* theAtomNumDensityVector=material->GetAtomicNumDensityVector();
G4DataVector* dv = new G4DataVector();
G4double cross = 0.0;
for (G4int i=0; i<nElements; i++ ) {
G4double Z = (*theElementVector)[i]->GetZ();
cross += theAtomNumDensityVector[i] * ComputeMicroscopicCrossSection(kineticEnergy,
Z, cut);
cross += theAtomNumDensityVector[i] * ComputeMicroscopicCrossSection(
kineticEnergy, Z, cut);
dv->push_back(cross);
}
return dv;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuPairProductionModel::MakeSamplingTables()
{
@@ -565,9 +530,8 @@ void G4MuPairProductionModel::MakeSamplingTables()
G4double fac = exp(dy);
G4double dx = exp(yy)*(fac - 1.0);
if(maxPairEnergy > minPairEnergy) {
G4double c = log(maxPairEnergy/minPairEnergy) ;
if (maxPairEnergy > minPairEnergy) {
G4double c = log(maxPairEnergy/minPairEnergy);
for (G4int i=0 ; i<NBIN; i++)
{
y += dy ;
@@ -576,23 +540,21 @@ void G4MuPairProductionModel::MakeSamplingTables()
G4double ep = minPairEnergy*exp(c*x) ;
CrossSection += ep*dx*ComputeDMicroscopicCrossSection(
kineticEnergy, atomicNumber, ep);
ya[i]=y ;
proba[iz][it][i] = CrossSection ;
ya[i] = y;
proba[iz][it][i] = CrossSection;
}
} else {
for (G4int i=0 ; i<NBIN; i++)
{
y += dy ;
ya[i]=y ;
proba[iz][it][i] = 0.0 ;
y += dy ;
ya[i] = y ;
proba[iz][it][i] = 0.0 ;
}
}
ya[NBIN]=0. ;
proba[iz][it][NBIN] = CrossSection ;
proba[iz][it][NBIN] = CrossSection;
if(CrossSection > 0.)
{
@@ -607,7 +569,7 @@ void G4MuPairProductionModel::MakeSamplingTables()
samplingTablesAreFilled = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4DynamicParticle* G4MuPairProductionModel::SampleSecondary(
const G4MaterialCutsCouple*,
@@ -618,7 +580,7 @@ G4DynamicParticle* G4MuPairProductionModel::SampleSecondary(
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
std::vector<G4DynamicParticle*>* G4MuPairProductionModel::SampleSecondaries(
const G4MaterialCutsCouple* couple,
@@ -681,38 +643,31 @@ std::vector<G4DynamicParticle*>* G4MuPairProductionModel::SampleSecondaries(
iy = 0 ;
else
{
G4double xc = log(minEnergy/minPairEnergy)/log(maxPairEnergy/minPairEnergy) ;
yc = log(xc) ;
iy = -1 ;
do {
iy += 1 ;
} while ((ya[iy] < yc )&&(iy < NBINminus1)) ;
G4double xc = log(minEnergy/minPairEnergy)/log(maxPairEnergy/minPairEnergy);
yc = log(xc) ;
iy = -1 ;
do { iy += 1;} while ((ya[iy] < yc )&&(iy < NBINminus1));
}
G4double norm = proba[izz][itt][iy] ;
G4double norm = proba[izz][itt][iy];
G4double r = norm+G4UniformRand()*(1.-norm) ;
G4double r = norm+G4UniformRand()*(1.-norm);
iy -= 1 ;
do {
iy += 1 ;
} while ((proba[izz][itt][iy] < r)&&(iy < NBINminus1)) ;
iy -= 1;
do { iy += 1;} while ((proba[izz][itt][iy] < r)&&(iy < NBINminus1));
//sampling is uniformly in y in the bin
if( iy < NBIN )
y = ya[iy] + G4UniformRand() * ( ya[iy+1] - ya[iy]) ;
else
y = ya[iy] ;
if( iy < NBIN ) y = ya[iy] + G4UniformRand() * ( ya[iy+1] - ya[iy]);
else y = ya[iy];
x = exp(y) ;
x = exp(y);
PairEnergy = minPairEnergy*exp(x*log(maxPairEnergy/minPairEnergy)) ;
PairEnergy = minPairEnergy*exp(x*log(maxPairEnergy/minPairEnergy));
// sample r=(E+-E-)/PairEnergy ( uniformly .....)
G4double rmax = (1.-6.*particleMass*particleMass/(totalEnergy*
(totalEnergy-PairEnergy)))
*sqrt(1.-minPairEnergy/PairEnergy) ;
*sqrt(1.-minPairEnergy/PairEnergy);
r = rmax * (-1.+2.*G4UniformRand()) ;
// compute energies from PairEnergy,r
@@ -762,7 +717,7 @@ std::vector<G4DynamicParticle*>* G4MuPairProductionModel::SampleSecondaries(
return vdp;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const G4Element* G4MuPairProductionModel::SelectRandomAtom(
const G4MaterialCutsCouple* couple) const
@@ -772,8 +727,8 @@ const G4Element* G4MuPairProductionModel::SelectRandomAtom(
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;
if (nElements == 1) return (*theElementVector)[0];
else if (nElements < 1) return 0;
G4DataVector* dv = partialSumSigma[couple->GetIndex()];
G4double rval = G4UniformRand()*((*dv)[nElements-1]);