cepgen
is hosted by
Hepforge
,
IPPP Durham
CepGen
1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
python_parse.cc
Go to the documentation of this file.
1
/*
2
* CepGen: a central exclusive processes event generator
3
* Copyright (C) 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
#include "
CepGen/Cards/Handler.h
"
20
#include "
CepGen/Core/RunParameters.h
"
21
#include "
CepGen/Modules/CardsHandlerFactory.h
"
22
#include "
CepGen/Utils/ArgumentsParser.h
"
23
#include "
CepGen/Utils/Test.h
"
24
25
using namespace
std;
26
27
int
main
(
int
argc,
char
* argv[]) {
28
cepgen::ArgumentsParser
(argc, argv).
parse
();
29
30
auto
card =
cepgen::CardsHandlerFactory::get
().build(
".py"
);
31
card->parseCommands({R
"(import Config.Core as cepgen
32
lim = (42.42, 420.420)
33
vec_lim = [(0., 1.), (1., 2.)]
34
)"});
35
36
// retrieve all parameters parsed from Python commands
37
const
auto
& parsed_params = card->parameters().
get
<
cepgen::ParametersList
>(
"parsed"
);
38
39
const
auto
lim =
cepgen::Limits
{42.42, 420.420};
40
CG_TEST_EQUAL
(parsed_params.get<
cepgen::Limits
>(
"lim"
), lim,
"limits"
);
41
const
vector<cepgen::Limits> vec_lim = {{0., 1.}, {1., 2.}};
42
CG_TEST_EQUAL
(parsed_params.get<vector<cepgen::Limits> >(
"vec_lim"
), vec_lim,
"vector of limits"
);
43
44
CG_TEST_SUMMARY
;
45
}
ArgumentsParser.h
CardsHandlerFactory.h
Handler.h
RunParameters.h
Test.h
CG_TEST_SUMMARY
#define CG_TEST_SUMMARY
Definition
Test.h:127
CG_TEST_EQUAL
#define CG_TEST_EQUAL(var1, var2, name)
Definition
Test.h:45
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::Limits
Validity interval for a variable.
Definition
Limits.h:28
cepgen::ParametersList
Definition
ParametersList.h:52
main
int main()
Definition
pythia6_decay.cc:9
cepgen::CardsHandlerFactory::get
static CardsHandlerFactory & get()
Definition
CardsHandlerFactory.cpp:25
CepGenAddOns
PythonWrapper
test
python_parse.cc
Generated on Mon Jul 29 2024 for CepGen by
1.9.7