G4eBremsstrahlungSpectrum Class Reference

#include <G4eBremsstrahlungSpectrum.hh>

Inheritance diagram for G4eBremsstrahlungSpectrum:

G4VEnergySpectrum

Public Member Functions

 G4eBremsstrahlungSpectrum (const G4DataVector &bins, const G4String &name)
 ~G4eBremsstrahlungSpectrum ()
G4double Probability (G4int Z, G4double tMin, G4double tMax, G4double kineticEnergy, G4int shell=0, const G4ParticleDefinition *pd=0) const
G4double AverageEnergy (G4int Z, G4double tMin, G4double tMax, G4double kineticEnergy, G4int shell=0, const G4ParticleDefinition *pd=0) const
G4double SampleEnergy (G4int Z, G4double tMin, G4double tMax, G4double kineticEnergy, G4int shell=0, const G4ParticleDefinition *pd=0) const
G4double MaxEnergyOfSecondaries (G4double kineticEnergy, G4int Z=0, const G4ParticleDefinition *pd=0) const
G4double Excitation (G4int Z, G4double kineticEnergy) const
void PrintData () const

Detailed Description

Definition at line 65 of file G4eBremsstrahlungSpectrum.hh.


Constructor & Destructor Documentation

G4eBremsstrahlungSpectrum::G4eBremsstrahlungSpectrum ( const G4DataVector bins,
const G4String name 
)

Definition at line 54 of file G4eBremsstrahlungSpectrum.cc.

00055                        :G4VEnergySpectrum(),
00056   lowestE(0.1*eV),
00057   xp(bins)
00058 {
00059   length = xp.size();
00060   theBRparam = new G4BremsstrahlungParameters(name,length+1);
00061 
00062   verbose = 0;
00063 }

G4eBremsstrahlungSpectrum::~G4eBremsstrahlungSpectrum (  ) 

Definition at line 66 of file G4eBremsstrahlungSpectrum.cc.

00067 {
00068   delete theBRparam;
00069 }


Member Function Documentation

G4double G4eBremsstrahlungSpectrum::AverageEnergy ( G4int  Z,
G4double  tMin,
G4double  tMax,
G4double  kineticEnergy,
G4int  shell = 0,
const G4ParticleDefinition pd = 0 
) const [virtual]

Implements G4VEnergySpectrum.

Definition at line 119 of file G4eBremsstrahlungSpectrum.cc.

References G4cout, G4endl, G4BremsstrahlungParameters::Parameter(), and G4BremsstrahlungParameters::ParameterC().

00125 {
00126   G4double tm = std::min(tmax, e);
00127   G4double t0 = std::max(tmin, lowestE);
00128   if(t0 >= tm) return 0.0;
00129 
00130   t0 /= e;
00131   tm /= e;
00132 
00133   G4double z0 = lowestE/e;
00134 
00135   G4DataVector p;
00136 
00137   // Access parameters
00138   for (size_t i=0; i<=length; i++) {
00139       p.push_back(theBRparam->Parameter(i, Z, e));
00140   }
00141 
00142   G4double x  = AverageValue(t0, tm, p);
00143   G4double y  = IntSpectrum(z0, 1.0, p);
00144 
00145   // Add integrant over lowest energies
00146   G4double zmin = tmin/e;
00147   if(zmin < t0) {
00148     G4double c  = std::sqrt(theBRparam->ParameterC(Z));
00149     x += p[0]*(t0 - zmin - c*(std::atan(t0/c) - std::atan(zmin/c)));
00150   }
00151   x *= e;
00152 
00153   if(1 < verbose) {
00154     G4cout << "tcut(MeV)= " << tmin/MeV
00155            << "; tMax(MeV)= " << tmax/MeV
00156            << "; e(MeV)= " << e/MeV
00157            << "; t0= " << t0
00158            << "; tm= " << tm
00159            << "; y= " << y
00160            << "; x= " << x
00161            << G4endl;
00162   }
00163   p.clear();
00164 
00165   if(y > 0.0) x /= y;
00166   else        x  = 0.0;
00167   //  if(x < 0.0) x  = 0.0;
00168 
00169   return x;
00170 }

G4double G4eBremsstrahlungSpectrum::Excitation ( G4int  Z,
G4double  kineticEnergy 
) const [virtual]

Implements G4VEnergySpectrum.

Definition at line 301 of file G4eBremsstrahlungSpectrum.cc.

00302 {
00303   return 0.0;
00304 }

G4double G4eBremsstrahlungSpectrum::MaxEnergyOfSecondaries ( G4double  kineticEnergy,
G4int  Z = 0,
const G4ParticleDefinition pd = 0 
) const [virtual]

Implements G4VEnergySpectrum.

Definition at line 306 of file G4eBremsstrahlungSpectrum.cc.

00309 {
00310   return kineticEnergy;
00311 }

void G4eBremsstrahlungSpectrum::PrintData (  )  const [virtual]

Implements G4VEnergySpectrum.

Definition at line 298 of file G4eBremsstrahlungSpectrum.cc.

References G4BremsstrahlungParameters::PrintData().

00299 { theBRparam->PrintData(); }

G4double G4eBremsstrahlungSpectrum::Probability ( G4int  Z,
G4double  tMin,
G4double  tMax,
G4double  kineticEnergy,
G4int  shell = 0,
const G4ParticleDefinition pd = 0 
) const [virtual]

Implements G4VEnergySpectrum.

Definition at line 72 of file G4eBremsstrahlungSpectrum.cc.

References G4cout, G4endl, and G4BremsstrahlungParameters::Parameter().

00078 {
00079   G4double tm = std::min(tmax, e);
00080   G4double t0 = std::max(tmin, lowestE);
00081   if(t0 >= tm) return 0.0;
00082 
00083   t0 /= e;
00084   tm /= e;
00085 
00086   G4double z0 = lowestE/e;
00087   G4DataVector p;
00088 
00089   // Access parameters
00090   for (size_t i=0; i<=length; i++) {
00091     p.push_back(theBRparam->Parameter(i, Z, e));
00092   }
00093 
00094   G4double x  = IntSpectrum(t0, tm, p);
00095   G4double y  = IntSpectrum(z0, 1.0, p);
00096 
00097 
00098   if(1 < verbose) {
00099     G4cout << "tcut(MeV)= " << tmin/MeV
00100            << "; tMax(MeV)= " << tmax/MeV
00101            << "; t0= " << t0
00102            << "; tm= " << tm
00103            << "; xp[0]= " << xp[0]
00104            << "; z= " << z0
00105            << "; val= " << x
00106            << "; nor= " << y
00107            << G4endl;
00108   }
00109   p.clear();
00110 
00111   if(y > 0.0) x /= y;
00112   else        x  = 0.0;
00113   //  if(x < 0.0) x  = 0.0;
00114 
00115   return x;
00116 }

G4double G4eBremsstrahlungSpectrum::SampleEnergy ( G4int  Z,
G4double  tMin,
G4double  tMax,
G4double  kineticEnergy,
G4int  shell = 0,
const G4ParticleDefinition pd = 0 
) const [virtual]

Implements G4VEnergySpectrum.

Definition at line 173 of file G4eBremsstrahlungSpectrum.cc.

References G4cout, G4endl, G4UniformRand, and G4BremsstrahlungParameters::Parameter().

00179 {
00180   G4double tm = std::min(tmax, e);
00181   G4double t0 = std::max(tmin, lowestE);
00182   if(t0 >= tm) return 0.0;
00183 
00184   t0 /= e;
00185   tm /= e;
00186 
00187   G4DataVector p;
00188 
00189   for (size_t i=0; i<=length; i++) {
00190     p.push_back(theBRparam->Parameter(i, Z, e));
00191   }
00192   G4double amaj = std::max(p[length], 1. - (p[1] - p[0])*xp[0]/(xp[1] - xp[0]) );
00193 
00194   G4double amax = std::log(tm);
00195   G4double amin = std::log(t0);
00196   G4double tgam, q, fun;
00197 
00198   do {
00199     G4double x = amin + G4UniformRand()*(amax - amin);
00200     tgam = std::exp(x);
00201     fun = Function(tgam, p);
00202 
00203     if(fun > amaj) {
00204           G4cout << "WARNING in G4eBremsstrahlungSpectrum::SampleEnergy:"
00205                  << " Majoranta " << amaj
00206                  << " < " << fun
00207                  << G4endl;
00208     }
00209 
00210     q = amaj * G4UniformRand();
00211   } while (q > fun);
00212 
00213   tgam *= e;
00214 
00215   p.clear();
00216 
00217   return tgam;
00218 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:51:49 2013 for Geant4 by  doxygen 1.4.7