From cbb7c4d3193426584117ceb23d4b1ee6a4d082c5 Mon Sep 17 00:00:00 2001 From: Vanya Belyaev Date: Sun, 27 Oct 2024 15:00:00 +0100 Subject: [PATCH] add (a,r)precision artugmenrs and width --- source/include/Ostap/KramersKronig.h | 74 +++++++++++++++++----------- source/src/KramersKronig.cpp | 10 +++- 2 files changed, 54 insertions(+), 30 deletions(-) diff --git a/source/include/Ostap/KramersKronig.h b/source/include/Ostap/KramersKronig.h index a654c204..d75c2540 100644 --- a/source/include/Ostap/KramersKronig.h +++ b/source/include/Ostap/KramersKronig.h @@ -39,29 +39,35 @@ namespace Ostap /** templated contructor from the function, low integration edge, * number of subtractions and the scale factor * @param rho the function - * @param omega0 low intergation edge - * @param n number of subtractions - * @param scale scale factor (e.g. sign) - * @param tag unique tag/label for cacheing + * @param omega0 low intergation edge + * @param n number of subtractions + * @param scale scale factor (e.g. sign) + * @param tag unique tag/label for cache * @param rescale rescale function for better numerical precison - * @param size size of integration workspace + * @param size size of integration workspace */ template KramersKronig - ( FUNCTION rho , - const double omega0 , - const unsigned short n = 0 , - const double scale = 1 , - const std::size_t tag = 0 , - const unsigned short rescale = 0 , - const std::size_t size = 0 ) - : m_rho ( rho ) - , m_omega0 ( omega0 ) - , m_n ( n ) - , m_scale ( scale ) - , m_tag ( tag ) - , m_rescale ( rescale ) - , m_integrator ( size ) + ( FUNCTION rho , + const double omega0 , + const unsigned short n = 0 , + const double scale = 1 , + const std::size_t tag = 0 , + const unsigned short rescale = 0 , + const double aprecision = 0 , + const double rprecision = 0 , + const double width = 0 , + const std::size_t size = 0 ) + : m_rho ( rho ) + , m_omega0 ( omega0 ) + , m_n ( n ) + , m_scale ( scale ) + , m_tag ( tag ) + , m_rescale ( rescale ) + , m_aprecision ( aprecision ) + , m_rprecision ( rprecision ) + , m_width ( width ) + , m_integrator ( size ) {} // ====================================================================== public: @@ -78,14 +84,18 @@ namespace Ostap template inline static KramersKronig create - ( FUNCTION rho , - const double omega0 , - const unsigned short n = 0 , - const double scale = 1 , - const std::size_t tag = 0 , - const unsigned short rescale = 0 , - const std::size_t size = 0 ) - { return KramersKronig ( rho , omega0 , n , scale , tag , rescale , size ) ; } + ( FUNCTION rho , + const double omega0 , + const unsigned short n = 0 , + const double scale = 1 , + const std::size_t tag = 0 , + const unsigned short rescale = 0 , + const double aprecision = 0 , + const double rprecision = 0 , + const double width = 0 , + const std::size_t size = 0 ) + { return KramersKronig ( rho , omega0 , n , scale , tag , rescale , + aprecision , rprecision , width , size ) ; } // ====================================================================== public: // ====================================================================== @@ -124,8 +134,14 @@ namespace Ostap double m_scale ; // scale factor (e.g. sign) /// unique tag/label std::size_t m_tag ; // unique tag/label - /// rescale fnuction for better numerical precision - unsigned short m_rescale ; // #rescale points + /// rescale function for better numerical precision + unsigned short m_rescale ; // #rescale points + /// absolute precison + double m_aprecision ; // absolute preciison + /// relative precison + double m_rprecision ; // relative precision + /// width + double m_width ; // width /// Integrator Ostap::Math::Integrator m_integrator ; // integrator // ====================================================================== diff --git a/source/src/KramersKronig.cpp b/source/src/KramersKronig.cpp index c0c474c0..1c534a8e 100644 --- a/source/src/KramersKronig.cpp +++ b/source/src/KramersKronig.cpp @@ -26,7 +26,15 @@ // ============================================================================= double Ostap::Math::KramersKronig::operator() ( const double x ) const { return m_scale * m_integrator.kramers_kronig - ( std::cref ( m_rho ) , x , m_omega0 , m_n , m_tag , m_rescale ) ; } + ( std::cref ( m_rho ) , + x , + m_omega0 , + m_n , + m_tag , + m_rescale , + m_aprecision , + m_rprecision , + m_width ) ; } // =============================================================================