Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
G4INCLIFunction1D.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// INCL++ intra-nuclear cascade model
27// Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
28// Davide Mancusi, CEA
29// Alain Boudard, CEA
30// Sylvie Leray, CEA
31// Joseph Cugnon, University of Liege
32//
33// INCL++ revision: v5.1.8
34//
35#define INCLXX_IN_GEANT4_MODE 1
36
37#include "globals.hh"
38
39/** \file G4INCLIFunction1D.hh
40 * \brief Functor for 1-dimensional mathematical functions
41 *
42 * \date 16 July 2012
43 * \author Davide Mancusi
44 */
45
46#ifndef G4INCLIFUNCTION1D_HH_
47#define G4INCLIFUNCTION1D_HH_ 1
48
49#include <vector>
50
51namespace G4INCL {
52
53 // Forward declaration
54 class InverseInterpolationTable;
55
56 /**
57 * 1D function interface
58 */
60 public:
62 xMin(0.),
63 xMax(0.)
64 {};
65 IFunction1D(const G4double x0, const G4double x1) :
66 xMin(x0),
67 xMax(x1)
68 {};
69
70 virtual ~IFunction1D() {};
71
72 /// \brief Return the minimum allowed value of the independent variable
73 virtual inline G4double getXMinimum() const { return xMin; }
74
75 /// \brief Return the maximum allowed value of the independent variable
76 virtual inline G4double getXMaximum() const { return xMax; }
77
78 /// \brief Compute the value of the function
79 virtual G4double operator()(const G4double x) const = 0;
80
81 /** \brief Integrate the function between two values
82 *
83 * \param x0 lower integration bound
84 * \param x1 upper integration bound
85 * \param step largest integration step size; if <0, 45 steps will be used
86 * \return \f$\int_{x_0}^{x_1} f(x) dx\f$
87 */
88 virtual G4double integrate(const G4double x0, const G4double x1, const G4double step=-1.) const;
89
90 /// \brief Return a pointer to the (numerical) primitive to this function
91 IFunction1D *primitive() const;
92
93 /// \brief Return a pointer to the inverse of the CDF of this function
94 InverseInterpolationTable *inverseCDFTable(const G4int nNodes=60) const;
95
96 protected:
97 /// \brief Minimum value of the independent variable
99 /// \brief Maximum value of the independent variable
101
102 private:
103 /// \brief Coefficients for numerical integration
104 static const G4double integrationCoefficients[];
105 };
106
107}
108
109#endif // G4INCLIFUNCTION1D_HH_
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
virtual G4double operator()(const G4double x) const =0
Compute the value of the function.
virtual G4double getXMaximum() const
Return the maximum allowed value of the independent variable.
G4double xMin
Minimum value of the independent variable.
IFunction1D * primitive() const
Return a pointer to the (numerical) primitive to this function.
G4double xMax
Maximum value of the independent variable.
virtual G4double integrate(const G4double x0, const G4double x1, const G4double step=-1.) const
Integrate the function between two values.
virtual G4double getXMinimum() const
Return the minimum allowed value of the independent variable.
IFunction1D(const G4double x0, const G4double x1)
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.