Version: SMASH-2.0
particledata.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/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;
50  // Parent particles are not updated by the elastic scatterings,
51  // hypersurface crossings or failed string processes
52  break;
63  // store two parent particles
64  history_.p1 = plist[0].pdgcode();
65  history_.p2 = plist[1].pdgcode();
66  break;
70  case ProcessType::None:
71  // nullify parents
72  history_.p1 = 0x0;
73  history_.p2 = 0x0;
74  break;
75  }
76 }
77 
78 double ParticleData::xsec_scaling_factor(double delta_time) const {
79  double time_of_interest = position_.x0() + delta_time;
80  // cross section scaling factor at the time_of_interest
81  double scaling_factor;
82 
83  if (formation_power_ <= 0.) {
84  // use a step function to form particles
85  if (time_of_interest < formation_time_) {
86  // particles will not be fully formed at time of interest
87  scaling_factor = initial_xsec_scaling_factor_;
88  } else {
89  // particles are fully formed at time of interest
90  scaling_factor = 1.;
91  }
92  } else {
93  // use smooth function to scale cross section (unless particles are already
94  // fully formed at desired time or will start to form later)
95  if (formation_time_ <= time_of_interest) {
96  // particles are fully formed when colliding
97  scaling_factor = 1.;
98  } else if (begin_formation_time_ >= time_of_interest) {
99  // particles will start formimg later
100  scaling_factor = initial_xsec_scaling_factor_;
101  } else {
102  // particles are in the process of formation at the given time
103  scaling_factor =
106  std::pow((time_of_interest - begin_formation_time_) /
109  }
110  }
111  return scaling_factor;
112 }
113 
114 std::ostream &operator<<(std::ostream &out, const ParticleData &p) {
115  out.fill(' ');
116  return out << p.type().name() << " (" << std::setw(5) << p.type().pdgcode()
117  << ")" << std::right << "{id:" << field<6> << p.id()
118  << ", process:" << field<4> << p.id_process()
119  << ", pos [fm]:" << p.position() << ", mom [GeV]:" << p.momentum()
120  << ", formation time [fm]:" << p.formation_time()
121  << ", cross section scaling factor:" << p.xsec_scaling_factor()
122  << "}";
123 }
124 
125 std::ostream &operator<<(std::ostream &out, const ParticleList &particle_list) {
126  auto column = out.tellp();
127  out << '[';
128  for (const auto &p : particle_list) {
129  if (out.tellp() - column >= 201) {
130  out << '\n';
131  column = out.tellp();
132  out << ' ';
133  }
134  out << std::setw(5) << std::setprecision(3) << p.momentum().abs3()
135  << p.type().name();
136  }
137  return out << ']';
138 }
139 
140 std::ostream &operator<<(std::ostream &out,
141  const PrintParticleListDetailed &particle_list) {
142  bool first = true;
143  out << '[';
144  for (const auto &p : particle_list.list) {
145  if (first) {
146  first = false;
147  } else {
148  out << "\n ";
149  }
150  out << p;
151  }
152  return out << ']';
153 }
154 
155 double ParticleData::formation_power_ = 0.0;
156 
157 } // namespace smash
smash
Definition: action.h:24
smash::PrintParticleListDetailed::list
const ParticleList & list
Particle list.
Definition: particledata.h:479
smash::ProcessType::StringHard
hard string process involving 2->2 QCD process by PYTHIA.
particledata.h
smash::ParticleData::xsec_scaling_factor
double xsec_scaling_factor(double delta_time=0.) const
Return the cross section scaling factor at a given time.
Definition: particledata.cc:78
smash::ParticleData::momentum
const FourVector & momentum() const
Get the particle's 4-momentum.
Definition: particledata.h:152
smash::HistoryData::p1
PdgCode p1
PdgCode of the first parent particles.
Definition: particledata.h:39
smash::ParticleData::history_
HistoryData history_
history information
Definition: particledata.h:456
smash::HistoryData::collisions_per_particle
int32_t collisions_per_particle
Collision counter per particle, zero only for initially present particles.
Definition: particledata.h:26
smash::ParticleData::pole_mass
double pole_mass() const
Get the particle's pole mass ("on-shell").
Definition: particledata.h:109
smash::ParticleData
Definition: particledata.h:52
smash::ProcessType::MultiParticleThreeToTwo
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::ParticleData::effective_mass
double effective_mass() const
Get the particle's effective mass.
Definition: particledata.cc:21
smash::ParticleData::formation_time_
double formation_time_
Formation time at which the particle is fully formed given as an absolute value in the computational ...
Definition: particledata.h:447
smash::operator<<
std::ostream & operator<<(std::ostream &out, const ActionPtr &action)
Definition: action.h:518
smash::ProcessType::TwoToTwo
2->2 inelastic scattering
smash::HistoryData::process_type
ProcessType process_type
type of the last action
Definition: particledata.h:30
smash::ProcessType::StringSoftSingleDiffractiveXB
single diffractive AB->XB.
smash::HistoryData::time_last_collision
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
smash::really_small
constexpr double really_small
Numerical error tolerance.
Definition: constants.h:37
smash::ProcessType::Thermalization
forced thermalization, many particles are replaced by a thermalized ensemble
smash::ProcessType::MultiParticleThreeMesonsToOne
multi particle scattering
smash::ProcessType::Wall
box wall crossing
smash::ParticleData::initial_xsec_scaling_factor_
double initial_xsec_scaling_factor_
Initial cross section scaling factor.
Definition: particledata.h:454
smash::ProcessType::FailedString
Soft String NNbar annihilation process can fail by lack of energy.
smash::FourVector::x0
double x0() const
Definition: fourvector.h:303
smash::ParticleData::position_
FourVector position_
position in space: x0, x1, x2, x3 as t, x, y, z
Definition: particledata.h:443
smash::ParticleData::begin_formation_time_
double begin_formation_time_
time when the cross section scaling factor starts to increase to 1
Definition: particledata.h:449
smash::PrintParticleListDetailed
Definition: particledata.h:477
smash::ParticleData::formation_power_
static double formation_power_
Power with which the cross section scaling factor grows in time.
Definition: particledata.h:378
smash::HistoryData::id_process
int32_t id_process
id of the last action
Definition: particledata.h:28
smash::ProcessType::Bremsstrahlung
bremsstrahlung process: a + b -> a + b + photon
smash::HistoryData::p2
PdgCode p2
PdgCode of the second parent particles.
Definition: particledata.h:41
smash::FourVector::abs
double abs() const
calculate the lorentz invariant absolute value
Definition: fourvector.h:454
smash::ProcessType::StringSoftSingleDiffractiveAX
(41-45) soft string excitations.
smash::ParticleData::set_history
void set_history(int ncoll, uint32_t pid, ProcessType pt, double time_of_or, const ParticleList &plist)
Store history information.
Definition: particledata.cc:31
smash::ProcessType::StringSoftAnnihilation
a special case of baryon-antibaryon annihilation.
constants.h
iomanipulators.h
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::ProcessType
ProcessType
Process Types are used to identify the type of the process.
Definition: processbranch.h:25
smash::ProcessType::TwoToThree
2->3 scattering