Skip to content

Commit

Permalink
Fix index error in XCOM data interpolation
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit Leck committed Mar 4, 2024
1 parent 4aaf99c commit a35f997
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gammapkt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -624,19 +624,19 @@ static auto get_chi_photo_electric_rf(const struct packet *pkt_ptr) -> double {
continue;
}
// get indices of lower and upper boundary
int E_gtr_idx = -2; //
int E_gtr_idx = -1; //

for (int j = 0; j < numb_energies; j++) {
if (photoion_data[Z - 1][j].energy > hnu_over_1MeV) {
E_gtr_idx = j;
break;
}
}
if (E_gtr_idx == -1) { // packet energy smaller than all tabulated values
if (E_gtr_idx == 0) { // packet energy smaller than all tabulated values
chi_cmf += photoion_data[Z - 1][0].sigma_xcom * n_i;
continue;
}
if (E_gtr_idx == -2) { // packet energy greater than all tabulated values
if (E_gtr_idx == -1) { // packet energy greater than all tabulated values
chi_cmf += photoion_data[Z - 1][numb_energies - 1].sigma_xcom * n_i;
continue;
}
Expand Down

0 comments on commit a35f997

Please sign in to comment.