diff --git a/Event/DigiEvent/CMakeLists.txt b/Event/DigiEvent/CMakeLists.txt index 6e4b9940a087318e34b956e5049558c16fad3fe0..216e9a5a10857ab0297bf25f3eecadc05dfdb2a9 100644 --- a/Event/DigiEvent/CMakeLists.txt +++ b/Event/DigiEvent/CMakeLists.txt @@ -25,6 +25,7 @@ gaudi_add_library(DigiEvent LHCb::EventBase LHCb::LHCbMathLib LHCb::UTDetLib + LHCb::VPDetLib ) gaudi_add_dictionary(DigiEventDict diff --git a/Event/DigiEvent/include/Event/VPMicroCluster.h b/Event/DigiEvent/include/Event/VPMicroCluster.h index 0f61d8762b9a4bfb533df8131077320b41c86bbc..5da5f6467187c5b21277b246be0f4d598f237e33 100644 --- a/Event/DigiEvent/include/Event/VPMicroCluster.h +++ b/Event/DigiEvent/include/Event/VPMicroCluster.h @@ -12,7 +12,9 @@ // Include files #include "Detector/VP/VPChannelID.h" +#include "GaudiKernel/Point3DTypes.h" #include "Kernel/VPConstants.h" +#include "VPDet/DeVP.h" #include <cstdint> #include <ostream> @@ -81,6 +83,24 @@ namespace LHCb { channelID() == other.channelID() ); } + auto localPosition( const DeVP& devp ) const { + const float fx = m_fx / 255.; + const float fy = m_fy / 255.; + const uint32_t cx = m_vpID.scol(); + const float local_x = devp.local_x( cx ) + fx * devp.x_pitch( cx ); + const float local_y = ( 0.5f + fy + to_unsigned( m_vpID.row() ) ) * devp.pixel_size(); + return std::make_tuple( local_x, local_y ); + } + + auto globalPosition( const DeVP& devp ) const { + const auto [local_x, local_y] = localPosition( devp ); + const auto& ltg = devp.ltg( m_vpID.sensor() ); + const float gx = ( ltg[0] * local_x + ltg[1] * local_y + ltg[9] ); + const float gy = ( ltg[3] * local_x + ltg[4] * local_y + ltg[10] ); + const float gz = ( ltg[6] * local_x + ltg[7] * local_y + ltg[11] ); + return Gaudi::XYZPointF{ gx, gy, gz }; + } + private: FracType m_fx{ 0 }; ///< inter-pixel fraction in x coordinate FracType m_fy{ 0 }; ///< inter-pixel fraction in y coordinate