Loading src/core/geometry/DetectorModel.hpp +8 −0 Original line number Diff line number Diff line Loading @@ -448,6 +448,14 @@ namespace allpix { */ virtual std::pair<int, int> getPixelIndex(const ROOT::Math::XYZPoint& local_pos) const = 0; /** * @brief Return a set containing all pixels of the matrix * @return Set of all pixel indices of the matrix * * @note This method is purely virtual and must be implemented by the respective concrete detector model classes */ virtual std::set<Pixel::Index> getPixels() const = 0; /** * @brief Return a set containing all pixels neighboring the given one with a configurable maximum distance * @param idx Index of the pixel in question Loading src/core/geometry/HexagonalPixelDetectorModel.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -105,6 +105,19 @@ ROOT::Math::XYZVector HexagonalPixelDetectorModel::getMatrixSize() const { return {limit_right - corner_offset_left, limit_top - corner_offset_bottom, 0}; } std::set<Pixel::Index> HexagonalPixelDetectorModel::getPixels() const { std::set<Pixel::Index> pixels; for(int x = -static_cast<int>(number_of_pixels_.y() / 2); x < static_cast<int>(number_of_pixels_.x()); x++) { for(int y = -static_cast<int>(number_of_pixels_.x() / 2); y < static_cast<int>(number_of_pixels_.y()); y++) { if(isWithinMatrix(x, y)) { pixels.insert({x, y}); } } } return pixels; } std::set<Pixel::Index> HexagonalPixelDetectorModel::getNeighbors(const Pixel::Index& idx, const size_t distance) const { std::set<Pixel::Index> neighbors; Loading src/core/geometry/HexagonalPixelDetectorModel.hpp +6 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,12 @@ namespace allpix { */ ROOT::Math::XYZVector getMatrixSize() const override; /** * @brief Return a set containing all pixels of the matrix * @return Set of all pixel indices of the matrix */ std::set<Pixel::Index> getPixels() const override; /** * @brief Return a set containing all pixels neighboring the given one with a configurable maximum distance * @param idx Index of the pixel in question Loading src/core/geometry/PixelDetectorModel.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -123,9 +123,21 @@ std::pair<int, int> PixelDetectorModel::getPixelIndex(const ROOT::Math::XYZPoint return {pixel_x, pixel_y}; } std::set<Pixel::Index> PixelDetectorModel::getPixels() const { std::set<Pixel::Index> pixels; for(int x = 0; x < static_cast<int>(number_of_pixels_.x()); x++) { for(int y = 0; y < static_cast<int>(number_of_pixels_.y()); y++) { pixels.insert({x, y}); } } return pixels; } std::set<Pixel::Index> PixelDetectorModel::getNeighbors(const Pixel::Index& idx, const size_t distance) const { std::set<Pixel::Index> neighbors; #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-overflow" for(int x = idx.x() - static_cast<int>(distance); x <= idx.x() + static_cast<int>(distance); x++) { for(int y = idx.y() - static_cast<int>(distance); y <= idx.y() + static_cast<int>(distance); y++) { if(!isWithinMatrix(x, y)) { Loading @@ -134,6 +146,7 @@ std::set<Pixel::Index> PixelDetectorModel::getNeighbors(const Pixel::Index& idx, neighbors.insert({x, y}); } } #pragma GCC diagnostic pop return neighbors; } Loading src/core/geometry/PixelDetectorModel.hpp +6 −0 Original line number Diff line number Diff line Loading @@ -113,6 +113,12 @@ namespace allpix { */ std::pair<int, int> getPixelIndex(const ROOT::Math::XYZPoint& local_pos) const override; /** * @brief Return a set containing all pixels of the matrix * @return Set of all pixel indices of the matrix */ std::set<Pixel::Index> getPixels() const override; /** * @brief Return a set containing all pixels neighboring the given one with a configurable maximum distance * @param idx Index of the pixel in question Loading Loading
src/core/geometry/DetectorModel.hpp +8 −0 Original line number Diff line number Diff line Loading @@ -448,6 +448,14 @@ namespace allpix { */ virtual std::pair<int, int> getPixelIndex(const ROOT::Math::XYZPoint& local_pos) const = 0; /** * @brief Return a set containing all pixels of the matrix * @return Set of all pixel indices of the matrix * * @note This method is purely virtual and must be implemented by the respective concrete detector model classes */ virtual std::set<Pixel::Index> getPixels() const = 0; /** * @brief Return a set containing all pixels neighboring the given one with a configurable maximum distance * @param idx Index of the pixel in question Loading
src/core/geometry/HexagonalPixelDetectorModel.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -105,6 +105,19 @@ ROOT::Math::XYZVector HexagonalPixelDetectorModel::getMatrixSize() const { return {limit_right - corner_offset_left, limit_top - corner_offset_bottom, 0}; } std::set<Pixel::Index> HexagonalPixelDetectorModel::getPixels() const { std::set<Pixel::Index> pixels; for(int x = -static_cast<int>(number_of_pixels_.y() / 2); x < static_cast<int>(number_of_pixels_.x()); x++) { for(int y = -static_cast<int>(number_of_pixels_.x() / 2); y < static_cast<int>(number_of_pixels_.y()); y++) { if(isWithinMatrix(x, y)) { pixels.insert({x, y}); } } } return pixels; } std::set<Pixel::Index> HexagonalPixelDetectorModel::getNeighbors(const Pixel::Index& idx, const size_t distance) const { std::set<Pixel::Index> neighbors; Loading
src/core/geometry/HexagonalPixelDetectorModel.hpp +6 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,12 @@ namespace allpix { */ ROOT::Math::XYZVector getMatrixSize() const override; /** * @brief Return a set containing all pixels of the matrix * @return Set of all pixel indices of the matrix */ std::set<Pixel::Index> getPixels() const override; /** * @brief Return a set containing all pixels neighboring the given one with a configurable maximum distance * @param idx Index of the pixel in question Loading
src/core/geometry/PixelDetectorModel.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -123,9 +123,21 @@ std::pair<int, int> PixelDetectorModel::getPixelIndex(const ROOT::Math::XYZPoint return {pixel_x, pixel_y}; } std::set<Pixel::Index> PixelDetectorModel::getPixels() const { std::set<Pixel::Index> pixels; for(int x = 0; x < static_cast<int>(number_of_pixels_.x()); x++) { for(int y = 0; y < static_cast<int>(number_of_pixels_.y()); y++) { pixels.insert({x, y}); } } return pixels; } std::set<Pixel::Index> PixelDetectorModel::getNeighbors(const Pixel::Index& idx, const size_t distance) const { std::set<Pixel::Index> neighbors; #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-overflow" for(int x = idx.x() - static_cast<int>(distance); x <= idx.x() + static_cast<int>(distance); x++) { for(int y = idx.y() - static_cast<int>(distance); y <= idx.y() + static_cast<int>(distance); y++) { if(!isWithinMatrix(x, y)) { Loading @@ -134,6 +146,7 @@ std::set<Pixel::Index> PixelDetectorModel::getNeighbors(const Pixel::Index& idx, neighbors.insert({x, y}); } } #pragma GCC diagnostic pop return neighbors; } Loading
src/core/geometry/PixelDetectorModel.hpp +6 −0 Original line number Diff line number Diff line Loading @@ -113,6 +113,12 @@ namespace allpix { */ std::pair<int, int> getPixelIndex(const ROOT::Math::XYZPoint& local_pos) const override; /** * @brief Return a set containing all pixels of the matrix * @return Set of all pixel indices of the matrix */ std::set<Pixel::Index> getPixels() const override; /** * @brief Return a set containing all pixels neighboring the given one with a configurable maximum distance * @param idx Index of the pixel in question Loading