ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
G4DataInterpolation.hh
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4DataInterpolation.hh
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
//
27
//
28
// Class description:
29
//
30
// The class consists of some methods for data interpolations and extrapolations.
31
// The methods based mainly on recommendations given in the book : An introduction to
32
// NUMERICAL METHODS IN C++, B.H. Flowers, Claredon Press, Oxford, 1995
33
//
34
// ------------------------------ Data members: ---------------------------------
35
//
36
// fArgument and fFunction - pointers to data table to be interpolated
37
// for y[i] and x[i] respectively
38
// fNumber - the corresponding table size
39
// ......
40
// G4DataInterpolation( G4double pX[], G4double pY[], G4int number )
41
//
42
// Constructor for initializing of fArgument, fFunction and fNumber data members:
43
// ......
44
// G4DataInterpolation( G4double pX[], G4double pY[], G4int number,
45
// G4double pFirstDerStart, G4double pFirstDerFinish )
46
//
47
// Constructor for cubic spline interpolation. It creates the array
48
// fSecondDerivative[0,...fNumber-1] which is used in this interpolation by
49
// the function:
50
// ....
51
// ~G4DataInterpolation()
52
//
53
// Destructor deletes dynamically created arrays for data members: fArgument,
54
// fFunction and fSecondDerivative, all have dimension of fNumber
55
//
56
// ------------------------------ Methods: ----------------------------------------
57
//
58
// G4double PolynomInterpolation(G4double pX, G4double& deltaY ) const
59
//
60
// This function returns the value P(pX), where P(x) is polynom of fNumber-1 degree
61
// such that P(fArgument[i]) = fFunction[i], for i = 0, ..., fNumber-1 .
62
// ........
63
// void PolIntCoefficient( G4double cof[]) const
64
//
65
// Given arrays fArgument[0,..,fNumber-1] and fFunction[0,..,fNumber-1] , this
66
// function calculates an array of coefficients. The coefficients don't provide
67
// usually (fNumber>10) better accuracy for polynom interpolation, as compared with
68
// PolynomInterpolation function. They could be used instead for derivate
69
// calculations and some other applications.
70
// .........
71
// G4double RationalPolInterpolation(G4double pX, G4double& deltaY ) const
72
//
73
// The function returns diagonal rational function (Bulirsch and Stoer algorithm
74
// of Neville type) Pn(x)/Qm(x) where P and Q are polynoms.
75
// Tests showed the method is not stable and hasn't advantage if compared with
76
// polynomial interpolation
77
// ................
78
// G4double CubicSplineInterpolation(G4double pX) const
79
//
80
// Cubic spline interpolation in point pX for function given by the table:
81
// fArgument, fFunction. The constructor, which creates fSecondDerivative, must be
82
// called before. The function works optimal, if sequential calls are in random
83
// values of pX.
84
// ..................
85
// G4double FastCubicSpline(G4double pX, G4int index) const
86
//
87
// Return cubic spline interpolation in the point pX which is located between
88
// fArgument[index] and fArgument[index+1]. It is usually called in sequence of
89
// known from external analysis values of index.
90
// .........
91
// G4int LocateArgument(G4double pX) const
92
//
93
// Given argument pX, returns index k, so that pX bracketed by fArgument[k] and
94
// fArgument[k+1]
95
// ......................
96
// void CorrelatedSearch( G4double pX, G4int& index ) const
97
//
98
// Given a value pX, returns a value 'index' such that pX is between fArgument[index]
99
// and fArgument[index+1]. fArgument MUST BE MONOTONIC, either increasing or
100
// decreasing. If index = -1 or fNumber, this indicates that pX is out of range.
101
// The value index on input is taken as the initial approximation for index on
102
// output.
103
104
// --------------------------------- History: --------------------------------------
105
//
106
// 3.4.97 V.Grichine (Vladimir.Grichine@cern.ch)
107
//
108
109
110
#ifndef G4DATAINTERPOLATION_HH
111
#define G4DATAINTERPOLATION_HH
112
113
#include "
globals.hh
"
114
115
class
G4DataInterpolation
116
{
117
public
:
118
G4DataInterpolation
(
G4double
pX[],
119
G4double
pY[],
120
G4int
number );
121
122
// Constructor for cubic spline interpolation. It creates fSecond Deivative array
123
// as well as fArgument and fFunction
124
125
G4DataInterpolation
(
G4double
pX[],
126
G4double
pY[],
127
G4int
number,
128
G4double
pFirstDerStart,
129
G4double
pFirstDerFinish ) ;
130
131
~G4DataInterpolation
() ;
132
133
G4double
PolynomInterpolation
(
G4double
pX,
134
G4double
& deltaY )
const
;
135
136
void
PolIntCoefficient
(
G4double
cof[])
const
;
137
138
G4double
RationalPolInterpolation
(
G4double
pX,
139
G4double
& deltaY )
const
;
140
141
G4double
CubicSplineInterpolation
(
G4double
pX )
const
;
142
143
G4double
FastCubicSpline
(
G4double
pX,
144
G4int
index )
const
;
145
146
G4int
LocateArgument
(
G4double
pX )
const
;
147
148
void
CorrelatedSearch
(
G4double
pX,
149
G4int
& index )
const
;
150
151
private
:
152
153
G4DataInterpolation
(
const
G4DataInterpolation
&);
154
G4DataInterpolation
&
operator=
(
const
G4DataInterpolation
&);
155
156
private
:
157
G4double
*
fArgument
;
158
G4double
*
fFunction
;
159
G4double
*
fSecondDerivative
;
160
G4int
fNumber
;
161
} ;
162
163
#endif
geant4
tree
geant4-10.6-release
source
global
HEPNumerics
include
G4DataInterpolation.hh
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:20
using
1.8.2 with
ECCE GitHub integration