cepgen
is hosted by
Hepforge
,
IPPP Durham
CepGen
1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
CuhreIntegrator.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 <cuba.h>
20
21
#include "
CepGen/Core/Exception.h
"
22
#include "
CepGen/Integration/Integrand.h
"
23
#include "
CepGen/Modules/IntegratorFactory.h
"
24
#include "
CepGenAddOns/CubaWrapper/Integrator.h
"
25
26
namespace
cepgen
{
27
namespace
cuba {
29
class
CuhreIntegrator
final :
public
Integrator
{
30
public
:
31
explicit
CuhreIntegrator
(
const
ParametersList
& params) :
Integrator
(params), key_(
steer
<int>(
"key"
)) {
32
CG_DEBUG
(
"Integrator:build"
) <<
"Cuba-Cuhre integrator built."
;
33
}
34
35
static
ParametersDescription
description
() {
36
auto
desc =
Integrator::description
();
37
desc.setDescription(
"Cuba implementation of the Cuhre algorithm"
);
38
desc.add<
int
>(
"key"
, 0).setDescription(
39
"basic integration rule:\n"
40
"key = 7, 9, 11, 13 selects the cubature rule of degree key. Note that the degree-11\n"
41
"rule is available only in 3 dimensions, the degree-13 rule only in 2 dimensions.\n"
42
"For other values, the default rule is taken, which is the degree-13 rule in 2 dimensions,\n"
43
"the degree-11 rule in 3 dimensions, and the degree-9 rule otherwise."
);
44
return
desc;
45
}
46
47
Value
integrate
()
override
{
48
int
nregions, neval, fail;
49
double
integral, error, prob;
50
51
Cuhre(
gIntegrand
->
size
(),
52
ncomp_
,
53
cuba_integrand
,
54
nullptr
,
55
nvec_
,
56
epsrel_
,
57
epsabs_
,
58
verbose_
,
59
mineval_
,
60
maxeval_
,
61
key_,
62
nullptr
,
// statefile
63
nullptr
,
// spin
64
&nregions,
65
&neval,
66
&fail,
67
&integral,
68
&error,
69
&prob);
70
71
CG_DEBUG
(
"CuhreIntegrator:integrate"
)
72
<<
"Number of regions needed: "
<< nregions <<
".\nNumber of function evaluations: "
<< neval
73
<<
"\nError flag: "
<< fail <<
"."
;
74
75
return
Value
{integral, error};
76
}
77
78
private
:
79
const
int
key_;
80
};
81
}
// namespace cuba
82
}
// namespace cepgen
83
using
CuhreIntegratorCuba
=
cepgen::cuba::CuhreIntegrator
;
84
REGISTER_INTEGRATOR
(
"cuba_cuhre"
,
CuhreIntegratorCuba
);
Exception.h
Integrand.h
IntegratorFactory.h
REGISTER_INTEGRATOR
#define REGISTER_INTEGRATOR(name, obj)
Add a generic process definition to the list of handled processes.
Definition
IntegratorFactory.h:25
CG_DEBUG
#define CG_DEBUG(mod)
Definition
Message.h:220
cepgen::Integrand::size
virtual size_t size() const =0
Phase space dimension.
cepgen::ParametersDescription
A description object for parameters collection.
Definition
ParametersDescription.h:26
cepgen::ParametersList
Definition
ParametersList.h:52
cepgen::Steerable::steer
T steer(const std::string &key) const
Retrieve a parameters as previously steered.
Definition
Steerable.h:39
cepgen::Value
A scalar value with its uncertainty.
Definition
Value.h:26
cepgen::cuba::CuhreIntegrator
Cuba implementation of the VEGAS integration algorithm.
Definition
CuhreIntegrator.cpp:29
cepgen::cuba::CuhreIntegrator::description
static ParametersDescription description()
Definition
CuhreIntegrator.cpp:35
cepgen::cuba::CuhreIntegrator::CuhreIntegrator
CuhreIntegrator(const ParametersList ¶ms)
Definition
CuhreIntegrator.cpp:31
cepgen::cuba::CuhreIntegrator::integrate
Value integrate() override
Definition
CuhreIntegrator.cpp:47
cepgen::cuba::Integrator
Cuba integration algorithm.
Definition
Integrator.h:29
cepgen::cuba::Integrator::mineval_
int mineval_
Definition
Integrator.h:43
cepgen::cuba::Integrator::nvec_
int nvec_
Definition
Integrator.h:41
cepgen::cuba::Integrator::maxeval_
int maxeval_
Definition
Integrator.h:43
cepgen::cuba::Integrator::ncomp_
int ncomp_
Definition
Integrator.h:41
cepgen::cuba::Integrator::verbose_
int verbose_
Definition
Integrator.h:44
cepgen::cuba::Integrator::epsrel_
double epsrel_
Definition
Integrator.h:42
cepgen::cuba::Integrator::description
static ParametersDescription description()
Definition
Integrator.cpp:42
cepgen::cuba::Integrator::gIntegrand
static Integrand * gIntegrand
Definition
Integrator.h:34
cepgen::cuba::Integrator::epsabs_
double epsabs_
Definition
Integrator.h:42
Integrator.h
cepgen::cuba::cuba_integrand
int cuba_integrand(const int *ndim, const double xx[], const int *, double ff[], void *)
Definition
Integrator.cpp:55
cepgen
Common namespace for this Monte Carlo generator.
Definition
CommandLineHandler.cpp:36
CepGenAddOns
CubaWrapper
CuhreIntegrator.cpp
Generated on Mon Jul 29 2024 for CepGen by
1.9.7