Geant4
10.02.p02
|
#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< G4double > | fCoefficients |
G4bool | fChanged |
G4double | fTolerance |
Definition at line 49 of file G4PolynomialPDF.hh.
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().
|
inline |
Definition at line 54 of file G4PolynomialPDF.hh.
Definition at line 334 of file G4PolynomialPDF.cc.
References Evaluate(), fX1, fX2, GetX(), and z.
Referenced by GetX().
void G4PolynomialPDF::Dump | ( | ) |
Definition at line 343 of file G4PolynomialPDF.cc.
References fX1, fX2, G4cout, G4endl, GetCoefficient(), and GetNCoefficients().
Referenced by Normalize().
Definition at line 98 of file G4PolynomialPDF.hh.
References fX1, fX2, and GetX().
Referenced by GetRandomX().
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().
|
inline |
Definition at line 60 of file G4PolynomialPDF.hh.
References fCoefficients.
Referenced by Dump(), Evaluate(), GetX(), HasNegativeMinimum(), and Normalize().
|
inline |
Definition at line 58 of file G4PolynomialPDF.hh.
References fCoefficients.
Referenced by Dump(), Evaluate(), GetX(), HasNegativeMinimum(), Normalize(), and SetCoefficients().
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().
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().
Definition at line 142 of file G4PolynomialPDF.cc.
References Evaluate(), fTolerance, fX2, G4cout, G4endl, GetCoefficient(), GetNCoefficients(), and GetX().
Referenced by GetRandomX().
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().
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().
|
inline |
Definition at line 59 of file G4PolynomialPDF.hh.
References fCoefficients.
Referenced by G4PolynomialPDF(), and G4PolarizationTransition::GenerateGammaCosTheta().
void G4PolynomialPDF::SetCoefficients | ( | size_t | n, |
const G4double * | coeffs | ||
) |
Definition at line 59 of file G4PolynomialPDF.cc.
References fChanged, GetNCoefficients(), SetCoefficient(), and SetNCoefficients().
|
inline |
Definition at line 57 of file G4PolynomialPDF.hh.
References fChanged, and fCoefficients.
Referenced by G4PolynomialPDF(), and SetCoefficients().
|
inline |
Definition at line 84 of file G4PolynomialPDF.hh.
References fTolerance, and tolerance.
|
protected |
Definition at line 110 of file G4PolynomialPDF.hh.
Referenced by GetRandomX(), SetCoefficient(), SetCoefficients(), SetDomain(), and SetNCoefficients().
|
protected |
Definition at line 109 of file G4PolynomialPDF.hh.
Referenced by GetCoefficient(), GetNCoefficients(), Normalize(), SetCoefficient(), SetCoefficients(), and SetNCoefficients().
|
protected |
Definition at line 111 of file G4PolynomialPDF.hh.
Referenced by GetX(), HasNegativeMinimum(), and SetTolerance().
|
protected |
Definition at line 107 of file G4PolynomialPDF.hh.
Referenced by Bisect(), Dump(), EvalInverseCDF(), Evaluate(), GetRandomX(), GetX(), Normalize(), and SetDomain().
|
protected |
Definition at line 108 of file G4PolynomialPDF.hh.
Referenced by Bisect(), Dump(), EvalInverseCDF(), GetRandomX(), GetX(), HasNegativeMinimum(), Normalize(), and SetDomain().