cepgen
is hosted by
Hepforge
,
IPPP Durham
CepGen
1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
BoostGaussKronrodAnalyticalIntegrator.cpp
Go to the documentation of this file.
1
/*
2
* CepGen: a central exclusive processes event generator
3
* Copyright (C) 2022-2024 Laurent Forthomme
4
*
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
#include <boost/math/quadrature/gauss_kronrod.hpp>
20
21
#include "
CepGen/Integration/AnalyticIntegrator.h
"
22
#include "
CepGen/Modules/AnalyticIntegratorFactory.h
"
23
#include "
CepGen/Utils/FunctionsWrappers.h
"
24
25
namespace
cepgen
{
27
template
<
size_t
N>
28
class
BoostGaussKronrodAnalyticalIntegrator
final :
public
AnalyticIntegrator
{
29
public
:
30
explicit
BoostGaussKronrodAnalyticalIntegrator
(
const
ParametersList
& params)
31
:
AnalyticIntegrator
(params),
32
max_refinements_(
steerAs
<int, size_t>(
"limit"
)),
33
tol_(
steer
<double>(
"tolerance"
)) {}
34
35
static
ParametersDescription
description
() {
36
auto
desc =
AnalyticIntegrator::description
();
37
desc.setDescription(
"Boost Gauss-Kronrod integration algorithm"
);
38
desc.add<
int
>(
"limit"
, 1000).setDescription(
"maximum number of subintervals to build"
);
39
desc.add<
double
>(
"tolerance"
, std::numeric_limits<double>::infinity()).setDescription(
"maximal tolerance"
);
40
return
desc;
41
}
42
43
double
integrate
(
const
utils::Function1D
& func,
void
* =
nullptr
,
const
Limits
& lim = {})
const
override
{
44
return
boost::math::quadrature::gauss_kronrod<double, N>::integrate(func,
45
lim.hasMin() ? lim.min() :
range_
.min(),
46
lim.hasMax() ? lim.max() :
range_
.max(),
47
tol_,
48
max_refinements_);
49
}
50
51
private
:
52
const
size_t
max_refinements_;
53
const
double
tol_;
54
};
55
}
// namespace cepgen
56
typedef
cepgen::BoostGaussKronrodAnalyticalIntegrator<15>
BGKIntegrator15
;
57
typedef
cepgen::BoostGaussKronrodAnalyticalIntegrator<31>
BGKIntegrator31
;
58
typedef
cepgen::BoostGaussKronrodAnalyticalIntegrator<41>
BGKIntegrator41
;
59
typedef
cepgen::BoostGaussKronrodAnalyticalIntegrator<51>
BGKIntegrator51
;
60
typedef
cepgen::BoostGaussKronrodAnalyticalIntegrator<61>
BGKIntegrator61
;
61
REGISTER_ANALYTIC_INTEGRATOR
(
"boost_gk15"
,
BGKIntegrator15
);
62
REGISTER_ANALYTIC_INTEGRATOR
(
"boost_gk31"
,
BGKIntegrator31
);
63
REGISTER_ANALYTIC_INTEGRATOR
(
"boost_gk41"
,
BGKIntegrator41
);
64
REGISTER_ANALYTIC_INTEGRATOR
(
"boost_gk51"
,
BGKIntegrator51
);
65
REGISTER_ANALYTIC_INTEGRATOR
(
"boost_gk61"
,
BGKIntegrator61
);
AnalyticIntegratorFactory.h
REGISTER_ANALYTIC_INTEGRATOR
#define REGISTER_ANALYTIC_INTEGRATOR(name, obj)
Add a generic analytical integrator object builder definition.
Definition
AnalyticIntegratorFactory.h:25
AnalyticIntegrator.h
BGKIntegrator31
cepgen::BoostGaussKronrodAnalyticalIntegrator< 31 > BGKIntegrator31
Definition
BoostGaussKronrodAnalyticalIntegrator.cpp:57
BGKIntegrator41
cepgen::BoostGaussKronrodAnalyticalIntegrator< 41 > BGKIntegrator41
Definition
BoostGaussKronrodAnalyticalIntegrator.cpp:58
BGKIntegrator61
cepgen::BoostGaussKronrodAnalyticalIntegrator< 61 > BGKIntegrator61
Definition
BoostGaussKronrodAnalyticalIntegrator.cpp:60
BGKIntegrator51
cepgen::BoostGaussKronrodAnalyticalIntegrator< 51 > BGKIntegrator51
Definition
BoostGaussKronrodAnalyticalIntegrator.cpp:59
BGKIntegrator15
cepgen::BoostGaussKronrodAnalyticalIntegrator< 15 > BGKIntegrator15
Definition
BoostGaussKronrodAnalyticalIntegrator.cpp:56
FunctionsWrappers.h
cepgen::AnalyticIntegrator
Analytic (functional) integration algorithm.
Definition
AnalyticIntegrator.h:32
cepgen::AnalyticIntegrator::range_
const Limits range_
Definition
AnalyticIntegrator.h:57
cepgen::AnalyticIntegrator::description
static ParametersDescription description()
Definition
AnalyticIntegrator.cpp:33
cepgen::BoostGaussKronrodAnalyticalIntegrator
Boost Gauss-Kronrod integration algorithm.
Definition
BoostGaussKronrodAnalyticalIntegrator.cpp:28
cepgen::BoostGaussKronrodAnalyticalIntegrator::BoostGaussKronrodAnalyticalIntegrator
BoostGaussKronrodAnalyticalIntegrator(const ParametersList ¶ms)
Definition
BoostGaussKronrodAnalyticalIntegrator.cpp:30
cepgen::BoostGaussKronrodAnalyticalIntegrator::description
static ParametersDescription description()
Definition
BoostGaussKronrodAnalyticalIntegrator.cpp:35
cepgen::BoostGaussKronrodAnalyticalIntegrator::integrate
double integrate(const utils::Function1D &func, void *=nullptr, const Limits &lim={}) const override
Evaluate the integral of a function at a given value.
Definition
BoostGaussKronrodAnalyticalIntegrator.cpp:43
cepgen::Limits
Validity interval for a variable.
Definition
Limits.h:28
cepgen::ParametersDescription
A description object for parameters collection.
Definition
ParametersDescription.h:26
cepgen::ParametersList
Definition
ParametersList.h:52
cepgen::Steerable::steerAs
U steerAs(const std::string &key) const
Retrieve a recasted parameters as previously steered.
Definition
Steerable.h:44
cepgen::Steerable::steer
T steer(const std::string &key) const
Retrieve a parameters as previously steered.
Definition
Steerable.h:39
cepgen::utils::Function1D
Wrapper to a 1-dimensional function with optional parameters.
Definition
FunctionsWrappers.h:29
cepgen
Common namespace for this Monte Carlo generator.
Definition
CommandLineHandler.cpp:36
CepGenAddOns
BoostWrapper
BoostGaussKronrodAnalyticalIntegrator.cpp
Generated on Mon Jul 29 2024 for CepGen by
1.9.7