Version: SMASH-1.5
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,
73  StringHard = 46
74 };
75 
81 
87 std::ostream &operator<<(std::ostream &os, ProcessType process_type);
88 
116  public:
119 
124  explicit ProcessBranch(double w) : branch_weight_(w) {}
125 
127  ProcessBranch(const ProcessBranch &) = delete;
128 
133  virtual ~ProcessBranch() = default;
134 
141  inline void set_weight(double process_weight);
142 
144  virtual ProcessType get_type() const = 0;
145 
147  virtual const ParticleTypePtrList &particle_types() const = 0;
148 
153  ParticleList particle_list() const;
154 
156  inline double weight() const;
157 
162  double threshold() const;
163 
165  virtual unsigned int particle_number() const = 0;
166 
167  protected:
171  mutable double threshold_ = -1.;
172 };
173 
180 inline void ProcessBranch::set_weight(double process_weight) {
181  branch_weight_ = process_weight;
182 }
183 
185 inline double ProcessBranch::weight() const { return branch_weight_; }
186 
193 template <typename Branch>
194 inline double total_weight(const ProcessBranchList<Branch> &l) {
195  double sum = 0.;
196  for (const auto &p : l) {
197  sum += p->weight();
198  }
199  return sum;
200 }
201 
209  public:
215  CollisionBranch(double w, ProcessType p_type)
216  : ProcessBranch(w), process_type_(p_type) {}
223  CollisionBranch(const ParticleType &type, double w, ProcessType p_type)
224  : ProcessBranch(w), process_type_(p_type) {
225  particle_types_.reserve(1);
226  particle_types_.push_back(&type);
227  }
235  CollisionBranch(const ParticleType &type_a, const ParticleType &type_b,
236  double w, ProcessType p_type)
237  : ProcessBranch(w), process_type_(p_type) {
238  particle_types_.reserve(2);
239  particle_types_.push_back(&type_a);
240  particle_types_.push_back(&type_b);
241  }
248  CollisionBranch(ParticleTypePtrList new_types, double w, ProcessType p_type)
249  : ProcessBranch(w),
250  particle_types_(std::move(new_types)),
251  process_type_(p_type) {}
255  particle_types_(std::move(rhs.particle_types_)),
257  const ParticleTypePtrList &particle_types() const override {
258  return particle_types_;
259  }
265  inline void set_type(ProcessType p_type) { process_type_ = p_type; }
267  inline ProcessType get_type() const override { return process_type_; }
269  unsigned int particle_number() const override {
270  return particle_types_.size();
271  }
272 
273  private:
281  ParticleTypePtrList particle_types_;
287 };
288 
294 std::ostream &operator<<(std::ostream &os, const CollisionBranch &cbranch);
295 
303 class DecayBranch : public ProcessBranch {
304  public:
310  DecayBranch(const DecayType &t, double w) : ProcessBranch(w), type_(t) {}
313  : ProcessBranch(rhs.branch_weight_), type_(rhs.type_) {}
315  inline int angular_momentum() const { return type_.angular_momentum(); }
316  const ParticleTypePtrList &particle_types() const override {
317  return type_.particle_types();
318  }
319  unsigned int particle_number() const override {
320  return type_.particle_number();
321  }
323  inline const DecayType &type() const { return type_; }
325  inline ProcessType get_type() const override { return ProcessType::Decay; }
326 
327  private:
329  const DecayType &type_;
330 };
331 
332 } // namespace smash
333 
334 #endif // SRC_INCLUDE_PROCESSBRANCH_H_
virtual unsigned int particle_number() const =0
int angular_momentum() const
ProcessBranch(double w)
Create a ProcessBranch with with weight but without final states.
const DecayType & type() const
ProcessBranch represents one possible final state of an interaction process.
const ParticleTypePtrList & particle_types() const
Definition: decaytype.h:59
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.
virtual unsigned int particle_number() const =0
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.
virtual const ParticleTypePtrList & particle_types() const =0
2->2 inelastic scattering
ProcessType get_type() const override
forced thermalization, many particles are replaced by a thermalized ensemble
DecayType is the abstract base class for all decay types.
Definition: decaytype.h:23
const ParticleTypePtrList & particle_types() const override
double weight() const
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.
ParticleList particle_list() const
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:87
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.
int angular_momentum() const
Definition: decaytype.h:61
virtual ~ProcessBranch()=default
Virtual Destructor.
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
virtual ProcessType get_type() const =0
std::ostream & operator<<(std::ostream &out, const ActionPtr &action)
Convenience: dereferences the ActionPtr to Action.
Definition: action.h:457
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.
double threshold_
Threshold of the branch.
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.
double threshold() const