10 #ifndef SRC_TESTS_SETUP_H_
11 #define SRC_TESTS_SETUP_H_
13 #include "../include/smash/cxx14compat.h"
14 #include "../include/smash/decaymodes.h"
15 #include "../include/smash/experiment.h"
16 #include "../include/smash/outputinterface.h"
17 #include "../include/smash/particledata.h"
18 #include "../include/smash/particles.h"
19 #include "../include/smash/particletype.h"
20 #include "../include/smash/random.h"
22 #include <boost/filesystem.hpp>
39 #include <particles.txt.h>
51 #include <decaymodes.txt.h>
68 "# NAME MASS[GEV] WIDTH[GEV] PARITY PDG\n"
80 "# NAME MASS[GEV] WIDTH[GEV] PARITY PDG\n"
108 p.set_4position(position);
117 p.set_4momentum(momentum);
127 p.set_4position(position);
128 p.set_4momentum(momentum);
141 p.set_4position(position);
142 p.set_4momentum(momentum);
153 {random_value(), random_value(), random_value(), random_value()});
155 {random_value(), random_value(), random_value()});
175 if (!overrides.empty()) {
196 inline std::unique_ptr<ExperimentBase>
experiment(
const char *configOverrides) {
203 template <
typename G>
207 for (
auto i =
n; i; --i) {
208 list.emplace_back(generator());
220 template <
typename G>
223 for (
auto i =
n; i; --i) {
224 p->insert(generator());
234 const std::initializer_list<ParticleData> &init) {
236 for (
const auto &data : init) {
260 int testparticles = 1,
double dt = 0.1,
263 make_unique<UniformClock>(0., dt),
264 make_unique<UniformClock>(0., 1.),
299 bool empty_event =
false) {
300 return EventInfo{impact_parameter, 0.0, 0.0, 0.0, 0.0, 0.0, 1, 1,
Interface to the SMASH configuration files.
void merge_yaml(const std::string &yaml)
Merge the configuration in yaml into the existing tree.
static void load_decaymodes(const std::string &input)
Loads the DecayModes map as described in the input string.
static std::unique_ptr< ExperimentBase > create(Configuration config, const bf::path &output_path)
Factory method that creates and initializes a new Experiment<Modus>.
The FourVector class holds relevant values in Minkowski spacetime with (+, −, −, −) metric signature.
FourVector()
default constructor nulls the fourvector components
ParticleData contains the dynamic information of a certain particle.
static const ParticleType & find(PdgCode pdgcode)
Returns the ParticleType object for the given pdgcode.
static void create_type_list(const std::string &particles)
Initialize the global ParticleType list (list_all) from the given input data.
std::bitset< 10 > ReactionsBitSet
Container for the 2 to 2 reactions in the code.
@ NoAnnihilation
No Annihilation.
std::bitset< 4 > MultiParticleReactionsBitSet
Container for the n to m reactions in the code.
CollisionCriterion
Criteria used to check collisions.
@ Geometric
(Default) geometric criterion.
ParticleList create_particle_list(std::size_t n, G &&generator)
Generate a list of particles from the given generator function.
static constexpr double smashon_mass
The mass of the smashon particle.
void create_actual_particletypes()
Creates the ParticleType list containing the actual particles that SMASH uses.
static constexpr const char smashon_pdg_string[]
The PDG code of the smashon particle.
ParticlesPtr create_particles(int n, G &&generator)
Creates a Particles object and fills it with n particles generated by the generator function.
static constexpr double smashon_width
The decay width of the smashon particle.
void create_actual_decaymodes()
Creates the DecayModes list containing the actual decay modes that SMASH uses.
std::unique_ptr< Particles > ParticlesPtr
A type alias for a unique_ptr of Particles.
ExperimentParameters default_parameters(int testparticles=1, double dt=0.1, CollisionCriterion crit=CollisionCriterion::Geometric)
Creates a standard ExperimentParameters object which works for almost all testing purposes.
void create_smashon_particletypes()
Creates a ParticleType list containing only the smashon test particle.
ParticleData smashon(int id=-1)
Create a particle with 0 position and momentum vectors and optionally a given id.
MultiParticleReactionsBitSet no_multiparticle_reactions()
returns BitSet for multi-particle reactions, where everything is off
EventInfo default_event_info(double impact_parameter=0.0, bool empty_event=false)
Creates default EventInfo object for testing purposes.
void create_stable_smashon_particletypes()
Creates a ParticleType list containing only the smashon test particle with width 0 (stable).
Configuration configuration(std::string overrides={})
Return a configuration object filled with data from src/config.yaml.
ParticleData smashon_random(int id=-1)
Create a particle with random position and momentum vectors and optionally a given id.
std::unique_ptr< ExperimentBase > experiment(const Configuration &c=configuration())
Create an experiment.
ReactionsBitSet all_reactions_included()
returns BitSet of 2->2 reactions, where everything is on
uniform_dist< T > make_uniform_distribution(T min, T max)
Structure to contain custom data for output.
Helper structure for Experiment.
A FourVector that is marked as a momentum vector.
A FourVector that is marked as a position vector.