cepgen
is hosted by
Hepforge
,
IPPP Durham
CepGen
1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
Derivator.h
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
#ifndef CepGen_Utils_Derivator_h
20
#define CepGen_Utils_Derivator_h
21
22
#include "
CepGen/Modules/NamedModule.h
"
23
#include "
CepGen/Utils/FunctionsWrappers.h
"
24
25
namespace
cepgen
{
26
namespace
utils {
27
class
Derivator
:
public
NamedModule
<Derivator> {
28
public
:
29
explicit
Derivator
(
const
ParametersList
& params) :
NamedModule
(params),
h_
(
steer
<double>(
"h"
)) {}
30
31
static
ParametersDescription
description
() {
32
auto
desc =
ParametersDescription
();
33
desc.add<
double
>(
"h"
, 1.e-2).setDescription(
"step size"
);
34
return
desc;
35
}
36
41
inline
double
derivate
(
const
std::function<
double
(
double
)>& func,
double
x,
double
h = -1.)
const
{
42
return
derivate
(
Function1D
(func), x, h);
43
}
48
virtual
double
derivate
(
const
Function1D
& func,
double
x,
double
h = -1.)
const
= 0;
49
50
protected
:
51
const
double
h_
;
52
};
53
}
// namespace utils
54
}
// namespace cepgen
55
56
#endif
FunctionsWrappers.h
NamedModule.h
cepgen::NamedModule
Base runtime module object.
Definition
NamedModule.h:28
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::utils::Derivator
Definition
Derivator.h:27
cepgen::utils::Derivator::derivate
double derivate(const std::function< double(double)> &func, double x, double h=-1.) const
Evaluate the derivative of a function at a given value.
Definition
Derivator.h:41
cepgen::utils::Derivator::description
static ParametersDescription description()
Definition
Derivator.h:31
cepgen::utils::Derivator::derivate
virtual double derivate(const Function1D &func, double x, double h=-1.) const =0
Evaluate the derivative of a function at a given value.
cepgen::utils::Derivator::Derivator
Derivator(const ParametersList ¶ms)
Definition
Derivator.h:29
cepgen::utils::Derivator::h_
const double h_
Definition
Derivator.h:51
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
CepGen
Utils
Derivator.h
Generated on Mon Jul 29 2024 for CepGen by
1.9.7