Version: SMASH-3.1
decaymodes.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013-2018,2020
3  * SMASH Team
4  *
5  * GNU General Public License (GPLv3 or later)
6  */
7 #ifndef SRC_INCLUDE_SMASH_DECAYMODES_H_
8 #define SRC_INCLUDE_SMASH_DECAYMODES_H_
9 
10 #include <stdexcept>
11 #include <string>
12 #include <utility>
13 #include <vector>
14 
15 #include "processbranch.h"
16 
17 namespace smash {
18 
29 class DecayModes {
30  public:
39  void add_mode(ParticleTypePtr mother, double ratio, int L,
40  ParticleTypePtrList particle_types);
41 
47  void add_mode(DecayBranchPtr branch) {
48  decay_modes_.push_back(std::move(branch));
49  }
50 
57  bool renormalize(const std::string &name);
58 
60  bool is_empty() const { return decay_modes_.empty(); }
61 
63  const DecayBranchList &decay_mode_list() const { return decay_modes_; }
64 
86  static void load_decaymodes(const std::string &input);
87 
98  ParticleTypePtrList particle_types, int L);
99 
101  struct InvalidDecay : public std::invalid_argument {
102  using std::invalid_argument::invalid_argument;
103  };
105  struct LoadFailure : public std::runtime_error {
106  using std::runtime_error::runtime_error;
107  };
109  struct MissingDecays : public LoadFailure {
110  using LoadFailure::LoadFailure;
111  };
114  using LoadFailure::LoadFailure;
115  };
116 
117  private:
123  DecayBranchList decay_modes_;
124 
126  friend const DecayModes &ParticleType::decay_modes() const;
127 
132  static std::vector<DecayModes> *all_decay_modes;
133 };
134 
135 } // namespace smash
136 
137 #endif // SRC_INCLUDE_SMASH_DECAYMODES_H_
The DecayModes class is used to store and update information about decay branches (i....
Definition: decaymodes.h:29
const DecayBranchList & decay_mode_list() const
Definition: decaymodes.h:63
void add_mode(DecayBranchPtr branch)
Add a decay mode from an already existing decay branch.
Definition: decaymodes.h:47
bool is_empty() const
Definition: decaymodes.h:60
void add_mode(ParticleTypePtr mother, double ratio, int L, ParticleTypePtrList particle_types)
Add a decay mode using all necessary information.
Definition: decaymodes.cc:29
bool renormalize(const std::string &name)
Renormalize the branching ratios to add up to 1.
Definition: decaymodes.cc:98
static std::vector< DecayModes > * all_decay_modes
A list of all DecayModes objects using the same indexing as all_particle_types.
Definition: decaymodes.h:132
DecayBranchList decay_modes_
Vector of decay modes.
Definition: decaymodes.h:123
static DecayType * get_decay_type(ParticleTypePtr mother, ParticleTypePtrList particle_types, int L)
Retrieve a decay type.
Definition: decaymodes.cc:43
static void load_decaymodes(const std::string &input)
Loads the DecayModes map as described in the input string.
Definition: decaymodes.cc:163
DecayType is the abstract base class for all decay types.
Definition: decaytype.h:23
A pointer-like interface to global references to ParticleType objects.
Definition: particletype.h:676
const DecayModes & decay_modes() const
Definition: action.h:24