Skip to content

Commit

Permalink
1. Add missing method Ostap::Math::Histo3D::integrateXZ ( y , ... )
Browse files Browse the repository at this point in the history
  • Loading branch information
VanyaBelyaev committed May 12, 2023
1 parent b928364 commit 7888776
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ include(CTest)
set(OSTAP_VERSION_MAJOR 1)
set(OSTAP_VERSION_MINOR 9)
set(OSTAP_VERSION_PATCH 8)
set(OSTAP_VERSION_TWEAK 7)
set(OSTAP_VERSION_TWEAK 8)

set(OSTAP_VERSION ${OSTAP_VERSION_MAJOR}.${OSTAP_VERSION_MINOR}.${OSTAP_VERSION_PATCH}.${OSTAP_VERSION_TWEAK})

Expand Down
4 changes: 4 additions & 0 deletions ReleaseNotes/release_notes.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# v1.9.8.8

## New features:

## Backward incompatible:

## Bug fixes:

1. Add missing method `Ostap::Math::Histo3D::integrateXZ ( y , ... )`

# v1.9.8.6

## New features:
Expand Down
10 changes: 10 additions & 0 deletions ReleaseNotes/v1.9.8.8.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# v1.9.8.8

## New features:

## Backward incompatible:

## Bug fixes:

1. Add missing method `Ostap::Math::Histo3D::integrateXZ ( y , ... )`

26 changes: 26 additions & 0 deletions ostap/core/tests/test_core_ostap.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# =============================================================================
# @file ostap/core/tests/test_core_ostap.py
# Copyright (c) Ostap developpers.
# =============================================================================
""" Test module
"""
# =============================================================================
import ostap
# =============================================================================
# logging
# =============================================================================
from ostap.logger.logger import getLogger
if '__main__' == __name__ : logger = getLogger ( 'test_core_ostap' )
else : logger = getLogger ( __name__ )
# =============================================================================

# =============================================================================
if '__main__' == __name__ :

pass

# =============================================================================
## The END
# =============================================================================
59 changes: 57 additions & 2 deletions source/src/HistoInterpolators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,8 +552,6 @@ double Ostap::Math::Histo2D::integral
//
return result ;
}


// ============================================================================
// integral over whole histogram range
// ============================================================================
Expand Down Expand Up @@ -839,6 +837,63 @@ double Ostap::Math::Histo3D::integrateYZ
// ============================================================================
// integral between low and high
// ============================================================================
double Ostap::Math::Histo3D::integrateXZ
( const double y ,
const double xmin , const double xmax ,
const double zmin , const double zmax ) const
{
//
if ( s_equal ( zmin , xmax ) ) { return 0 ; }
else if ( s_equal ( zmin , zmax ) ) { return 0 ; }
else if ( xmax < xmin ) { return - integrateXZ ( y , xmax , xmin , zmin , zmax ) ; }
else if ( zmax < zmin ) { return - integrateXZ ( y , xmin , xmax , zmax , zmin ) ; }
//
const TAxis* xa = m_h.GetXaxis () ;
if ( xmax <= xa->GetXmin () ) { return 0 ; }
else if ( xmin >= xa->GetXmax () ) { return 0 ; }
//
const TAxis* za = m_h.GetZaxis () ;
if ( zmax <= za->GetXmin () ) { return 0 ; }
else if ( zmin >= za->GetXmax () ) { return 0 ; }
//
const TAxis* ya = m_h.GetYaxis () ;
if ( y <= ya->GetXmin () ) { return 0 ; }
else if ( y >= ya->GetXmax () ) { return 0 ; }
//
const double x_min = std::max ( xmin , xa->GetXmin () ) ;
const double x_max = std::min ( xmax , xa->GetXmax () ) ;
const double z_min = std::max ( zmin , za->GetXmin () ) ;
const double z_max = std::min ( zmax , za->GetXmax () ) ;
//
// use 2D-cubature
//
typedef Ostap::Math::IntegrateXY<Histo3D> FXZ ;
const FXZ fxz ( this , y ) ;
//
static const Ostap::Math::GSL::Integrator2D<FXZ> s_cubature{} ;
static const char s_message[] = "IntegralXZ(Histo3D)" ;
const auto F = s_cubature.make_function ( &fxz ,
x_min , x_max ,
z_min , z_max ) ;
//
int ierror = 0 ;
double result = 1 ;
double error = -1 ;
std::tie ( ierror , result , error ) = s_cubature.cubature
( Ostap::Utils::hash_combiner ( tag () , 'Y' , y ) ,
&F ,
50000 ,
s_APRECISION_CUBE3D , // absolute precision
s_RPRECISION_CUBE3D , // relative precision
s_message ,
__FILE__ ,
__LINE__ ) ;
//
return result ;
}
// ============================================================================
// integral between low and high
// ============================================================================
double Ostap::Math::Histo3D::integrateX
( const double y ,
const double z ,
Expand Down

0 comments on commit 7888776

Please sign in to comment.