cepgen
is hosted by
Hepforge
,
IPPP Durham
CepGen
1.2.5
Central exclusive processes event generator
Toggle main menu visibility
Main Page
Related Pages
Packages
Package List
Package Members
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
x
y
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
x
y
Variables
Typedefs
Enumerations
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
p
q
r
s
t
u
v
w
x
y
z
Typedefs
Enumerations
Enumerator
b
c
d
e
g
h
i
l
m
n
p
r
t
u
w
x
y
z
Related Symbols
d
g
h
o
u
v
Files
File List
File Members
All
_
a
b
c
d
e
h
o
p
r
s
Functions
Variables
Macros
_
b
c
d
e
p
r
s
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
Loading...
Searching...
No Matches
cepgenScanPhaseSpace.cc
Go to the documentation of this file.
1
/*
2
* CepGen: a central exclusive processes event generator
3
* Copyright (C) 2013-2022 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/Core/RunParameters.h
"
21
#include "
CepGen/Generator.h
"
22
#include "
CepGen/Modules/DrawerFactory.h
"
23
#include "
CepGen/Process/Process.h
"
24
#include "
CepGen/Utils/ArgumentsParser.h
"
25
#include "
CepGen/Utils/Drawer.h
"
26
#include "
CepGen/Utils/Graph.h
"
27
#include "
CepGen/Utils/String.h
"
28
29
using namespace
std;
30
31
int
main
(
int
argc,
char
* argv[]) {
32
string
input_card, plotter;
33
int
npoints;
34
vector<int> dim;
35
double
def;
36
bool
draw_grid, log;
37
38
cepgen::ArgumentsParser
(argc, argv)
39
.
addArgument
(
"input,i"
,
"input card"
, &input_card)
40
.
addOptionalArgument
(
"default,D"
,
"default value for non-varying coordinates"
, &def, 0.5)
41
.
addOptionalArgument
(
"dim,s"
,
"dimensions to probe"
, &dim, vector<int>{0, 1})
42
.addOptionalArgument(
"num-points,n"
,
"number of points to probe"
, &npoints, 100)
43
.
addOptionalArgument
(
"draw-grid,g"
,
"draw the x/y grid"
, &draw_grid,
false
)
44
.
addOptionalArgument
(
"log,l"
,
"logarithmic axis"
, &log,
false
)
45
.
addOptionalArgument
(
"plotter,p"
,
"type of plotter to user"
, &plotter,
""
)
46
.
parse
();
47
48
cepgen::utils::Graph1D
gr_scan_1d(
"test_scan"
);
49
cepgen::utils::Graph2D
gr_scan_2d(
"test_scan"
);
50
if
(dim.size() > 3)
51
throw
CG_FATAL
(
"main"
) <<
"Number of dimensions to probe ("
<< dim.size() <<
") is too high"
;
52
53
cepgen::Generator
gen;
54
gen.
parseRunParameters
(input_card);
55
CG_LOG
<< gen.
runParameters
();
56
const
size_t
ndim = gen.
runParameters
().
process
().
ndim
();
57
58
vector<double> coord(ndim, def);
59
60
for
(
int
i = 0; i < npoints; ++i) {
61
const
double
x = i * 1. / npoints;
62
switch
(dim.size()) {
63
case
0:
64
gr_scan_1d.
addPoint
(x, gen.
computePoint
(vector<double>(ndim, x)));
65
break
;
66
case
1:
67
coord[dim.at(0)] = x;
68
gr_scan_1d.
addPoint
(x, gen.
computePoint
(coord));
69
break
;
70
case
2:
71
coord[dim.at(0)] = x;
72
for
(
int
j = 0; j < npoints; ++j) {
73
const
double
y = j * 1. / npoints;
74
coord[dim.at(1)] = y;
75
gr_scan_2d.
addPoint
(x, y, gen.
computePoint
(coord));
76
}
77
break
;
78
}
79
}
80
if
(!plotter.empty()) {
81
auto
plt = cepgen::DrawerFactory::get().build(plotter);
82
cepgen::utils::Drawer::Mode
dm;
83
if
(draw_grid)
84
dm |=
cepgen::utils::Drawer::Mode::grid
;
85
switch
(dim.size()) {
86
case
0:
87
case
1: {
88
if
(log)
89
dm |=
cepgen::utils::Drawer::Mode::logy
;
90
string
xlabel;
91
if
(dim.empty())
92
xlabel =
cepgen::utils::format
(
"x_{i = 0, ..., %ld}"
, ndim - 1);
93
else
94
xlabel =
cepgen::utils::format
(
"x_{%d}"
, dim.at(0));
95
gr_scan_1d.
setTitle
(
cepgen::utils::format
(
"%s variation, all others x_{i} at %g"
, xlabel.c_str(), def));
96
gr_scan_1d.
xAxis
().
setLabel
(xlabel);
97
gr_scan_2d.
yAxis
().
setLabel
(
cepgen::utils::format
(
"d^{%ld}#sigma/d#bf{x}^{%ld}"
, ndim, ndim));
98
plt->draw(gr_scan_1d, dm);
99
}
break
;
100
case
2: {
101
if
(log)
102
dm |=
cepgen::utils::Drawer::Mode::logz
;
103
string
xlabel =
cepgen::utils::format
(
"x_{%d}"
, dim.at(0)), ylabel =
cepgen::utils::format
(
"x_{%d}"
, dim.at(1));
104
gr_scan_2d.
setTitle
(
105
cepgen::utils::format
(
"(%s, %s) variation, all others x_{i} at %g"
, xlabel.c_str(), ylabel.c_str(), def));
106
gr_scan_2d.
xAxis
().
setLabel
(xlabel);
107
gr_scan_2d.
yAxis
().
setLabel
(ylabel);
108
gr_scan_2d.
zAxis
().
setLabel
(
cepgen::utils::format
(
"d^{%ld}#sigma/d#bf{x}^{%ld}"
, ndim, ndim));
109
plt->draw(gr_scan_2d, dm);
110
}
111
}
112
}
113
114
return
0;
115
}
ArgumentsParser.h
DrawerFactory.h
Drawer.h
Exception.h
CG_FATAL
#define CG_FATAL(mod)
Definition
Exception.h:61
Generator.h
Graph.h
CG_LOG
#define CG_LOG
Definition
Message.h:212
Process.h
RunParameters.h
String.h
cepgen::ArgumentsParser
A generic command line arguments parser.
Definition
ArgumentsParser.h:31
cepgen::ArgumentsParser::addArgument
ArgumentsParser & addArgument(Args &&... args)
Add a parameter required for the parser.
Definition
ArgumentsParser.h:39
cepgen::ArgumentsParser::parse
ArgumentsParser & parse()
Associate command-line arguments to parameters.
Definition
ArgumentsParser.cpp:106
cepgen::ArgumentsParser::addOptionalArgument
ArgumentsParser & addOptionalArgument(Args &&... args)
Add a non-mandatory parameters that can be parsed.
Definition
ArgumentsParser.h:46
cepgen::Generator
Core generator object allowing for process definition, cross section computation, and event generatio...
Definition
Generator.h:48
cepgen::Generator::computePoint
double computePoint(const std::vector< double > &x)
Compute one single point from the total phase space.
Definition
Generator.cpp:90
cepgen::Generator::parseRunParameters
void parseRunParameters(const std::string &)
Read a steering card to populate the run parameters block.
Definition
Generator.cpp:72
cepgen::Generator::runParameters
const RunParameters & runParameters() const
Pointer to the parameters block.
Definition
Generator.cpp:76
cepgen::RunParameters::process
proc::Process & process()
Process object for cross-section computation/events generation.
Definition
RunParameters.cpp:105
cepgen::proc::Process::ndim
size_t ndim() const
Number of dimensions on which the integration is performed.
Definition
Process.h:60
cepgen::utils::Drawable::AxisInfo::setLabel
AxisInfo & setLabel(const std::string &label)
Set the axis title.
Definition
Drawable.h:50
cepgen::utils::Drawable::yAxis
AxisInfo & yAxis()
Definition
Drawable.h:81
cepgen::utils::Drawable::zAxis
AxisInfo & zAxis()
Definition
Drawable.h:83
cepgen::utils::Drawable::xAxis
AxisInfo & xAxis()
Definition
Drawable.h:79
cepgen::utils::Drawable::setTitle
void setTitle(const std::string &title)
Set the drawable title.
Definition
Drawable.h:44
cepgen::utils::Drawer::Mode
Definition
Drawer.h:41
cepgen::utils::Drawer::Mode::logz
@ logz
Definition
Drawer.h:47
cepgen::utils::Drawer::Mode::grid
@ grid
Definition
Drawer.h:49
cepgen::utils::Drawer::Mode::logy
@ logy
Definition
Drawer.h:46
cepgen::utils::Graph1D
A one-dimensional graph object.
Definition
Graph.h:29
cepgen::utils::Graph1D::addPoint
Graph1D & addPoint(double x, double y)
Add one value to the graph.
Definition
Graph.cpp:30
cepgen::utils::Graph2D
A two-dimensional graph object.
Definition
Graph.h:58
cepgen::utils::Graph2D::addPoint
Graph2D & addPoint(double x, double y, double z)
Add one value to the graph.
Definition
Graph.cpp:82
cepgen::utils::format
std::string format(const std::string &fmt, Args... args)
Format a string using a printf style format descriptor.
Definition
String.h:61
main
int main()
Definition
pythia6_decay.cc:9
src
utils
cepgenScanPhaseSpace.cc
Generated on Mon Jul 29 2024 for CepGen by
1.9.7