Geant4  10.02.p02
G4PolynomialPDF Class Reference

#include <G4PolynomialPDF.hh>

Public Member Functions

 G4PolynomialPDF (size_t n=0, const double *coeffs=nullptr, G4double x1=0, G4double x2=1)
 
 ~G4PolynomialPDF ()
 
void SetNCoefficients (size_t n)
 
size_t GetNCoefficients () const
 
void SetCoefficients (const std::vector< G4double > &v)
 
G4double GetCoefficient (size_t i) const
 
void SetCoefficient (size_t i, G4double value)
 
void SetCoefficients (size_t n, const G4double *coeffs)
 
void SetDomain (G4double x1, G4double x2)
 
void Normalize ()
 
G4double Evaluate (G4double x, G4int ddxPower=0)
 
G4double GetRandomX ()
 
void SetTolerance (G4double tolerance)
 
G4double GetX (G4double p, G4double x1, G4double x2, G4int ddxPower=0, G4double guess=1.e99, G4bool bisect=true)
 
G4double EvalInverseCDF (G4double p)
 
G4double Bisect (G4double p, G4double x1, G4double x2)
 
void Dump ()
 

Protected Member Functions

G4bool HasNegativeMinimum (G4double x1, G4double x2)
 

Protected Attributes

G4double fX1
 
G4double fX2
 
std::vector< G4doublefCoefficients
 
G4bool fChanged
 
G4double fTolerance
 

Detailed Description

Definition at line 49 of file G4PolynomialPDF.hh.

Constructor & Destructor Documentation

G4PolynomialPDF::G4PolynomialPDF ( size_t  n = 0,
const double *  coeffs = nullptr,
G4double  x1 = 0,
G4double  x2 = 1 
)

Definition at line 44 of file G4PolynomialPDF.cc.

References SetCoefficients(), and SetNCoefficients().

+ Here is the call graph for this function:

G4PolynomialPDF::~G4PolynomialPDF ( )
inline

Definition at line 54 of file G4PolynomialPDF.hh.

Member Function Documentation

G4double G4PolynomialPDF::Bisect ( G4double  p,
G4double  x1,
G4double  x2 
)

Definition at line 334 of file G4PolynomialPDF.cc.

References Evaluate(), fX1, fX2, GetX(), and z.

Referenced by GetX().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G4PolynomialPDF::Dump ( )

Definition at line 343 of file G4PolynomialPDF.cc.

References fX1, fX2, G4cout, G4endl, GetCoefficient(), and GetNCoefficients().

Referenced by Normalize().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

G4double G4PolynomialPDF::EvalInverseCDF ( G4double  p)
inline

Definition at line 98 of file G4PolynomialPDF.hh.

References fX1, fX2, and GetX().

Referenced by GetRandomX().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

G4double G4PolynomialPDF::Evaluate ( G4double  x,
G4int  ddxPower = 0 
)

Evaluate f(x) ddxPower = -1: f = CDF ddxPower = 0: f = PDF ddxPower = 1: f = (d/dx) PDF ddxPower = 2: f = (d2/dx2) PDF

Definition at line 109 of file G4PolynomialPDF.cc.

References fX1, G4cout, G4endl, GetCoefficient(), GetNCoefficients(), and x.

Referenced by Bisect(), and HasNegativeMinimum().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

G4double G4PolynomialPDF::GetCoefficient ( size_t  i) const
inline

Definition at line 60 of file G4PolynomialPDF.hh.

References fCoefficients.

Referenced by Dump(), Evaluate(), GetX(), HasNegativeMinimum(), and Normalize().

+ Here is the caller graph for this function:

size_t G4PolynomialPDF::GetNCoefficients ( ) const
inline

Definition at line 58 of file G4PolynomialPDF.hh.

References fCoefficients.

Referenced by Dump(), Evaluate(), GetX(), HasNegativeMinimum(), Normalize(), and SetCoefficients().

+ Here is the caller graph for this function:

G4double G4PolynomialPDF::GetRandomX ( )

Definition at line 181 of file G4PolynomialPDF.cc.

References EvalInverseCDF(), fChanged, fX1, fX2, G4cout, G4endl, G4UniformRand, HasNegativeMinimum(), and Normalize().

Referenced by G4PolarizationTransition::GenerateGammaCosTheta().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

G4double G4PolynomialPDF::GetX ( G4double  p,
G4double  x1,
G4double  x2,
G4int  ddxPower = 0,
G4double  guess = 1.e99,
G4bool  bisect = true 
)

Find a value of X between x1 and x2 at which f(x) = p. ddxPower = -1: f = CDF ddxPower = 0: f = PDF ddxPower = 1: f = (d/dx) PDF Uses the Newton-Raphson method to find the zero of f(x) - p. If not found in range, returns the nearest boundary

Definition at line 194 of file G4PolynomialPDF.cc.

References a, Bisect(), fTolerance, fX1, fX2, G4cout, G4endl, GetCoefficient(), and GetNCoefficients().

Referenced by Bisect(), EvalInverseCDF(), and HasNegativeMinimum().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

G4bool G4PolynomialPDF::HasNegativeMinimum ( G4double  x1,
G4double  x2 
)
protected

Definition at line 142 of file G4PolynomialPDF.cc.

References Evaluate(), fTolerance, fX2, G4cout, G4endl, GetCoefficient(), GetNCoefficients(), and GetX().

Referenced by GetRandomX().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G4PolynomialPDF::Normalize ( )

Normalize PDF to 1 over domain fX1 to fX2. Double-check that the highest-order coefficient is non-zero.

Definition at line 81 of file G4PolynomialPDF.cc.

References Dump(), fCoefficients, fX1, fX2, G4cout, G4endl, GetCoefficient(), GetNCoefficients(), and SetCoefficient().

Referenced by GetRandomX().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G4PolynomialPDF::SetCoefficient ( size_t  i,
G4double  value 
)

Definition at line 52 of file G4PolynomialPDF.cc.

References fChanged, and fCoefficients.

Referenced by Normalize(), and SetCoefficients().

+ Here is the caller graph for this function:

void G4PolynomialPDF::SetCoefficients ( const std::vector< G4double > &  v)
inline

Definition at line 59 of file G4PolynomialPDF.hh.

References fCoefficients.

Referenced by G4PolynomialPDF(), and G4PolarizationTransition::GenerateGammaCosTheta().

+ Here is the caller graph for this function:

void G4PolynomialPDF::SetCoefficients ( size_t  n,
const G4double coeffs 
)

Definition at line 59 of file G4PolynomialPDF.cc.

References fChanged, GetNCoefficients(), SetCoefficient(), and SetNCoefficients().

+ Here is the call graph for this function:

void G4PolynomialPDF::SetDomain ( G4double  x1,
G4double  x2 
)

Definition at line 69 of file G4PolynomialPDF.cc.

References fChanged, fX1, fX2, G4cout, and G4endl.

void G4PolynomialPDF::SetNCoefficients ( size_t  n)
inline

Definition at line 57 of file G4PolynomialPDF.hh.

References fChanged, and fCoefficients.

Referenced by G4PolynomialPDF(), and SetCoefficients().

+ Here is the caller graph for this function:

void G4PolynomialPDF::SetTolerance ( G4double  tolerance)
inline

Definition at line 84 of file G4PolynomialPDF.hh.

References fTolerance, and tolerance.

Member Data Documentation

G4bool G4PolynomialPDF::fChanged
protected
std::vector<G4double> G4PolynomialPDF::fCoefficients
protected
G4double G4PolynomialPDF::fTolerance
protected

Definition at line 111 of file G4PolynomialPDF.hh.

Referenced by GetX(), HasNegativeMinimum(), and SetTolerance().

G4double G4PolynomialPDF::fX1
protected
G4double G4PolynomialPDF::fX2
protected

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