Version: SMASH-2.2
processbranch.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013-2021
3  * SMASH Team
4  *
5  * GNU General Public License (GPLv3 or later)
6  */
7 #ifndef SRC_INCLUDE_SMASH_PROCESSBRANCH_H_
8 #define SRC_INCLUDE_SMASH_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  TwoToThree = 4,
37  TwoToFour = 15,
39  TwoToFive = 13,
41  Decay = 5,
43  Wall = 6,
48  Thermalization = 7,
55  Bremsstrahlung = 9,
61 
92  StringHard = 46,
93 
98  FailedString = 47
99 };
100 
106 
112 std::ostream &operator<<(std::ostream &os, ProcessType process_type);
113 
141  public:
144 
149  explicit ProcessBranch(double w) : branch_weight_(w) {}
150 
152  ProcessBranch(const ProcessBranch &) = delete;
153 
158  virtual ~ProcessBranch() = default;
159 
166  inline void set_weight(double process_weight);
167 
169  virtual ProcessType get_type() const = 0;
170 
172  virtual const ParticleTypePtrList &particle_types() const = 0;
173 
178  ParticleList particle_list() const;
179 
181  inline double weight() const;
182 
187  double threshold() const;
188 
190  virtual unsigned int particle_number() const = 0;
191 
192  protected:
196  mutable double threshold_ = -1.;
197 };
198 
199 inline void ProcessBranch::set_weight(double process_weight) {
200  branch_weight_ = process_weight;
201 }
202 
204 inline double ProcessBranch::weight() const { return branch_weight_; }
205 
212 template <typename Branch>
213 inline double total_weight(const ProcessBranchList<Branch> &l) {
214  double sum = 0.;
215  for (const auto &p : l) {
216  sum += p->weight();
217  }
218  return sum;
219 }
220 
228  public:
234  CollisionBranch(double w, ProcessType p_type)
235  : ProcessBranch(w), process_type_(p_type) {}
242  CollisionBranch(const ParticleType &type, double w, ProcessType p_type)
243  : ProcessBranch(w), process_type_(p_type) {
244  particle_types_.reserve(1);
245  particle_types_.push_back(&type);
246  }
254  CollisionBranch(const ParticleType &type_a, const ParticleType &type_b,
255  double w, ProcessType p_type)
256  : ProcessBranch(w), process_type_(p_type) {
257  particle_types_.reserve(2);
258  particle_types_.push_back(&type_a);
259  particle_types_.push_back(&type_b);
260  }
261 
270  CollisionBranch(const ParticleType &type_a, const ParticleType &type_b,
271  const ParticleType &type_c, double w, ProcessType p_type)
272  : ProcessBranch(w), process_type_(p_type) {
273  particle_types_.reserve(3);
274  particle_types_.push_back(&type_a);
275  particle_types_.push_back(&type_b);
276  particle_types_.push_back(&type_c);
277  }
278 
288  CollisionBranch(const ParticleType &type_a, const ParticleType &type_b,
289  const ParticleType &type_c, const ParticleType &type_d,
290  double w, ProcessType p_type)
291  : ProcessBranch(w), process_type_(p_type) {
292  particle_types_.reserve(4);
293  particle_types_.push_back(&type_a);
294  particle_types_.push_back(&type_b);
295  particle_types_.push_back(&type_c);
296  particle_types_.push_back(&type_d);
297  }
298 
309  CollisionBranch(const ParticleType &type_a, const ParticleType &type_b,
310  const ParticleType &type_c, const ParticleType &type_d,
311  const ParticleType &type_e, double w, ProcessType p_type)
312  : ProcessBranch(w), process_type_(p_type) {
313  particle_types_.reserve(5);
314  particle_types_.push_back(&type_a);
315  particle_types_.push_back(&type_b);
316  particle_types_.push_back(&type_c);
317  particle_types_.push_back(&type_d);
318  particle_types_.push_back(&type_e);
319  }
320 
327  CollisionBranch(ParticleTypePtrList new_types, double w, ProcessType p_type)
328  : ProcessBranch(w),
329  particle_types_(std::move(new_types)),
330  process_type_(p_type) {}
334  particle_types_(std::move(rhs.particle_types_)),
336  const ParticleTypePtrList &particle_types() const override {
337  return particle_types_;
338  }
344  inline void set_type(ProcessType p_type) { process_type_ = p_type; }
346  inline ProcessType get_type() const override { return process_type_; }
348  unsigned int particle_number() const override {
349  return particle_types_.size();
350  }
351 
352  private:
354  ParticleTypePtrList particle_types_;
355 
361 };
362 
368 std::ostream &operator<<(std::ostream &os, const CollisionBranch &cbranch);
369 
377 class DecayBranch : public ProcessBranch {
378  public:
384  DecayBranch(const DecayType &t, double w) : ProcessBranch(w), type_(t) {}
387  : ProcessBranch(rhs.branch_weight_), type_(rhs.type_) {}
389  inline int angular_momentum() const { return type_.angular_momentum(); }
390  const ParticleTypePtrList &particle_types() const override {
391  return type_.particle_types();
392  }
393  unsigned int particle_number() const override {
394  return type_.particle_number();
395  }
397  inline const DecayType &type() const { return type_; }
399  inline ProcessType get_type() const override { return ProcessType::Decay; }
400 
401  private:
403  const DecayType &type_;
404 };
405 
406 } // namespace smash
407 
408 #endif // SRC_INCLUDE_SMASH_PROCESSBRANCH_H_
CollisionBranch is a derivative of ProcessBranch, which is used to represent particular final-state c...
ProcessType get_type() const override
CollisionBranch(CollisionBranch &&rhs)
The move constructor efficiently moves the particle-type list member.
ParticleTypePtrList particle_types_
List of particles appearing in this process outcome.
CollisionBranch(const ParticleType &type_a, const ParticleType &type_b, const ParticleType &type_c, const ParticleType &type_d, const ParticleType &type_e, double w, ProcessType p_type)
Construct collision branch with 5 particles in final state.
const ParticleTypePtrList & particle_types() const override
CollisionBranch(const ParticleType &type, double w, ProcessType p_type)
Construct collision branch with 1 particle in final state.
CollisionBranch(ParticleTypePtrList new_types, double w, ProcessType p_type)
Construct collision branch with a list of particles in final state.
ProcessType process_type_
Process type are used to distinguish different types of processes, e.g.
unsigned int particle_number() const override
CollisionBranch(const ParticleType &type_a, const ParticleType &type_b, const ParticleType &type_c, double w, ProcessType p_type)
Construct collision branch with 3 particles in final state.
CollisionBranch(const ParticleType &type_a, const ParticleType &type_b, const ParticleType &type_c, const ParticleType &type_d, double w, ProcessType p_type)
Construct collision branch with 4 particles in final state.
CollisionBranch(const ParticleType &type_a, const ParticleType &type_b, double w, ProcessType p_type)
Construct collision branch with 2 particles in final state.
CollisionBranch(double w, ProcessType p_type)
Construct collision branch with empty final state.
void set_type(ProcessType p_type)
Set the process type.
DecayBranch is a derivative of ProcessBranch, which is used to represent decay channels.
DecayBranch(DecayBranch &&rhs)
The move constructor efficiently moves the particle-type list member.
unsigned int particle_number() const override
ProcessType get_type() const override
const DecayType & type() const
DecayBranch(const DecayType &t, double w)
Construct decay branch.
const ParticleTypePtrList & particle_types() const override
int angular_momentum() const
const DecayType & type_
Decay type (including final-state particles and angular momentum)
DecayType is the abstract base class for all decay types.
Definition: decaytype.h:23
virtual unsigned int particle_number() const =0
const ParticleTypePtrList & particle_types() const
Definition: decaytype.h:59
int angular_momentum() const
Definition: decaytype.h:61
Particle type contains the static properties of a particle species.
Definition: particletype.h:97
ProcessBranch represents one possible final state of an interaction process.
ParticleList particle_list() const
virtual ~ProcessBranch()=default
Virtual Destructor.
virtual const ParticleTypePtrList & particle_types() const =0
double total_weight(const ProcessBranchList< Branch > &l)
ProcessBranch(const ProcessBranch &)=delete
Copying is disabled. Use std::move or create a new object.
virtual ProcessType get_type() const =0
ProcessBranch()
Create a ProcessBranch without final states and weight.
double threshold_
Threshold of the branch.
double branch_weight_
Weight of the branch, typically a cross section or a branching ratio.
ProcessBranch(double w)
Create a ProcessBranch with with weight but without final states.
void set_weight(double process_weight)
Set the weight of the branch.
virtual unsigned int particle_number() const =0
double threshold() const
double weight() const
std::ostream & operator<<(std::ostream &out, const ActionPtr &action)
Convenience: dereferences the ActionPtr to Action.
Definition: action.h:532
constexpr int p
Proton.
Definition: action.h:24
ProcessType
Process Types are used to identify the type of the process.
Definition: processbranch.h:25
@ FailedString
Soft String NNbar annihilation process can fail by lack of energy.
@ TwoToOne
resonance formation (2->1)
@ StringSoftDoubleDiffractive
double diffractive. Two strings are formed, one from A and one from B.
@ Bremsstrahlung
bremsstrahlung process: a + b -> a + b + photon
@ Thermalization
forced thermalization, many particles are replaced by a thermalized ensemble
@ Decay
resonance decay
@ TwoToFive
2->5 scattering
@ StringSoftSingleDiffractiveXB
single diffractive AB->XB.
@ TwoToTwo
2->2 inelastic scattering
@ Wall
box wall crossing
@ Elastic
elastic scattering: particles remain the same, only momenta change
@ TwoToFour
2->4 scattering
@ StringSoftAnnihilation
a special case of baryon-antibaryon annihilation.
@ MultiParticleThreeMesonsToOne
multi particle scattering
@ StringSoftNonDiffractive
non-diffractive. Two strings are formed both have ends in A and B.
@ StringSoftSingleDiffractiveAX
(41-45) soft string excitations.
@ StringHard
hard string process involving 2->2 QCD process by PYTHIA.
@ HyperSurfaceCrossing
Hypersurface crossing Particles are removed from the evolution and printed to a separate output to se...
@ TwoToThree
2->3 scattering
bool is_string_soft_process(ProcessType p)
Check if a given process type is a soft string excitation.