Version: SMASH-1.5
particledata.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/particledata.h"
11 
12 #include <iomanip>
13 #include <iostream>
14 #include <vector>
15 
16 #include "smash/constants.h"
17 #include "smash/iomanipulators.h"
18 
19 namespace smash {
20 
22  const double m_pole = pole_mass();
23  if (m_pole < really_small) {
24  // prevent numerical problems with massless or very light particles
25  return m_pole;
26  } else {
27  return momentum().abs();
28  }
29 }
30 
31 void ParticleData::set_history(int ncoll, uint32_t pid, ProcessType pt,
32  double time_last_coll,
33  const ParticleList &plist) {
34  if (pt != ProcessType::Wall) {
36  history_.time_last_collision = time_last_coll;
37  }
38  history_.id_process = pid;
40  switch (pt) {
41  case ProcessType::Decay:
42  case ProcessType::Wall:
43  // only store one parent
44  history_.p1 = plist[0].pdgcode();
45  history_.p2 = 0x0;
46  break;
56  // store two parent particles
57  history_.p1 = plist[0].pdgcode();
58  history_.p2 = plist[1].pdgcode();
59  break;
61  case ProcessType::None:
62  // nullify parents
63  history_.p1 = 0x0;
64  history_.p2 = 0x0;
65  break;
66  }
67 }
68 
69 double ParticleData::xsec_scaling_factor(double delta_time) const {
70  double time_of_interest = position_.x0() + delta_time;
71  // cross section scaling factor at the time_of_interest
72  double scaling_factor;
73 
74  if (formation_power_ <= 0.) {
75  // use a step function to form particles
76  if (time_of_interest < formation_time_) {
77  // particles will not be fully formed at time of interest
78  scaling_factor = initial_xsec_scaling_factor_;
79  } else {
80  // particles are fully formed at time of interest
81  scaling_factor = 1.;
82  }
83  } else {
84  // use smooth function to scale cross section (unless particles are already
85  // fully formed at desired time or will start to form later)
86  if (formation_time_ <= time_of_interest) {
87  // particles are fully formed when colliding
88  scaling_factor = 1.;
89  } else if (begin_formation_time_ >= time_of_interest) {
90  // particles will start formimg later
91  scaling_factor = initial_xsec_scaling_factor_;
92  } else {
93  // particles are in the process of formation at the given time
94  scaling_factor =
97  std::pow((time_of_interest - begin_formation_time_) /
100  }
101  }
102  return scaling_factor;
103 }
104 
105 std::ostream &operator<<(std::ostream &out, const ParticleData &p) {
106  out.fill(' ');
107  return out << p.type().name() << " (" << std::setw(5) << p.type().pdgcode()
108  << ")" << std::right << "{id:" << field<6> << p.id()
109  << ", process:" << field<4> << p.id_process()
110  << ", pos [fm]:" << p.position() << ", mom [GeV]:" << p.momentum()
111  << ", formation time [fm]:" << p.formation_time()
112  << ", cross section scaling factor:" << p.xsec_scaling_factor()
113  << "}";
114 }
115 
116 std::ostream &operator<<(std::ostream &out, const ParticleList &particle_list) {
117  auto column = out.tellp();
118  out << '[';
119  for (const auto &p : particle_list) {
120  if (out.tellp() - column >= 201) {
121  out << '\n';
122  column = out.tellp();
123  out << ' ';
124  }
125  out << std::setw(5) << std::setprecision(3) << p.momentum().abs3()
126  << p.type().name();
127  }
128  return out << ']';
129 }
130 
131 std::ostream &operator<<(std::ostream &out,
132  const PrintParticleListDetailed &particle_list) {
133  bool first = true;
134  out << '[';
135  for (const auto &p : particle_list.list) {
136  if (first) {
137  first = false;
138  } else {
139  out << "\n ";
140  }
141  out << p;
142  }
143  return out << ']';
144 }
145 
146 double ParticleData::formation_power_ = 0.0;
147 
148 } // namespace smash
double begin_formation_time_
time when the cross section scaling factor starts to increase to 1
Definition: particledata.h:436
resonance decays
double diffractive. Two strings are formed, one from A and one from B.
constexpr double really_small
Numerical error tolerance.
Definition: constants.h:34
const ParticleList & list
Particle list.
Definition: particledata.h:466
double effective_mass() const
Get the particle&#39;s effective mass.
Definition: particledata.cc:21
ProcessType
Process Types are used to identify the type of the process.
Definition: processbranch.h:25
Collection of useful constants that are known at compile time.
double pole_mass() const
Get the particle&#39;s pole mass ("on-shell").
Definition: particledata.h:96
a special case of baryon-antibaryon annihilation.
PdgCode p2
PdgCode of the second parent particles.
Definition: particledata.h:41
2->2 inelastic scattering
const FourVector & momentum() const
Get the particle&#39;s 4-momentum.
Definition: particledata.h:139
forced thermalization, many particles are replaced by a thermalized ensemble
double x0() const
Definition: fourvector.h:290
HistoryData history_
history information
Definition: particledata.h:443
uint32_t id_process
id of the last action
Definition: particledata.h:28
PdgCode p1
PdgCode of the first parent particles.
Definition: particledata.h:39
FourVector position_
position in space: x0, x1, x2, x3 as t, x, y, z
Definition: particledata.h:430
elastic scattering: particles remain the same, only momenta change
double formation_time_
Formation time at which the particle is fully formed given as an absolute value in the computational ...
Definition: particledata.h:434
double time_last_collision
Time of the last action (excluding walls), time of kinetic freeze_out for HBT analysis this time shou...
Definition: particledata.h:37
double initial_xsec_scaling_factor_
Initial cross section scaling factor.
Definition: particledata.h:441
hard string process involving 2->2 QCD process by PYTHIA.
box wall crossing
static double formation_power_
Power with which the cross section scaling factor grows in time.
Definition: particledata.h:365
ProcessType process_type
type of the last action
Definition: particledata.h:30
constexpr int p
Proton.
resonance formation (2->1)
int collisions_per_particle
Collision counter per particle, zero only for initially present particles.
Definition: particledata.h:26
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.
void set_history(int ncoll, uint32_t pid, ProcessType pt, double time_of_or, const ParticleList &plist)
Store history information.
Definition: particledata.cc:31
double abs() const
calculate the lorentz invariant absolute value
Definition: fourvector.h:441
ParticleData contains the dynamic information of a certain particle.
Definition: particledata.h:52
(41-45) soft string excitations.
Definition: action.h:24
double xsec_scaling_factor(double delta_time=0.) const
Return the cross section scaling factor at a given time.
Definition: particledata.cc:69