Version: SMASH-1.7
processbranch.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013-2018
3  * SMASH Team
4  *
5  * GNU General Public License (GPLv3 or later)
6  */
7 #ifndef SRC_INCLUDE_PROCESSBRANCH_H_
8 #define SRC_INCLUDE_PROCESSBRANCH_H_
9 
10 #include <iostream>
11 #include <memory>
12 #include <utility>
13 #include <vector>
14 
15 #include "decaytype.h"
16 #include "forwarddeclarations.h"
17 #include "particletype.h"
18 
19 namespace smash {
20 
25 enum class ProcessType {
27  None = 0,
29  Elastic = 1,
31  TwoToOne = 2,
33  TwoToTwo = 3,
35  Decay = 5,
37  Wall = 6,
42  Thermalization = 7,
78  StringHard = 46
79 };
80 
86 
92 std::ostream &operator<<(std::ostream &os, ProcessType process_type);
93 
121  public:
123  ProcessBranch() : branch_weight_(0.) {}
124 
129  explicit ProcessBranch(double w) : branch_weight_(w) {}
130 
132  ProcessBranch(const ProcessBranch &) = delete;
133 
138  virtual ~ProcessBranch() = default;
139 
146  inline void set_weight(double process_weight);
147 
149  virtual ProcessType get_type() const = 0;
150 
152  virtual const ParticleTypePtrList &particle_types() const = 0;
153 
158  ParticleList particle_list() const;
159 
161  inline double weight() const;
162 
167  double threshold() const;
168 
170  virtual unsigned int particle_number() const = 0;
171 
172  protected:
176  mutable double threshold_ = -1.;
177 };
178 
179 inline void ProcessBranch::set_weight(double process_weight) {
180  branch_weight_ = process_weight;
181 }
182 
184 inline double ProcessBranch::weight() const { return branch_weight_; }
185 
192 template <typename Branch>
193 inline double total_weight(const ProcessBranchList<Branch> &l) {
194  double sum = 0.;
195  for (const auto &p : l) {
196  sum += p->weight();
197  }
198  return sum;
199 }
200 
208  public:
214  CollisionBranch(double w, ProcessType p_type)
215  : ProcessBranch(w), process_type_(p_type) {}
222  CollisionBranch(const ParticleType &type, double w, ProcessType p_type)
223  : ProcessBranch(w), process_type_(p_type) {
224  particle_types_.reserve(1);
225  particle_types_.push_back(&type);
226  }
234  CollisionBranch(const ParticleType &type_a, const ParticleType &type_b,
235  double w, ProcessType p_type)
236  : ProcessBranch(w), process_type_(p_type) {
237  particle_types_.reserve(2);
238  particle_types_.push_back(&type_a);
239  particle_types_.push_back(&type_b);
240  }
247  CollisionBranch(ParticleTypePtrList new_types, double w, ProcessType p_type)
248  : ProcessBranch(w),
249  particle_types_(std::move(new_types)),
250  process_type_(p_type) {}
253  : ProcessBranch(rhs.branch_weight_),
254  particle_types_(std::move(rhs.particle_types_)),
255  process_type_(rhs.process_type_) {}
256  const ParticleTypePtrList &particle_types() const override {
257  return particle_types_;
258  }
264  inline void set_type(ProcessType p_type) { process_type_ = p_type; }
266  inline ProcessType get_type() const override { return process_type_; }
268  unsigned int particle_number() const override {
269  return particle_types_.size();
270  }
271 
272  private:
280  ParticleTypePtrList particle_types_;
286 };
287 
293 std::ostream &operator<<(std::ostream &os, const CollisionBranch &cbranch);
294 
302 class DecayBranch : public ProcessBranch {
303  public:
309  DecayBranch(const DecayType &t, double w) : ProcessBranch(w), type_(t) {}
312  : ProcessBranch(rhs.branch_weight_), type_(rhs.type_) {}
314  inline int angular_momentum() const { return type_.angular_momentum(); }
315  const ParticleTypePtrList &particle_types() const override {
316  return type_.particle_types();
317  }
318  unsigned int particle_number() const override {
319  return type_.particle_number();
320  }
322  inline const DecayType &type() const { return type_; }
324  inline ProcessType get_type() const override { return ProcessType::Decay; }
325 
326  private:
328  const DecayType &type_;
329 };
330 
331 } // namespace smash
332 
333 #endif // SRC_INCLUDE_PROCESSBRANCH_H_
ProcessBranch(double w)
Create a ProcessBranch with with weight but without final states.
ProcessBranch represents one possible final state of an interaction process.
resonance decays
CollisionBranch(ParticleTypePtrList new_types, double w, ProcessType p_type)
Construct collision branch with a list of particles in final state.
double diffractive. Two strings are formed, one from A and one from B.
bool is_string_soft_process(ProcessType p)
Check if a given process type is a soft string excitation.
ProcessType
Process Types are used to identify the type of the process.
Definition: processbranch.h:25
ProcessBranch()
Create a ProcessBranch without final states and weight.
ProcessType process_type_
Process type are used to distinguish different types of processes, e.g.
double total_weight(const ProcessBranchList< Branch > &l)
a special case of baryon-antibaryon annihilation.
DecayBranch(const DecayType &t, double w)
Construct decay branch.
STL namespace.
2->2 inelastic scattering
const DecayType & type() const
ProcessType get_type() const override
forced thermalization, many particles are replaced by a thermalized ensemble
Hypersurface crossing Particles are removed from the evolution and printed to a separate output to se...
int angular_momentum() const
double weight() const
DecayType is the abstract base class for all decay types.
Definition: decaytype.h:23
const ParticleTypePtrList & particle_types() const override
unsigned int particle_number() const override
void set_weight(double process_weight)
Set the weight of the branch.
CollisionBranch(const ParticleType &type_a, const ParticleType &type_b, double w, ProcessType p_type)
Construct collision branch with 2 particles in final state.
elastic scattering: particles remain the same, only momenta change
double branch_weight_
Weight of the branch, typically a cross section or a branching ratio.
CollisionBranch(double w, ProcessType p_type)
Construct collision branch with empty final state.
CollisionBranch is a derivative of ProcessBranch, which is used to represent particular final-state c...
Particle type contains the static properties of a particle species.
Definition: particletype.h:97
const ParticleTypePtrList & particle_types() const override
CollisionBranch(CollisionBranch &&rhs)
The move constructor efficiently moves the particle-type list member.
hard string process involving 2->2 QCD process by PYTHIA.
box wall crossing
DecayBranch is a derivative of ProcessBranch, which is used to represent decay channels.
CollisionBranch(const ParticleType &type, double w, ProcessType p_type)
Construct collision branch with 1 particle in final state.
constexpr int p
Proton.
resonance formation (2->1)
unsigned int particle_number() const override
ProcessType get_type() const override
std::ostream & operator<<(std::ostream &out, const ActionPtr &action)
Convenience: dereferences the ActionPtr to Action.
Definition: action.h:463
non-diffractive. Two strings are formed both have ends in A and B.
const DecayType & type_
Decay type (including final-state particles and angular momentum)
(41-45) soft string excitations.
DecayBranch(DecayBranch &&rhs)
The move constructor efficiently moves the particle-type list member.
Definition: action.h:24
void set_type(ProcessType p_type)
Set the process type.
ParticleTypePtrList particle_types_
List of particles appearing in this process outcome.