cepgen
is hosted by
Hepforge
,
IPPP Durham
CepGen
1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
VegasIntegrator.cpp
Go to the documentation of this file.
1
/*
2
* CepGen: a central exclusive processes event generator
3
* Copyright (C) 2021-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 "
CepGen/Core/Exception.h
"
20
#include "
CepGen/Integration/Integrand.h
"
21
#include "
CepGen/Modules/IntegratorFactory.h
"
22
#include "
CepGenAddOns/CubaWrapper/Integrator.h
"
23
#include "cuba.h"
24
25
namespace
cepgen
{
26
namespace
cuba {
28
class
VegasIntegrator
:
public
Integrator
{
29
public
:
30
explicit
VegasIntegrator
(
const
ParametersList
& params)
31
:
Integrator
(params),
32
nstart_(
steer
<int>(
"NStart"
)),
33
nincrease_(
steer
<int>(
"NIncrease"
)),
34
nbatch_(
steer
<int>(
"NBatch"
)),
35
gridno_(
steer
<int>(
"GridNo"
)) {
36
CG_DEBUG
(
"Integrator:build"
) <<
"Cuba-VEGAS integrator built."
;
37
}
38
39
static
ParametersDescription
description
() {
40
auto
desc =
Integrator::description
();
41
desc.setDescription(
"Cuba implementation of the VEGAS algorithm"
);
42
desc.add<
int
>(
"NStart"
, 1000).setDescription(
"number of integrand evaluations per iteration to start with"
);
43
desc.add<
int
>(
"NIncrease"
, 500).setDescription(
"increase in the number of integrand evaluations per iteration"
);
44
desc.add<
int
>(
"NBatch"
, 1000)
45
.setDescription(
"number of points sent in one MathLink packet to be sampled by Mathematica"
);
46
desc.add<
int
>(
"GridNo"
, 0).setDescription(
"slot in the internal grid table"
);
47
return
desc;
48
}
49
50
Value
integrate
()
override
{
51
int
neval, fail;
52
double
integral, error, prob;
53
54
Vegas(
gIntegrand
->
size
(),
55
ncomp_
,
56
cuba_integrand
,
57
nullptr
,
58
nvec_
,
59
epsrel_
,
60
epsabs_
,
61
verbose_
,
62
rnd_gen_
->parameters().get<
unsigned
long
long
>(
"seed"
),
63
mineval_
,
64
maxeval_
,
65
nstart_,
66
nincrease_,
67
nbatch_,
68
gridno_,
69
nullptr
,
70
nullptr
,
71
&neval,
72
&fail,
73
&integral,
74
&error,
75
&prob);
76
return
Value
{integral, error};
77
}
78
79
private
:
80
const
int
nstart_, nincrease_, nbatch_;
81
const
int
gridno_;
82
};
83
}
// namespace cuba
84
}
// namespace cepgen
85
using
VegasIntegratorCuba
=
cepgen::cuba::VegasIntegrator
;
86
REGISTER_INTEGRATOR
(
"cuba_vegas"
,
VegasIntegratorCuba
);
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::Integrator::rnd_gen_
const std::unique_ptr< utils::RandomGenerator > rnd_gen_
Definition
Integrator.h:56
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::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
cepgen::cuba::VegasIntegrator
Cuba implementation of the VEGAS integration algorithm.
Definition
VegasIntegrator.cpp:28
cepgen::cuba::VegasIntegrator::VegasIntegrator
VegasIntegrator(const ParametersList ¶ms)
Definition
VegasIntegrator.cpp:30
cepgen::cuba::VegasIntegrator::description
static ParametersDescription description()
Definition
VegasIntegrator.cpp:39
cepgen::cuba::VegasIntegrator::integrate
Value integrate() override
Definition
VegasIntegrator.cpp:50
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
VegasIntegrator.cpp
Generated on Mon Jul 29 2024 for CepGen by
1.9.7