Version: SMASH-3.4
scatteraction.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2014-2025
4  * SMASH Team
5  *
6  * GNU General Public License (GPLv3 or later)
7  *
8  */
9 
10 #ifndef SRC_INCLUDE_SMASH_SCATTERACTION_H_
11 #define SRC_INCLUDE_SMASH_SCATTERACTION_H_
12 
13 #include <memory>
14 #include <set>
15 #include <string>
16 #include <utility>
17 
18 #include "action.h"
19 #include "isoparticletype.h"
21 #include "stringprocess.h"
22 
23 namespace smash {
24 
25 /**
26  * \ingroup action
27  * ScatterAction is a special action which takes two incoming particles
28  * and performs a scattering, producing one or more final-state particles.
29  */
30 class ScatterAction : public Action {
31  public:
32  /**
33  * Construct a ScatterAction object.
34  *
35  * \param[in] in_part1 first scattering partner
36  * \param[in] in_part2 second scattering partner
37  * \param[in] time Time at which the action is supposed to take place
38  * \param[in] isotropic if true, do the collision isotropically
39  * \param[in] string_formation_time Time string fragments take to form
40  * \param[in] box_length Passing box length to determine
41  * coordinate of the collision, in case it happened through
42  * the wall in a box. If negative, then there is no wrapping.
43  * \param[in] is_total_parametrized Whether the total cross section used for
44  * collision finding is parametrized
45  * \param[in] spin_interaction_type Which type of spin interaction to use
46  */
47  ScatterAction(const ParticleData& in_part1, const ParticleData& in_part2,
48  double time, bool isotropic = false,
49  double string_formation_time = 1.0, double box_length = -1.0,
50  bool is_total_parametrized = false,
51  const SpinInteractionType spin_interaction_type =
53  /**
54  * Add a new collision channel.
55  *
56  * \param[in] p Channel to be added.
57  */
58  void add_collision(CollisionBranchPtr p);
59 
60  /**
61  * Add several new collision channels at once.
62  *
63  * \param[in] pv list of channels to be added.
64  */
65  void add_collisions(CollisionBranchList pv);
66 
67  /**
68  * Calculate the transverse distance of the two incoming particles in their
69  * local rest frame.
70  *
71  * According to UrQMD criterion, \iref{Bass:1998ca} eq. (3.27):
72  * - position of particle a: \f$\mathbf{x}_a\f$
73  * - position of particle b: \f$\mathbf{x}_b\f$
74  * - momentum of particle a: \f$\mathbf{p}_a\f$
75  * - momentum of particle b: \f$\mathbf{p}_b\f$
76  *
77  * \f[
78  * d^2_\mathrm{coll}
79  * = (\mathbf{x}_a - \mathbf{x}_b)^2 -
80  * \frac{\bigl[(\mathbf{x}_a - \mathbf{x}_b) \cdot
81  * (\mathbf{p}_a - \mathbf{p}_b)\bigr]^2 }
82  * {(\mathbf{p}_a - \mathbf{p}_b)^2}
83  * \f]
84  *
85  * \return squared distance \f$d^2_\mathrm{coll}\f$.
86  */
87  double transverse_distance_sqr() const;
88 
89  /**
90  * Calculate the transverse distance of the two incoming particles in their
91  * local rest frame written in a covariant form. Equivalent to the UrQMD
92  * transverse distance. See \iref{Hirano:2012yy} (5.6)-(5.11).
93  *
94  * \return squared distance \f$d^2_\mathrm{coll}\f$.
95  */
96  double cov_transverse_distance_sqr() const;
97  /**
98  * Determine the Mandelstam s variable,
99  *
100  * \f[s = (p_a + p_b)^2\f]
101  * Equal to the square of CMS energy.
102  *
103  * \return Mandelstam s
104  */
105  double mandelstam_s() const;
106 
107  /**
108  * Get the relative velocity of the two incoming
109  * particles. For a defintion see e.g. \iref{Seifert:2017oyb}, eq. (5)
110  *
111  * \return relative velocity.
112  */
113  double relative_velocity() const;
114 
115  /**
116  * Generate the final-state of the scattering process.
117  * Performs either elastic or inelastic scattering.
118  *
119  * \throw InvalidScatterAction
120 
121  */
122  void generate_final_state() override;
123 
124  /**
125  * Get the total cross section of scattering particles.
126  *
127  * \return total cross section.
128  */
129  double get_total_weight() const override;
130 
131  /**
132  * Get the partial cross section of the chosen channel.
133  *
134  * \return partial cross section.
135  */
136  double get_partial_weight() const override;
137 
138  /**
139  * Sample final-state angles in a 2->2 collision (possibly anisotropic).
140  */
141  void sample_angles(std::pair<double, double> masses,
142  double kinetic_energy_cm) override;
143 
144  /**
145  * Add all possible scattering subprocesses for this action object. This can
146  * only be called once per ScatterAction instance.
147  *
148  * \param[in] finder_parameters parameters for collision finding.
149  */
150  void add_all_scatterings(
151  const ScatterActionsFinderParameters& finder_parameters);
152 
153  /**
154  * Given the incoming particles, assigns the correct parametrization of the
155  * total cross section.
156  *
157  * \param[in] finder_parameters Parameters for collision finding.
158  */
160  const ScatterActionsFinderParameters& finder_parameters);
161 
162  /**
163  * Get list of possible collision channels.
164  *
165  * \return list of possible collision channels.
166  */
167  const CollisionBranchList& collision_channels() {
168  return collision_channels_;
169  }
170 
171  /**
172  * \ingroup exception
173  * Thrown when ScatterAction is called to perform with unknown ProcessType.
174  */
175  class InvalidScatterAction : public std::invalid_argument {
176  using std::invalid_argument::invalid_argument;
177  };
178 
179  /**
180  * Set the StringProcess object to be used.
181  *
182  * The StringProcess object is used to handle string excitation and to
183  * generate final state particles.
184  *
185  * \param[in] str_proc String process object to be used.
186  */
188  string_process_ = str_proc;
189  }
190 
191  /**
192  * Get the total cross section of the scattering particles, either from a
193  * parametrization, or from the sum of partials.
194  *
195  * \return total cross section.
196  */
197  virtual double cross_section() const {
200  }
202  }
203 
204  protected:
205  /**
206  * Get the momentum of the center of mass of the incoming particles
207  * in the calculation frame.
208  *
209  * \return center of mass momentum.
210  */
211  double cm_momentum() const;
212  /**
213  * Get the squared momentum of the center of mass of the incoming
214  * particles in the calculation frame.
215  *
216  * \return center of mass momentum squared.
217  */
218  double cm_momentum_squared() const;
219 
220  /**
221  * Get the velocity of the center of mass of the scattering/incoming particles
222  * in the calculation frame.
223  *
224  * Note: Do not use this function to boost the outgoing
225  * particles. Use total_momentum_of_outgoing_particles(), which corrects for
226  * the effect of potentials on intial and final state.
227  *
228  * \return boost velocity between center of mass and calculation frame.
229  */
230  ThreeVector beta_cm() const;
231  /**
232  * Get the gamma factor corresponding to a boost to the center of mass frame
233  * of the colliding particles.
234  *
235  * \return gamma factor.
236  */
237  double gamma_cm() const;
238 
239  /// Perform an elastic two-body scattering, i.e. just exchange momentum.
240  void elastic_scattering();
241 
242  /// Perform an inelastic two-body scattering, i.e. new particles are formed
243  void inelastic_scattering();
244 
245  /// Perform an inelastic two-to-many-body scattering (more than 2)
246  void two_to_many_scattering();
247 
248  /// Creates the final states for string-processes after they are performed
250  /**
251  * Todo(ryu): document better - it is not really UrQMD-based, isn't it?
252  * Perform the UrQMD-based string excitation and decay
253  */
254  void string_excitation();
255 
256  /**
257  * Perform spin interaction in binary interactions. At the moment, we include
258  * a spin-flip in the y component of elastic scatterings if enabled.
259  */
260  void spin_interaction();
261 
262  /**
263  * Perform spin interaction in string excitations. At the moment, we assign
264  * unpolarized spin vectors to the outgoing particles, unless the process is
265  * single diffractive, in which case we copy the spin vector of the
266  * elastically scattered particle to the corresponding outgoing particle.
267  */
269 
270  /**
271  * \ingroup logging
272  * Writes information about this scatter action to the \p out stream.
273  */
274  void format_debug_output(std::ostream& out) const override;
275 
276  /// List of possible collisions
277  CollisionBranchList collision_channels_;
278 
279  /// Current sum of partial hadronic cross sections
281 
282  /// Partial cross-section to the chosen outgoing channel
284 
285  /// Do this collision isotropically?
286  bool isotropic_ = false;
287 
288  /// Time fragments take to be fully formed in hard string excitation.
290 
291  private:
292  /**
293  * Check if the scattering is elastic.
294  *
295  * \return whether the scattering is elastic.
296  */
297  bool is_elastic() const;
298 
299  /**
300  * Perform a 2->1 resonance-formation process.
301  * \throw InvalidResonanceFormation
302  */
303  void resonance_formation();
304 
305  /**
306  * Loop over the possible branches and rescales their weight according to the
307  * desired total cross section. In case the current sum of partials is close
308  * to 0, a warning is issued as this would not happen in an usual run, and an
309  * elastic process is added to match the total.
310  */
312 
313  /**
314  * Try to find a pseudo-resonance that can be created from the incoming
315  * particles using a given method.
316  *
317  * \param[in] method used to select the pseudo-resonance among possible
318  * candidates. \see_key{key_CT_pseudoresonance_}
319  * \param[in] transition parameters for the string transition region, which
320  * are also used to determine when a pseudo-resonance can be created.
321  * \return the appropriate pseudo-resonance, if there is any, or an invalid
322  * pointer otherwise.
323  */
325  const PseudoResonance method,
326  const StringTransitionParameters& transition) const;
327 
328  /// Pointer to interface class for strings
330 
331  /// Whether the total cross section is parametrized
333 
334  /// If cross section is parametrized, store the value
335  std::optional<double> parametrized_total_cross_section_ = std::nullopt;
336 
337  /// What kind of spin interaction to use
339 
340  /// Lock for calling add_all_scatterings only once
341  bool were_processes_added_ = false;
342 
343  /// Warn about zero cross section only once per particle type pair
344  static inline std::set<std::set<ParticleTypePtr>>
346 };
347 
348 } // namespace smash
349 
350 #endif // SRC_INCLUDE_SMASH_SCATTERACTION_H_
Action is the base class for a generic process that takes a number of incoming particles and transfor...
Definition: action.h:35
ParticleData contains the dynamic information of a certain particle.
Definition: particledata.h:59
A pointer-like interface to global references to ParticleType objects.
Definition: particletype.h:731
Thrown when ScatterAction is called to perform with unknown ProcessType.
ScatterAction is a special action which takes two incoming particles and performs a scattering,...
Definition: scatteraction.h:30
SpinInteractionType spin_interaction_type_
What kind of spin interaction to use.
bool is_elastic() const
Check if the scattering is elastic.
bool isotropic_
Do this collision isotropically?
double string_formation_time_
Time fragments take to be fully formed in hard string excitation.
std::optional< double > parametrized_total_cross_section_
If cross section is parametrized, store the value.
void string_spin_interaction()
Perform spin interaction in string excitations.
const CollisionBranchList & collision_channels()
Get list of possible collision channels.
void rescale_outgoing_branches()
Loop over the possible branches and rescales their weight according to the desired total cross sectio...
void add_collision(CollisionBranchPtr p)
Add a new collision channel.
ScatterAction(const ParticleData &in_part1, const ParticleData &in_part2, double time, bool isotropic=false, double string_formation_time=1.0, double box_length=-1.0, bool is_total_parametrized=false, const SpinInteractionType spin_interaction_type=SpinInteractionType::Off)
Construct a ScatterAction object.
void resonance_formation()
Perform a 2->1 resonance-formation process.
ThreeVector beta_cm() const
Get the velocity of the center of mass of the scattering/incoming particles in the calculation frame.
double partial_cross_section_
Partial cross-section to the chosen outgoing channel.
double relative_velocity() const
Get the relative velocity of the two incoming particles.
double mandelstam_s() const
Determine the Mandelstam s variable,.
void set_parametrized_total_cross_section(const ScatterActionsFinderParameters &finder_parameters)
Given the incoming particles, assigns the correct parametrization of the total cross section.
double get_partial_weight() const override
Get the partial cross section of the chosen channel.
StringProcess * string_process_
Pointer to interface class for strings.
bool is_total_parametrized_
Whether the total cross section is parametrized.
void create_string_final_state()
Creates the final states for string-processes after they are performed.
double sum_of_partial_cross_sections_
Current sum of partial hadronic cross sections.
void set_string_interface(StringProcess *str_proc)
Set the StringProcess object to be used.
double cm_momentum_squared() const
Get the squared momentum of the center of mass of the incoming particles in the calculation frame.
void generate_final_state() override
Generate the final-state of the scattering process.
void add_all_scatterings(const ScatterActionsFinderParameters &finder_parameters)
Add all possible scattering subprocesses for this action object.
void two_to_many_scattering()
Perform an inelastic two-to-many-body scattering (more than 2)
double get_total_weight() const override
Get the total cross section of scattering particles.
void string_excitation()
Todo(ryu): document better - it is not really UrQMD-based, isn't it? Perform the UrQMD-based string e...
void elastic_scattering()
Perform an elastic two-body scattering, i.e. just exchange momentum.
void inelastic_scattering()
Perform an inelastic two-body scattering, i.e. new particles are formed.
void spin_interaction()
Perform spin interaction in binary interactions.
void sample_angles(std::pair< double, double > masses, double kinetic_energy_cm) override
Sample final-state angles in a 2->2 collision (possibly anisotropic).
void add_collisions(CollisionBranchList pv)
Add several new collision channels at once.
double gamma_cm() const
Get the gamma factor corresponding to a boost to the center of mass frame of the colliding particles.
double cm_momentum() const
Get the momentum of the center of mass of the incoming particles in the calculation frame.
bool were_processes_added_
Lock for calling add_all_scatterings only once.
static std::set< std::set< ParticleTypePtr > > warned_no_rescaling_available
Warn about zero cross section only once per particle type pair.
double cov_transverse_distance_sqr() const
Calculate the transverse distance of the two incoming particles in their local rest frame written in ...
virtual double cross_section() const
Get the total cross section of the scattering particles, either from a parametrization,...
ParticleTypePtr try_find_pseudoresonance(const PseudoResonance method, const StringTransitionParameters &transition) const
Try to find a pseudo-resonance that can be created from the incoming particles using a given method.
CollisionBranchList collision_channels_
List of possible collisions.
double transverse_distance_sqr() const
Calculate the transverse distance of the two incoming particles in their local rest frame.
Helper class for ScatterActionsFinder.
String excitation processes used in SMASH.
Definition: stringprocess.h:46
The ThreeVector class represents a physical three-vector with the components .
Definition: threevector.h:31
PseudoResonance
Which pseudo-resonance fills the inelastic gap in the transition to string region of cross sections.
SpinInteractionType
Possible spin interaction types.
@ Off
No spin interactions.
void format_debug_output(std::ostream &out) const override
Writes information about this scatter action to the out stream.
constexpr int p
Proton.
Definition: action.h:24
Constants related to transition between low and high collision energies.