33 #define INCLXX_IN_GEANT4_MODE 1
82 nIntervals =
G4int(interval/step);
85 G4int remainder = nIntervals % 9;
87 nIntervals += 9 - remainder;
89 nIntervals =
std::max(nIntervals, 9);
92 const G4double dx = interval/nIntervals;
94 for(
G4int j = 1; j<nIntervals; ++j) {
96 const unsigned index = j%9;
100 return result*dx*
sign;
113 return theFunction->integrate(
xMin,x);
117 } *thePrimitive =
new Primitive(
this);
128 normalisation(1./theFunction->integrate(
xMin,
xMax))
132 return std::min(1., normalisation * theFunction->integrate(
xMin,x));
137 } *theInverseCDF =
new InverseCDF(
this);
140 delete theInverseCDF;
Simple interpolation table for the inverse of a IFunction1D functor.
IFunction1D * primitive() const
Return a pointer to the (numerical) primitive to this function.
G4double xMin
Minimum value of the independent variable.
virtual G4double operator()(const G4double x) const =0
Compute the value of the function.
G4double xMax
Maximum value of the independent variable.
InverseInterpolationTable * inverseCDFTable(const G4int nNodes=60) const
Return a pointer to the inverse of the CDF of this function.
Class for interpolating the inverse of a 1-dimensional function.
static const G4double integrationCoefficients[]
Coefficients for numerical integration.
virtual G4double integrate(const G4double x0, const G4double x1, const G4double step=-1.) const
Integrate the function between two values.
T max(const T t1, const T t2)
brief Return the largest of the two arguments
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
Functor for 1-dimensional mathematical functions.
virtual G4double getXMinimum() const
Return the minimum allowed value of the independent variable.
virtual G4double getXMaximum() const
Return the maximum allowed value of the independent variable.
G4int sign(const T t)
A simple sign function that allows us to port fortran code to c++ more easily.