Version: SMASH-1.5
processbranch.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2014-2018
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::Elastic || ptype == ProcessType::Decay) {
70  ParticleTypePtrList ptype_list = cbranch.particle_types();
71  /* Sorting ensures unique name for every channel
72  * It avoids duplicates, such as Δ⁰Δ⁺⁺ and Δ⁺⁺Δ⁰,
73  * which actually occur in SMASH, because of the way channels are added:
74  * for example one channel can be added twice with halved cross-section. */
75  std::sort(ptype_list.begin(), ptype_list.end());
76  for (const auto& type : ptype_list) {
77  os << type->name();
78  }
79  } else {
80  os << ptype;
81  }
82  return os;
83 }
84 
85 std::ostream& operator<<(std::ostream& os, ProcessType process_type) {
86  switch (process_type) {
87  case ProcessType::None:
88  os << "None";
89  break;
91  os << "Elastic";
92  break;
94  os << "TwoToOne";
95  break;
97  os << "TwoToTwo";
98  break;
104  os << "Soft String Excitation";
105  break;
107  os << "Hard String via Pythia";
108  break;
109  case ProcessType::Decay:
110  os << "Decay";
111  break;
112  case ProcessType::Wall:
113  os << "Wall";
114  break;
115  default:
116  os.setstate(std::ios_base::failbit);
117  }
118  return os;
119 }
120 
121 } // namespace smash
virtual unsigned int particle_number() const =0
resonance decays
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
a special case of baryon-antibaryon annihilation.
virtual const ParticleTypePtrList & particle_types() const =0
2->2 inelastic scattering
ProcessType get_type() const override
const ParticleTypePtrList & particle_types() const override
ParticleList particle_list() const
elastic scattering: particles remain the same, only momenta change
CollisionBranch is a derivative of ProcessBranch, which is used to represent particular final-state c...
hard string process involving 2->2 QCD process by PYTHIA.
box wall crossing
constexpr int p
Proton.
resonance formation (2->1)
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.
ParticleData contains the dynamic information of a certain particle.
Definition: particledata.h:52
(41-45) soft string excitations.
double threshold_
Threshold of the branch.
Definition: action.h:24
double threshold() const