32#ifndef G4NeutronHPInterpolator_h
33#define G4NeutronHPInterpolator_h 1
55 if(x2-x1==0)
return (y2+y1)/2.;
56 slope = (y2-y1)/(x2-x1);
90 G4int theScheme = aScheme;
97 result = LinearLinear(x, x1, x2, y1, y2);
100 result = LinearLinear(x, x1, x2, y1, y2);
103 result = LinearLogarithmic(x, x1, x2, y1, y2);
106 result = LogarithmicLinear(x, x1, x2, y1, y2);
109 result = LogarithmicLogarithmic(x, x1, x2, y1, y2);
112 result = Random(x, x1, x2, y1, y2);
116 throw G4HadronicException(__FILE__, __LINE__,
"G4NeutronHPInterpolator::Carthesian Invalid InterpolationScheme");
122inline G4double G4NeutronHPInterpolator::
130inline G4double G4NeutronHPInterpolator::
134 if(x2-x1==0)
return (y2+y1)/2.;
135 slope = (y2-y1)/(x2-x1);
141inline G4double G4NeutronHPInterpolator::
145 if(x==0) result = y1+y2/2.;
146 else if(x1==0) result = y1;
147 else if(x2==0) result = y2;
148 else result = LinearLinear(std::log(x), std::log(x1), std::log(x2), y1, y2);
152inline G4double G4NeutronHPInterpolator::
156 if(y1==0||y2==0) result = 0;
159 result = LinearLinear(x, x1, x2, std::log(y1), std::log(y2));
160 result = std::exp(result);
165inline G4double G4NeutronHPInterpolator::
169 if(x==0) result = y1+y2/2.;
170 else if(x1==0) result = y1;
171 else if(x2==0) result = y2;
172 if(y1==0||y2==0) result = 0;
175 result = LinearLinear(std::log(x), std::log(x1), std::log(x2), std::log(y1), std::log(y2));
176 result = std::exp(result);
181inline G4double G4NeutronHPInterpolator::
G4DLLIMPORT std::ostream G4cout
G4double GetWeightedBinIntegral(const G4InterpolationScheme &aScheme, const G4double x1, const G4double x2, const G4double y1, const G4double y2)
G4NeutronHPInterpolator()
G4double Lin(G4double x, G4double x1, G4double x2, G4double y1, G4double y2)
G4double Interpolate(G4InterpolationScheme aScheme, G4double x, G4double x1, G4double x2, G4double y1, G4double y2) const
G4double GetBinIntegral(const G4InterpolationScheme &aScheme, const G4double x1, const G4double x2, const G4double y1, const G4double y2)
~G4NeutronHPInterpolator()