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
cepgenPlotKTFluxes.cc
Go to the documentation of this file.
1
/*
2
* CepGen: a central exclusive processes event generator
3
* Copyright (C) 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 <fstream>
20
21
#include "
CepGen/Generator.h
"
22
#include "
CepGen/KTFluxes/KTFlux.h
"
23
#include "
CepGen/Modules/DrawerFactory.h
"
24
#include "
CepGen/Modules/PartonFluxFactory.h
"
25
#include "
CepGen/Utils/ArgumentsParser.h
"
26
#include "
CepGen/Utils/Drawer.h
"
27
#include "
CepGen/Utils/Graph.h
"
28
#include "
CepGen/Utils/Message.h
"
29
#include "
CepGen/Utils/String.h
"
30
31
using namespace
std;
32
using namespace
std::string_literals;
33
34
int
main
(
int
argc,
char
* argv[]) {
35
vector<string> fluxes_names;
36
int
num_points;
37
double
kt2, mx, q2;
38
string
output_file, plotter;
39
bool
logx, logy, draw_grid, normalised, ratio_plot;
40
cepgen::Limits
x_range, y_range;
41
42
cepgen::initialise
();
43
44
cepgen::ArgumentsParser
(argc, argv)
45
.
addOptionalArgument
(
46
"fluxes,f"
,
"parton fluxes modellings"
, &fluxes_names, cepgen::KTFluxFactory::get().modules())
47
.
addOptionalArgument
(
"mx,M"
,
"diffractive mass (GeV)"
, &mx, 1.5)
48
.
addOptionalArgument
(
"q2,q"
,
"parton virtuality (GeV^2)"
, &q2, -1.)
49
.
addOptionalArgument
(
"xrange,x"
,
"fractional loss range"
, &x_range,
cepgen::Limits
{0., 1.})
50
.addOptionalArgument(
"yrange,y"
,
"y range"
, &y_range)
51
.
addOptionalArgument
(
"kt2,k"
,
"parton transverse virtuality (GeV^2)"
, &kt2, 10.)
52
.
addOptionalArgument
(
"npoints,n"
,
"number of x-points to scan"
, &num_points, 100)
53
.
addOptionalArgument
(
"output,o"
,
"output file name"
, &output_file,
"flux.scan.output.txt"
)
54
.
addOptionalArgument
(
"plotter,p"
,
"type of plotter to user"
, &plotter,
""
)
55
.
addOptionalArgument
(
"logx"
,
"logarithmic x-scale"
, &logx,
false
)
56
.
addOptionalArgument
(
"logy,l"
,
"logarithmic y-scale"
, &logy,
false
)
57
.
addOptionalArgument
(
"draw-grid,g"
,
"draw the x/y grid"
, &draw_grid,
false
)
58
.
addOptionalArgument
(
"ratio,r"
,
"draw the ratio plot"
, &ratio_plot,
false
)
59
.
addOptionalArgument
(
"normalised"
,
"plot xf(x) instead of f(x)"
, &normalised,
false
)
60
.
parse
();
61
62
const
bool
plot_vs_q2 = (q2 >= 0.);
63
if
(logx && x_range.
min
() == 0.)
64
x_range.
min
() = 1.e-3;
65
if
(x_range.
max
() == 1.)
66
x_range.
max
() -= 1.e-15;
67
68
vector<std::unique_ptr<cepgen::KTFlux> > fluxes;
69
vector<cepgen::utils::Graph1D> graph_flux;
70
for
(
const
auto
& flux : fluxes_names) {
71
fluxes.emplace_back(cepgen::KTFluxFactory::get().build(flux));
72
graph_flux.emplace_back(flux, cepgen::KTFluxFactory::get().describe(flux));
73
}
74
75
ofstream out(output_file);
76
out <<
"# parton fluxes: "
<<
cepgen::utils::merge
(fluxes_names,
";"
) <<
"\n"
;
77
out <<
"# transverse virtuality: "
<< kt2 <<
" GeV^2\n"
;
78
if
(plot_vs_q2)
79
out <<
"# virtuality: "
<< q2 <<
" GeV^2\n"
;
80
else
81
out <<
"# diffractive mass: "
<< mx <<
" GeV/c^2\n"
;
82
out <<
"# fractional momentum loss: "
<< x_range;
83
84
for
(
const
auto
& x : x_range.
generate
(num_points)) {
85
out <<
"\n"
<< x;
86
for
(
size_t
i = 0; i < fluxes.size(); ++i) {
87
auto
flux = plot_vs_q2 ? fluxes.at(i)->fluxQ2(x, kt2, q2) : fluxes.at(i)->fluxMX2(x, kt2, mx * mx);
88
flux *= (normalised ? x : 1.);
89
out <<
"\t"
<< flux;
90
graph_flux.at(i).addPoint(x, flux);
91
}
92
}
93
out.close();
94
CG_LOG
<<
"Scan written in \""
<< output_file <<
"\"."
;
95
96
if
(!plotter.empty()) {
97
auto
plt = cepgen::DrawerFactory::get().build(plotter);
98
cepgen::utils::Drawer::Mode
dm;
99
if
(logx)
100
dm |=
cepgen::utils::Drawer::Mode::logx
;
101
if
(logy)
102
dm |=
cepgen::utils::Drawer::Mode::logy
;
103
if
(draw_grid)
104
dm |=
cepgen::utils::Drawer::Mode::grid
;
105
if
(ratio_plot)
106
dm |=
cepgen::utils::Drawer::Mode::ratio
;
107
cepgen::utils::DrawableColl
coll;
108
109
for
(
auto
& gr : graph_flux) {
110
gr.xAxis().setLabel(
"$\\xi$"
);
111
gr.yAxis().setLabel(
"$"
s + (normalised ?
"\\xi\\varphi"
:
"\\varphi"
) +
"(\\xi, "
+
112
(plot_vs_q2 ?
"Q^{2}"
:
"M_{X}"
) +
", k_{T}^{2})$"
);
113
if
(y_range.
valid
())
114
gr.yAxis().setRange(y_range);
115
coll.emplace_back(&gr);
116
}
117
plt->draw(coll,
118
"comp_partonflux"
,
119
(plot_vs_q2 ?
cepgen::utils::format
(
"$Q^{2}$ = %g GeV$^{2}$"
, q2)
120
:
cepgen::utils::format
(
"$M_{X}$ = %g GeV"
, mx)) +
121
", "
+
cepgen::utils::format
(
"$k_{T}^{2}$ = %g GeV$^{2}$"
, kt2),
122
dm);
123
}
124
125
return
0;
126
}
ArgumentsParser.h
DrawerFactory.h
Drawer.h
Generator.h
Graph.h
KTFlux.h
Message.h
CG_LOG
#define CG_LOG
Definition
Message.h:212
PartonFluxFactory.h
String.h
cepgen::ArgumentsParser
A generic command line arguments parser.
Definition
ArgumentsParser.h:31
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::Limits
Validity interval for a variable.
Definition
Limits.h:28
cepgen::Limits::valid
bool valid() const
Is there a lower and upper limit?
Definition
Limits.cpp:85
cepgen::Limits::generate
std::vector< double > generate(size_t num_bins, bool log_scale=false) const
Generate a collection of values from a number of bins.
Definition
Limits.cpp:113
cepgen::Limits::min
double min() const
Lower limit to apply on the variable.
Definition
Limits.h:52
cepgen::Limits::max
double max() const
Upper limit to apply on the variable.
Definition
Limits.h:54
cepgen::utils::Drawer::Mode
Definition
Drawer.h:41
cepgen::utils::Drawer::Mode::grid
@ grid
Definition
Drawer.h:49
cepgen::utils::Drawer::Mode::ratio
@ ratio
Definition
Drawer.h:52
cepgen::utils::Drawer::Mode::logx
@ logx
Definition
Drawer.h:45
cepgen::utils::Drawer::Mode::logy
@ logy
Definition
Drawer.h:46
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
cepgen::utils::DrawableColl
std::vector< const Drawable * > DrawableColl
A collection of drawable objects.
Definition
Drawer.h:34
cepgen::utils::merge
std::string merge(const std::vector< T > &vec, const std::string &delim)
Merge a collection of a printable type in a single string.
Definition
String.cpp:248
cepgen::initialise
void initialise(bool safe_mode)
Definition
GlobalFunctions.cpp:91
main
int main()
Definition
pythia6_decay.cc:9
src
utils
cepgenPlotKTFluxes.cc
Generated on Mon Jul 29 2024 for CepGen by
1.9.7