Import Geant4 5.1.0 source tree
This commit is contained in:
@@ -20,8 +20,8 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4eBremsstrahlungSpectrum.cc,v 1.7 2002/05/30 17:53:09 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-05-00 $
|
||||
// $Id: G4eBremsstrahlungSpectrum.cc,v 1.9 2003/02/28 08:42:18 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-05-01 $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
@@ -31,14 +31,16 @@
|
||||
// File name: G4eBremsstrahlungSpectrum
|
||||
//
|
||||
// Author: V.Ivanchenko (Vladimir.Ivanchenko@cern.ch)
|
||||
//
|
||||
//
|
||||
// Creation date: 29 September 2001
|
||||
//
|
||||
// Modifications:
|
||||
// Modifications:
|
||||
// 10.10.01 MGP Revision to improve code quality and consistency with design
|
||||
// 15.11.01 VI Update spectrum model Bethe-Haitler spectrum at high energy
|
||||
// 30.05.02 VI Update interpolation between 2 last energy points in the
|
||||
// parametrisation
|
||||
// 21.02.03 V.Ivanchenko Energy bins are defined in the constructor
|
||||
// 28.02.03 V.Ivanchenko Filename is defined in the constructor
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
@@ -47,36 +49,27 @@
|
||||
#include "Randomize.hh"
|
||||
|
||||
|
||||
G4eBremsstrahlungSpectrum::G4eBremsstrahlungSpectrum():
|
||||
G4VEnergySpectrum(),
|
||||
G4eBremsstrahlungSpectrum::G4eBremsstrahlungSpectrum(const G4DataVector& bins,
|
||||
const G4String& name):G4VEnergySpectrum(),
|
||||
lowestE(0.1*eV),
|
||||
length(15)
|
||||
xp(bins)
|
||||
{
|
||||
theBRparam = new G4BremsstrahlungParameters();
|
||||
xp.clear();
|
||||
for(size_t i=0; i<length; i++) {
|
||||
G4double x = 0.1*((G4double)i);
|
||||
if(i == 0) x = 0.01;
|
||||
if(i == 10) x = 0.95;
|
||||
if(i == 11) x = 0.97;
|
||||
if(i == 12) x = 0.99;
|
||||
if(i == 13) x = 0.995;
|
||||
if(i == 14) x = 1.0;
|
||||
xp.push_back(x);
|
||||
}
|
||||
length = xp.size();
|
||||
theBRparam = new G4BremsstrahlungParameters(name,length+1);
|
||||
|
||||
verbose = 0;
|
||||
}
|
||||
|
||||
|
||||
G4eBremsstrahlungSpectrum::~G4eBremsstrahlungSpectrum()
|
||||
G4eBremsstrahlungSpectrum::~G4eBremsstrahlungSpectrum()
|
||||
{
|
||||
delete theBRparam;
|
||||
}
|
||||
|
||||
|
||||
G4double G4eBremsstrahlungSpectrum::Probability(G4int Z,
|
||||
G4double tmin,
|
||||
G4double tmax,
|
||||
G4double G4eBremsstrahlungSpectrum::Probability(G4int Z,
|
||||
G4double tmin,
|
||||
G4double tmax,
|
||||
G4double e,
|
||||
G4int,
|
||||
const G4ParticleDefinition*) const
|
||||
@@ -95,20 +88,20 @@ G4double G4eBremsstrahlungSpectrum::Probability(G4int Z,
|
||||
for (size_t i=0; i<=length; i++) {
|
||||
p.push_back(theBRparam->Parameter(i, Z, e));
|
||||
}
|
||||
|
||||
|
||||
G4double x = IntSpectrum(t0, tm, p);
|
||||
G4double y = IntSpectrum(z, 1.0, p);
|
||||
G4double y = IntSpectrum(z, 1.0, p);
|
||||
|
||||
|
||||
if(1 < verbose) {
|
||||
G4cout << "tcut(MeV)= " << tmin/MeV
|
||||
<< "; tMax(MeV)= " << tmax/MeV
|
||||
<< "; t0= " << t0
|
||||
<< "; tm= " << tm
|
||||
G4cout << "tcut(MeV)= " << tmin/MeV
|
||||
<< "; tMax(MeV)= " << tmax/MeV
|
||||
<< "; t0= " << t0
|
||||
<< "; tm= " << tm
|
||||
<< "; xp[0]= " << xp[0]
|
||||
<< "; z= " << z
|
||||
<< "; val= " << x
|
||||
<< "; nor= " << y
|
||||
<< "; z= " << z
|
||||
<< "; val= " << x
|
||||
<< "; nor= " << y
|
||||
<< G4endl;
|
||||
}
|
||||
p.clear();
|
||||
@@ -117,13 +110,13 @@ G4double G4eBremsstrahlungSpectrum::Probability(G4int Z,
|
||||
else x = 0.0;
|
||||
// if(x < 0.0) x = 0.0;
|
||||
|
||||
return x;
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
G4double G4eBremsstrahlungSpectrum::AverageEnergy(G4int Z,
|
||||
G4double tmin,
|
||||
G4double tmax,
|
||||
G4double tmin,
|
||||
G4double tmax,
|
||||
G4double e,
|
||||
G4int,
|
||||
const G4ParticleDefinition*) const
|
||||
@@ -153,16 +146,16 @@ G4double G4eBremsstrahlungSpectrum::AverageEnergy(G4int Z,
|
||||
G4double f = Function(z0, p);
|
||||
x += 0.5*f*z0*(z0 - c*atan(z0/c));
|
||||
|
||||
x *= e;
|
||||
x *= e;
|
||||
|
||||
if(1 < verbose) {
|
||||
G4cout << "tcut(MeV)= " << tmin/MeV
|
||||
<< "; tMax(MeV)= " << tmax/MeV
|
||||
<< "; e(MeV)= " << e/MeV
|
||||
<< "; t0= " << t0
|
||||
<< "; tm= " << tm
|
||||
G4cout << "tcut(MeV)= " << tmin/MeV
|
||||
<< "; tMax(MeV)= " << tmax/MeV
|
||||
<< "; e(MeV)= " << e/MeV
|
||||
<< "; t0= " << t0
|
||||
<< "; tm= " << tm
|
||||
<< "; y= " << y
|
||||
<< "; x= " << x
|
||||
<< "; x= " << x
|
||||
<< G4endl;
|
||||
}
|
||||
p.clear();
|
||||
@@ -171,13 +164,13 @@ G4double G4eBremsstrahlungSpectrum::AverageEnergy(G4int Z,
|
||||
else x = 0.0;
|
||||
// if(x < 0.0) x = 0.0;
|
||||
|
||||
return x;
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
G4double G4eBremsstrahlungSpectrum::SampleEnergy(G4int Z,
|
||||
G4double tmin,
|
||||
G4double tmax,
|
||||
G4double tmin,
|
||||
G4double tmax,
|
||||
G4double e,
|
||||
G4int,
|
||||
const G4ParticleDefinition*) const
|
||||
@@ -194,7 +187,7 @@ G4double G4eBremsstrahlungSpectrum::SampleEnergy(G4int Z,
|
||||
for (size_t i=0; i<=length; i++) {
|
||||
p.push_back(theBRparam->Parameter(i, Z, e));
|
||||
}
|
||||
G4double amaj = G4std::max(p[15], 1. - (p[1] - p[0])/9.);
|
||||
G4double amaj = G4std::max(p[length], 1. - (p[1] - p[0])*xp[0]/(xp[1] - xp[0]) );
|
||||
|
||||
G4double amax = log(tm);
|
||||
G4double amin = log(t0);
|
||||
@@ -206,8 +199,8 @@ G4double G4eBremsstrahlungSpectrum::SampleEnergy(G4int Z,
|
||||
fun = Function(tgam, p);
|
||||
|
||||
if(fun > amaj) {
|
||||
G4cout << "WARNING in G4eBremsstrahlungSpectrum::SampleEnergy:"
|
||||
<< " Majoranta " << amaj
|
||||
G4cout << "WARNING in G4eBremsstrahlungSpectrum::SampleEnergy:"
|
||||
<< " Majoranta " << amaj
|
||||
<< " < " << fun
|
||||
<< G4endl;
|
||||
}
|
||||
@@ -219,19 +212,19 @@ G4double G4eBremsstrahlungSpectrum::SampleEnergy(G4int Z,
|
||||
|
||||
p.clear();
|
||||
|
||||
return tgam;
|
||||
return tgam;
|
||||
}
|
||||
|
||||
G4double G4eBremsstrahlungSpectrum::IntSpectrum(G4double xMin,
|
||||
G4double G4eBremsstrahlungSpectrum::IntSpectrum(G4double xMin,
|
||||
G4double xMax,
|
||||
const G4DataVector& p) const
|
||||
{
|
||||
G4double x1 = G4std::min(xMin, xp[0]);
|
||||
G4double x2 = G4std::min(xMax, xp[0]);
|
||||
G4double sum = 0.0;
|
||||
|
||||
|
||||
if(x1 < x2) {
|
||||
G4double k = (p[1] - p[0])/0.09;
|
||||
G4double k = (p[1] - p[0])/(xp[1] - xp[0]);
|
||||
sum += (1. - k*xp[0])*log(x2/x1) + k*(x2 - x1);
|
||||
}
|
||||
|
||||
@@ -248,7 +241,7 @@ G4double G4eBremsstrahlungSpectrum::IntSpectrum(G4double xMin,
|
||||
return sum;
|
||||
}
|
||||
|
||||
G4double G4eBremsstrahlungSpectrum::AverageValue(G4double xMin,
|
||||
G4double G4eBremsstrahlungSpectrum::AverageValue(G4double xMin,
|
||||
G4double xMax,
|
||||
const G4DataVector& p) const
|
||||
{
|
||||
@@ -257,9 +250,9 @@ G4double G4eBremsstrahlungSpectrum::AverageValue(G4double xMin,
|
||||
G4double z1 = x1;
|
||||
G4double z2 = x2;
|
||||
G4double sum = 0.0;
|
||||
|
||||
|
||||
if(x1 < x2) {
|
||||
G4double k = (p[1] - p[0])/0.09;
|
||||
G4double k = (p[1] - p[0])/(xp[1] - xp[0]);
|
||||
sum += (z2 - z1)*(1. - k*xp[0]);
|
||||
z1 *= x1;
|
||||
z2 *= x2;
|
||||
@@ -277,15 +270,15 @@ G4double G4eBremsstrahlungSpectrum::AverageValue(G4double xMin,
|
||||
}
|
||||
if(sum < 0.0) sum = 0.0;
|
||||
return sum;
|
||||
}
|
||||
|
||||
G4double G4eBremsstrahlungSpectrum::Function(G4double x,
|
||||
}
|
||||
|
||||
G4double G4eBremsstrahlungSpectrum::Function(G4double x,
|
||||
const G4DataVector& p) const
|
||||
{
|
||||
G4double f = 0.0;
|
||||
|
||||
|
||||
if(x <= xp[0]) {
|
||||
f = 1. + (p[1] - p[0])*(x - xp[0])/0.09;
|
||||
f = 1. + (p[1] - p[0])*(x - xp[0])/(xp[1] - xp[0]);
|
||||
|
||||
} else {
|
||||
|
||||
@@ -298,7 +291,7 @@ G4double G4eBremsstrahlungSpectrum::Function(G4double x,
|
||||
}
|
||||
}
|
||||
return f;
|
||||
}
|
||||
}
|
||||
|
||||
void G4eBremsstrahlungSpectrum::PrintData() const
|
||||
{ theBRparam->PrintData(); }
|
||||
@@ -311,6 +304,6 @@ G4double G4eBremsstrahlungSpectrum::Excitation(G4int Z, G4double kineticEnergy)
|
||||
G4double G4eBremsstrahlungSpectrum::MaxEnergyOfSecondaries(G4double kineticEnergy,
|
||||
G4int Z,
|
||||
const G4ParticleDefinition*) const
|
||||
{
|
||||
return kineticEnergy;
|
||||
{
|
||||
return kineticEnergy;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user