Version: SMASH-1.6
decayaction.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/decayaction.h"
11 
12 #include "smash/angles.h"
13 #include "smash/decaymodes.h"
14 #include "smash/kinematics.h"
15 #include "smash/logging.h"
16 #include "smash/pdgcode.h"
18 
19 namespace smash {
20 
22  : Action({p}, time), total_width_(0.) {}
23 
24 void DecayAction::add_decays(DecayBranchList pv) {
25  add_processes<DecayBranch>(std::move(pv), decay_channels_, total_width_);
26 }
27 
28 void DecayAction::add_decay(DecayBranchPtr p) {
29  add_process<DecayBranch>(p, decay_channels_, total_width_);
30 }
31 
33  const auto &log = logger<LogArea::DecayModes>();
34  log.debug("Process: Resonance decay. ");
35  /* Execute a decay process for the selected particle.
36  *
37  * randomly select one of the decay modes of the particle
38  * according to their relative weights. Then decay the particle
39  * by calling function sample_2body_phasespace or sample_3body_phasespace.
40  */
41  const DecayBranch *proc =
42  choose_channel<DecayBranch>(decay_channels_, total_width_);
44  // set positions of the outgoing particles
45  for (auto &p : outgoing_particles_) {
46  p.set_4position(incoming_particles_[0].position());
47  }
48  process_type_ = proc->get_type();
49  L_ = proc->angular_momentum();
50  partial_width_ = proc->weight();
51 
52  switch (outgoing_particles_.size()) {
53  case 2:
55  break;
56  case 3:
58  break;
59  default:
60  throw InvalidDecay(
61  "DecayAction::perform: Only 1->2 or 1->3 processes are supported. "
62  "Decay from 1->" +
63  std::to_string(outgoing_particles_.size()) +
64  " was requested. (PDGcode=" +
65  incoming_particles_[0].pdgcode().string() + ", mass=" +
66  std::to_string(incoming_particles_[0].effective_mass()) + ")");
67  }
68 
69  // Set formation time.
70  for (auto &p : outgoing_particles_) {
71  log.debug("particle momenta in lrf ", p);
72  // assuming decaying particles are always fully formed
73  p.set_formation_time(time_of_execution_);
74  // Boost to the computational frame
75  p.boost_momentum(-total_momentum_of_outgoing_particles().velocity());
76  log.debug("particle momenta in comp ", p);
77  }
78 }
79 
80 /* This is overridden from the Action class in order to
81  * take care of the angular momentum L_. */
82 std::pair<double, double> DecayAction::sample_masses(
83  double kinetic_energy_cm) const {
84  const ParticleType &t_a = outgoing_particles_[0].type();
85  const ParticleType &t_b = outgoing_particles_[1].type();
86 
87  // start with pole masses
88  std::pair<double, double> masses = {t_a.mass(), t_b.mass()};
89 
90  if (kinetic_energy_cm < t_a.min_mass_kinematic() + t_b.min_mass_kinematic()) {
91  const std::string reaction =
92  incoming_particles_[0].type().name() + "→" + t_a.name() + t_b.name();
94  reaction + ": not enough energy, " + std::to_string(kinetic_energy_cm) +
95  " < " + std::to_string(t_a.min_mass_kinematic()) + " + " +
96  std::to_string(t_b.min_mass_kinematic()));
97  }
98 
99  // If one of the particles is a resonance, sample its mass.
100  if (!t_a.is_stable() && t_b.is_stable()) {
101  masses.first = t_a.sample_resonance_mass(t_b.mass(), kinetic_energy_cm, L_);
102  } else if (!t_b.is_stable() && t_a.is_stable()) {
103  masses.second =
104  t_b.sample_resonance_mass(t_a.mass(), kinetic_energy_cm, L_);
105  } else if (!t_a.is_stable() && !t_b.is_stable()) {
106  // two resonances in final state
107  masses = t_a.sample_resonance_masses(t_b, kinetic_energy_cm, L_);
108  }
109 
110  return masses;
111 }
112 
113 void DecayAction::format_debug_output(std::ostream &out) const {
114  out << "Decay of " << incoming_particles_ << " to " << outgoing_particles_
115  << ", sqrt(s)=" << format(sqrt_s(), "GeV", 11, 9);
116 }
117 
118 } // namespace smash
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:310
Thrown when DecayAction is called to perform with 0 or more than 2 entries in outgoing_particles.
Definition: decayaction.h:85
double sqrt_s() const
Determine the total energy in the center-of-mass frame [GeV].
Definition: action.h:265
bool is_stable() const
Definition: particletype.h:236
ProcessType process_type_
type of process
Definition: action.h:320
void add_decay(DecayBranchPtr p)
Add one new decay.
Definition: decayaction.cc:28
void add_decays(DecayBranchList pv)
Add several new decays at once.
Definition: decayaction.cc:24
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 &#39;this&#39;) and one ...
int angular_momentum() const
double weight() const
DecayAction(const ParticleData &p, double time)
Construct a DecayAction from a particle p.
Definition: decayaction.cc:21
DecayBranchList decay_channels_
List of possible decays.
Definition: decayaction.h:97
double total_width_
total decay width
Definition: decayaction.h:100
FourVector total_momentum_of_outgoing_particles() const
Calculate the total kinetic momentum of the outgoing particles.
Definition: action.cc:123
double min_mass_kinematic() const
The minimum mass of the resonance that is kinematically allowed.
int L_
Angular momentum of the decay.
Definition: decayaction.h:106
double mass() const
Definition: particletype.h:144
Thrown for example when ScatterAction is called to perform with a wrong number of final-state particl...
Definition: action.h:297
const std::string & name() const
Definition: particletype.h:141
ParticleList outgoing_particles_
Initially this stores only the PDG codes of final-state particles.
Definition: action.h:311
virtual void sample_3body_phasespace()
Sample the full 3-body phase-space (masses, momenta, angles) in the center-of-mass frame for the fina...
Definition: action.cc:219
Particle type contains the static properties of a particle species.
Definition: particletype.h:97
ParticleList incoming_particles_
List with data of incoming particles.
Definition: action.h:303
Action is the base class for a generic process that takes a number of incoming particles and transfor...
Definition: action.h:34
DecayBranch is a derivative of ProcessBranch, which is used to represent decay channels.
void generate_final_state() override
Generate the final state of the decay process.
Definition: decayaction.cc:32
constexpr int p
Proton.
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:208
ProcessType get_type() const override
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
std::pair< double, double > sample_masses(double kinetic_energy_cm) const override
Sample the masses of the final particles.
Definition: decayaction.cc:82
double partial_width_
partial decay width to the chosen outgoing channel
Definition: decayaction.h:103
ParticleData contains the dynamic information of a certain particle.
Definition: particledata.h:52
Definition: action.h:24
const double time_of_execution_
Time at which the action is supposed to be performed (absolute time in the lab frame in fm/c)...
Definition: action.h:317
void format_debug_output(std::ostream &out) const override
Writes information about this decay action to the out stream.
Definition: decayaction.cc:113