Version: SMASH-3.1
processbranch.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2014-2023
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;
150  os << "Freeforall";
151  break;
152  default:
153  os.setstate(std::ios_base::failbit);
154  }
155  return os;
156 }
157 
158 } // 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:547
constexpr int p
Proton.
Definition: action.h:24
ProcessType
ProcessTypes are used to identify the type of the process.
Definition: processbranch.h:39
@ TwoToOne
See here for a short description.
@ MultiParticleThreeToTwo
See here for a short description.
@ StringSoftDoubleDiffractive
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.