Loading src/core/geometry/DetectorField.tpp +7 −0 Original line number Diff line number Diff line Loading @@ -180,12 +180,19 @@ namespace allpix { // Compute indices // If the number of bins in x or y is 1, the field is assumed to be 2-dimensional and the respective index // is forced to zero. This circumvents that the field size in the respective dimension would otherwise be zero // Due to rounding issues at the upper field boundary, decrement bin if one beyond range. auto x_ind = (bins_[0] == 1 ? 0 : int_floor(x * static_cast<double>(bins_[0]))); if(x_ind == static_cast<int>(bins_[0])) { x_ind--; } if(x_ind < 0 || x_ind >= static_cast<int>(bins_[0])) { return {}; } auto y_ind = (bins_[1] == 1 ? 0 : int_floor(y * static_cast<double>(bins_[1]))); if(y_ind == static_cast<int>(bins_[1])) { y_ind--; } if(y_ind < 0 || y_ind >= static_cast<int>(bins_[1])) { return {}; } Loading Loading
src/core/geometry/DetectorField.tpp +7 −0 Original line number Diff line number Diff line Loading @@ -180,12 +180,19 @@ namespace allpix { // Compute indices // If the number of bins in x or y is 1, the field is assumed to be 2-dimensional and the respective index // is forced to zero. This circumvents that the field size in the respective dimension would otherwise be zero // Due to rounding issues at the upper field boundary, decrement bin if one beyond range. auto x_ind = (bins_[0] == 1 ? 0 : int_floor(x * static_cast<double>(bins_[0]))); if(x_ind == static_cast<int>(bins_[0])) { x_ind--; } if(x_ind < 0 || x_ind >= static_cast<int>(bins_[0])) { return {}; } auto y_ind = (bins_[1] == 1 ? 0 : int_floor(y * static_cast<double>(bins_[1]))); if(y_ind == static_cast<int>(bins_[1])) { y_ind--; } if(y_ind < 0 || y_ind >= static_cast<int>(bins_[1])) { return {}; } Loading