Version: SMASH-3.1
processbranch.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013-2023
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 
39 enum class ProcessType {
41  None = 0,
43  Elastic = 1,
45  TwoToOne = 2,
47  TwoToTwo = 3,
49  TwoToThree = 4,
51  TwoToFour = 15,
53  TwoToFive = 13,
55  Decay = 5,
57  Wall = 6,
59  Thermalization = 7,
63  Bremsstrahlung = 9,
83  StringHard = 46,
85  FailedString = 47,
87  Freeforall = 90
88 };
89 
95 
101 std::ostream &operator<<(std::ostream &os, ProcessType process_type);
102 
130  public:
133 
138  explicit ProcessBranch(double w) : branch_weight_(w) {}
139 
141  ProcessBranch(const ProcessBranch &) = delete;
142 
147  virtual ~ProcessBranch() = default;
148 
155  inline void set_weight(double process_weight);
156 
158  virtual ProcessType get_type() const = 0;
159 
161  virtual const ParticleTypePtrList &particle_types() const = 0;
162 
167  ParticleList particle_list() const;
168 
170  inline double weight() const;
171 
176  double threshold() const;
177 
179  virtual unsigned int particle_number() const = 0;
180 
181  protected:
185  mutable double threshold_ = -1.;
186 };
187 
188 inline void ProcessBranch::set_weight(double process_weight) {
189  branch_weight_ = process_weight;
190 }
191 
193 inline double ProcessBranch::weight() const { return branch_weight_; }
194 
201 template <typename Branch>
202 inline double total_weight(const ProcessBranchList<Branch> &l) {
203  double sum = 0.;
204  for (const auto &p : l) {
205  sum += p->weight();
206  }
207  return sum;
208 }
209 
217  public:
223  CollisionBranch(double w, ProcessType p_type)
224  : ProcessBranch(w), process_type_(p_type) {}
231  CollisionBranch(const ParticleType &type, double w, ProcessType p_type)
232  : ProcessBranch(w), process_type_(p_type) {
233  particle_types_.reserve(1);
234  particle_types_.push_back(&type);
235  }
243  CollisionBranch(const ParticleType &type_a, const ParticleType &type_b,
244  double w, ProcessType p_type)
245  : ProcessBranch(w), process_type_(p_type) {
246  particle_types_.reserve(2);
247  particle_types_.push_back(&type_a);
248  particle_types_.push_back(&type_b);
249  }
250 
259  CollisionBranch(const ParticleType &type_a, const ParticleType &type_b,
260  const ParticleType &type_c, double w, ProcessType p_type)
261  : ProcessBranch(w), process_type_(p_type) {
262  particle_types_.reserve(3);
263  particle_types_.push_back(&type_a);
264  particle_types_.push_back(&type_b);
265  particle_types_.push_back(&type_c);
266  }
267 
277  CollisionBranch(const ParticleType &type_a, const ParticleType &type_b,
278  const ParticleType &type_c, const ParticleType &type_d,
279  double w, ProcessType p_type)
280  : ProcessBranch(w), process_type_(p_type) {
281  particle_types_.reserve(4);
282  particle_types_.push_back(&type_a);
283  particle_types_.push_back(&type_b);
284  particle_types_.push_back(&type_c);
285  particle_types_.push_back(&type_d);
286  }
287 
298  CollisionBranch(const ParticleType &type_a, const ParticleType &type_b,
299  const ParticleType &type_c, const ParticleType &type_d,
300  const ParticleType &type_e, double w, ProcessType p_type)
301  : ProcessBranch(w), process_type_(p_type) {
302  particle_types_.reserve(5);
303  particle_types_.push_back(&type_a);
304  particle_types_.push_back(&type_b);
305  particle_types_.push_back(&type_c);
306  particle_types_.push_back(&type_d);
307  particle_types_.push_back(&type_e);
308  }
309 
316  CollisionBranch(ParticleTypePtrList new_types, double w, ProcessType p_type)
317  : ProcessBranch(w),
318  particle_types_(std::move(new_types)),
319  process_type_(p_type) {}
323  particle_types_(std::move(rhs.particle_types_)),
325  const ParticleTypePtrList &particle_types() const override {
326  return particle_types_;
327  }
333  inline void set_type(ProcessType p_type) { process_type_ = p_type; }
335  inline ProcessType get_type() const override { return process_type_; }
337  unsigned int particle_number() const override {
338  return particle_types_.size();
339  }
340 
341  private:
343  ParticleTypePtrList particle_types_;
344 
350 };
351 
357 std::ostream &operator<<(std::ostream &os, const CollisionBranch &cbranch);
358 
366 class DecayBranch : public ProcessBranch {
367  public:
373  DecayBranch(const DecayType &t, double w) : ProcessBranch(w), type_(t) {}
376  : ProcessBranch(rhs.branch_weight_), type_(rhs.type_) {}
378  inline int angular_momentum() const { return type_.angular_momentum(); }
379  const ParticleTypePtrList &particle_types() const override {
380  return type_.particle_types();
381  }
382  unsigned int particle_number() const override {
383  return type_.particle_number();
384  }
386  inline const DecayType &type() const { return type_; }
388  inline ProcessType get_type() const override { return ProcessType::Decay; }
389 
390  private:
392  const DecayType &type_;
393 };
394 
395 } // namespace smash
396 
397 #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:58
int angular_momentum() const
Definition: decaytype.h:60
Particle type contains the static properties of a particle species.
Definition: particletype.h:98
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:547
constexpr int p
Proton.
Definition: action.h:24
ProcessType
ProcessTypes are used to identify the type of the process.
Definition: processbranch.h:39
@ FailedString
See here for a short description.
@ TwoToOne
See here for a short description.
@ MultiParticleThreeToTwo
See here for a short description.
@ StringSoftDoubleDiffractive
See here for a short description.
@ Bremsstrahlung
See here for a short description.
@ Thermalization
See here for a short description.
@ Freeforall
See here for a short description.
@ Decay
See here for a short description.
@ TwoToFive
See here for a short description.
@ None
See here for a short description.
@ StringSoftSingleDiffractiveXB
See here for a short description.
@ TwoToTwo
See here for a short description.
@ Wall
See here for a short description.
@ Elastic
See here for a short description.
@ TwoToFour
See here for a short description.
@ StringSoftAnnihilation
See here for a short description.
@ MultiParticleThreeMesonsToOne
See here for a short description.
@ StringSoftNonDiffractive
See here for a short description.
@ MultiParticleFourToTwo
See here for a short description.
@ StringSoftSingleDiffractiveAX
See here for a short description.
@ StringHard
See here for a short description.
@ HyperSurfaceCrossing
See here for a short description.
@ TwoToThree
See here for a short description.
@ MultiParticleFiveToTwo
See here for a short description.
bool is_string_soft_process(ProcessType p)
Check if a given process type is a soft string excitation.