diff --git a/src/core/detector/BigPixelDetector.cpp b/src/core/detector/BigPixelDetector.cpp index 83ab35b69a90527d67283752d94595668c02663e..865e53e3d83a74809c4fc7613e01b842d0c7053d 100644 --- a/src/core/detector/BigPixelDetector.cpp +++ b/src/core/detector/BigPixelDetector.cpp @@ -177,6 +177,40 @@ ROOT::Math::XYVector BigPixelDetector::getSize() const { m_pitch.Y() * (m_nPixels.Y() + static_cast<double>(big_pixel_y.size()))); } +XYVector BigPixelDetector::getSpatialResolution(double column = 0, double row = 0) const { + bool is_big_x_pixel = 0; + bool is_big_y_pixel = 0; + + for(unsigned int i = 0; i < big_pixel_x.size(); i++) { + if(fabs(column - big_pixel_x[i]) < 0.5) { + is_big_x_pixel = true; + break; + } + } + + for(unsigned int i = 0; i < big_pixel_y.size(); i++) { + if(fabs(row - big_pixel_y[i]) < 0.5) { + is_big_y_pixel = true; + break; + } + } + + double resolution_x = is_big_x_pixel ? 2*m_spatial_resolution.x() : m_spatial_resolution.x(); + double resolution_y = is_big_y_pixel ? 2*m_spatial_resolution.y() : m_spatial_resolution.y(); + return XYVector(resolution_x, resolution_y); +} + +TMatrixD BigPixelDetector::getSpatialResolutionMatrixGlobal(double column = 0, double row = 0) const { + TMatrixD errorMatrix(3, 3); + TMatrixD locToGlob(3, 3), globToLoc(3, 3); + auto spatial_resolution = getSpatialResolution(column, row); + errorMatrix(0, 0) = spatial_resolution.x() * spatial_resolution.x(); + errorMatrix(1, 1) = spatial_resolution.y() * spatial_resolution.y(); + alignment_->local2global().Rotation().GetRotationMatrix(locToGlob); + alignment_->global2local().Rotation().GetRotationMatrix(globToLoc); + return (locToGlob * errorMatrix * globToLoc); +} + Configuration BigPixelDetector::getConfiguration() const { auto config = PixelDetector::getConfiguration(); diff --git a/src/core/detector/BigPixelDetector.hpp b/src/core/detector/BigPixelDetector.hpp index b6d90264f89abec5e4d8f76b669969a063b7ba5c..2f7afe55b8bf96be54badd2be3687cabd5b56800 100644 --- a/src/core/detector/BigPixelDetector.hpp +++ b/src/core/detector/BigPixelDetector.hpp @@ -42,6 +42,22 @@ namespace corryvreckan { // Function to get local position from column (x) and row (y) coordinates PositionVector3D<Cartesian3D<double>> getLocalPosition(double column, double row) const override; + /** + * @brief Get intrinsic spatial resolution of the detector + * @return Intrinsic spatial resolution in X and Y + * + * @note For a detector with variable pixel sizes this declaration could be changed to take column and row pixel + * indices to calculate the resolution for a specific pixel + */ + XYVector getSpatialResolution(double, double) const override; + + /** + * @brief Get intrinsic spatial resolution in global coordinates of the detector + * @return Intrinsic spatial resolution in global X and Y + */ + TMatrixD getSpatialResolutionMatrixGlobal(double, double) const override; + + ROOT::Math::XYVector getSize() const override; /**