cepgen
is hosted by
Hepforge
,
IPPP Durham
CepGen
1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
GluonGrid.cpp
Go to the documentation of this file.
1
/*
2
* CepGen: a central exclusive processes event generator
3
* Copyright (C) 2018-2023 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 <cmath>
20
#include <fstream>
21
22
#include "
CepGen/Core/Exception.h
"
23
#include "
CepGen/Physics/GluonGrid.h
"
24
#include "
CepGen/Utils/Timer.h
"
25
26
namespace
kmr
{
27
GluonGrid
&
GluonGrid::get
(
const
cepgen::ParametersList
& params) {
28
static
GluonGrid
instance(!params.
empty
() ? params :
description
().
parameters
());
29
return
instance;
30
}
31
32
GluonGrid::GluonGrid
(
const
cepgen::ParametersList
& params)
33
:
cepgen
::GridHandler<3, 1>(
cepgen
::GridType::linear
/*grid is already logarithmic*/
),
34
SteeredObject(params),
35
grid_path_(steerPath(
"path"
)) {
36
CG_INFO
(
"GluonGrid"
) <<
"Building the KMR grid evaluator."
;
37
38
cepgen::utils::Timer
tmr;
39
{
// file readout part
40
std::ifstream file(grid_path_, std::ios::in);
41
if
(!file.is_open())
42
throw
CG_FATAL
(
"GluonGrid"
) <<
"Failed to load grid file \""
<< grid_path_ <<
"\"!"
;
43
44
std::string x, kt2, mu2, fg;
45
while
(file >> x >> kt2 >> mu2 >> fg)
46
insert
({std::stod(x), std::stod(kt2), std::stod(mu2)}, {std::stod(fg)});
47
file.close();
48
initialise
();
// initialise the grid after filling its nodes
49
}
50
const
auto
limits =
boundaries
();
51
CG_INFO
(
"GluonGrid"
) <<
"KMR grid evaluator built in "
<< tmr.
elapsed
() <<
" s.\n\t"
52
<<
" log(x) in range "
<< limits.at(0) <<
",\t"
53
<<
"x in range "
<< limits.at(0).compute(std::exp) <<
"\n\t"
54
<<
" log(kt^2) in range "
<< limits.at(1) <<
",\t"
55
<<
"kt^2 in range "
<< limits.at(1).compute(std::exp) <<
"\n\t"
56
<<
" log(mu^2) in range "
<< limits.at(2) <<
",\t"
57
<<
"mu^2 in range "
<< limits.at(2).compute(std::exp) <<
"."
;
58
}
59
60
double
GluonGrid::operator()
(
double
x,
double
kt2,
double
mu2)
const
{
61
return
cepgen::GridHandler<3, 1>::eval
({std::log10(x), std::log10(kt2), std::log10(mu2)}).at(0);
62
}
63
64
cepgen::ParametersDescription
GluonGrid::description
() {
65
auto
desc =
cepgen::ParametersDescription
();
66
desc.add<std::string>(
"path"
,
DEFAULT_KMR_GRID_PATH
);
67
return
desc;
68
}
69
}
// namespace kmr
Exception.h
CG_FATAL
#define CG_FATAL(mod)
Definition
Exception.h:61
GluonGrid.h
DEFAULT_KMR_GRID_PATH
#define DEFAULT_KMR_GRID_PATH
Definition
GluonGrid.h:25
CG_INFO
#define CG_INFO(mod)
Definition
Message.h:216
Timer.h
cepgen::GridHandler< 3, 1 >::initialise
void initialise()
Initialise the grid and all useful interpolators/accelerators.
Definition
GridHandler.cpp:150
cepgen::GridHandler< 3, 1 >::insert
void insert(coord_t coord, values_t value)
Insert a new value in the grid.
Definition
GridHandler.cpp:129
cepgen::GridHandler< 3, 1 >::boundaries
std::array< Limits, D > boundaries() const
Grid boundaries (collection of (min,max))
Definition
GridHandler.cpp:268
cepgen::GridHandler::eval
values_t eval(coord_t in_coords) const
Interpolate a point to a given coordinate.
Definition
GridHandler.cpp:37
cepgen::ParametersDescription
A description object for parameters collection.
Definition
ParametersDescription.h:26
cepgen::ParametersDescription::parameters
ParametersList & parameters()
List of parameters associated to this description object.
Definition
ParametersDescription.cpp:216
cepgen::ParametersList
Definition
ParametersList.h:52
cepgen::ParametersList::empty
bool empty() const
Is the list empty?
Definition
ParametersList.cpp:249
cepgen::utils::Timer
A generic timer to extract the processing time between two steps in this software's flow.
Definition
Timer.h:30
cepgen::utils::Timer::elapsed
double elapsed() const
Time elapsed since the last reset call (or class construction)
Definition
Timer.h:37
kmr::GluonGrid
A KMR unintegrated gluon densities grid interpolator.
Definition
GluonGrid.h:30
kmr::GluonGrid::GluonGrid
GluonGrid(const GluonGrid &)=delete
kmr::GluonGrid::operator()
double operator()(double x, double kt2, double mu2) const
Compute the gluon flux.
Definition
GluonGrid.cpp:60
kmr::GluonGrid::get
static GluonGrid & get(const cepgen::ParametersList ¶ms={})
Retrieve the grid interpolator (singleton)
Definition
GluonGrid.cpp:27
kmr::GluonGrid::description
static cepgen::ParametersDescription description()
Definition
GluonGrid.cpp:64
cepgen
Common namespace for this Monte Carlo generator.
Definition
CommandLineHandler.cpp:36
kmr
Kimber-Martin-Ryskin unintegrated gluon densities.
Definition
GluonGrid.cpp:26
CepGen
Physics
GluonGrid.cpp
Generated on Mon Jul 29 2024 for CepGen by
1.9.7