Version: SMASH-3.1
decayaction.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2013-2021
4  * SMASH Team
5  *
6  * GNU General Public License (GPLv3 or later)
7  *
8  */
9 
10 #include "smash/decayaction.h"
11 
12 #include "smash/decaymodes.h"
13 #include "smash/logging.h"
14 #include "smash/pdgcode.h"
15 
16 namespace smash {
17 static constexpr int LDecayModes = LogArea::DecayModes::id;
18 
20  : Action({p}, time), total_width_(0.) {}
21 
22 void DecayAction::add_decays(DecayBranchList pv) {
23  add_processes<DecayBranch>(std::move(pv), decay_channels_, total_width_);
24 }
25 
26 void DecayAction::add_decay(DecayBranchPtr p) {
27  add_process<DecayBranch>(p, decay_channels_, total_width_);
28 }
29 
31  logg[LDecayModes].debug("Process: Resonance decay. ");
32  /* Execute a decay process for the selected particle.
33  *
34  * randomly select one of the decay modes of the particle
35  * according to their relative weights. Then decay the particle
36  * by calling function sample_2body_phasespace or sample_manybody_phasespace.
37  */
38  const DecayBranch *proc =
39  choose_channel<DecayBranch>(decay_channels_, total_width_);
41  // set positions of the outgoing particles
42  for (auto &p : outgoing_particles_) {
43  p.set_4position(incoming_particles_[0].position());
44  }
45  process_type_ = proc->get_type();
46  L_ = proc->angular_momentum();
47  partial_width_ = proc->weight();
48 
49  switch (outgoing_particles_.size()) {
50  case 2:
52  break;
53  case 3:
55  break;
56  default:
57  throw InvalidDecay(
58  "DecayAction::perform: Only 1->2 or 1->3 processes are supported. "
59  "Decay from 1->" +
60  std::to_string(outgoing_particles_.size()) +
61  " was requested. (PDGcode=" +
62  incoming_particles_[0].pdgcode().string() + ", mass=" +
63  std::to_string(incoming_particles_[0].effective_mass()) + ")");
64  }
65 
66  // Set formation time.
67  for (auto &p : outgoing_particles_) {
68  logg[LDecayModes].debug("particle momenta in lrf ", p);
69  // assuming decaying particles are always fully formed
70  p.set_formation_time(time_of_execution_);
71  // Boost to the computational frame
72  p.boost_momentum(-total_momentum_of_outgoing_particles().velocity());
73  logg[LDecayModes].debug("particle momenta in comp ", p);
74  }
75 }
76 
77 /* This is overridden from the Action class in order to
78  * take care of the angular momentum L_. */
79 std::pair<double, double> DecayAction::sample_masses(
80  double kinetic_energy_cm) const {
81  const ParticleType &t_a = outgoing_particles_[0].type();
82  const ParticleType &t_b = outgoing_particles_[1].type();
83 
84  // start with pole masses
85  std::pair<double, double> masses = {t_a.mass(), t_b.mass()};
86 
87  if (kinetic_energy_cm < t_a.min_mass_kinematic() + t_b.min_mass_kinematic()) {
88  const std::string reaction =
89  incoming_particles_[0].type().name() + "→" + t_a.name() + t_b.name();
91  reaction + ": not enough energy, " + std::to_string(kinetic_energy_cm) +
92  " < " + std::to_string(t_a.min_mass_kinematic()) + " + " +
93  std::to_string(t_b.min_mass_kinematic()));
94  }
95 
96  // If one of the particles is a resonance, sample its mass.
97  if (!t_a.is_stable() && t_b.is_stable()) {
98  masses.first = t_a.sample_resonance_mass(t_b.mass(), kinetic_energy_cm, L_);
99  } else if (!t_b.is_stable() && t_a.is_stable()) {
100  masses.second =
101  t_b.sample_resonance_mass(t_a.mass(), kinetic_energy_cm, L_);
102  } else if (!t_a.is_stable() && !t_b.is_stable()) {
103  // two resonances in final state
104  masses = t_a.sample_resonance_masses(t_b, kinetic_energy_cm, L_);
105  }
106 
107  return masses;
108 }
109 
110 void DecayAction::format_debug_output(std::ostream &out) const {
111  out << "Decay of " << incoming_particles_ << " to " << outgoing_particles_
112  << ", sqrt(s)=" << format(sqrt_s(), "GeV", 11, 9);
113 }
114 
115 } // namespace smash
Thrown for example when ScatterAction is called to perform with a wrong number of final-state particl...
Definition: action.h:330
Action is the base class for a generic process that takes a number of incoming particles and transfor...
Definition: action.h:35
void sample_2body_phasespace()
Sample the full 2-body phase-space (masses, momenta, angles) in the center-of-mass frame for the fina...
Definition: action.cc:302
FourVector total_momentum_of_outgoing_particles() const
Calculate the total kinetic momentum of the outgoing particles.
Definition: action.cc:157
ParticleList outgoing_particles_
Initially this stores only the PDG codes of final-state particles.
Definition: action.h:363
virtual void sample_manybody_phasespace()
Sample the full n-body phase-space (masses, momenta, angles) in the center-of-mass frame for the fina...
Definition: action.cc:446
const double time_of_execution_
Time at which the action is supposed to be performed (absolute time in the lab frame in fm).
Definition: action.h:369
double sqrt_s() const
Determine the total energy in the center-of-mass frame [GeV].
Definition: action.h:271
ParticleList incoming_particles_
List with data of incoming particles.
Definition: action.h:355
ProcessType process_type_
type of process
Definition: action.h:372
Thrown when DecayAction is called to perform with 0 or more than 2 entries in outgoing_particles.
Definition: decayaction.h:85
double partial_width_
partial decay width to the chosen outgoing channel
Definition: decayaction.h:103
double total_width_
total decay width
Definition: decayaction.h:100
void add_decays(DecayBranchList pv)
Add several new decays at once.
Definition: decayaction.cc:22
void generate_final_state() override
Generate the final state of the decay process.
Definition: decayaction.cc:30
DecayAction(const ParticleData &p, double time)
Construct a DecayAction from a particle p.
Definition: decayaction.cc:19
void add_decay(DecayBranchPtr p)
Add one new decay.
Definition: decayaction.cc:26
DecayBranchList decay_channels_
List of possible decays.
Definition: decayaction.h:97
int L_
Angular momentum of the decay.
Definition: decayaction.h:106
std::pair< double, double > sample_masses(double kinetic_energy_cm) const override
Sample the masses of the final particles.
Definition: decayaction.cc:79
DecayBranch is a derivative of ProcessBranch, which is used to represent decay channels.
ProcessType get_type() const override
int angular_momentum() const
ParticleData contains the dynamic information of a certain particle.
Definition: particledata.h:58
Particle type contains the static properties of a particle species.
Definition: particletype.h:98
double sample_resonance_mass(const double mass_stable, const double cms_energy, int L=0) const
Resonance mass sampling for 2-particle final state with one resonance (type given by 'this') and one ...
double min_mass_kinematic() const
The minimum mass of the resonance that is kinematically allowed.
const std::string & name() const
Definition: particletype.h:142
bool is_stable() const
Definition: particletype.h:246
double mass() const
Definition: particletype.h:145
std::pair< double, double > sample_resonance_masses(const ParticleType &t2, const double cms_energy, int L=0) const
Resonance mass sampling for 2-particle final state with two resonances.
ParticleList particle_list() const
double weight() const
std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > logg
An array that stores all pre-configured Logger objects.
Definition: logging.cc:39
void format_debug_output(std::ostream &out) const override
Writes information about this decay action to the out stream.
Definition: decayaction.cc:110
FormattingHelper< T > format(const T &value, const char *unit, int width=-1, int precision=-1)
Acts as a stream modifier for std::ostream to output an object with an optional suffix string and wit...
Definition: logging.h:217
constexpr int p
Proton.
Definition: action.h:24
static constexpr int LDecayModes
Definition: decayaction.cc:17