Version: SMASH-1.8
decayaction.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2014-2019
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 static constexpr int LDecayModes = LogArea::DecayModes::id;
21 
23  : Action({p}, time), total_width_(0.) {}
24 
25 void DecayAction::add_decays(DecayBranchList pv) {
26  add_processes<DecayBranch>(std::move(pv), decay_channels_, total_width_);
27 }
28 
29 void DecayAction::add_decay(DecayBranchPtr p) {
30  add_process<DecayBranch>(p, decay_channels_, total_width_);
31 }
32 
34  logg[LDecayModes].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  logg[LDecayModes].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  logg[LDecayModes].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
smash
Definition: action.h:24
smash::ProcessBranch::particle_list
ParticleList particle_list() const
Definition: processbranch.cc:26
smash::Action::incoming_particles_
ParticleList incoming_particles_
List with data of incoming particles.
Definition: action.h:304
smash::DecayAction::total_width_
double total_width_
total decay width
Definition: decayaction.h:100
smash::DecayAction::L_
int L_
Angular momentum of the decay.
Definition: decayaction.h:106
smash::Action::time_of_execution_
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:318
smash::DecayAction::add_decays
void add_decays(DecayBranchList pv)
Add several new decays at once.
Definition: decayaction.cc:25
smash::ParticleData
Definition: particledata.h:52
smash::Action::sample_2body_phasespace
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:206
smash::DecayAction::format_debug_output
void format_debug_output(std::ostream &out) const override
Definition: decayaction.cc:113
smash::ParticleType::mass
double mass() const
Definition: particletype.h:144
smash::DecayAction::DecayAction
DecayAction(const ParticleData &p, double time)
Construct a DecayAction from a particle p.
Definition: decayaction.cc:22
smash::DecayBranch::get_type
ProcessType get_type() const override
Definition: processbranch.h:344
smash::logg
std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > logg
An array that stores all pre-configured Logger objects.
Definition: logging.cc:39
smash::DecayAction::partial_width_
double partial_width_
partial decay width to the chosen outgoing channel
Definition: decayaction.h:103
angles.h
smash::DecayAction::decay_channels_
DecayBranchList decay_channels_
List of possible decays.
Definition: decayaction.h:97
smash::DecayBranch
Definition: processbranch.h:322
decayaction.h
smash::DecayBranch::angular_momentum
int angular_momentum() const
Definition: processbranch.h:334
smash::format
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:304
smash::LDecayModes
static constexpr int LDecayModes
Definition: decayaction.cc:20
smash::ParticleType::sample_resonance_masses
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.
Definition: particletype.cc:679
smash::ParticleType::is_stable
bool is_stable() const
Definition: particletype.h:236
smash::ParticleType::sample_resonance_mass
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 ...
Definition: particletype.cc:622
smash::Action::process_type_
ProcessType process_type_
type of process
Definition: action.h:321
smash::DecayAction::generate_final_state
void generate_final_state() override
Generate the final state of the decay process.
Definition: decayaction.cc:33
smash::ParticleType
Definition: particletype.h:97
smash::ParticleType::name
const std::string & name() const
Definition: particletype.h:141
smash::Action::total_momentum_of_outgoing_particles
FourVector total_momentum_of_outgoing_particles() const
Calculate the total kinetic momentum of the outgoing particles.
Definition: action.cc:123
smash::Action::outgoing_particles_
ParticleList outgoing_particles_
Initially this stores only the PDG codes of final-state particles.
Definition: action.h:312
smash::Action::sample_3body_phasespace
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:217
kinematics.h
smash::Action::sqrt_s
double sqrt_s() const
Determine the total energy in the center-of-mass frame [GeV].
Definition: action.h:266
pdgcode.h
logging.h
smash::Action
Definition: action.h:35
smash::pdg::p
constexpr int p
Proton.
Definition: pdgcode_constants.h:28
smash::ParticleType::min_mass_kinematic
double min_mass_kinematic() const
The minimum mass of the resonance that is kinematically allowed.
Definition: particletype.cc:360
potential_globals.h
smash::DecayAction::add_decay
void add_decay(DecayBranchPtr p)
Add one new decay.
Definition: decayaction.cc:29
smash::DecayAction::InvalidDecay
Definition: decayaction.h:85
smash::Action::InvalidResonanceFormation
Definition: action.h:298
smash::DecayAction::sample_masses
std::pair< double, double > sample_masses(double kinetic_energy_cm) const override
Sample the masses of the final particles.
Definition: decayaction.cc:82
smash::ProcessBranch::weight
double weight() const
Definition: processbranch.h:186
decaymodes.h