32#ifndef G4ParticleHPInterpolator_h
33#define G4ParticleHPInterpolator_h 1
52 if (x2 - x1 == 0)
return (y2 + y1) / 2.;
53 slope = (y2 - y1) / (x2 - x1);
54 off = y2 - x2 * slope;
88 G4int theScheme = aScheme;
89 theScheme = theScheme %
CSTART_;
94 result = LinearLinear(x, x1, x2, y1, y2);
97 result = LinearLinear(x, x1, x2, y1, y2);
100 result = LinearLogarithmic(x, x1, x2, y1, y2);
103 result = LogarithmicLinear(x, x1, x2, y1, y2);
106 result = LogarithmicLogarithmic(x, x1, x2, y1, y2);
109 result = Random(x, x1, x2, y1, y2);
114 "G4ParticleHPInterpolator::Carthesian Invalid InterpolationScheme");
125 G4int theScheme = aScheme;
126 theScheme = theScheme %
CSTART_;
129 result = Histogram(x, x1, x2, y1, y2);
132 result = LinearLinear(x, x1, x2, y1, y2);
135 result = LinearLogarithmic(x, x1, x2, y1, y2);
138 result = LogarithmicLinear(x, x1, x2, y1, y2);
141 result = LogarithmicLogarithmic(x, x1, x2, y1, y2);
144 result = Random(x, x1, x2, y1, y2);
149 "G4ParticleHPInterpolator::Carthesian Invalid InterpolationScheme");
167 if (x2 - x1 == 0)
return (y2 + y1) / 2.;
168 slope = (y2 - y1) / (x2 - x1);
169 off = y2 - x2 * slope;
179 result = y1 + y2 / 2.;
193 if (y1 == 0 || y2 == 0)
196 result = LinearLinear(x, x1, x2,
G4Log(y1),
G4Log(y2));
197 result =
G4Exp(result);
206 if (x == 0)
return y1 + y2 / 2.;
207 if (x1 == 0)
return y1;
208 if (x2 == 0)
return y2;
210 if (y1 == 0 || y2 == 0)
214 result =
G4Exp(result);
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
G4double G4Log(G4double x)
G4GLOB_DLL std::ostream G4cout
G4double Interpolate(G4InterpolationScheme aScheme, G4double x, G4double x1, G4double x2, G4double y1, G4double y2) const
G4ParticleHPInterpolator()=default
G4double GetWeightedBinIntegral(const G4InterpolationScheme &aScheme, const G4double x1, const G4double x2, const G4double y1, const G4double y2)
G4double Interpolate2(G4InterpolationScheme aScheme, G4double x, G4double x1, G4double x2, G4double y1, G4double y2) const
G4double Lin(G4double x, G4double x1, G4double x2, G4double y1, G4double y2)
~G4ParticleHPInterpolator()=default
G4double GetBinIntegral(const G4InterpolationScheme &aScheme, const G4double x1, const G4double x2, const G4double y1, const G4double y2)