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
cepgenPlotStrFunctions.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 <fstream>
20
21
#include "
CepGen/Core/Exception.h
"
22
#include "
CepGen/Generator.h
"
23
#include "
CepGen/Modules/DrawerFactory.h
"
24
#include "
CepGen/Modules/StructureFunctionsFactory.h
"
25
#include "
CepGen/Physics/PDG.h
"
26
#include "
CepGen/Physics/Utils.h
"
27
#include "
CepGen/StructureFunctions/Parameterisation.h
"
28
#include "
CepGen/Utils/ArgumentsParser.h
"
29
#include "
CepGen/Utils/Drawer.h
"
30
#include "
CepGen/Utils/Graph.h
"
31
#include "
CepGen/Utils/String.h
"
32
33
using namespace
std;
34
35
int
main
(
int
argc,
char
* argv[]) {
36
int
var, num_points;
37
double
q2;
38
string
output_file, plotter;
39
vector<string> strfun_types;
40
bool
logx, logy, draw_grid, ratio_plot;
41
cepgen::Limits
xrange, yrange;
42
43
cepgen::initialise
();
44
45
cepgen::ArgumentsParser
(argc, argv)
46
.
addOptionalArgument
(
47
"sf,s"
,
"structure functions modelling"
, &strfun_types, cepgen::StructureFunctionsFactory::get().modules())
48
.
addOptionalArgument
(
"q2,q"
,
"parton virtuality (GeV^2)"
, &q2, 10.)
49
.
addOptionalArgument
(
"var,t"
,
"variable to study (0=xBj, 1=w)"
, &var, 0)
50
.
addOptionalArgument
(
"xrange,x"
,
"Bjorken x range"
, &xrange,
cepgen::Limits
{1.e-7, 1.})
51
.addOptionalArgument(
"yrange"
,
"plotting range for y"
, &yrange,
cepgen::Limits
())
52
.
addOptionalArgument
(
"npoints,n"
,
"number of x-points to scan"
, &num_points, 500)
53
.
addOptionalArgument
(
"output,o"
,
"output file name"
, &output_file,
"strfuns.scan.output.txt"
)
54
.
addOptionalArgument
(
"plotter,p"
,
"type of plotter to user"
, &plotter,
""
)
55
.
addOptionalArgument
(
"logx"
,
"logarithmic x-axis"
, &logx,
false
)
56
.
addOptionalArgument
(
"logy,l"
,
"logarithmic y-axis"
, &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
.
parse
();
60
61
string
var_name, var_unit;
62
switch
(var) {
63
case
0:
64
var_name =
"$x_{Bj}$"
;
65
break
;
66
case
1:
67
var_name =
"w"
;
68
var_unit =
"GeV"
;
69
break
;
70
case
2:
71
var_name =
"w$^{2}$"
;
72
var_unit =
"GeV$^{2}$"
;
73
break
;
74
default
:
75
throw
CG_FATAL
(
"main"
) <<
"Unsupported variable to be plotted!"
;
76
}
77
78
ofstream out(output_file);
79
out <<
"# structure functions: "
;
80
string
sep;
81
for
(
const
auto
& sf_type : strfun_types)
82
out << sep << sf_type, sep =
", "
;
83
out <<
"\n"
84
<<
"# x in ["
<< xrange <<
"]\n"
;
85
86
const
float
mp =
cepgen::PDG::get
().
mass
(2212), mp2 = mp * mp;
87
88
vector<unique_ptr<cepgen::strfun::Parameterisation> > strfuns;
89
vector<cepgen::utils::Graph1D> g_strfuns_f2, g_strfuns_fl, g_strfuns_fe, g_strfuns_fm, g_strfuns_w1, g_strfuns_w2;
90
for
(
const
auto
& sf_type : strfun_types) {
91
auto
sf = cepgen::StructureFunctionsFactory::get().build(sf_type);
92
const
auto
sf_name = cepgen::StructureFunctionsFactory::get().describe(sf_type);
93
g_strfuns_f2.emplace_back(
"f2_"
+ sf_type, sf_name);
94
g_strfuns_fl.emplace_back(
"fl_"
+ sf_type, sf_name);
95
g_strfuns_fe.emplace_back(
"fe_"
+ sf_type, sf_name);
96
g_strfuns_fm.emplace_back(
"fm_"
+ sf_type, sf_name);
97
g_strfuns_w1.emplace_back(
"w1_"
+ sf_type, sf_name);
98
g_strfuns_w2.emplace_back(
"w2_"
+ sf_type, sf_name);
99
strfuns.emplace_back(move(sf));
100
}
101
const
auto
xvals = xrange.
generate
(num_points, logx);
102
for
(
int
i = 0; i < num_points; ++i) {
103
const
auto
& x = xvals.at(i);
104
out << x <<
"\t"
;
105
size_t
j = 0;
106
for
(
auto
& sf : strfuns) {
107
double
xbj;
108
switch
(var) {
109
case
0:
110
xbj = x;
111
break
;
112
case
1:
113
xbj =
cepgen::utils::xBj
(q2, mp2, x * x);
114
break
;
115
case
2:
116
xbj =
cepgen::utils::xBj
(q2, mp2, x);
117
break
;
118
default
:
119
xbj = 0.;
120
break
;
121
}
122
out <<
"\t"
<< sf->F2(xbj, q2) <<
"\t"
<< sf->FL(xbj, q2);
123
g_strfuns_f2.at(j).addPoint(x, sf->F2(xbj, q2));
124
g_strfuns_fl.at(j).addPoint(x, sf->FL(xbj, q2));
125
g_strfuns_fe.at(j).addPoint(x, sf->FE(xbj, q2));
126
g_strfuns_fm.at(j).addPoint(x, sf->FM(xbj, q2));
127
g_strfuns_w1.at(j).addPoint(x, sf->W1(xbj, q2));
128
g_strfuns_w2.at(j).addPoint(x, sf->W2(xbj, q2));
129
++j;
130
}
131
out <<
"\n"
;
132
}
133
CG_LOG
<<
"Scan written in \""
<< output_file <<
"\"."
;
134
out.close();
135
136
if
(!plotter.empty()) {
137
auto
plt = cepgen::DrawerFactory::get().build(plotter);
138
cepgen::utils::Drawer::Mode
dm;
139
if
(logx)
140
dm |=
cepgen::utils::Drawer::Mode::logx
;
141
if
(logy)
142
dm |=
cepgen::utils::Drawer::Mode::logy
;
143
if
(draw_grid)
144
dm |=
cepgen::utils::Drawer::Mode::grid
;
145
if
(ratio_plot)
146
dm |=
cepgen::utils::Drawer::Mode::ratio
;
147
148
for
(
auto
& canv : map<pair<string, string>, vector<cepgen::utils::Graph1D> >{{{
"f2"
,
"$F_{2}$"
}, g_strfuns_f2},
149
{{
"fl"
,
"$F_{L}$"
}, g_strfuns_fl},
150
{{
"fe"
,
"$F_{E}$"
}, g_strfuns_fe},
151
{{
"fm"
,
"$F_{M}$"
}, g_strfuns_fm},
152
{{
"w1"
,
"$W_{1}$"
}, g_strfuns_w1},
153
{{
"w2"
,
"$W_{2}$"
}, g_strfuns_w2}}) {
154
cepgen::utils::DrawableColl
plots;
155
for
(
auto
& p : canv.second) {
156
p.xAxis().setLabel(var_name + (!var_unit.empty() ?
" ("
+ var_unit +
")"
:
""
));
157
p.yAxis().setLabel(canv.first.second + (!var_name.empty() ?
"("
+ var_name +
", $Q^{2}$)"
:
""
));
158
if
(yrange.
valid
())
159
p.yAxis().setRange(yrange);
160
plots.emplace_back(&p);
161
}
162
plt->draw(plots,
"sfcomp_"
+ canv.first.first,
cepgen::utils::format
(
"$Q^{2}$ = %g GeV$^{2}$"
, q2), dm);
163
}
164
}
165
166
return
0;
167
}
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
PDG.h
Utils.h
String.h
StructureFunctionsFactory.h
Parameterisation.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::PDG::mass
double mass(spdgid_t) const
Particle mass (in GeV)
Definition
PDG.cpp:90
cepgen::PDG::get
static PDG & get()
Retrieve a unique instance of this particles info collection.
Definition
PDG.cpp:41
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::xBj
double xBj(double q2, double mp2, double mx2)
Compute Bjorken x from virtuality/diffractive mass.
Definition
Utils.cpp:41
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::initialise
void initialise(bool safe_mode)
Definition
GlobalFunctions.cpp:91
main
int main()
Definition
pythia6_decay.cc:9
src
utils
cepgenPlotStrFunctions.cc
Generated on Mon Jul 29 2024 for CepGen by
1.9.7