Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4BetaSpectrumSampler Class Reference

#include <G4BetaSpectrumSampler.hh>

Static Public Member Functions

static G4double shoot (const G4int npoints, const G4double *aCDF, const G4double estep)
 

Detailed Description

Definition at line 42 of file G4BetaSpectrumSampler.hh.

Member Function Documentation

◆ shoot()

G4double G4BetaSpectrumSampler::shoot ( const G4int npoints,
const G4double * aCDF,
const G4double estep )
static

Definition at line 40 of file G4BetaSpectrumSampler.cc.

42{
43 G4double prob = aCDF[npoints - 1]*G4UniformRand();
44 G4int i = 0;
45 for (; i<npoints; ++i) { if (prob <= aCDF[i]) { break; } }
46 const G4double p1 = (i > 0) ? aCDF[i - 1] : aCDF[0];
47 const G4double p2 = aCDF[i];
48 const G4double delta = p2 - p1;
49 const G4double x = (delta > 0.0) ? estep*i - estep*(p2 - prob)/delta : estep*i;
50 return x;
51}
double G4double
Definition G4Types.hh:83
int G4int
Definition G4Types.hh:85
#define G4UniformRand()
Definition Randomize.hh:52

Referenced by G4BetaMinusDecay::DecayIt(), and G4BetaPlusDecay::DecayIt().


The documentation for this class was generated from the following files: