Version: SMASH-1.7
scatteractionsfinder.h
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 #ifndef SRC_INCLUDE_SCATTERACTIONSFINDER_H_
11 #define SRC_INCLUDE_SCATTERACTIONSFINDER_H_
12 
13 #include <memory>
14 #include <set>
15 #include <vector>
16 
17 #include "action.h"
18 #include "actionfinderfactory.h"
19 #include "configuration.h"
20 #include "constants.h"
21 #include "scatteraction.h"
22 
23 namespace smash {
24 
32  public:
58  const ExperimentParameters &parameters,
59  const std::vector<bool> &nucleon_has_interacted,
60  int N_tot, int N_proj);
61 
78  inline double collision_time(
79  const ParticleData &p1, const ParticleData &p2, double dt,
80  const std::vector<FourVector> &beam_momentum) const {
82  return dt * random::uniform(0., 1.);
83  } else {
84  /*
85  * For frozen Fermi motion:
86  * If particles have not yet interacted and are the initial nucleons,
87  * perform action finding with beam momentum instead of Fermi motion
88  * corrected momentum. That is because the particles are propagated with
89  * the beam momentum until they interact.
90  */
91  if (p1.id() < 0 || p2.id() < 0) {
92  throw std::runtime_error("Invalid particle ID for Fermi motion");
93  }
94  const bool p1_has_no_prior_interactions =
95  (static_cast<uint64_t>(p1.id()) < // particle from
96  static_cast<uint64_t>(beam_momentum.size())) && // initial nucleus
98 
99  const bool p2_has_no_prior_interactions =
100  (static_cast<uint64_t>(p2.id()) < // particle from
101  static_cast<uint64_t>(beam_momentum.size())) && // initial nucleus
103 
104  const FourVector p1_mom = (p1_has_no_prior_interactions)
105  ? beam_momentum[p1.id()]
106  : p1.momentum();
107  const FourVector p2_mom = (p2_has_no_prior_interactions)
108  ? beam_momentum[p2.id()]
109  : p2.momentum();
110 
120  const ThreeVector dv_times_e1e2 =
121  p1_mom.threevec() * p2_mom.x0() - p2_mom.threevec() * p1_mom.x0();
122  const double dv_times_e1e2_sqr = dv_times_e1e2.sqr();
123  if (dv_times_e1e2_sqr < really_small) {
124  return -1.0;
125  }
126  const ThreeVector dr =
127  p1.position().threevec() - p2.position().threevec();
128  return -(dr * dv_times_e1e2) *
129  (p1_mom.x0() * p2_mom.x0() / dv_times_e1e2_sqr);
130  }
131  }
132 
147  ActionList find_actions_in_cell(
148  const ParticleList &search_list, double dt, const double cell_vol,
149  const std::vector<FourVector> &beam_momentum) const override;
150 
163  ActionList find_actions_with_neighbors(
164  const ParticleList &search_list, const ParticleList &neighbors_list,
165  double dt, const std::vector<FourVector> &beam_momentum) const override;
166 
179  const ParticleList &search_list, const Particles &surrounding_list,
180  double dt, const std::vector<FourVector> &beam_momentum) const override;
181 
186  ActionList find_final_actions(const Particles & /*search_list*/,
187  bool /*only_res*/ = false) const override {
188  return ActionList();
189  }
190 
201  inline bool is_constant_elastic_isotropic() const {
202  return ParticleType::list_all().size() == 1 && !two_to_one_ && isotropic_ &&
203  elastic_parameter_ > 0.;
204  }
205 
216  double max_transverse_distance_sqr(int testparticles) const {
219  testparticles * fm2_mb * M_1_PI;
220  }
221 
226  void dump_reactions() const;
227 
241  void dump_cross_sections(const ParticleType &a, const ParticleType &b,
242  double m_a, double m_b, bool final_state,
243  std::vector<double> &plab) const;
244 
250  if (strings_switch_) {
251  return string_process_interface_.get();
252  } else {
253  return NULL;
254  }
255  }
256 
257  private:
288  ActionPtr check_collision(const ParticleData &data_a,
289  const ParticleData &data_b, double dt,
290  const std::vector<FourVector> &beam_momentum = {},
291  const double cell_vol = 0.0) const;
292 
294  std::unique_ptr<StringProcess> string_process_interface_;
298  const double elastic_parameter_;
300  const int testparticles_;
302  const bool isotropic_;
304  const bool two_to_one_;
311  const double low_snn_cut_;
313  const bool strings_switch_;
315  const bool use_AQM_;
323  const std::vector<bool> &nucleon_has_interacted_;
325  const int N_tot_;
327  const int N_proj_;
330 };
331 
332 } // namespace smash
333 
334 #endif // SRC_INCLUDE_SCATTERACTIONSFINDER_H_
StringProcess * get_process_string_ptr()
ActionList find_actions_in_cell(const ParticleList &search_list, double dt, const double cell_vol, const std::vector< FourVector > &beam_momentum) const override
Search for all the possible collisions within one cell.
The ThreeVector class represents a physical three-vector with the components .
Definition: threevector.h:31
ActionList find_actions_with_surrounding_particles(const ParticleList &search_list, const Particles &surrounding_list, double dt, const std::vector< FourVector > &beam_momentum) const override
Search for all the possible secondary collisions between the outgoing particles and the rest...
const int testparticles_
Number of test particles.
constexpr double really_small
Numerical error tolerance.
Definition: constants.h:37
Stochastic Criteiron.
String excitation processes used in SMASH.
Definition: processstring.h:46
const ReactionsBitSet incl_set_
List of included 2<->2 reactions.
const FourVector & position() const
Get the particle&#39;s position in Minkowski space.
Definition: particledata.h:185
bool is_constant_elastic_isotropic() const
If there is only one particle sort, no decays (only elastic scatterings are possible), scatterings are isotropic and cross-section fixed to elastic_parameter_ independently on momenta, then maximal cross-section is elastic_parameter_.
const bool two_to_one_
Enable 2->1 processes.
const double low_snn_cut_
Elastic collsions between two nucleons with sqrt_s below low_snn_cut_ are excluded.
const double string_formation_time_
Parameter for formation time.
Collection of useful constants that are known at compile time.
double sqr() const
Definition: threevector.h:259
const bool strings_with_probability_
Decide whether to implement string fragmentation based on a probability.
ActionList find_final_actions(const Particles &, bool=false) const override
Find some final collisions at the end of the simulation.
double max_transverse_distance_sqr(int testparticles) const
The maximal distance over which particles can interact, related to the number of test particles and t...
ThreeVector threevec() const
Definition: fourvector.h:319
constexpr double fm2_mb
mb <-> fm^2 conversion factor.
Definition: constants.h:28
const std::vector< bool > & nucleon_has_interacted_
Parameter to record whether the nucleon has experienced a collision or not.
Interface to the SMASH configuration files.
constexpr double maximum_cross_section
The maximal cross section (in mb) for which it is guaranteed that all collisions with this cross sect...
Definition: constants.h:111
NNbarTreatment
Treatment of N Nbar Annihilation.
std::unique_ptr< StringProcess > string_process_interface_
Class that deals with strings, interfacing Pythia.
const bool strings_switch_
Switch to turn off string excitation.
void dump_cross_sections(const ParticleType &a, const ParticleType &b, double m_a, double m_b, bool final_state, std::vector< double > &plab) const
Print out partial cross-sections of all processes that can occur in the collision of a(mass = m_a) an...
double x0() const
Definition: fourvector.h:303
static const ParticleTypeList & list_all()
Definition: particletype.cc:55
CollisionCriterion
Criteria used to check collisions.
HistoryData get_history() const
Get history information.
Definition: particledata.h:120
Particle type contains the static properties of a particle species.
Definition: particletype.h:97
ScatterActionsFinder(Configuration config, const ExperimentParameters &parameters, const std::vector< bool > &nucleon_has_interacted, int N_tot, int N_proj)
Constructor of the finder with the given parameters.
A simple scatter finder: Just loops through all particles and checks each pair for a collision...
const NNbarTreatment nnbar_treatment_
Switch for NNbar reactions.
ActionPtr check_collision(const ParticleData &data_a, const ParticleData &data_b, double dt, const std::vector< FourVector > &beam_momentum={}, const double cell_vol=0.0) const
Check for a single pair of particles (id_a, id_b) if a collision will happen in the next timestep and...
T uniform(T min, T max)
Definition: random.h:88
std::bitset< 10 > ReactionsBitSet
Container for the 2 to 2 reactions in the code.
void dump_reactions() const
Prints out all the 2-> n (n > 1) reactions with non-zero cross-sections between all possible pairs of...
ActionList find_actions_with_neighbors(const ParticleList &search_list, const ParticleList &neighbors_list, double dt, const std::vector< FourVector > &beam_momentum) const override
Search for all the possible collisions among the neighboring cells.
const bool use_AQM_
Switch to control whether to use AQM or not.
const int N_proj_
Record the number of the nucleons in the projectile.
const bool isotropic_
Do all collisions isotropically.
const int N_tot_
Record the total number of the nucleons in the two colliding nuclei.
ActionFinderInterface is the abstract base class for all action finders, i.e.
The Particles class abstracts the storage and manipulation of particles.
Definition: particles.h:33
double collision_time(const ParticleData &p1, const ParticleData &p2, double dt, const std::vector< FourVector > &beam_momentum) const
Determine the collision time of the two particles.
int32_t id() const
Get the id of the particle.
Definition: particledata.h:70
The FourVector class holds relevant values in Minkowski spacetime with (+, −, −, −) metric signature.
Definition: fourvector.h:33
Helper structure for Experiment.
ParticleData contains the dynamic information of a certain particle.
Definition: particledata.h:52
const double elastic_parameter_
Elastic cross section parameter (in mb).
int32_t collisions_per_particle
Collision counter per particle, zero only for initially present particles.
Definition: particledata.h:26
Definition: action.h:24
const FourVector & momentum() const
Get the particle&#39;s 4-momentum.
Definition: particledata.h:139
const CollisionCriterion coll_crit_
Specifies which collision criterion is used.