Version: SMASH-1.8
smash.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2012-2020
4  * SMASH Team
5  *
6  * GNU General Public License (GPLv3 or later)
7  *
8  */
9 #include <getopt.h>
10 
11 #include <set>
12 #include <sstream>
13 #include <vector>
14 
15 #include <boost/filesystem/fstream.hpp>
16 
17 #include "smash/cxx14compat.h"
18 #include "smash/decaymodes.h"
19 #include "smash/experiment.h"
20 #include "smash/filelock.h"
21 #include "smash/random.h"
24 #include "smash/sha256.h"
25 #include "smash/stringfunctions.h"
26 /* build dependent variables */
27 #include "smash/config.h"
28 
29 namespace smash {
30 
31 namespace {
43 void usage(const int rc, const std::string &progname) {
128  std::printf("\nUsage: %s [option]\n\n", progname.c_str());
129  std::printf(
130  " -h, --help usage information\n"
131  "\n"
132  " -i, --inputfile <file> path to input configuration file\n"
133  " (default: ./config.yaml)\n"
134  " -d, --decaymodes <file> override default decay modes from file\n"
135  " -p, --particles <file> override default particles from file\n"
136  "\n"
137  " -c, --config <YAML> specify config value overrides\n"
138  " (multiple -c arguments are supported)\n"
139  " -m, --modus <modus> shortcut for -c 'General: { Modus: <modus> "
140  "}'\n"
141  " -e, --endtime <time> shortcut for -c 'General: { End_Time: <time> "
142  "}'"
143  "\n"
144  "\n"
145  " -o, --output <dir> output directory (default: ./data/<runid>)\n"
146  " -l, --list-2-to-n list all possible 2->n reactions (with n>1)\n"
147  " -r, --resonance <pdg> dump width(m) and m*spectral function(m^2)"
148  " for resonance pdg\n"
149  " -s, --cross-sections <pdg1>,<pdg2>[,mass1,mass2[,plab1,...]] \n"
150  " dump all partial cross-sections of "
151  "pdg1 + pdg2 reactions versus sqrt(s).\n"
152  " -S, --cross-sections-fs <pdg1>,<pdg2>[,mass1,mass2[,plab1,...]] \n"
153  " dump an approximation of the final-state"
154  " cross-sections\n"
155  " of pdg1 + pdg2 reactions versus sqrt(s).\n"
156  " Contributions from strings are not considered"
157  " for the final state.\n"
158  " Masses are optional, by default pole masses"
159  " are used.\n"
160  " Note the required comma and no spaces.\n"
161  " -f, --force force overwriting files in the output "
162  "directory"
163  "\n"
164  " -x, --dump_iSS Dump particle table in iSS format\n"
165  " This format is used in MUSIC and CLVisc\n"
166  " relativistic hydro codes\n"
167  " -n, --no-cache Don't cache integrals on disk\n"
168  " -v, --version\n\n");
169  std::exit(rc);
170 }
171 
174  std::cout
175  << "###################################################################"
176  << "############"
177  << "\n"
178  << "\n"
179  << " :::s.\n"
180  << " .... ''ss:: "
181  "ah:\n"
182  << " a::''. ..:sss "
183  ".HH.\n"
184  << " mss'.. ...s'm. sSA##As mAhh##hsh##s. .hA##ASa sS###As "
185  "hMAh##h.\n"
186  << " :a':'. .'':as sM#' .HHm''HMS''AMs mMA' .AMs aMA. "
187  "'HHa..HM:\n"
188  << " .a:s'. ..''ss 'h#H#S. mMm 'M#' .HH. 'MH. :MA 'h#H#S. "
189  "hMm :M#\n"
190  << " .::ss'. .... 'SMm .HH. SMa hMm sM#..mHMs 'AMa "
191  "'MH. SMa\n"
192  << " .s::' #SMASHh aMS .MH: HM: #MMMmMM. #SMASHh "
193  "aMS .MM.\n"
194  << "\n"
195  << "###################################################################"
196  << "############"
197  << "\n"
198  << " This is SMASH version: " << VERSION_MAJOR << "\n"
199  << " Simulating Many Accelerated Strongly-interacting Hadrons"
200  << "\n"
201  << "\n"
202  << " Distributed under the GNU General Public License 3.0"
203  << " (GPLv3 or later)."
204  << "\n"
205  << " See LICENSE for details."
206  << "\n"
207  << " For the full list of contributors see AUTHORS."
208  << "\n"
209  << "\n"
210  << " When using SMASH, please cite"
211  << "\n"
212  << " J. Weil et al., Phys.Rev. C94 (2016) no.5, 054905"
213  << "\n"
214  << " together with the software DOI for the specific code version "
215  << "employed:"
216  << "\n"
217  << " https://doi.org/10.5281/zenodo.3484711."
218  << "\n"
219  << " In addition, if Pythia is used please cite"
220  << "\n"
221  << " T. Sjöstrand, S. Mrenna and P. Skands, JHEP05 (2006) 026,"
222  << "\n"
223  << " Comput. Phys. Comm. 178 (2008) 852."
224  << "\n"
225  << "\n"
226  << " Webpage: https://smash-transport.github.io"
227  << "\n"
228  << "\n"
229  << " Report issues at https://github.com/smash-transport/smash"
230  << "\n"
231  << " or contact us by email at elfner@itp.uni-frankfurt.de"
232  << "\n"
233  << "\n"
234  << "###################################################################"
235  << "############"
236  << "\n"
237  << "\n";
238 }
239 
245 struct OutputDirectoryExists : public std::runtime_error {
246  using std::runtime_error::runtime_error;
247 };
254 struct OutputDirectoryOutOfIds : public std::runtime_error {
255  using std::runtime_error::runtime_error;
256 };
257 
260  const bf::path p = bf::absolute("data");
261  if (!bf::exists(p)) {
262  return p / "0";
263  }
264  bf::path p2;
265  for (int id = 0; id < std::numeric_limits<int>::max(); ++id) {
266  p2 = p / std::to_string(id);
267  if (!bf::exists(p2)) {
268  break;
269  }
270  }
271  if (p == p2) {
272  throw OutputDirectoryOutOfIds("no unique data subdir ID left");
273  }
274  return p2;
275 }
276 
283 void ensure_path_is_valid(const bf::path &path) {
284  if (bf::exists(path)) {
285  if (!bf::is_directory(path)) {
286  throw OutputDirectoryExists("The given path (" + path.native() +
287  ") exists, but it is not a directory.");
288  }
289  } else {
290  if (!bf::create_directories(path)) {
291  throw OutputDirectoryExists(
292  "Race condition detected: The directory " + path.native() +
293  " did not exist a few cycles ago, but was created in the meantime by "
294  "a different process.");
295  }
296  }
297 }
298 
306  // The following parameters are only relevant for nucleus-nucleus collisions.
307  // Setting them to the valuing values makes sure they don't have any effect.
308  const std::vector<bool> nucleon_has_interacted = {};
309  const int N_tot = 0;
310  const int N_proj = 0;
311 
313  return ScatterActionsFinder(configuration, params, nucleon_has_interacted,
314  N_tot, N_proj);
315 }
316 
326  const std::string smash_version = "1.8";
327  const std::set<std::string> compatible_config_versions = {"1.8"};
328 
329  const std::string config_version = configuration.read({"Version"});
330 
331  if (compatible_config_versions.find(config_version) ==
332  compatible_config_versions.end()) {
333  std::stringstream err;
334  err << "The version of the configuration file (" << config_version
335  << ") is not compatible with the SMASH version (" << smash_version
336  << ").\nThe following config versions are supported:\n";
337  for (auto it : compatible_config_versions) {
338  err << it << " ";
339  }
340  err << "\nPlease consider updating your config or using a compatible SMASH"
341  " version.";
342  throw std::runtime_error(err.str());
343  }
344 }
345 
350  const std::string report = configuration.unused_values_report();
351 
352  if (report != "{}") {
353  throw std::runtime_error(
354  "The following configuration values were not used:\n" + report);
355  }
356 }
357 
365  for (const std::string s :
366  {"Version", "particles", "decaymodes", "Modi", "General", "Output",
367  "Lattice", "Potentials", "Forced_Thermalization"}) {
368  if (configuration.has_value({s.c_str()})) {
369  configuration.take({s.c_str()});
370  }
371  }
372 }
373 
379 }
380 
385  sha256::Hash hash,
386  bf::path tabulations_path) {
388  logg[LMain].info("Tabulating cross section integrals...");
389  IsoParticleType::tabulate_integrals(hash, tabulations_path);
390 }
391 
392 } // unnamed namespace
393 
394 } // namespace smash
395 
406 int main(int argc, char *argv[]) {
407  using namespace smash; // NOLINT(build/namespaces)
408 
409  constexpr option longopts[] = {
410  {"config", required_argument, 0, 'c'},
411  {"decaymodes", required_argument, 0, 'd'},
412  {"endtime", required_argument, 0, 'e'},
413  {"force", no_argument, 0, 'f'},
414  {"help", no_argument, 0, 'h'},
415  {"inputfile", required_argument, 0, 'i'},
416  {"modus", required_argument, 0, 'm'},
417  {"particles", required_argument, 0, 'p'},
418  {"output", required_argument, 0, 'o'},
419  {"list-2-to-n", no_argument, 0, 'l'},
420  {"resonance", required_argument, 0, 'r'},
421  {"cross-sections", required_argument, 0, 's'},
422  {"cross-sections-fs", required_argument, 0, 'S'},
423  {"dump-iSS", no_argument, 0, 'x'},
424  {"version", no_argument, 0, 'v'},
425  {"no-cache", no_argument, 0, 'n'},
426  {nullptr, 0, 0, 0}};
427 
428  // strip any path to progname
429  const std::string progname = bf::path(argv[0]).filename().native();
430 
431  try {
432  bool force_overwrite = false;
433  bf::path output_path = default_output_path(), input_path("./config.yaml");
434  std::vector<std::string> extra_config;
435  char *particles = nullptr, *decaymodes = nullptr, *modus = nullptr,
436  *end_time = nullptr, *pdg_string = nullptr, *cs_string = nullptr;
437  bool list2n_activated = false;
438  bool resonance_dump_activated = false;
439  bool cross_section_dump_activated = false;
440  bool final_state_cross_sections = false;
441  bool particles_dump_iSS_format = false;
442  bool cache_integrals = true;
443 
444  // parse command-line arguments
445  int opt;
446  bool suppress_disclaimer = false;
447  while ((opt = getopt_long(argc, argv, "c:d:e:fhi:m:p:o:lr:s:S:xvn",
448  longopts, nullptr)) != -1) {
449  switch (opt) {
450  case 'c':
451  extra_config.emplace_back(optarg);
452  break;
453  case 'd':
454  decaymodes = optarg;
455  break;
456  case 'f':
457  force_overwrite = true;
458  break;
459  case 'i':
460  input_path = optarg;
461  break;
462  case 'h':
463  usage(EXIT_SUCCESS, progname);
464  break;
465  case 'm':
466  modus = optarg;
467  break;
468  case 'p':
469  particles = optarg;
470  break;
471  case 'e':
472  end_time = optarg;
473  break;
474  case 'o':
475  output_path = optarg;
476  break;
477  case 'l':
478  list2n_activated = true;
479  suppress_disclaimer = true;
480  break;
481  case 'r':
482  resonance_dump_activated = true;
483  pdg_string = optarg;
484  suppress_disclaimer = true;
485  break;
486  case 'S':
487  final_state_cross_sections = true;
488  // fallthrough
489  case 's':
490  cross_section_dump_activated = true;
491  cs_string = optarg;
492  suppress_disclaimer = true;
493  break;
494  case 'x':
495  particles_dump_iSS_format = true;
496  suppress_disclaimer = true;
497  break;
498  case 'v':
499  std::printf(
500  "%s\n"
501  "Branch : %s\nSystem : %s\nCompiler : %s %s\n"
502  "Build : %s\nDate : %s\n",
503  VERSION_MAJOR, GIT_BRANCH, CMAKE_SYSTEM, CMAKE_CXX_COMPILER_ID,
504  CMAKE_CXX_COMPILER_VERSION, CMAKE_BUILD_TYPE, BUILD_DATE);
505  std::exit(EXIT_SUCCESS);
506  case 'n':
507  cache_integrals = false;
508  break;
509  default:
510  usage(EXIT_FAILURE, progname);
511  }
512  }
513 
514  // Abort if there are unhandled arguments left.
515  if (optind < argc) {
516  std::cout << argv[0] << ": invalid argument -- '" << argv[optind]
517  << "'\n";
518  usage(EXIT_FAILURE, progname);
519  }
520 
521  if (!suppress_disclaimer) {
523  }
524 
526 
527  // Read in config file
528  Configuration configuration(input_path.parent_path(),
529  input_path.filename());
530  // Merge config passed via command line
531  for (const auto &config : extra_config) {
532  configuration.merge_yaml(config);
533  }
534 
535  // Set up logging
537  configuration.take({"Logging", "default"}, einhard::ALL));
538  create_all_loggers(configuration["Logging"]);
539 
540  // check if version matches before doing anything else
542 
543  logg[LMain].trace(source_location, " create ParticleType and DecayModes");
544 
545  auto particles_and_decays =
546  load_particles_and_decaymodes(particles, decaymodes);
547  /* For particles and decaymodes: external file is superior to config.
548  * Hovever, warn in case of conflict.
549  */
550  if (configuration.has_value({"particles"}) && particles) {
551  logg[LMain].warn(
552  "Ambiguity: particles from external file ", particles,
553  " requested, but there is also particle list in the config."
554  " Using particles from ",
555  particles);
556  }
557  if (!configuration.has_value({"particles"}) || particles) {
558  configuration["particles"] = particles_and_decays.first;
559  }
560 
561  if (configuration.has_value({"decaymodes"}) && decaymodes) {
562  logg[LMain].warn(
563  "Ambiguity: decaymodes from external file ", decaymodes,
564  " requested, but there is also decaymodes list in the config."
565  " Using decaymodes from",
566  decaymodes);
567  }
568  if (!configuration.has_value({"decaymodes"}) || decaymodes) {
569  configuration["decaymodes"] = particles_and_decays.second;
570  }
571 
572  // Calculate a hash of the SMASH version, the particles and decaymodes.
573  const std::string version(VERSION_MAJOR);
574  const std::string particle_string = configuration["particles"].to_string();
575  const std::string decay_string = configuration["decaymodes"].to_string();
576  sha256::Context hash_context;
577  hash_context.update(version);
578  hash_context.update(particle_string);
579  hash_context.update(decay_string);
580  const auto hash = hash_context.finalize();
581  logg[LMain].info() << "Config hash: " << sha256::hash_to_string(hash);
582 
583  bf::path tabulations_path;
584  if (cache_integrals) {
585  tabulations_path = output_path.parent_path() / "tabulations";
586  bf::create_directories(tabulations_path);
587  logg[LMain].info() << "Tabulations path: " << tabulations_path;
588  } else {
589  tabulations_path = "";
590  }
591  if (list2n_activated) {
592  /* Print only 2->n, n > 1. Do not dump decays, which can be found in
593  * decaymodes.txt anyway */
594  configuration.merge_yaml("{Collision_Term: {Two_to_One: False}}");
595  logg[LMain].info() << "Tabulations path: " << tabulations_path;
596  initialize_particles_and_decays(configuration, hash, tabulations_path);
597  auto scat_finder = actions_finder_for_dump(configuration);
598 
601 
602  scat_finder.dump_reactions();
603  std::exit(EXIT_SUCCESS);
604  }
605  if (particles_dump_iSS_format) {
607  ParticleTypePtrList list;
608  list.clear();
609  for (const auto &ptype : ParticleType::list_all()) {
610  list.push_back(&ptype);
611  }
612  std::sort(list.begin(), list.end(),
614  return a->mass() < b->mass();
615  });
616  for (const ParticleTypePtr ptype : list) {
617  if (ptype->pdgcode().is_lepton() || ptype->baryon_number() < 0) {
618  continue;
619  }
620  const auto &decay_modes = ptype->decay_modes();
621  const auto &modelist = decay_modes.decay_mode_list();
622  int ndecays = ptype->is_stable() ? 1 : modelist.size();
623  printf("%13i %s %10.5f %10.5f %5i %5i %5i %5i %5i %5i %5i %5i\n",
624  ptype->pdgcode().get_decimal(),
625  smash::utf8::fill_left(ptype->name(), 12, ' ').c_str(),
626  ptype->mass(), ptype->width_at_pole(),
627  ptype->pdgcode().spin_degeneracy(), ptype->baryon_number(),
628  ptype->strangeness(), ptype->pdgcode().charmness(),
629  ptype->pdgcode().bottomness(), ptype->isospin() + 1,
630  ptype->charge(), ndecays);
631  if (!ptype->is_stable()) {
632  for (const auto &decay : modelist) {
633  auto ptypes = decay->particle_types();
634  printf("%13i %13i %20.5f %13i %13i %13i %13i %13i\n",
635  ptype->pdgcode().get_decimal(), 2, decay->weight(),
636  ptypes[0]->pdgcode().get_decimal(),
637  ptypes[1]->pdgcode().get_decimal(), 0, 0, 0);
638  }
639  } else {
640  printf("%13i %13i %20.5f %13i %13i %13i %13i %13i\n",
641  ptype->pdgcode().get_decimal(), 1, 1.0,
642  ptype->pdgcode().get_decimal(), 0, 0, 0, 0);
643  }
644  }
645  std::exit(EXIT_SUCCESS);
646  }
647  if (resonance_dump_activated) {
648  // Ignore config values that don't make sense.
649  initialize_particles_and_decays(configuration, hash, tabulations_path);
650  const auto _dummy = ExperimentBase::create(configuration, "");
653 
654  PdgCode pdg(pdg_string);
655  const ParticleType &res = ParticleType::find(pdg);
657  std::exit(EXIT_SUCCESS);
658  }
659  if (cross_section_dump_activated) {
660  initialize_particles_and_decays(configuration, hash, tabulations_path);
661  std::string arg_string(cs_string);
662  std::vector<std::string> args = split(arg_string, ',');
663  const unsigned int n_arg = args.size();
664  if (n_arg != 2 && n_arg != 4 && n_arg < 5) {
665  throw std::invalid_argument("-s usage: pdg1,pdg2[,m1,m2[,sqrts1,...]]");
666  }
667  PdgCode pdg_a(args[0]), pdg_b(args[1]);
668  const ParticleType &a = ParticleType::find(pdg_a);
669  const ParticleType &b = ParticleType::find(pdg_b);
670  if (n_arg < 4) {
671  for (unsigned int i = 0; i < 4 - n_arg; i++) {
672  args.push_back("");
673  }
674  }
675  double ma = (args[2] == "") ? a.mass() : std::stod(args[2]);
676  double mb = (args[3] == "") ? b.mass() : std::stod(args[3]);
677  if (a.is_stable() && args[2] != "" && std::stod(args[2]) != a.mass()) {
678  ma = a.mass();
679  std::cerr << "Warning: pole mass is used for stable particle "
680  << a.name() << " instead of " << args[2] << std::endl;
681  }
682  if (b.is_stable() && args[3] != "" && std::stod(args[3]) != b.mass()) {
683  mb = b.mass();
684  std::cerr << "Warning: pole mass is used for stable particle "
685  << b.name() << " instead of " << args[3] << std::endl;
686  }
687  const size_t plab_size = n_arg <= 4 ? 0 : n_arg - 4;
688  std::vector<double> plab;
689  plab.reserve(plab_size);
690  for (size_t i = 4; i < n_arg; i++) {
691  plab.push_back(std::stod(args.at(i)));
692  }
693  auto scat_finder = actions_finder_for_dump(configuration);
694 
697 
698  scat_finder.dump_cross_sections(a, b, ma, mb, final_state_cross_sections,
699  plab);
700  std::exit(EXIT_SUCCESS);
701  }
702  if (modus) {
703  configuration["General"]["Modus"] = std::string(modus);
704  }
705  if (end_time) {
706  configuration["General"]["End_Time"] = std::abs(std::atof(end_time));
707  }
708 
709  int64_t seed = configuration.read({"General", "Randomseed"});
710  if (seed < 0) {
711  configuration["General"]["Randomseed"] = random::generate_63bit_seed();
712  }
713 
714  // Check output path
715  ensure_path_is_valid(output_path);
716  const bf::path lock_path = output_path / "smash.lock";
717  FileLock lock(lock_path);
718  if (!lock.acquire()) {
719  throw std::runtime_error(
720  "Another instance of SMASH is already writing to the specified "
721  "output directory. If you are sure this is not the case, remove \"" +
722  lock_path.native() + "\".");
723  }
724  logg[LMain].debug("output path: ", output_path);
725  if (!force_overwrite && bf::exists(output_path / "config.yaml")) {
726  throw std::runtime_error(
727  "Output directory would get overwritten. Select a different output "
728  "directory, clean up, or tell SMASH to ignore existing files.");
729  }
730 
731  /* Keep a copy of the configuration that was used in the output directory
732  * also save information about SMASH build as a comment */
733  bf::ofstream(output_path / "config.yaml")
734  << "# " << VERSION_MAJOR << '\n'
735  << "# Branch : " << GIT_BRANCH << '\n'
736  << "# System : " << CMAKE_SYSTEM << '\n'
737  << "# Compiler : " << CMAKE_CXX_COMPILER_ID << ' '
738  << CMAKE_CXX_COMPILER_VERSION << '\n'
739  << "# Build : " << CMAKE_BUILD_TYPE << '\n'
740  << "# Date : " << BUILD_DATE << '\n'
741  << configuration.to_string() << '\n';
742  logg[LMain].trace(source_location, " create ParticleType and DecayModes");
743  initialize_particles_and_decays(configuration, hash, tabulations_path);
744 
745  // Create an experiment
746  logg[LMain].trace(source_location, " create Experiment");
747  auto experiment = ExperimentBase::create(configuration, output_path);
748 
749  // Version value is not used in experiment. Get rid of it to prevent
750  // warning.
751  configuration.take({"Version"});
753 
754  // Run the experiment
755  logg[LMain].trace(source_location, " run the Experiment");
756  experiment->run();
757  } catch (std::exception &e) {
758  logg[LMain].fatal() << "SMASH failed with the following error:\n"
759  << e.what();
760  return EXIT_FAILURE;
761  }
762 
763  logg[LMain].trace() << source_location << " about to return from main";
764  return 0;
765 }
smash::split
std::vector< std::string > split(const std::string &s, char delim)
Split string by delimiter.
Definition: stringfunctions.cc:120
smash
Definition: action.h:24
smash::anonymous_namespace{smash.cc}::OutputDirectoryExists
Definition: smash.cc:245
smash::DecayModes::load_decaymodes
static void load_decaymodes(const std::string &input)
Loads the DecayModes map as described in the input string.
Definition: decaymodes.cc:164
smash::ParticleType::dump_width_and_spectral_function
void dump_width_and_spectral_function() const
Prints out width and spectral function versus mass to the standard output.
Definition: particletype.cc:730
smash::Test::configuration
Configuration configuration(std::string overrides={})
Return a configuration object filled with data from src/config.yaml.
Definition: setup.h:161
smash::anonymous_namespace{smash.cc}::OutputDirectoryOutOfIds
Definition: smash.cc:254
smash::anonymous_namespace{smash.cc}::check_for_unused_config_values
void check_for_unused_config_values(const Configuration &configuration)
Checks if there are unused config values.
Definition: smash.cc:349
smash::sha256::Context::update
void update(uint8_t const *buffer, size_t buffer_size)
Add data to the SHA256 context.
Definition: sha256.cc:153
smash::Configuration::read
Value read(std::initializer_list< const char * > keys) const
Additional interface for SMASH to read configuration values without removing them.
Definition: configuration.cc:158
cxx14compat.h
smash::Configuration::to_string
std::string to_string() const
Returns a YAML string of the current tree.
Definition: configuration.cc:192
smash::utf8::fill_left
std::string fill_left(const std::string &s, size_t width, char fill=' ')
Fill string with characters to the left until the given width is reached.
Definition: stringfunctions.cc:47
smash::ScatterActionsFinder
Definition: scatteractionsfinder.h:31
smash::sha256::Context
A SHA256 context.
Definition: sha256.h:19
smash::ParticleType::mass
double mass() const
Definition: particletype.h:144
smash::Configuration::unused_values_report
std::string unused_values_report() const
Returns a string listing the key/value pairs that have not been taken yet.
Definition: configuration.cc:186
smash::Configuration::has_value
bool has_value(std::initializer_list< const char * > keys) const
Returns whether there is a non-empty value behind the requested keys.
Definition: configuration.cc:181
smash::FileLock
Guard to create a file lock.
Definition: filelock.h:30
smash::random::generate_63bit_seed
int64_t generate_63bit_seed()
Generates a seed with a truly random 63-bit value, if possible.
Definition: random.cc:18
smash::ParticleType::create_type_list
static void create_type_list(const std::string &particles)
Initialize the global ParticleType list (list_all) from the given input data.
Definition: particletype.cc:205
smash::LMain
static constexpr int LMain
Definition: experiment.h:77
smash::set_default_loglevel
void set_default_loglevel(einhard::LogLevel level)
Set the default log level (what will be returned from subsequent default_loglevel calls).
Definition: logging.cc:24
smash::logg
std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > logg
An array that stores all pre-configured Logger objects.
Definition: logging.cc:39
smash::create_all_loggers
void create_all_loggers(Configuration config)
Called from main() right after the Configuration object is fully set up to create all logger objects ...
Definition: logging.cc:118
smash::ParticleType::find
static const ParticleType & find(PdgCode pdgcode)
Returns the ParticleType object for the given pdgcode.
Definition: particletype.cc:105
smash::anonymous_namespace{smash.cc}::check_config_version_is_compatible
void check_config_version_is_compatible(Configuration configuration)
Checks if the SMASH version is compatible with the version of the configuration file.
Definition: smash.cc:325
random.h
smash::IsoParticleType::tabulate_integrals
static void tabulate_integrals(sha256::Hash hash, const bf::path &tabulations_path)
Tabulate all relevant integrals.
Definition: isoparticletype.cc:267
smash::Configuration
Interface to the SMASH configuration files.
Definition: configuration.h:464
filelock.h
smash::ParticleTypePtr
Definition: particletype.h:663
source_location
#define source_location
Hackery that is required to output the location in the source code where the log statement occurs.
Definition: logging.h:240
experiment.h
main
int main(int argc, char *argv[])
Main program Smashes Many Accelerated Strongly-Interacting Hadrons :-)
Definition: smash.cc:406
smash::create_experiment_parameters
ExperimentParameters create_experiment_parameters(Configuration config)
Gathers all general Experiment parameters.
Definition: experiment.cc:328
smash::load_particles_and_decaymodes
std::pair< std::string, std::string > load_particles_and_decaymodes(const char *particles_file, const char *decaymodes_file)
Loads particles and decaymodes from provided files particles_file and decaymodes_file.
Definition: setup_particles_decaymodes.cc:31
smash::ParticleType::is_stable
bool is_stable() const
Definition: particletype.h:236
setup_particles_decaymodes.h
smash::anonymous_namespace{smash.cc}::ignore_simulation_config_values
void ignore_simulation_config_values(Configuration &configuration)
Remove all config values that are only needed for simulations.
Definition: smash.cc:364
smash::ParticleType
Definition: particletype.h:97
smash::ParticleType::name
const std::string & name() const
Definition: particletype.h:141
smash::setup_default_float_traps
void setup_default_float_traps()
Setup the floating-point traps used throughout SMASH.
Definition: fpenvironment.cc:69
einhard::ALL
Log all message.
Definition: einhard.hpp:106
smash::PdgCode
Definition: pdgcode.h:108
smash::anonymous_namespace{smash.cc}::initialize_particles_and_decays
void initialize_particles_and_decays(Configuration &configuration, sha256::Hash hash, bf::path tabulations_path)
Initialize the particles and decays from the configuration, the hash and the path to the cashed reson...
Definition: smash.cc:384
sha256.h
smash::ParticleType::check_consistency
static void check_consistency()
Definition: particletype.cc:451
smash::sha256::Hash
std::array< uint8_t, HASH_SIZE > Hash
A SHA256 hash.
Definition: sha256.h:16
smash::Configuration::merge_yaml
void merge_yaml(const std::string &yaml)
Merge the configuration in yaml into the existing tree.
Definition: configuration.cc:118
smash::sha256::hash_to_string
std::string hash_to_string(Hash hash)
Convert a SHA256 hash to a hexadecimal string.
Definition: sha256.cc:230
smash::Configuration::take
Value take(std::initializer_list< const char * > keys)
The default interface for SMASH to read configuration values.
Definition: configuration.cc:140
smash::ExperimentParameters
Helper structure for Experiment.
Definition: experimentparameters.h:23
smash::anonymous_namespace{smash.cc}::ensure_path_is_valid
void ensure_path_is_valid(const bf::path &path)
Ensures the output path is valid.
Definition: smash.cc:283
smash::pdg::p
constexpr int p
Proton.
Definition: pdgcode_constants.h:28
scatteractionsfinder.h
smash::FileLock::acquire
bool acquire()
Try to acquire the file lock.
Definition: filelock.cc:20
smash::Test::experiment
std::unique_ptr< ExperimentBase > experiment(const Configuration &c=configuration())
Create an experiment.
Definition: setup.h:175
smash::ExperimentBase::create
static std::unique_ptr< ExperimentBase > create(Configuration config, const bf::path &output_path)
Factory method that creates and initializes a new Experiment<Modus>.
stringfunctions.h
smash::anonymous_namespace{smash.cc}::default_output_path
bf::path default_output_path()
Definition: smash.cc:259
smash::ParticleType::list_all
static const ParticleTypeList & list_all()
Definition: particletype.cc:57
smash::anonymous_namespace{smash.cc}::actions_finder_for_dump
ScatterActionsFinder actions_finder_for_dump(Configuration configuration)
Prepares ActionsFinder for cross-section and reaction dumps.
Definition: smash.cc:305
smash::sha256::Context::finalize
Hash finalize()
Performs the final calculation of the hash and returns the digest (32 byte buffer containing 256bit h...
Definition: sha256.cc:185
smash::anonymous_namespace{smash.cc}::print_disclaimer
void print_disclaimer()
Print the disclaimer.
Definition: smash.cc:173
decaymodes.h