Version: SMASH-2.2
processbranch.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2014-2022
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 }
25 
26 ParticleList ProcessBranch::particle_list() const {
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 }
34 
35 double ProcessBranch::threshold() const {
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 }
54 
55 std::ostream& operator<<(std::ostream& os, const CollisionBranch& cbranch) {
56  ProcessType ptype = cbranch.get_type();
59  os << "1-diff";
60  } else if (ptype == ProcessType::StringSoftDoubleDiffractive) {
61  os << "2-diff";
62  } else if (ptype == ProcessType::StringSoftAnnihilation) {
63  os << "BBbar";
64  } else if (ptype == ProcessType::StringSoftNonDiffractive) {
65  os << "non-diff";
66  } else if (ptype == ProcessType::StringHard) {
67  os << "hard";
68  } else if (ptype == ProcessType::TwoToOne || ptype == ProcessType::TwoToTwo ||
69  ptype == ProcessType::TwoToThree ||
70  ptype == ProcessType::TwoToFour ||
71  ptype == ProcessType::TwoToFive || ptype == ProcessType::Elastic ||
72  ptype == ProcessType::Decay ||
77  ParticleTypePtrList ptype_list = cbranch.particle_types();
78  /* Sorting ensures unique name for every channel
79  * It avoids duplicates, such as Δ⁰Δ⁺⁺ and Δ⁺⁺Δ⁰,
80  * which actually occur in SMASH, because of the way channels are added:
81  * for example one channel can be added twice with halved cross-section. */
82  std::sort(ptype_list.begin(), ptype_list.end());
83  for (const auto& type : ptype_list) {
84  os << type->name();
85  }
86  } else {
87  os << ptype;
88  }
89  return os;
90 }
91 
92 std::ostream& operator<<(std::ostream& os, ProcessType process_type) {
93  switch (process_type) {
94  case ProcessType::None:
95  os << "None";
96  break;
98  os << "Elastic";
99  break;
101  os << "TwoToOne";
102  break;
104  os << "TwoToTwo";
105  break;
107  os << "TwoToThree";
108  break;
110  os << "TwoToFour";
111  break;
113  os << "TwoToFive";
114  break;
120  os << "Soft String Excitation";
121  break;
123  os << "Hard String via Pythia";
124  break;
125  case ProcessType::Decay:
126  os << "Decay";
127  break;
128  case ProcessType::Wall:
129  os << "Wall";
130  break;
132  os << "Thermalization";
133  break;
135  os << "Hypersurface crossing";
136  break;
138  os << "ThreeMesonsToOne";
139  break;
141  os << "ThreeToTwo";
142  break;
144  os << "FourToTwo";
145  break;
147  os << "FiveToTwo";
148  break;
149  default:
150  os.setstate(std::ios_base::failbit);
151  }
152  return os;
153 }
154 
155 } // 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:58
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: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
@ TwoToOne
resonance formation (2->1)
@ StringSoftDoubleDiffractive
double diffractive. Two strings are formed, one from A and one from B.
@ 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.