cepgen
is hosted by
Hepforge
,
IPPP Durham
CepGen
1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
python_particle_mod.cc
Go to the documentation of this file.
1
/*
2
* CepGen: a central exclusive processes event generator
3
* Copyright (C) 2023-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/Physics/PDG.h
"
23
#include "
CepGen/Utils/ArgumentsParser.h
"
24
#include "
CepGen/Utils/Test.h
"
25
26
int
main
(
int
argc,
char
* argv[]) {
27
cepgen::ArgumentsParser
(argc, argv).
parse
();
28
29
CG_DEBUG
(
"main"
) <<
"Will build a Python cards handler."
;
30
31
auto
card =
cepgen::CardsHandlerFactory::get
().build(
".py"
);
32
card->parseCommands({R
"(
33
from Config.PDG_cfi import PDG, registerParticle
34
registerParticle(name='teston', pdgid=42, mass=42.42, width=1.1))"});
35
36
CG_DEBUG
(
"main"
) <<
"Configuration string successfully parsed."
;
37
38
const
auto
& teston =
cepgen::PDG::get
()(42);
39
CG_TEST_EQUAL
(teston.pdgid, 42,
"new particle PDG id"
);
40
CG_TEST_EQUAL
(teston.name,
"teston"
,
"new particle name"
);
41
CG_TEST_EQUAL
(teston.mass, 42.42,
"new particle mass"
);
42
CG_TEST_EQUAL
(teston.width, 1.1,
"new particle width"
);
43
44
CG_TEST_SUMMARY
;
45
}
ArgumentsParser.h
CardsHandlerFactory.h
Handler.h
CG_DEBUG
#define CG_DEBUG(mod)
Definition
Message.h:220
PDG.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::PDG::get
static PDG & get()
Retrieve a unique instance of this particles info collection.
Definition
PDG.cpp:41
main
int main()
Definition
pythia6_decay.cc:9
cepgen::CardsHandlerFactory::get
static CardsHandlerFactory & get()
Definition
CardsHandlerFactory.cpp:25
CepGenAddOns
PythonWrapper
test
python_particle_mod.cc
Generated on Mon Jul 29 2024 for CepGen by
1.9.7