Version: SMASH-1.8
decayactionsfinder.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 
11 
12 #include "smash/constants.h"
13 #include "smash/cxx14compat.h"
14 #include "smash/decayaction.h"
16 #include "smash/fourvector.h"
17 #include "smash/particles.h"
18 #include "smash/random.h"
19 
20 namespace smash {
21 
23  const ParticleList &search_list, double dt, const double,
24  const std::vector<FourVector> &) const {
25  ActionList actions;
26  /* for short time steps this seems reasonable to expect
27  * less than 10 decays in most time steps */
28  actions.reserve(10);
29 
30  for (const auto &p : search_list) {
31  if (p.type().is_stable()) {
32  continue; // particle doesn't decay
33  }
34 
35  DecayBranchList processes = p.type().get_partial_widths(
36  p.momentum(), p.position().threevec(), WhichDecaymodes::Hadronic);
37  // total decay width (mass-dependent)
38  const double width = total_weight<DecayBranch>(processes);
39 
40  // check if there are any (hadronic) decays
41  if (!(width > 0.0)) {
42  continue;
43  }
44 
45  constexpr double one_over_hbarc = 1. / hbarc;
46 
47  /* The decay_time is sampled from an exponential distribution.
48  * Even though it may seem suspicious that it is sampled every
49  * timestep, it can be proven that this still overall obeys
50  * the exponential decay law.
51  */
52  double decay_time =
53  res_lifetime_factor_ * random::exponential<double>(
54  /* The clock goes slower in the rest
55  * frame of the resonance */
56  one_over_hbarc * p.inverse_gamma() * width);
57  /* If the particle is not yet formed, shift the decay time by the time it
58  * takes the particle to form */
59  if (p.xsec_scaling_factor() < 1.0) {
60  decay_time += p.formation_time() - p.position().x0();
61  }
62  if (decay_time < dt) {
63  /* => decay_time ∈ [0, dt[
64  * => the particle decays in this timestep. */
65  auto act = make_unique<DecayAction>(p, decay_time);
66  act->add_decays(std::move(processes));
67  actions.emplace_back(std::move(act));
68  }
69  }
70  return actions;
71 }
72 
73 ActionList DecayActionsFinder::find_final_actions(const Particles &search_list,
74  bool /*only_res*/) const {
75  ActionList actions;
76 
77  for (const auto &p : search_list) {
78  if (p.type().is_stable()) {
79  continue; // particle doesn't decay
80  }
81  auto act = make_unique<DecayAction>(p, 0.);
82  act->add_decays(p.type().get_partial_widths(
83  p.momentum(), p.position().threevec(), WhichDecaymodes::All));
84  actions.emplace_back(std::move(act));
85  }
86  return actions;
87 }
88 
89 } // namespace smash
smash
Definition: action.h:24
smash::DecayActionsFinder::res_lifetime_factor_
const double res_lifetime_factor_
Multiplicative factor to be applied to resonance lifetimes.
Definition: decayactionsfinder.h:74
decayactionsfinder.h
cxx14compat.h
smash::WhichDecaymodes::All
All decay mode widths.
experimentparameters.h
fourvector.h
smash::hbarc
constexpr double hbarc
GeV <-> fm conversion factor.
Definition: constants.h:25
smash::DecayActionsFinder::find_actions_in_cell
ActionList find_actions_in_cell(const ParticleList &search_list, double dt, const double, const std::vector< FourVector > &) const override
Check the whole particle list for decays.
Definition: decayactionsfinder.cc:22
random.h
decayaction.h
smash::DecayActionsFinder::find_final_actions
ActionList find_final_actions(const Particles &search_list, bool only_res=false) const override
Force all resonances to decay at the end of the simulation.
Definition: decayactionsfinder.cc:73
smash::WhichDecaymodes::Hadronic
Ignore dilepton decay modes widths.
particles.h
smash::Particles
Definition: particles.h:33
constants.h
smash::pdg::p
constexpr int p
Proton.
Definition: pdgcode_constants.h:28