Version: SMASH-3.4
action.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2014-2026
4  * SMASH Team
5  *
6  * GNU General Public License (GPLv3 or later)
7  *
8  */
9 
10 #ifndef SRC_INCLUDE_SMASH_ACTION_H_
11 #define SRC_INCLUDE_SMASH_ACTION_H_
12 
13 #include <stdexcept>
14 #include <utility>
15 #include <vector>
16 
17 #include "lattice.h"
18 #include "particles.h"
19 #include "pauliblocking.h"
20 #include "potentials.h"
21 #include "processbranch.h"
22 #include "random.h"
23 
24 namespace smash {
25 static constexpr int LAction = LogArea::Action::id;
26 
27 /**
28  * \ingroup action
29  * Action is the base class for a generic process that takes a number of
30  * incoming particles and transforms them into any number of outgoing particles.
31  * Currently such an action can be either a decay, a two-body collision, a
32  * wallcrossing or a thermalization.
33  * (see derived classes).
34  */
35 class Action {
36  public:
37  /**
38  * Construct an action object with incoming particles and relative time.
39  *
40  * \param[in] in_part list of incoming particles
41  * \param[in] time time at which the action is supposed to take place
42  * (relative to the current time of the incoming particles)
43  */
44  Action(const ParticleList &in_part, double time)
45  : incoming_particles_(in_part),
46  time_of_execution_(time + in_part[0].position().x0()) {}
47 
48  /**
49  * Construct an action object with the incoming particles, relative time, and
50  * the already known outgoing particles and type of the process.
51  *
52  * \param[in] in_part list of incoming particles
53  * \param[in] out_part list of outgoing particles
54  * \param[in] time time at which the action is supposed to take place
55  * (relative to the current time of the incoming particles)
56  * \param[in] type type of the interaction
57  */
58  Action(const ParticleData &in_part, const ParticleData &out_part, double time,
59  ProcessType type)
60  : incoming_particles_({in_part}),
61  outgoing_particles_({out_part}),
62  time_of_execution_(time + in_part.position().x0()),
63  process_type_(type) {}
64 
65  /**
66  * Construct an action object with the incoming particles, absolute time, and
67  * the already known outgoing particles and type of the process.
68  *
69  * \param[in] in_part list of incoming particles
70  * \param[in] out_part list of outgoing particles
71  * \param[in] absolute_execution_time absolute time at which the action is
72  * supposed to take place
73  * \param[in] type type of the interaction
74  */
75  Action(const ParticleList &in_part, const ParticleList &out_part,
76  double absolute_execution_time, ProcessType type)
77  : incoming_particles_(std::move(in_part)),
78  outgoing_particles_(std::move(out_part)),
79  time_of_execution_(absolute_execution_time),
80  process_type_(type) {}
81 
82  /// Copying is disabled. Use pointers or create a new Action.
83  Action(const Action &) = delete;
84 
85  /**
86  * Virtual Destructor.
87  * The declaration of the destructor is necessary to make it virtual.
88  */
89  virtual ~Action();
90 
91  /**
92  * Determine whether one action takes place before another in time
93  *
94  * \return if the first argument action takes place before the other
95  */
96  bool operator<(const Action &rhs) const {
98  }
99 
100  /**
101  * Return the total weight value, which is mainly used for the weight
102  * output entry. It has different meanings depending of the type of
103  * action. It is the total cross section in case of a ScatterAction,
104  * the total decay width in case of a DecayAction and the shining
105  * weight in case of a DecayActionDilepton.
106  *
107  * Prefer to use a more specific function. If there is no weight for the
108  * action type, 0 should be returned.
109  *
110  * \return total cross section, decay width or shining weight
111  */
112  virtual double get_total_weight() const = 0;
113 
114  /**
115  * Return the specific weight for the chosen outgoing channel, which is mainly
116  * used for the partial weight output entry. For scatterings it will be the
117  * partial cross section, for decays (including dilepton decays) the partial
118  * decay width.
119  *
120  * If there is no weight for the action type, 0 should be returned.
121  *
122  * \return specific weight for the chosen output channel.
123  */
124  virtual double get_partial_weight() const = 0;
125 
126  /**
127  * Get the process type.
128  *
129  * \return type of the process
130  */
131  virtual ProcessType get_type() const { return process_type_; }
132 
133  /**
134  * Add a new subprocess.
135  *
136  * \param[in] p process to be added
137  * \param[out] subprocesses processes, where p is added to
138  * \param[out] total_weight summed weights of all the subprocesses
139  */
140  template <typename Branch>
141  void add_process(ProcessBranchPtr<Branch> &p,
142  ProcessBranchList<Branch> &subprocesses,
143  double &total_weight) {
144  if (p->weight() > 0) {
145  total_weight += p->weight();
146  subprocesses.emplace_back(std::move(p));
147  }
148  }
149 
150  /**
151  * Add several new subprocesses at once.
152  *
153  * \param[in] pv processes list to be added
154  * \param[out] subprocesses processes, where pv are added to
155  * \param[out] total_weight summed weights of all the subprocesses
156  */
157  template <typename Branch>
158  void add_processes(ProcessBranchList<Branch> pv,
159  ProcessBranchList<Branch> &subprocesses,
160  double &total_weight) {
161  subprocesses.reserve(subprocesses.size() + pv.size());
162  for (auto &proc : pv) {
163  if (proc->weight() > 0) {
164  total_weight += proc->weight();
165  subprocesses.emplace_back(std::move(proc));
166  }
167  }
168  }
169 
170  /**
171  * Generate the final state for this action.
172  *
173  * This function selects a subprocess by Monte-Carlo decision and sets up
174  * the final-state particles in phase space.
175  */
176  virtual void generate_final_state() = 0;
177 
178  /**
179  * Actually perform the action, e.g. carry out a decay or scattering by
180  * updating the particle list.
181  *
182  * This function removes the initial-state particles from the particle list
183  * and then inserts the final-state particles. It does not do any sanity
184  * checks, but assumes that is_valid has been called to determine if the
185  * action is still valid.
186  *
187  * \param[in] id_process unique id of the performed process
188  * \param[out] particles particle list that is updated
189  *
190  * \return the amount of energy violated in Pythia processes (if any)
191  *
192  * Note that you are required to increase id_process before the next call,
193  * such that you get unique numbers.
194  */
195  virtual double perform(Particles *particles, uint32_t id_process);
196 
197  /**
198  * Check whether the action still applies.
199  *
200  * It can happen that a different action removed the incoming_particles from
201  * the set of existing particles in the experiment, or that the particle has
202  * scattered elastically in the meantime. In this case the Action doesn't
203  * apply anymore and should be discarded.
204 
205  * \param[in] particles current particle list
206  * \return true, if action still applies; false otherwise
207  */
208  bool is_valid(const Particles &particles) const;
209 
210  /**
211  * Check if the action is Pauli-blocked.
212  *
213  * If there are baryons in the final
214  * state then blocking probability is \f$ 1 - \Pi (1-f_i) \f$, where the
215  * product is taken by all fermions in the final state and \f$ f_i \f$
216  * denotes the phase-space density at the position of i-th final-state
217  * fermion.
218  *
219  * \param[in] ensembles current particle list, all ensembles
220  * \param[in] p_bl PauliBlocker that stores the configurations concerning
221  * Pauli-blocking.
222  * \return true, if the action is Pauli-blocked, false otherwise
223  */
224  bool is_pauli_blocked(const std::vector<Particles> &ensembles,
225  const PauliBlocker &p_bl) const;
226 
227  /**
228  * Get the list of particles that go into the action.
229  *
230  * \return a list of incoming particles
231  */
232  const ParticleList &incoming_particles() const;
233 
234  /**
235  * Update the incoming particles that are stored in this action to the state
236  * they have in the global particle list.
237  *
238  * \param[in] particles current particle list
239  */
240  void update_incoming(const Particles &particles);
241 
242  /**
243  * Get the list of particles that resulted from the action.
244  *
245  * \return list of outgoing particles
246  */
247  const ParticleList &outgoing_particles() const { return outgoing_particles_; }
248 
249  /**
250  * Get the time at which the action is supposed to be performed
251  *
252  * \return absolute time in the calculation frame in fm
253  */
254  double time_of_execution() const { return time_of_execution_; }
255 
256  /**
257  * Check various conservation laws.
258  *
259  * \param[in] id_process process id only used for debugging output
260  *
261  * \return the amount of energy conservation violated by Pythia processes (if
262  * any)
263  */
264  virtual double check_conservation(const uint32_t id_process) const;
265 
266  /**
267  * Determine the total energy in the center-of-mass frame [GeV]
268  *
269  * \return \f$ \sqrt{s}\f$ of incoming particles
270  */
271  double sqrt_s() const { return total_momentum().abs(); }
272 
273  /**
274  * Calculate the total kinetic momentum of the outgoing particles
275  *
276  * Use this to determine the momemtum and boost of the outgoing particles by
277  * calcluating the total momentum of the incoming particles and correcting it
278  * for the effect of potentials. This function is used when the species of the
279  * outgoing particles are already determined.
280  *
281  * \return total kinetic momentum of the outgoing particles [GeV]
282  */
284 
285  /**
286  * Get the interaction point
287  *
288  * \return four vector of interaction point
289  */
291 
292  /**
293  * Get the skyrme and asymmetry potential at the interaction point
294  *
295  * \return skyrme and asymmetry potential [GeV]
296  */
297  std::pair<FourVector, FourVector> get_potential_at_interaction_point() const;
298 
299  /**
300  * Setter function that stores a random incoming particle index latter used to
301  * determine the interaction point
302  */
304  const int max_inc_idx = incoming_particles_.size() - 1;
306  }
307 
308  /**
309  * Little helper function that calculates the lambda function (sometimes
310  * written with a tilde to better distinguish it) that appears e.g. in the
311  * relative velocity or 3-to-2 probability calculation, where it is used with
312  * a=s, b=m1^2 and c=m2^2. Defintion found e.g. in \iref{Seifert:2017oyb},
313  * eq. (5).
314  */
315  static double lambda_tilde(double a, double b, double c) {
316  const double res = (a - b - c) * (a - b - c) - 4. * b * c;
317  if (res < 0.0) {
318  // floating point precision problem
319  return 0.0;
320  }
321  return res;
322  }
323 
324  /**
325  * \ingroup exception
326  * Thrown for example when ScatterAction is called to perform with a wrong
327  * number of final-state particles or when the energy is too low to produce
328  * the resonance.
329  */
330  class InvalidResonanceFormation : public std::invalid_argument {
331  using std::invalid_argument::invalid_argument;
332  };
333 
334  /**
335  * \ingroup exception
336  * Exception for a temporary bugfix for when multiparticle interactions do
337  * not have the necessary energy to create the final state. This is used in
338  * a try/catch block, and will be removed in future releases.
339  */
340  class StochasticBelowEnergyThreshold : public std::runtime_error {
341  using std::runtime_error::runtime_error;
342  };
343 
344  /**
345  * Assign an unpolarized spin vector to all outgoing particles.
346  *
347  * \attention Make sure to assign the spin vectors after the boosted
348  * 4-momentum of the outgoing particles has been set, as the function includes
349  * a boost to the lab frame.
350  */
352 
353  protected:
354  /// List with data of incoming particles.
355  ParticleList incoming_particles_;
356 
357  /**
358  * Initially this stores only the PDG codes of final-state particles.
359  *
360  * After perform was called it contains the complete particle data of the
361  * outgoing particles.
362  */
363  ParticleList outgoing_particles_;
364 
365  /**
366  * Time at which the action is supposed to be performed
367  * (absolute time in the lab frame in fm).
368  */
369  const double time_of_execution_;
370 
371  /// type of process
373 
374  /**
375  * Box length: needed to determine coordinates of collision
376  * correctly in case of collision through the wall.
377  * Ignored if negative.
378  */
379  double box_length_ = -1.0;
380 
381  /**
382  * This stores a randomly-chosen index to an incoming particle. If
383  * non-negative, the the interaction point equals the postion of the
384  * chosen particle (index). This is done for the stochastic criterion.
385  */
387 
388  /// Sum of 4-momenta of incoming particles
390  FourVector mom(0.0, 0.0, 0.0, 0.0);
391  for (const auto &p : incoming_particles_) {
392  mom += p.momentum();
393  }
394  return mom;
395  }
396 
397  /**
398  * Decide for a particular final-state channel via Monte-Carlo
399  * and return it as a ProcessBranch
400 
401  * \tparam Branch Type of processbranch
402  * \param[in] subprocesses list of possible processes
403  * \param[in] total_weight summed weight of all processes
404  * \return ProcessBranch that is sampled
405  */
406  template <typename Branch>
407  const Branch *choose_channel(const ProcessBranchList<Branch> &subprocesses,
408  double total_weight) {
409  double random_weight = random::uniform(0., total_weight);
410  double weight_sum = 0.;
411  /* Loop through all subprocesses and select one by Monte Carlo, based on
412  * their weights. */
413  for (const auto &proc : subprocesses) {
414  weight_sum += proc->weight();
415  if (random_weight <= weight_sum) {
416  /* Return the full process information. */
417  return proc.get();
418  }
419  }
420  /* Should never get here. */
422  "Problem in choose_channel: ", subprocesses.size(), " ",
423  weight_sum, " ", total_weight, " ", random_weight, "\n",
424  *this);
425  std::abort();
426  }
427 
428  /**
429  * Sample final-state masses in general X->2 processes
430  * (thus also fixing the absolute c.o.m. momentum).
431  *
432  * \param[in] kinetic_energy_cm total kinetic energy of
433  * the outgoing particles in their center of
434  * mass frame [GeV]
435  * \throws InvalidResonanceFormation
436  * \return masses of final state particles
437  */
438  virtual std::pair<double, double> sample_masses(
439  double kinetic_energy_cm) const;
440 
441  /**
442  * Sample final-state momenta in general X->2 processes
443  * (here: using an isotropical angular distribution).
444  *
445  * \param[in] kinetic_energy_cm total kinetic energy of
446  * the outgoing particles in their center of
447  * mass frame [GeV]
448  * \param[in] masses masses of each of the final state particles
449  */
450  virtual void sample_angles(std::pair<double, double> masses,
451  double kinetic_energy_cm);
452 
453  /**
454  * Sample the full 2-body phase-space (masses, momenta, angles)
455  * in the center-of-mass frame for the final state particles.
456  */
457  virtual void sample_2body_phasespace();
458 
459  /**
460  * Sample the full n-body phase-space (masses, momenta, angles)
461  * in the center-of-mass frame for the final state particles.
462  *
463  * \throw std::invalid_argument if one outgoing particle is a resonance
464  */
465  virtual void sample_manybody_phasespace();
466 
467  /**
468  * Assign the formation time to the outgoing particles.
469  *
470  * The formation time is set to the largest formation time of the incoming
471  * particles, if it is larger than the execution time. The newly produced
472  * particles are supposed to continue forming exactly like the latest forming
473  * ingoing particle. Therefore the details on the formation are adopted.
474  * The initial cross section scaling factor of the incoming particles is
475  * considered to also be the scaling factor of the newly produced outgoing
476  * particles. If the formation time is smaller than the exectution time, the
477  * execution time is taken to be the formation time.
478  *
479  * Note: Make sure to assign the formation times before boosting the outgoing
480  * particles to the computational frame.
481  */
483 
484  /**
485  * \ingroup logging
486  * Writes information about this action to the \p out stream.
487  *
488  * \param[out] out out stream to be written to
489  */
490  virtual void format_debug_output(std::ostream &out) const = 0;
491 
492  /**
493  * \ingroup logging
494  * Dispatches formatting to the virtual Action::format_debug_output function.
495  */
496  friend std::ostream &operator<<(std::ostream &out, const Action &action) {
497  action.format_debug_output(out);
498  return out;
499  }
500 
501  private:
502  /**
503  * Get the type of a given particle
504  *
505  * \param[in] p_out particle of which the type will be returned
506  * \return type of given particle
507  */
508  const ParticleType &type_of_pout(const ParticleData &p_out) const {
509  return p_out.type();
510  }
511  /**
512  * Get the particle type for given pointer to a particle type.
513  *
514  * Helper function for total_momentum_of_outgoing_particles
515  *
516  * \param[in] p_out pointer to a particle type
517  * \return particle type
518  */
519  const ParticleType &type_of_pout(const ParticleTypePtr &p_out) const {
520  return *p_out;
521  }
522 };
523 
524 /**
525  * Append vector of action pointers
526  *
527  * \param[in] lhs vector of action pointers that is appended to
528  * \param[in] rhs vector of action pointers that is appended
529  * \return vector of action pointers containing lhs and rhs
530  */
531 inline std::vector<ActionPtr> &operator+=(std::vector<ActionPtr> &lhs,
532  std::vector<ActionPtr> &&rhs) {
533  if (lhs.size() == 0) {
534  lhs = std::move(rhs);
535  } else {
536  lhs.insert(lhs.end(), std::make_move_iterator(rhs.begin()),
537  std::make_move_iterator(rhs.end()));
538  }
539  return lhs;
540 }
541 
542 /**
543  * \ingroup logging
544  * Convenience: dereferences the ActionPtr to Action.
545  */
546 inline std::ostream &operator<<(std::ostream &out, const ActionPtr &action) {
547  return out << *action;
548 }
549 
550 /**
551  * \ingroup logging
552  * Writes multiple actions to the \p out stream.
553  */
554 std::ostream &operator<<(std::ostream &out, const ActionList &actions);
555 
556 namespace detail {
557 /**
558  * \brief Implementation of the full n-body phase-space sampling (masses,
559  * momenta, angles) in the center-of-mass frame for the final state particles,
560  * using the M-method from CERN-68-15, paragraph 9.6.
561  *
562  * The algorithm proceeds in two stages:
563  *
564  * 1. Generate invariant masses \f$M_{12}, M_{123}, M_{1234}, \ldots\f$ from
565  * the measure
566  * \f[
567  * dM_{12}\, dM_{123}\, dM_{1234}\, \cdots,
568  * \f]
569  * while respecting non-trivial kinematic limits.
570  *
571  * Introduce shifted variables
572  * \f[
573  * T_{12} = M_{12} - (m_1 + m_2),\qquad
574  * T_{123} = M_{123} - (m_1 + m_2 + m_3),\ \ldots
575  * \f]
576  * and sample uniformly under the ordering constraint
577  * \f[
578  * 0 \le T_{12} \le T_{123} \le T_{1234} \le \cdots
579  * \le \sqrt{s} - \sum_i m_i.
580  * \f]
581  * A practical trick is to draw values uniformly in
582  * \f$[0,\,\sqrt{s} - \sum_i m_i]\f$ and sort them.
583  *
584  * 2. Accept or reject each invariant-mass configuration with weight
585  * proportional to
586  * \f[
587  * R_2(\sqrt{s}, M_{n-1}, m_n)
588  * \times R_2(M_{n-1}, M_{n-2}, m_{n-1})
589  * \times \cdots
590  * \times R_2(M_2, m_1, m_2)
591  * \times \prod_i M_i.
592  * \f]
593  *
594  * The maximum weight is estimated heuristically; following an idea by Scott
595  * Pratt, it is expected near
596  * \f[
597  * T_{12} = T_{123} = T_{1234} = \cdots
598  * = \frac{\sqrt{s} - \sum_i m_i}{n - 1}.
599  * \f]
600  */
601 void sample_manybody_phasespace_impl(double sqrts,
602  const ParticleTypePtrList &types,
603  std::vector<FourVector> &sampled_momenta);
604 
605 /**
606  * \brief Metropolis–Hastings sampling of the many body phase space, starting
607  * from an initial guess in sampled_momenta that is assumed appropriate.
608  *
609  * The algorithm works by repeatedly picking a random pair of particles,
610  * resampling their masses from the spectral functions, and adjusting their
611  * momenta accordingly in the CM frame of the pair, which conserves energy and
612  * momentum. This is done for a fixed number of iterations heuristically chosen
613  * (200), but no systematic analysis was done.
614  *
615  * The function is for now used as a fallback for the rejection algorithm in
616  * sample_manybody_phasespace_impl and takes its initial guess from there.
617  */
618 void sample_manybody_phasespace_MCMC(const ParticleTypePtrList &types,
619  std::vector<FourVector> &sampled_momenta);
620 } // namespace detail
621 
622 } // namespace smash
623 
624 #endif // SRC_INCLUDE_SMASH_ACTION_H_
Thrown for example when ScatterAction is called to perform with a wrong number of final-state particl...
Definition: action.h:330
Exception for a temporary bugfix for when multiparticle interactions do not have the necessary energy...
Definition: action.h:340
Action is the base class for a generic process that takes a number of incoming particles and transfor...
Definition: action.h:35
virtual 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:308
FourVector total_momentum_of_outgoing_particles() const
Calculate the total kinetic momentum of the outgoing particles.
Definition: action.cc:163
Action(const Action &)=delete
Copying is disabled. Use pointers or create a new Action.
void assign_formation_time_to_outgoing_particles()
Assign the formation time to the outgoing particles.
Definition: action.cc:194
virtual ~Action()
Virtual Destructor.
int stochastic_position_idx_
This stores a randomly-chosen index to an incoming particle.
Definition: action.h:386
std::pair< FourVector, FourVector > get_potential_at_interaction_point() const
Get the skyrme and asymmetry potential at the interaction point.
Definition: action.cc:115
virtual void sample_angles(std::pair< double, double > masses, double kinetic_energy_cm)
Sample final-state momenta in general X->2 processes (here: using an isotropical angular distribution...
Definition: action.cc:285
ParticleList outgoing_particles_
Initially this stores only the PDG codes of final-state particles.
Definition: action.h:363
bool operator<(const Action &rhs) const
Determine whether one action takes place before another in time.
Definition: action.h:96
virtual ProcessType get_type() const
Get the process type.
Definition: action.h:131
const ParticleType & type_of_pout(const ParticleData &p_out) const
Get the type of a given particle.
Definition: action.h:508
FourVector total_momentum() const
Sum of 4-momenta of incoming particles.
Definition: action.h:389
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:319
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
virtual double get_total_weight() const =0
Return the total weight value, which is mainly used for the weight output entry.
void set_stochastic_pos_idx()
Setter function that stores a random incoming particle index latter used to determine the interaction...
Definition: action.h:303
virtual double perform(Particles *particles, uint32_t id_process)
Actually perform the action, e.g.
Definition: action.cc:131
void update_incoming(const Particles &particles)
Update the incoming particles that are stored in this action to the state they have in the global par...
Definition: action.cc:65
void assign_unpolarized_spin_vector_to_outgoing_particles()
Assign an unpolarized spin vector to all outgoing particles.
Definition: action.cc:339
Action(const ParticleList &in_part, double time)
Construct an action object with incoming particles and relative time.
Definition: action.h:44
virtual double check_conservation(const uint32_t id_process) const
Check various conservation laws.
Definition: action.cc:345
const ParticleList & incoming_particles() const
Get the list of particles that go into the action.
Definition: action.cc:61
Action(const ParticleList &in_part, const ParticleList &out_part, double absolute_execution_time, ProcessType type)
Construct an action object with the incoming particles, absolute time, and the already known outgoing...
Definition: action.h:75
double time_of_execution() const
Get the time at which the action is supposed to be performed.
Definition: action.h:254
virtual void generate_final_state()=0
Generate the final state for this action.
void add_process(ProcessBranchPtr< Branch > &p, ProcessBranchList< Branch > &subprocesses, double &total_weight)
Add a new subprocess.
Definition: action.h:141
const Branch * choose_channel(const ProcessBranchList< Branch > &subprocesses, double total_weight)
Decide for a particular final-state channel via Monte-Carlo and return it as a ProcessBranch.
Definition: action.h:407
virtual double get_partial_weight() const =0
Return the specific weight for the chosen outgoing channel, which is mainly used for the partial weig...
double sqrt_s() const
Determine the total energy in the center-of-mass frame [GeV].
Definition: action.h:271
double box_length_
Box length: needed to determine coordinates of collision correctly in case of collision through the w...
Definition: action.h:379
ParticleList incoming_particles_
List with data of incoming particles.
Definition: action.h:355
FourVector get_interaction_point() const
Get the interaction point.
Definition: action.cc:71
Action(const ParticleData &in_part, const ParticleData &out_part, double time, ProcessType type)
Construct an action object with the incoming particles, relative time, and the already known outgoing...
Definition: action.h:58
virtual std::pair< double, double > sample_masses(double kinetic_energy_cm) const
Sample final-state masses in general X->2 processes (thus also fixing the absolute c....
Definition: action.cc:256
static double lambda_tilde(double a, double b, double c)
Little helper function that calculates the lambda function (sometimes written with a tilde to better ...
Definition: action.h:315
void add_processes(ProcessBranchList< Branch > pv, ProcessBranchList< Branch > &subprocesses, double &total_weight)
Add several new subprocesses at once.
Definition: action.h:158
ProcessType process_type_
type of process
Definition: action.h:372
const ParticleType & type_of_pout(const ParticleTypePtr &p_out) const
Get the particle type for given pointer to a particle type.
Definition: action.h:519
const ParticleList & outgoing_particles() const
Get the list of particles that resulted from the action.
Definition: action.h:247
bool is_valid(const Particles &particles) const
Check whether the action still applies.
Definition: action.cc:32
bool is_pauli_blocked(const std::vector< Particles > &ensembles, const PauliBlocker &p_bl) const
Check if the action is Pauli-blocked.
Definition: action.cc:38
The FourVector class holds relevant values in Minkowski spacetime with (+, −, −, −) metric signature.
Definition: fourvector.h:33
double abs() const
calculate the lorentz invariant absolute value
Definition: fourvector.h:464
ParticleData contains the dynamic information of a certain particle.
Definition: particledata.h:59
const ParticleType & type() const
Get the type of the particle.
Definition: particledata.h:132
A pointer-like interface to global references to ParticleType objects.
Definition: particletype.h:731
Particle type contains the static properties of a particle species.
Definition: particletype.h:100
The Particles class abstracts the storage and manipulation of particles.
Definition: particles.h:33
A class that stores parameters needed for Pauli blocking, tabulates necessary integrals and computes ...
Definition: pauliblocking.h:38
#define SMASH_SOURCE_LOCATION
Hackery that is required to output the location in the source code where the log statement occurs.
Definition: logging.h:153
std::ostream & operator<<(std::ostream &out, const ActionPtr &action)
Convenience: dereferences the ActionPtr to Action.
Definition: action.h:546
friend std::ostream & operator<<(std::ostream &out, const Action &action)
Dispatches formatting to the virtual Action::format_debug_output function.
Definition: action.h:496
std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > & logg
An array that stores all pre-configured Logger objects.
Definition: logging.h:245
virtual void format_debug_output(std::ostream &out) const =0
Writes information about this action to the out stream.
void sample_manybody_phasespace_impl(double sqrts, const ParticleTypePtrList &types, std::vector< FourVector > &sampled_momenta)
Implementation of the full n-body phase-space sampling (masses, momenta, angles) in the center-of-mas...
Definition: action.cc:410
void sample_manybody_phasespace_MCMC(const ParticleTypePtrList &types, std::vector< FourVector > &sampled_momenta)
Metropolis–Hastings sampling of the many body phase space, starting from an initial guess in sampled_...
Definition: action.cc:552
constexpr int p
Proton.
T uniform_int(T min, T max)
Definition: random.h:106
T uniform(T min, T max)
Definition: random.h:91
Definition: action.h:24
static constexpr int LAction
Definition: action.h:25
ProcessType
ProcessTypes are used to identify the type of the process.
Definition: processbranch.h:39
std::vector< ActionPtr > & operator+=(std::vector< ActionPtr > &lhs, std::vector< ActionPtr > &&rhs)
Append vector of action pointers.
Definition: action.h:531