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
22#include "CepGen/Physics/PDG.h"
24#include "CepGen/Utils/Test.h"
25
26int 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"(
33from Config.PDG_cfi import PDG, registerParticle
34registerParticle(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
45}
#define CG_DEBUG(mod)
Definition Message.h:220
#define CG_TEST_SUMMARY
Definition Test.h:127
#define CG_TEST_EQUAL(var1, var2, name)
Definition Test.h:45
A generic command line arguments parser.
ArgumentsParser & parse()
Associate command-line arguments to parameters.
static PDG & get()
Retrieve a unique instance of this particles info collection.
Definition PDG.cpp:41
int main()
static CardsHandlerFactory & get()