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");
122 inline G4double G4NeutronHPInterpolator::
130 inline G4double G4NeutronHPInterpolator::
134 if(x2-x1==0)
return (y2+y1)/2.;
135 slope = (y2-
y1)/(x2-x1);
141 inline 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);
152 inline 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);
165 inline 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);
181 inline G4double G4NeutronHPInterpolator::