Version: SMASH-3.1
smash::ProcessBranch Class Referenceabstract

#include <processbranch.h>

ProcessBranch represents one possible final state of an interaction process.

Each final state has two components;

  1. The list of particle types present in this state.
  2. The weight of this state, i.e. how probable this outcome is compared to other possible outcomes. Depending on context, this can be either a cross section or a branching ratio.
  3. The process id that identifies a certain class of processes. If the outgoing particles are not known yet, e.g. for strings there will be only the weight and the process id.

For example, create a list of decay modes for \(\Delta^+\) resonance:

std::vector<ProcessBranch> deltaplus_decay_modes;
branch.set_weight(2);
deltaplus_decay_modes.push_back(branch);
// set_weight erases the previous weight
branch.set_weight(1);
deltaplus_decay_modes.push_back(branch);
ProcessBranch()
Create a ProcessBranch without final states and weight.

Definition at line 129 of file processbranch.h.

Inheritance diagram for smash::ProcessBranch:
smash::CollisionBranch smash::DecayBranch

Public Member Functions

 ProcessBranch ()
 Create a ProcessBranch without final states and weight. More...
 
 ProcessBranch (double w)
 Create a ProcessBranch with with weight but without final states. More...
 
 ProcessBranch (const ProcessBranch &)=delete
 Copying is disabled. Use std::move or create a new object. More...
 
virtual ~ProcessBranch ()=default
 Virtual Destructor. More...
 
void set_weight (double process_weight)
 Set the weight of the branch. More...
 
virtual ProcessType get_type () const =0
 
virtual const ParticleTypePtrList & particle_types () const =0
 
ParticleList particle_list () const
 
double weight () const
 
double threshold () const
 
virtual unsigned int particle_number () const =0
 

Protected Attributes

double branch_weight_
 Weight of the branch, typically a cross section or a branching ratio. More...
 
double threshold_ = -1.
 Threshold of the branch. More...
 

Related Functions

(Note that these are not member functions.)

template<typename Branch >
double total_weight (const ProcessBranchList< Branch > &l)
 

Constructor & Destructor Documentation

◆ ProcessBranch() [1/3]

smash::ProcessBranch::ProcessBranch ( )
inline

Create a ProcessBranch without final states and weight.

Definition at line 132 of file processbranch.h.

132 : branch_weight_(0.) {}
double branch_weight_
Weight of the branch, typically a cross section or a branching ratio.

◆ ProcessBranch() [2/3]

smash::ProcessBranch::ProcessBranch ( double  w)
inlineexplicit

Create a ProcessBranch with with weight but without final states.

Parameters
[in]wWeight of new branch.

Definition at line 138 of file processbranch.h.

138 : branch_weight_(w) {}

◆ ProcessBranch() [3/3]

smash::ProcessBranch::ProcessBranch ( const ProcessBranch )
delete

Copying is disabled. Use std::move or create a new object.

◆ ~ProcessBranch()

virtual smash::ProcessBranch::~ProcessBranch ( )
virtualdefault

Virtual Destructor.

The declaration of the destructor is necessary to make it virtual.

Member Function Documentation

◆ set_weight()

void smash::ProcessBranch::set_weight ( double  process_weight)
inline

Set the weight of the branch.

In other words, how probable this branch is compared to other branches.

Parameters
[in]process_weightWeight of the process.

Definition at line 188 of file processbranch.h.

188  {
189  branch_weight_ = process_weight;
190 }

◆ get_type()

virtual ProcessType smash::ProcessBranch::get_type ( ) const
pure virtual
Returns
the process type

Implemented in smash::DecayBranch, and smash::CollisionBranch.

◆ particle_types()

virtual const ParticleTypePtrList& smash::ProcessBranch::particle_types ( ) const
pure virtual
Returns
the particle types associated with this branch.

Implemented in smash::DecayBranch, and smash::CollisionBranch.

◆ particle_list()

ParticleList smash::ProcessBranch::particle_list ( ) const
Returns
a list of ParticleData initialized with the stored ParticleType objects.

Definition at line 26 of file processbranch.cc.

26  {
27  ParticleList l;
28  l.reserve(particle_number());
29  for (const auto& type : particle_types()) {
30  l.push_back(ParticleData{*type});
31  }
32  return l;
33 }
virtual const ParticleTypePtrList & particle_types() const =0
virtual unsigned int particle_number() const =0

◆ weight()

double smash::ProcessBranch::weight ( ) const
inline
Returns
the branch weight.
the branch weight

Definition at line 193 of file processbranch.h.

193 { return branch_weight_; }

◆ threshold()

double smash::ProcessBranch::threshold ( ) const
Returns
the threshold for this branch, i.e. the minimum energy that is required to produce all final-state particles.

Definition at line 35 of file processbranch.cc.

35  {
36  if (threshold_ < 0.) {
37  /* Sum up the (minimum) masses of all final-state particles
38  * this requires double-precision to ensure that the sum is never
39  * smaller than the real sum would be without rounding. */
40  double thr = 0.;
41  for (const auto& type : particle_types()) {
42  thr += type->min_mass_kinematic();
43  }
44  /* This may round up or down. Up is good. If down
45  * we must add one ULP via 'nextafter'. */
46  const double rounded = thr;
47  threshold_ =
48  rounded < thr
49  ? std::nextafter(rounded, std::numeric_limits<double>::max())
50  : rounded;
51  }
52  return threshold_;
53 }
double threshold_
Threshold of the branch.

◆ particle_number()

virtual unsigned int smash::ProcessBranch::particle_number ( ) const
pure virtual
Returns
the number of particles in the final state.

Implemented in smash::DecayBranch, and smash::CollisionBranch.

Friends And Related Function Documentation

◆ total_weight()

template<typename Branch >
double total_weight ( const ProcessBranchList< Branch > &  l)
related
Parameters
[in]lThe list of all the processes that would be summed.
Returns
the total weight calculated by summing all weights of the ProcessBranch objects in the list l.

Definition at line 202 of file processbranch.h.

202  {
203  double sum = 0.;
204  for (const auto &p : l) {
205  sum += p->weight();
206  }
207  return sum;
208 }
constexpr int p
Proton.

Member Data Documentation

◆ branch_weight_

double smash::ProcessBranch::branch_weight_
protected

Weight of the branch, typically a cross section or a branching ratio.

Definition at line 183 of file processbranch.h.

◆ threshold_

double smash::ProcessBranch::threshold_ = -1.
mutableprotected

Threshold of the branch.

Definition at line 185 of file processbranch.h.


The documentation for this class was generated from the following files: