138{
139 auto find_lower_bound = [
this](
G4double e) {
140 auto low = 0;
141 auto upp = num_node_ - 1;
142 if (e < Eion_[0]) { return low; }
143 while (low <= upp) {
144 const auto mid = static_cast<int>((low + upp) * 0.5);
145 if (e < Eion_[mid]) { upp = mid - 1; }
146 else { low = mid + 1; }
147 if (upp < 0) { upp = 0; }
148 }
149 return upp;
150 };
151
153 if (e < Eion_[0]) { return alpha_[0]; }
154 const auto num_bin = num_node_ - 1;
155 const auto bin2 = bin1 + 1;
157 if (bin2 <= num_bin) {
158 auto log10_e = std::log10(e);
159 auto log10_e1 = Eion_[bin1];
160 auto log10_e2 = Eion_[bin2];
161 auto log10_a1 = alpha_[bin1];
162 auto log10_a2 = alpha_[bin2];
163 if (log10_a1 != 0.0 && log10_a2 != 0.0) {
164 log10_e1 = std::log10(log10_e1);
165 log10_e2 = std::log10(log10_e2);
166 log10_a1 = std::log10(log10_a1);
167 log10_a2 = std::log10(log10_a2);
168 value = log10_a1 + (log10_a2 - log10_a1)
169 * (log10_e - log10_e1) / (log10_e2 - log10_e1);
170 value = std::pow(10.0, value);
171 }
172 } else {
173 value = alpha_[num_bin];
174 }
175 return value;
176 };
177
178 const auto bin1 = find_lower_bound(energy);
179 return interp_log_log(bin1, energy);
180}