hep-mc
0.8
|
How integrand functions are written.
Functions that can be integrated by the Monte Carlo algorithms must accept a single parameter of the type mc_point and return a value of type T
. For example, an integrand of the form \( f(x) := x^2 \) implemented with double precision numbers would look like:
Some integration algorithms, e.g. vegas, supply additional information that can be accessed by capturing the argument with a different type, e.g. for VEGAS by vegas_point :
If additional variables in the integrand are necessary, they can be supplied by global variables or using functors:
Starting with version 0.5 it is possible to generate differential distributions, which can be generated if a second argument is accepted, e.g.
Specifying the integrand is not enough for the Monte Carlo integration routines. They also must know the dimensionsionaly of the integrand, or how many random numbers are needed; furthermore, the numeric type with which the operations should be performed must be specified. If distributions should be accumulated during the integration the binning (how many bins, upper and lower boundaries) must be specified as well. Since this is generic for all algorithms the complete integrand information is specified by creating an integrand, which, for the examples above, would be written as follows:
An integrand for a multi channel integrator requires even more information because the user must provide PDFs and CDFs. Both must be calculated in a single function that has the following signature:
A multi_channel_integrand is now created as follows:
Classes | |
class | hep::integrand< T, F, distributions > |
class | hep::mc_point< T > |
class | hep::multi_channel_integrand< T, F, M, distributions > |
class | hep::multi_channel_point< T > |
class | hep::multi_channel_point2< T, M > |
class | hep::vegas_point< T > |
Typedefs | |
template<typename T , typename F , bool distributions> | |
using | hep::integrand_type = integrand< T, typename std::decay< F >::type, distributions > |
template<typename I > | |
using | hep::numeric_type_of = typename std::remove_reference< I >::type::numeric_type |
template<typename T , typename F , typename M , bool distributions> | |
using | hep::multi_channel_integrand_type = multi_channel_integrand< T, typename std::decay< F >::type, typename std::decay< M >::type, distributions > |
Enumerations | |
enum | hep::multi_channel_map { hep::multi_channel_map::calculate_coordinates, hep::multi_channel_map::calculate_densities } |
Functions | |
template<typename T , typename F > | |
integrand_type< T, F, false > | hep::make_integrand (F &&function, std::size_t dimensions) |
template<typename T , typename F , typename... D> | |
integrand_type< T, F, true > | hep::make_integrand (F &&function, std::size_t dimensions, D &&... parameters) |
template<typename T , typename F , typename M > | |
multi_channel_integrand_type< T, F, M, false > | hep::make_multi_channel_integrand (F &&function, std::size_t dimensions, M &&map, std::size_t map_dimensions, std::size_t channels) |
template<typename T , typename F , typename M , typename... Ds> | |
multi_channel_integrand_type< T, F, M, true > | hep::make_multi_channel_integrand (F &&function, std::size_t dimensions, M &&map, std::size_t map_dimensions, std::size_t channels, Ds &&... parameters) |
using hep::integrand_type = typedef integrand<T, typename std::decay<F>::type, distributions> |
Template alias for an integrand with its type F
decayed with std::decay
.
using hep::multi_channel_integrand_type = typedef multi_channel_integrand<T, typename std::decay<F>::type, typename std::decay<M>::type, distributions> |
Template alias for a multi_channel_integrand with its types F
and M
decayed with std::decay
.
using hep::numeric_type_of = typedef typename std::remove_reference<I>::type::numeric_type |
Shortcut for accessing the numeric type of an integrand that is possibly a reference.
|
strong |
Enumeration that specifies which parameters of the user specified map should be calculated.
|
inline |
PLAIN/VEGAS integrand constructor. This function constructs an integrand using the given function
that must accept points from the \( d \)-dimensional hypercube, where \( d \) is given by the parameter dimensions
. The type of the point is determined by the integration algorithm later used on the integrand, e.g. for vegas it is vegas_point. For this case the integrand would look like:
|
inline |
PLAIN/VEGAS distributions constructor. This function constructs an integrand using the given function
that must accept points from the \( d \)-dimensional hypercube and a reference to a projector that generates the distributions. The dimension \( d \) is given by the parameter dimension
, and parameters
define the number and parameters of the distribution(s). For the VEGAS algorithm the function would look like:
|
inline |
Multi channel integrand constructor. For a description of the parameters see make_integrand. In addition, Multi Channel integrators need an additonal function map
that computes the PDFs and the CDFs for a randomly selected channel. This function should look like:
This function is called by the multi channel integrator, first with the parameter action
set to multi_channel_map::calculate_coordinates, which signals that the vector coordinates
must be filled using the CDFs. The return value is ignored for this function call. If the integrand returns a non-zero value map
is called again with action
set to multi_channel_map::calculate_densities, which means that the vector densities
must be populated with all PDFs for the given channel
and random_numbers
. The return value is the jacobian for the given channel
.
|
inline |
Multi channel integrand constructor for distributions.