Loading src/core/geometry/BrickwallPixelDetectorModel.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,19 @@ BrickwallPixelDetectorModel::BrickwallPixelDetectorModel(std::string type, } } ROOT::Math::XYZPoint BrickwallPixelDetectorModel::getMatrixCenter() const { // Matrix center is shifted by the pixel offset along x - if the offset is negative, because then the origin of the // local coordinate system not the leftmost pixel anymore, the matrix center is calculated relative to the local origin return {getMatrixSize().x() / 2.0 - getPixelSize().x() / 2.0 + (offset_ < 0 ? offset_ : 0.) * getPixelSize().x(), getMatrixSize().y() / 2.0 - getPixelSize().y() / 2.0, 0}; } ROOT::Math::XYZVector BrickwallPixelDetectorModel::getMatrixSize() const { // Matrix size is extended in x by the pixel offset: return {(getNPixels().x() + std::fabs(offset_)) * getPixelSize().x(), getNPixels().y() * getPixelSize().y(), 0}; } /** * Faster implementation of matrix lookup for local coordinate positions than going through the pixel index * This is quite easy for rectangular pixels and matrices. Loading src/core/geometry/BrickwallPixelDetectorModel.hpp +19 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,25 @@ namespace allpix { const ConfigReader& reader, const Configuration& config); /** * @brief Get local coordinate of the position and rotation center in global frame * @note It can be a bit counter intuitive that this is not usually the origin, neither the geometric center of the * model, but the geometric center of the sensitive part. This way, the position of the sensing element is invariant * under rotations * * The center coordinate corresponds to the \ref Detector::getPosition "position" in the global frame. */ ROOT::Math::XYZPoint getMatrixCenter() const override; /** * @brief Get total size of the pixel grid * @return Size of the pixel grid * * @warning The grid has zero thickness * @note This is basically a 2D method, but provided in 3D because it is primarily used there */ ROOT::Math::XYZVector getMatrixSize() const override; /** * @brief Returns if a position is within the grid of pixels defined for the device * @param position Position in local coordinates of the detector model Loading Loading
src/core/geometry/BrickwallPixelDetectorModel.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,19 @@ BrickwallPixelDetectorModel::BrickwallPixelDetectorModel(std::string type, } } ROOT::Math::XYZPoint BrickwallPixelDetectorModel::getMatrixCenter() const { // Matrix center is shifted by the pixel offset along x - if the offset is negative, because then the origin of the // local coordinate system not the leftmost pixel anymore, the matrix center is calculated relative to the local origin return {getMatrixSize().x() / 2.0 - getPixelSize().x() / 2.0 + (offset_ < 0 ? offset_ : 0.) * getPixelSize().x(), getMatrixSize().y() / 2.0 - getPixelSize().y() / 2.0, 0}; } ROOT::Math::XYZVector BrickwallPixelDetectorModel::getMatrixSize() const { // Matrix size is extended in x by the pixel offset: return {(getNPixels().x() + std::fabs(offset_)) * getPixelSize().x(), getNPixels().y() * getPixelSize().y(), 0}; } /** * Faster implementation of matrix lookup for local coordinate positions than going through the pixel index * This is quite easy for rectangular pixels and matrices. Loading
src/core/geometry/BrickwallPixelDetectorModel.hpp +19 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,25 @@ namespace allpix { const ConfigReader& reader, const Configuration& config); /** * @brief Get local coordinate of the position and rotation center in global frame * @note It can be a bit counter intuitive that this is not usually the origin, neither the geometric center of the * model, but the geometric center of the sensitive part. This way, the position of the sensing element is invariant * under rotations * * The center coordinate corresponds to the \ref Detector::getPosition "position" in the global frame. */ ROOT::Math::XYZPoint getMatrixCenter() const override; /** * @brief Get total size of the pixel grid * @return Size of the pixel grid * * @warning The grid has zero thickness * @note This is basically a 2D method, but provided in 3D because it is primarily used there */ ROOT::Math::XYZVector getMatrixSize() const override; /** * @brief Returns if a position is within the grid of pixels defined for the device * @param position Position in local coordinates of the detector model Loading