Version: SMASH-3.4
processbranch.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2014-2023,2025-2026
4  * SMASH Team
5  *
6  * GNU General Public License (GPLv3 or later)
7  *
8  */
9 
10 #include "smash/processbranch.h"
11 
12 #include <limits>
13 
14 #include "smash/particledata.h"
15 
16 namespace smash {
17 
24 }
30 }
31 
33  return is_string_soft_process(type) || is_string_hard_process(type);
34 }
35 ParticleList ProcessBranch::particle_list() const {
36  ParticleList l;
37  l.reserve(particle_number());
38  for (const auto& type : particle_types()) {
39  l.push_back(ParticleData{*type});
40  }
41  return l;
42 }
43 
44 double ProcessBranch::threshold() const {
45  if (threshold_ < 0.) {
46  /* Sum up the (minimum) masses of all final-state particles
47  * this requires double-precision to ensure that the sum is never
48  * smaller than the real sum would be without rounding. */
49  double thr = 0.;
50  for (const auto& type : particle_types()) {
51  thr += type->min_mass_kinematic();
52  }
53  /* This may round up or down. Up is good. If down
54  * we must add one ULP via 'nextafter'. */
55  const double rounded = thr;
56  threshold_ =
57  rounded < thr
58  ? std::nextafter(rounded, std::numeric_limits<double>::max())
59  : rounded;
60  }
61  return threshold_;
62 }
63 
64 std::ostream& operator<<(std::ostream& os, const CollisionBranch& cbranch) {
65  ProcessType ptype = cbranch.get_type();
68  os << "soft-1-diff";
69  } else if (ptype == ProcessType::StringSoftDoubleDiffractive) {
70  os << "soft-2-diff";
71  } else if (ptype == ProcessType::StringSoftAnnihilation) {
72  os << "soft-BBbar";
73  } else if (ptype == ProcessType::StringSoftNonDiffractive) {
74  os << "soft-non-diff";
75  } else if (ptype == ProcessType::StringHardNonDiffractive) {
76  os << "hard-non-diff";
77  } else if (ptype == ProcessType::StringHardSingleDiffractiveXB ||
79  os << "hard-1-diff";
80  } else if (ptype == ProcessType::StringHardDoubleDiffractive) {
81  os << "hard-2-diff";
82  } else if (ptype == ProcessType::TwoToOne || ptype == ProcessType::TwoToTwo ||
83  ptype == ProcessType::TwoToThree ||
84  ptype == ProcessType::TwoToFour ||
85  ptype == ProcessType::TwoToFive || ptype == ProcessType::Elastic ||
86  ptype == ProcessType::Decay ||
91  ParticleTypePtrList ptype_list = cbranch.particle_types();
92  /* Sorting ensures unique name for every channel
93  * It avoids duplicates, such as Δ⁰Δ⁺⁺ and Δ⁺⁺Δ⁰,
94  * which actually occur in SMASH, because of the way channels are added:
95  * for example one channel can be added twice with halved cross-section. */
96  std::sort(ptype_list.begin(), ptype_list.end());
97  for (const auto& type : ptype_list) {
98  os << type->name();
99  }
100  } else {
101  os << ptype;
102  }
103  return os;
104 }
105 
106 std::ostream& operator<<(std::ostream& os, ProcessType process_type) {
107  switch (process_type) {
108  case ProcessType::None:
109  os << "None";
110  break;
112  os << "Elastic";
113  break;
115  os << "TwoToOne";
116  break;
118  os << "TwoToTwo";
119  break;
121  os << "TwoToThree";
122  break;
124  os << "TwoToFour";
125  break;
127  os << "TwoToFive";
128  break;
134  os << "SoftStringExcitation";
135  break;
140  os << "HardStringExcitation";
141  break;
142  case ProcessType::Decay:
143  os << "Decay";
144  break;
145  case ProcessType::Wall:
146  os << "Wall";
147  break;
149  os << "Thermalization";
150  break;
153  os << "Fluidization";
154  break;
156  os << "ThreeMesonsToOne";
157  break;
159  os << "ThreeToTwo";
160  break;
162  os << "FourToTwo";
163  break;
165  os << "FiveToTwo";
166  break;
168  os << "Freeforall";
169  break;
170  default:
171  os.setstate(std::ios_base::failbit);
172  }
173  return os;
174 }
175 
176 } // namespace smash
CollisionBranch is a derivative of ProcessBranch, which is used to represent particular final-state c...
ProcessType get_type() const override
const ParticleTypePtrList & particle_types() const override
ParticleData contains the dynamic information of a certain particle.
Definition: particledata.h:59
ParticleList particle_list() const
virtual const ParticleTypePtrList & particle_types() const =0
double threshold_
Threshold of the branch.
virtual unsigned int particle_number() const =0
double threshold() const
std::ostream & operator<<(std::ostream &out, const ActionPtr &action)
Convenience: dereferences the ActionPtr to Action.
Definition: action.h:546
Definition: action.h:24
ProcessType
ProcessTypes are used to identify the type of the process.
Definition: processbranch.h:39
@ FluidizationNoRemoval
See here for a short description.
@ TwoToOne
See here for a short description.
@ StringHardSingleDiffractiveAX
See here for a short description.
@ MultiParticleThreeToTwo
See here for a short description.
@ StringSoftDoubleDiffractive
See here for a short description.
@ Fluidization
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.
@ StringHardNonDiffractive
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.
@ StringHardSingleDiffractiveXB
See here for a short description.
@ StringHardDoubleDiffractive
See here for a short description.
@ TwoToThree
See here for a short description.
@ MultiParticleFiveToTwo
See here for a short description.
bool is_string_hard_process(ProcessType p)
Check if a given process type is a hard string excitation.
bool is_string_soft_process(ProcessType p)
Check if a given process type is a soft string excitation.
bool is_string_process(ProcessType p)
Check if a given process type is a string excitation.