Version: SMASH-2.0
processbranch.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2014-2020
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 ||
71  ParticleTypePtrList ptype_list = cbranch.particle_types();
72  /* Sorting ensures unique name for every channel
73  * It avoids duplicates, such as Δ⁰Δ⁺⁺ and Δ⁺⁺Δ⁰,
74  * which actually occur in SMASH, because of the way channels are added:
75  * for example one channel can be added twice with halved cross-section. */
76  std::sort(ptype_list.begin(), ptype_list.end());
77  for (const auto& type : ptype_list) {
78  os << type->name();
79  }
80  } else {
81  os << ptype;
82  }
83  return os;
84 }
85 
86 std::ostream& operator<<(std::ostream& os, ProcessType process_type) {
87  switch (process_type) {
88  case ProcessType::None:
89  os << "None";
90  break;
92  os << "Elastic";
93  break;
95  os << "TwoToOne";
96  break;
98  os << "TwoToTwo";
99  break;
105  os << "Soft String Excitation";
106  break;
108  os << "Hard String via Pythia";
109  break;
110  case ProcessType::Decay:
111  os << "Decay";
112  break;
113  case ProcessType::Wall:
114  os << "Wall";
115  break;
117  os << "Hypersurface crossing";
118  break;
120  os << "3MesonsToOne";
121  break;
122  default:
123  os.setstate(std::ios_base::failbit);
124  }
125  return os;
126 }
127 
128 } // namespace smash
smash
Definition: action.h:24
smash::ProcessBranch::particle_list
ParticleList particle_list() const
Definition: processbranch.cc:26
smash::ProcessType::StringHard
hard string process involving 2->2 QCD process by PYTHIA.
processbranch.h
particledata.h
smash::ParticleData
Definition: particledata.h:52
smash::ProcessType::Decay
resonance decay
smash::ProcessType::StringSoftDoubleDiffractive
double diffractive. Two strings are formed, one from A and one from B.
smash::ProcessType::StringSoftNonDiffractive
non-diffractive. Two strings are formed both have ends in A and B.
smash::is_string_soft_process
bool is_string_soft_process(ProcessType p)
Check if a given process type is a soft string excitation.
Definition: processbranch.cc:18
smash::operator<<
std::ostream & operator<<(std::ostream &out, const ActionPtr &action)
Definition: action.h:518
smash::ProcessType::TwoToTwo
2->2 inelastic scattering
smash::ProcessType::StringSoftSingleDiffractiveXB
single diffractive AB->XB.
smash::ProcessType::MultiParticleThreeMesonsToOne
multi particle scattering
smash::ProcessBranch::threshold
double threshold() const
Definition: processbranch.cc:35
smash::ProcessType::Wall
box wall crossing
smash::ProcessBranch::threshold_
double threshold_
Threshold of the branch.
Definition: processbranch.h:190
smash::ProcessBranch::particle_number
virtual unsigned int particle_number() const =0
smash::CollisionBranch::get_type
ProcessType get_type() const override
Definition: processbranch.h:298
smash::ProcessType::StringSoftSingleDiffractiveAX
(41-45) soft string excitations.
smash::ProcessBranch::particle_types
virtual const ParticleTypePtrList & particle_types() const =0
smash::ProcessType::StringSoftAnnihilation
a special case of baryon-antibaryon annihilation.
smash::CollisionBranch::particle_types
const ParticleTypePtrList & particle_types() const override
Definition: processbranch.h:288
smash::ProcessType::Elastic
elastic scattering: particles remain the same, only momenta change
smash::ProcessType::HyperSurfaceCrossing
Hypersurface crossing Particles are removed from the evolution and printed to a separate output to se...
smash::DensityType::None
smash::pdg::p
constexpr int p
Proton.
Definition: pdgcode_constants.h:28
smash::ProcessType::TwoToOne
resonance formation (2->1)
smash::CollisionBranch
Definition: processbranch.h:221
smash::ProcessType
ProcessType
Process Types are used to identify the type of the process.
Definition: processbranch.h:25