cepgen is hosted by Hepforge, IPPP Durham
CepGen 1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
add_particles.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
20#include "CepGen/Generator.h"
22#include "CepGen/Physics/PDG.h"
25#include "CepGen/Utils/Test.h"
27
28using namespace std;
29using namespace std::string_literals;
30
31int main(int argc, char* argv[]) {
32 cepgen::ArgumentsParser(argc, argv).parse();
34
35 const cepgen::pdgid_t my_part = 13;
36 const auto my_part_mass = 42.;
37
39 cepgen::ParticleProperties(my_part, "la", "laurentino", 0., my_part_mass, 0., {-3, 3}, true));
40
41 auto mg5 = cepgen::ProcessFactory::get().build(
42 "mg5_aMC",
44 .set("kinematicsGenerator", cepgen::ParametersList().setName("coll2to4"s))
45 .set("extraParticles", cepgen::ParametersList().set("la", cepgen::PDG::get()(my_part)))
46 .set("process", "a a > la+ la-"s));
47 mg5->initialise();
48
49 const auto& proc_evt = mg5->event();
50 CG_TEST_EQUAL(proc_evt.oneWithRole(cepgen::Particle::Role::Parton1).pdgId(), cepgen::PDG::photon, "parton 1 PDG id");
51 CG_TEST_EQUAL(proc_evt.oneWithRole(cepgen::Particle::Role::Parton2).pdgId(), cepgen::PDG::photon, "parton 2 PDG id");
52 CG_TEST_EQUAL(proc_evt(cepgen::Particle::Role::CentralSystem).size(), 2, "cent.part.multiplicity");
53 for (size_t i = 0; i < 2; ++i) {
54 const auto& cent = proc_evt(cepgen::Particle::Role::CentralSystem).at(i);
55 CG_TEST_EQUAL(cent.integerPdgId(), short((i == 0 ? -1 : +1) * my_part), "cent." + to_string(i) + " PDG id");
56 CG_TEST_EQUAL(cent.momentum().mass(), my_part_mass, "cent." + to_string(i) + " mass");
57 }
58
60}
#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.
@ photon
Definition PDG.h:41
void define(const ParticleProperties &)
Add a new particle definition to the library.
Definition PDG.cpp:60
static PDG & get()
Retrieve a unique instance of this particles info collection.
Definition PDG.cpp:41
@ Parton2
beam incoming parton
Definition Particle.h:59
@ Parton1
beam incoming parton
Definition Particle.h:58
@ CentralSystem
Central particles system.
Definition Particle.h:56
void initialise(bool safe_mode)
unsigned long long pdgid_t
Alias for the integer-like particle PDG id.
int main()
A collection of physics constants associated to a single particle.