hep-mc  0.8
Classes | Functions
Results

Detailed Description

Obtaining, combining and checking results.

Results can always be obtained by capturing the return-value of the integration functions. The types depend on the algorithm used, e.g. plain returns an instance of mc_result which stores the estimate of the integral, its error and the number of integrand calls used to obtain this result. The vegas and vegas_iteration functions return one or a vector of instances of vegas_result that gives additional information about the PDF that was used during this iteration and the data accumulated that would be used to compute the PDF for the next iteration.

Classes

struct  hep::weighted_with_variance< IteratorOverMcResults >
 
struct  hep::weighted_equally< IteratorOverMcResults >
 
class  hep::mc_result< T >
 
class  hep::multi_channel_result< T >
 
class  hep::multi_channel_weight_info< T >
 
class  hep::plain_result< T >
 
class  hep::vegas_result< T >
 

Functions

template<template< typename > class Accumulator, typename IteratorOverMcResults >
hep_mc_result_if< IteratorOverMcResults > hep::accumulate (IteratorOverMcResults begin, IteratorOverMcResults end)
 
template<template< typename > class Accumulator, typename IteratorOverPlainResults >
hep_plain_result_if< IteratorOverPlainResults > hep::accumulate (IteratorOverPlainResults begin, IteratorOverPlainResults end)
 
template<template< typename > class Accumulator, typename IteratorOverMcResults >
hep_numeric_type< IteratorOverMcResults > hep::chi_square_dof (IteratorOverMcResults begin, IteratorOverMcResults end)
 
template<typename T >
mc_result< T > hep::create_result (std::size_t calls, std::size_t non_zero_calls, std::size_t finite_calls, T value, T error)
 
template<typename T >
hep::multi_channel_max_difference (multi_channel_result< T > const &result)
 
template<typename T >
std::vector< std::size_t > hep::minimal_weight_channels (multi_channel_weight_info< T > const &info)
 

Function Documentation

◆ accumulate() [1/2]

template<template< typename > class Accumulator, typename IteratorOverMcResults >
hep_mc_result_if<IteratorOverMcResults> hep::accumulate ( IteratorOverMcResults  begin,
IteratorOverMcResults  end 
)
inline

Accumulates the results in the interval [begin, end) using an instance of the type Accumulator. This function is called if the interval points to results of the type mc_result, but not plain_result. Accumulator can be weighted_with_variance, weighted_equally, or a similar type.

◆ accumulate() [2/2]

template<template< typename > class Accumulator, typename IteratorOverPlainResults >
hep_plain_result_if<IteratorOverPlainResults> hep::accumulate ( IteratorOverPlainResults  begin,
IteratorOverPlainResults  end 
)
inline

Accumulates the results in the interval [begin, end) using an instance of the type Accumulator. This function is called if the interval points to results of the type plain_result and therefore also accumulates all distributions. Accumulator can be weighted_with_variance, weighted_equally, or a similar type.

◆ chi_square_dof()

template<template< typename > class Accumulator, typename IteratorOverMcResults >
hep_numeric_type<IteratorOverMcResults> hep::chi_square_dof ( IteratorOverMcResults  begin,
IteratorOverMcResults  end 
)
inline

Returns an approximation for the \( \chi^2 \) per degree of freedom using the results \( (E_i, S_i) \) pointed to by the range [begin, end). The cumulative value \( E \) is calculated using an instance of Accumulator. The \( \chi^2 \) is then computed as:

\[ \chi^2 / \mathrm{dof} \approx \frac{1}{n-1} \sum_{i=1}^n \frac{\left( E_i - E \right)^2}{S_i^2} \]

If the range [begin, end) is empty, the result is zero. If it contains one element the result is infinity.

Examples:
helper_example.cpp, mpi_vegas_example.cpp, and vegas_example.cpp.

◆ create_result()

template<typename T >
mc_result<T> hep::create_result ( std::size_t  calls,
std::size_t  non_zero_calls,
std::size_t  finite_calls,
value,
error 
)
inline

Creates a mc_result using the parameters calls, non_zero_calls, value and error.

Examples:
helper_example.cpp.

◆ minimal_weight_channels()

template<typename T >
std::vector<std::size_t> hep::minimal_weight_channels ( multi_channel_weight_info< T > const &  info)
inline

Returns a vector containing the indices of the channels with the smallest weights.

◆ multi_channel_max_difference()

template<typename T >
T hep::multi_channel_max_difference ( multi_channel_result< T > const &  result)
inline

Returns the maximum difference \( D \) defined in Ref. [2] as

\[ D = \max_{i,j} | W_i ( \alpha ) - W_j ( \alpha ) | \]

with \( W_i ( \alpha ) \) being stored in adjustment_data of of the given result.