Version: SMASH-3.4
decayactionsfinder.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2014-2020,2022-2026
4  * SMASH Team
5  *
6  * GNU General Public License (GPLv3 or later)
7  *
8  */
9 
11 
12 #include "smash/constants.h"
13 #include "smash/decayaction.h"
14 #include "smash/decaymodes.h"
15 #include "smash/fourvector.h"
16 #include "smash/random.h"
17 
18 namespace smash {
19 
21  const ParticleList &search_list, double dt, const double,
22  const std::vector<FourVector> &) const {
23  ActionList actions;
24  /* for short time steps this seems reasonable to expect
25  * less than 10 decays in most time steps */
26  actions.reserve(10);
27 
28  for (const auto &p : search_list) {
29  if (p.type().is_stable()) {
30  continue; // particle doesn't decay
31  }
33  p.get_history().collisions_per_particle == 0) {
34  continue;
35  }
36  /* Prevent decays of charmed particles if 'Charm_Rescattering_Method' is set
37  * to 'none' and D* meson decays if set to 'T-matrix'. Adding it in this
38  * function ensures that find_final_actions will still lead to forced decays
39  * for all charmed hardons if 'Force_Decays_At_End' is set to true. */
41  p.type().pdgcode().frac_charm() != 0) ||
43  p.type().pdgcode().is_Dstar2007())) {
44  continue;
45  }
46 
47  DecayBranchList processes = p.type().get_partial_widths(
48  p.momentum(), p.position().threevec(), WhichDecaymodes::Hadronic);
49  // total decay width (mass-dependent)
50  const double width = total_weight<DecayBranch>(processes);
51 
52  // check if there are any (hadronic) decays
53  if (!(width > 0.0)) {
54  continue;
55  }
56 
57  constexpr double one_over_hbarc = 1. / hbarc;
58 
59  /* The decay_time is sampled from an exponential distribution.
60  * Even though it may seem suspicious that it is sampled every
61  * timestep, it can be proven that this still overall obeys
62  * the exponential decay law. */
63  double decay_time =
64  res_lifetime_factor_ * random::exponential<double>(
65  /* The clock goes slower in the rest
66  * frame of the resonance */
67  one_over_hbarc * p.inverse_gamma() * width);
68  /* If the particle is not yet formed, shift the decay time by the time it
69  * takes the particle to form */
70  if (p.xsec_scaling_factor() < 1.0) {
71  decay_time += p.formation_time() - p.position().x0();
72  }
73  if (decay_time < dt) {
74  /* => decay_time ∈ [0, dt[
75  * => the particle decays in this timestep. */
76  auto act =
77  std::make_unique<DecayAction>(p, decay_time, spin_interaction_type_);
78  act->add_decays(std::move(processes));
79  actions.emplace_back(std::move(act));
80  }
81  }
82  return actions;
83 }
84 
86  const Particles &search_list) const {
87  ActionList actions;
89  for (const auto &p : search_list) {
90  if (!ignore_minimum_width_at_end_ && p.type().is_stable()) {
91  continue; // particle is stable with respect to strong interaction
92  }
94  p.get_history().collisions_per_particle == 0) {
95  continue;
96  }
97  if (p.type().decay_modes().is_empty()) {
98  continue; // particle cannot decay (not even e.m. or weakly)
99  }
100 
101  auto act = std::make_unique<DecayAction>(p, 0., spin_interaction_type_);
102  act->add_decays(p.type().get_partial_widths(
103  p.momentum(), p.position().threevec(), WhichDecaymodes::All));
104  actions.emplace_back(std::move(act));
105  }
106  }
107  return actions;
108 }
109 
110 } // namespace smash
const bool ignore_minimum_width_at_end_
Do all non-strong decays (including weak and electro-magnetic ones)
const bool decay_initial_particles_
Whether to initial state particles can decay.
const CharmRescattering charm_rescattering_method_
Charm rescattering method.
const double res_lifetime_factor_
Multiplicative factor to be applied to resonance lifetimes.
const bool force_decays_at_end_
Whether to find final decay actions.
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.
const SpinInteractionType spin_interaction_type_
Spin interaction type.
ActionList find_final_actions(const Particles &search_list) const override
Force all resonances to decay at the end of the simulation.
The Particles class abstracts the storage and manipulation of particles.
Definition: particles.h:33
Collection of useful constants that are known at compile time.
@ T_Matrix
Charm interactions via T-matrix approach.
@ None
Disable charm interactions.
constexpr int p
Proton.
Definition: action.h:24
constexpr double hbarc
GeV <-> fm conversion factor.
Definition: constants.h:29
@ Hadronic
Ignore dilepton decay modes widths.
@ All
All decay mode widths.