Version: SMASH-1.8
smash::ScatterActionsFinder Class Reference

#include <scatteractionsfinder.h>

A simple scatter finder: Just loops through all particles and checks each pair for a collision. It supports two collision criteria: a geometric and stochastic criterion.

Definition at line 31 of file scatteractionsfinder.h.

Inheritance diagram for smash::ScatterActionsFinder:
[legend]
Collaboration diagram for smash::ScatterActionsFinder:
[legend]

Public Member Functions

 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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
ActionList find_final_actions (const Particles &, bool=false) const override
 Find some final collisions at the end of the simulation. More...
 
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_. More...
 
double max_transverse_distance_sqr (int testparticles) const
 The maximal distance over which particles can interact, related to the number of test particles and the maximal cross section. More...
 
void dump_reactions () const
 Prints out all the 2-> n (n > 1) reactions with non-zero cross-sections between all possible pairs of particle types. More...
 
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) and b(mass = m_b). More...
 
StringProcessget_process_string_ptr ()
 
- Public Member Functions inherited from smash::ActionFinderInterface
virtual ~ActionFinderInterface ()=default
 

Private Member Functions

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 create a corresponding Action object in that case. More...
 

Private Attributes

std::unique_ptr< StringProcessstring_process_interface_
 Class that deals with strings, interfacing Pythia. More...
 
const CollisionCriterion coll_crit_
 Specifies which collision criterion is used. More...
 
const double elastic_parameter_
 Elastic cross section parameter (in mb). More...
 
const int testparticles_
 Number of test particles. More...
 
const bool isotropic_
 Do all collisions isotropically. More...
 
const bool two_to_one_
 Enable 2->1 processes. More...
 
const ReactionsBitSet incl_set_
 List of included 2<->2 reactions. More...
 
const double low_snn_cut_
 Elastic collsions between two nucleons with sqrt_s below low_snn_cut_ are excluded. More...
 
const bool strings_switch_
 Switch to turn off string excitation. More...
 
const bool use_AQM_
 Switch to control whether to use AQM or not. More...
 
const bool strings_with_probability_
 Decide whether to implement string fragmentation based on a probability. More...
 
const NNbarTreatment nnbar_treatment_
 Switch for NNbar reactions. More...
 
const std::vector< bool > & nucleon_has_interacted_
 Parameter to record whether the nucleon has experienced a collision or not. More...
 
const int N_tot_
 Record the total number of the nucleons in the two colliding nuclei. More...
 
const int N_proj_
 Record the number of the nucleons in the projectile. More...
 
const double string_formation_time_
 Parameter for formation time. More...
 

Constructor & Destructor Documentation

◆ ScatterActionsFinder()

smash::ScatterActionsFinder::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.

Parameters
[in]configConfiguration of smash from which we take: 1) A global elastic cross section [mb]. It will be used regardless of the species of the colliding particles. It won't be used if the value is negative. 2) An option determining whether all the scatterings are isotropic 3) Parameters of the string process
[in]parametersStruct of parameters determining whether to exclude some certain types of scatterings and switching among the methods to treat with the NNbar collisions.
[in]nucleon_has_interactedFlags to record whether an initial nucleon has interacted with another particle not from the same nucleus. The flags are used if we want to exclude the first collisions among the nucleons within the same nucleus.
[in]N_totTotal number of the initial nucleons. This number, as well as the next parameter, will be used to determine whether two intial nucleons are within the same nucleus if we'd like to exclude the first collisions among them.
[in]N_projTotal projectile number

Definition at line 232 of file scatteractionsfinder.cc.

235  : coll_crit_(config.take({"Collision_Term", "Collision_Criterion"},
238  config.take({"Collision_Term", "Elastic_Cross_Section"}, -1.)),
239  testparticles_(parameters.testparticles),
240  isotropic_(config.take({"Collision_Term", "Isotropic"}, false)),
241  two_to_one_(parameters.two_to_one),
242  incl_set_(parameters.included_2to2),
243  low_snn_cut_(parameters.low_snn_cut),
244  strings_switch_(parameters.strings_switch),
245  use_AQM_(parameters.use_AQM),
246  strings_with_probability_(parameters.strings_with_probability),
247  nnbar_treatment_(parameters.nnbar_treatment),
248  nucleon_has_interacted_(nucleon_has_interacted),
249  N_tot_(N_tot),
250  N_proj_(N_proj),
251  string_formation_time_(config.take(
252  {"Collision_Term", "String_Parameters", "Formation_Time"}, 1.)) {
255  throw std::invalid_argument(
256  "The stochastic collision criterion is only supported for elastic (and "
257  "isotropic)\n2-to-2 reactions of one particle species. Change you "
258  "config accordingly.");
259  }
261  logg[LFindScatter].info(
262  "Constant elastic isotropic cross-section mode:", " using ",
263  elastic_parameter_, " mb as maximal cross-section.");
264  }
265  if (strings_switch_) {
266  auto subconfig = config["Collision_Term"]["String_Parameters"];
267  string_process_interface_ = make_unique<StringProcess>(
268  subconfig.take({"String_Tension"}, 1.0), string_formation_time_,
269  subconfig.take({"Gluon_Beta"}, 0.5),
270  subconfig.take({"Gluon_Pmin"}, 0.001),
271  subconfig.take({"Quark_Alpha"}, 2.0),
272  subconfig.take({"Quark_Beta"}, 7.0),
273  subconfig.take({"Strange_Supp"}, 0.16),
274  subconfig.take({"Diquark_Supp"}, 0.036),
275  subconfig.take({"Sigma_Perp"}, 0.42),
276  subconfig.take({"StringZ_A_Leading"}, 0.2),
277  subconfig.take({"StringZ_B_Leading"}, 2.0),
278  subconfig.take({"StringZ_A"}, 2.0), subconfig.take({"StringZ_B"}, 0.55),
279  subconfig.take({"String_Sigma_T"}, 0.5),
280  subconfig.take({"Form_Time_Factor"}, 1.0),
281  subconfig.take({"Mass_Dependent_Formation_Times"}, false),
282  subconfig.take({"Prob_proton_to_d_uu"}, 1. / 3.),
283  subconfig.take({"Separate_Fragment_Baryon"}, true),
284  subconfig.take({"Popcorn_Rate"}, 0.15));
285  }
286 }

Member Function Documentation

◆ collision_time()

double smash::ScatterActionsFinder::collision_time ( const ParticleData p1,
const ParticleData p2,
double  dt,
const std::vector< FourVector > &  beam_momentum 
) const
inline

Determine the collision time of the two particles.

Time of the closest approach is taken as collision time, if the geometric collision criterion is used. For stochastic criterion the time is distributed uniformly within the timestep as in Xu:2004mz [48].

Parameters
[in]p1First incoming particle
[in]p2Second incoming particle
[in]dtThe maximum time interval at the current time step [fm]
[in]beam_momentum[GeV] List of beam momenta for each particle; only necessary for frozen Fermi motion
Returns
How long does it take for the two incoming particles to propagate before scattering [fm/c]. It's set equal to -1 if the two particles are not moving relative to each other.

UrQMD collision time in computational frame, see Bass:1998ca [4] (3.28): position of particle 1: \(r_1\) [fm] position of particle 2: \(r_2\) [fm] velocity of particle 1: \(v_1\) velocity of particle 1: \(v_2\)

\[t_{coll} = - (r_1 - r_2) . (v_1 - v_2) / (v_1 - v_2)^2\]

[fm/c]

Definition at line 78 of file scatteractionsfinder.h.

80  {
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
97  (p1.get_history().collisions_per_particle == 0);
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
102  (p2.get_history().collisions_per_particle == 0);
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  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_actions_in_cell()

ActionList smash::ScatterActionsFinder::find_actions_in_cell ( const ParticleList &  search_list,
double  dt,
const double  cell_vol,
const std::vector< FourVector > &  beam_momentum 
) const
overridevirtual

Search for all the possible collisions within one cell.

This function is only used for counting the primary collisions at the beginning of each time step. (Although it's also called afterwards for searching the secondary collisions among the outgoing particles, no new actions will be found since the scattered pairs cannot scatter again.)

Parameters
[in]search_listA list of particles within one cell
[in]dtThe maximum time interval at the current time step [fm]
[in]cell_volVolume of searched grid cell [fm^3]
[in]beam_momentum[GeV] List of beam momenta for each particle; only necessary for frozen Fermi motion
Returns
A list of possible scatter actions

Implements smash::ActionFinderInterface.

Definition at line 414 of file scatteractionsfinder.cc.

416  {
417  std::vector<ActionPtr> actions;
418  for (const ParticleData& p1 : search_list) {
419  for (const ParticleData& p2 : search_list) {
420  if (p1.id() < p2.id()) {
421  // Check if a collision is possible.
422  ActionPtr act = check_collision(p1, p2, dt, beam_momentum, cell_vol);
423  if (act) {
424  actions.push_back(std::move(act));
425  }
426  }
427  }
428  }
429  return actions;
430 }
Here is the call graph for this function:

◆ find_actions_with_neighbors()

ActionList smash::ScatterActionsFinder::find_actions_with_neighbors ( const ParticleList &  search_list,
const ParticleList &  neighbors_list,
double  dt,
const std::vector< FourVector > &  beam_momentum 
) const
overridevirtual

Search for all the possible collisions among the neighboring cells.

This function is only used for counting the primary collisions at the beginning of each time step.

Parameters
[in]search_listA list of particles within the current cell
[in]neighbors_listA list of particles within the neighboring cell
[in]dtThe maximum time interval at the current time step [fm/c]
[in]beam_momentum[GeV] List of beam momenta for each particle; only necessary for frozen Fermi motion
Returns
A list of possible scatter actions

Implements smash::ActionFinderInterface.

Definition at line 432 of file scatteractionsfinder.cc.

434  {
435  std::vector<ActionPtr> actions;
437  // Only search in cells
438  return actions;
439  }
440  for (const ParticleData& p1 : search_list) {
441  for (const ParticleData& p2 : neighbors_list) {
442  assert(p1.id() != p2.id());
443  // Check if a collision is possible.
444  ActionPtr act = check_collision(p1, p2, dt, beam_momentum);
445  if (act) {
446  actions.push_back(std::move(act));
447  }
448  }
449  }
450  return actions;
451 }
Here is the call graph for this function:

◆ find_actions_with_surrounding_particles()

ActionList smash::ScatterActionsFinder::find_actions_with_surrounding_particles ( const ParticleList &  search_list,
const Particles surrounding_list,
double  dt,
const std::vector< FourVector > &  beam_momentum 
) const
overridevirtual

Search for all the possible secondary collisions between the outgoing particles and the rest.

Parameters
[in]search_listA list of particles within the current cell
[in]surrounding_listThe whole particle list
[in]dtThe maximum time interval at the current time step [fm/c]
[in]beam_momentum[GeV] List of beam momenta for each particle; only necessary for frozen Fermi motion
Returns
A list of possible scatter actions

Implements smash::ActionFinderInterface.

Definition at line 453 of file scatteractionsfinder.cc.

455  {
456  std::vector<ActionPtr> actions;
458  // Only search in cells
459  return actions;
460  }
461  for (const ParticleData& p2 : surrounding_list) {
462  /* don't look for collisions if the particle from the surrounding list is
463  * also in the search list */
464  auto result = std::find_if(
465  search_list.begin(), search_list.end(),
466  [&p2](const ParticleData& p) { return p.id() == p2.id(); });
467  if (result != search_list.end()) {
468  continue;
469  }
470  for (const ParticleData& p1 : search_list) {
471  // Check if a collision is possible.
472  ActionPtr act = check_collision(p1, p2, dt, beam_momentum);
473  if (act) {
474  actions.push_back(std::move(act));
475  }
476  }
477  }
478  return actions;
479 }
Here is the call graph for this function:

◆ find_final_actions()

ActionList smash::ScatterActionsFinder::find_final_actions ( const Particles ,
bool  = false 
) const
inlineoverridevirtual

Find some final collisions at the end of the simulation.

Todo:
Seems to do nothing.

Implements smash::ActionFinderInterface.

Definition at line 186 of file scatteractionsfinder.h.

187  {
188  return ActionList();
189  }

◆ is_constant_elastic_isotropic()

bool smash::ScatterActionsFinder::is_constant_elastic_isotropic ( ) const
inline

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_.

This knowledge can be used for improving performance.

Returns
A boolean indicating whether all the scatterings are elastic and isotropic

Definition at line 201 of file scatteractionsfinder.h.

201  {
202  return ParticleType::list_all().size() == 1 && !two_to_one_ && isotropic_ &&
203  elastic_parameter_ > 0.;
204  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ max_transverse_distance_sqr()

double smash::ScatterActionsFinder::max_transverse_distance_sqr ( int  testparticles) const
inline

The maximal distance over which particles can interact, related to the number of test particles and the maximal cross section.

Parameters
[in]testparticlesNumber of test particles.
Returns
Maximal transverse distance squared. [fm \(^{2}\)] Particle pairs whose transverse distance is larger than this are not checked for collisions.

Definition at line 216 of file scatteractionsfinder.h.

216  {
219  testparticles * fm2_mb * M_1_PI;
220  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dump_reactions()

void smash::ScatterActionsFinder::dump_reactions ( ) const

Prints out all the 2-> n (n > 1) reactions with non-zero cross-sections between all possible pairs of particle types.

Definition at line 481 of file scatteractionsfinder.cc.

481  {
482  constexpr double time = 0.0;
483 
484  const size_t N_isotypes = IsoParticleType::list_all().size();
485  const size_t N_pairs = N_isotypes * (N_isotypes - 1) / 2;
486 
487  std::cout << N_isotypes << " iso-particle types." << std::endl;
488  std::cout << "They can make " << N_pairs << " pairs." << std::endl;
489  std::vector<double> momentum_scan_list = {0.1, 0.3, 0.5, 1.0,
490  2.0, 3.0, 5.0, 10.0};
491  for (const IsoParticleType& A_isotype : IsoParticleType::list_all()) {
492  for (const IsoParticleType& B_isotype : IsoParticleType::list_all()) {
493  if (&A_isotype > &B_isotype) {
494  continue;
495  }
496  bool any_nonzero_cs = false;
497  std::vector<std::string> r_list;
498  for (const ParticleTypePtr A_type : A_isotype.get_states()) {
499  for (const ParticleTypePtr B_type : B_isotype.get_states()) {
500  if (A_type > B_type) {
501  continue;
502  }
503  ParticleData A(*A_type), B(*B_type);
504  for (auto mom : momentum_scan_list) {
505  A.set_4momentum(A.pole_mass(), mom, 0.0, 0.0);
506  B.set_4momentum(B.pole_mass(), -mom, 0.0, 0.0);
507  ScatterActionPtr act = make_unique<ScatterAction>(
508  A, B, time, isotropic_, string_formation_time_);
509  if (strings_switch_) {
510  act->set_string_interface(string_process_interface_.get());
511  }
512  act->add_all_scatterings(elastic_parameter_, two_to_one_, incl_set_,
516  const double total_cs = act->cross_section();
517  if (total_cs <= 0.0) {
518  continue;
519  }
520  any_nonzero_cs = true;
521  for (const auto& channel : act->collision_channels()) {
522  const auto type = channel->get_type();
523  std::string r;
524  if (is_string_soft_process(type) ||
525  type == ProcessType::StringHard) {
526  r = A_type->name() + B_type->name() + std::string(" → strings");
527  } else {
528  std::string r_type =
529  (type == ProcessType::Elastic)
530  ? std::string(" (el)")
531  : (channel->get_type() == ProcessType::TwoToTwo)
532  ? std::string(" (inel)")
533  : std::string(" (?)");
534  r = A_type->name() + B_type->name() + std::string(" → ") +
535  channel->particle_types()[0]->name() +
536  channel->particle_types()[1]->name() + r_type;
537  }
538  isoclean(r);
539  r_list.push_back(r);
540  }
541  }
542  }
543  }
544  std::sort(r_list.begin(), r_list.end());
545  r_list.erase(std::unique(r_list.begin(), r_list.end()), r_list.end());
546  if (any_nonzero_cs) {
547  for (auto r : r_list) {
548  std::cout << r;
549  if (r_list.back() != r) {
550  std::cout << ", ";
551  }
552  }
553  std::cout << std::endl;
554  }
555  }
556  }
557 }
Here is the call graph for this function:

◆ dump_cross_sections()

void smash::ScatterActionsFinder::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) and b(mass = m_b).

Parameters
[in]aThe specie of the first incoming particle.
[in]bThe specie of the second incoming particle.
[in]m_aMass of species a [GeV].
[in]m_bMass of species b [GeV].
[in]final_stateWhether the final state cross sections should be printed.
[in]plabOptional momenta in lab frame to be evaluated [GeV]. Ignored if empty.

Definition at line 868 of file scatteractionsfinder.cc.

870  {
871  typedef std::vector<std::pair<double, double>> xs_saver;
872  std::map<std::string, xs_saver> xs_dump;
873  std::map<std::string, double> outgoing_total_mass;
874 
875  ParticleData a_data(a), b_data(b);
876  int n_momentum_points = 200;
877  constexpr double momentum_step = 0.02;
878  /*
879  // Round to output precision.
880  for (auto& p : plab) {
881  p = std::floor((p * 100000) + 0.5) / 100000;
882  }
883  */
884  if (plab.size() > 0) {
885  n_momentum_points = plab.size();
886  // Remove duplicates.
887  std::sort(plab.begin(), plab.end());
888  plab.erase(std::unique(plab.begin(), plab.end()), plab.end());
889  }
890  for (int i = 0; i < n_momentum_points; i++) {
891  double momentum;
892  if (plab.size() > 0) {
893  momentum = pCM_from_s(s_from_plab(plab.at(i), m_a, m_b), m_a, m_b);
894  } else {
895  momentum = momentum_step * (i + 1);
896  }
897  a_data.set_4momentum(m_a, momentum, 0.0, 0.0);
898  b_data.set_4momentum(m_b, -momentum, 0.0, 0.0);
899  const double sqrts = (a_data.momentum() + b_data.momentum()).abs();
900  const ParticleList incoming = {a_data, b_data};
901  ScatterActionPtr act = make_unique<ScatterAction>(
902  a_data, b_data, 0., isotropic_, string_formation_time_);
903  if (strings_switch_) {
904  act->set_string_interface(string_process_interface_.get());
905  }
906  act->add_all_scatterings(elastic_parameter_, two_to_one_, incl_set_,
909  decaytree::Node tree(a.name() + b.name(), act->cross_section(), {&a, &b},
910  {&a, &b}, {&a, &b}, {});
911  const CollisionBranchList& processes = act->collision_channels();
912  for (const auto& process : processes) {
913  const double xs = process->weight();
914  if (xs <= 0.0) {
915  continue;
916  }
917  if (!final_state) {
918  std::stringstream process_description_stream;
919  process_description_stream << *process;
920  const std::string& description = process_description_stream.str();
921  double m_tot = 0.0;
922  for (const auto& ptype : process->particle_types()) {
923  m_tot += ptype->mass();
924  }
925  outgoing_total_mass[description] = m_tot;
926  if (!xs_dump[description].empty() &&
927  std::abs(xs_dump[description].back().first - sqrts) <
928  really_small) {
929  xs_dump[description].back().second += xs;
930  } else {
931  xs_dump[description].push_back(std::make_pair(sqrts, xs));
932  }
933  } else {
934  std::stringstream process_description_stream;
935  process_description_stream << *process;
936  const std::string& description = process_description_stream.str();
937  ParticleTypePtrList initial_particles = {&a, &b};
938  ParticleTypePtrList final_particles = process->particle_types();
939  auto& process_node =
940  tree.add_action(description, xs, std::move(initial_particles),
941  std::move(final_particles));
942  decaytree::add_decays(process_node, sqrts);
943  }
944  }
945  xs_dump["total"].push_back(std::make_pair(sqrts, act->cross_section()));
946  // Total cross-section should be the first in the list -> negative mass
947  outgoing_total_mass["total"] = -1.0;
948  if (final_state) {
949  // tree.print();
950  auto final_state_xs = tree.final_state_cross_sections();
951  deduplicate(final_state_xs);
952  for (const auto& p : final_state_xs) {
953  // Don't print empty columns.
954  //
955  // FIXME(steinberg): The better fix would be to not have them in the
956  // first place.
957  if (p.name_ == "") {
958  continue;
959  }
960  outgoing_total_mass[p.name_] = p.mass_;
961  xs_dump[p.name_].push_back(std::make_pair(sqrts, p.cross_section_));
962  }
963  }
964  }
965  // Get rid of cross sections that are zero.
966  // (This only happens if their is a resonance in the final state that cannot
967  // decay with our simplified assumptions.)
968  for (auto it = begin(xs_dump); it != end(xs_dump);) {
969  // Sum cross section over all energies.
970  const xs_saver& xs = (*it).second;
971  double sum = 0;
972  for (const auto& p : xs) {
973  sum += p.second;
974  }
975  if (sum == 0.) {
976  it = xs_dump.erase(it);
977  } else {
978  ++it;
979  }
980  }
981 
982  // Nice ordering of channels by summed pole mass of products
983  std::vector<std::string> all_channels;
984  for (const auto channel : xs_dump) {
985  all_channels.push_back(channel.first);
986  }
987  std::sort(all_channels.begin(), all_channels.end(),
988  [&](const std::string& str_a, const std::string& str_b) {
989  return outgoing_total_mass[str_a] < outgoing_total_mass[str_b];
990  });
991 
992  // Print header
993  std::cout << "# Dumping partial " << a.name() << b.name()
994  << " cross-sections in mb, energies in GeV" << std::endl;
995  std::cout << " sqrt_s";
996  // Align everything to 16 unicode characters.
997  // This should be enough for the longest channel name (7 final-state
998  // particles).
999  for (const auto channel : all_channels) {
1000  std::cout << utf8::fill_left(channel, 16, ' ');
1001  }
1002  std::cout << std::endl;
1003 
1004  // Print out all partial cross-sections in mb
1005  for (int i = 0; i < n_momentum_points; i++) {
1006  double momentum;
1007  if (plab.size() > 0) {
1008  momentum = pCM_from_s(s_from_plab(plab.at(i), m_a, m_b), m_a, m_b);
1009  } else {
1010  momentum = momentum_step * (i + 1);
1011  }
1012  a_data.set_4momentum(m_a, momentum, 0.0, 0.0);
1013  b_data.set_4momentum(m_b, -momentum, 0.0, 0.0);
1014  const double sqrts = (a_data.momentum() + b_data.momentum()).abs();
1015  std::printf("%9.6f", sqrts);
1016  for (const auto channel : all_channels) {
1017  const xs_saver energy_and_xs = xs_dump[channel];
1018  size_t j = 0;
1019  for (; j < energy_and_xs.size() && energy_and_xs[j].first < sqrts; j++) {
1020  }
1021  double xs = 0.0;
1022  if (j < energy_and_xs.size() &&
1023  std::abs(energy_and_xs[j].first - sqrts) < really_small) {
1024  xs = energy_and_xs[j].second;
1025  }
1026  std::printf("%16.6f", xs); // Same alignment as in the header.
1027  }
1028  std::printf("\n");
1029  }
1030 }
Here is the call graph for this function:

◆ get_process_string_ptr()

StringProcess* smash::ScatterActionsFinder::get_process_string_ptr ( )
inline
Returns
Pointer to the string process class object. If string is turned off, the null pointer is returned.

Definition at line 249 of file scatteractionsfinder.h.

249  {
250  if (strings_switch_) {
251  return string_process_interface_.get();
252  } else {
253  return NULL;
254  }
255  }

◆ check_collision()

ActionPtr smash::ScatterActionsFinder::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
private

Check for a single pair of particles (id_a, id_b) if a collision will happen in the next timestep and create a corresponding Action object in that case.

Two criteria for the collision decision are supported: 1. The default geometric criterion from UrQMD Bass:1998ca [4] (3.27). 2. A stochastic collision criterion e.g. employed by BAMPS Xu:2004mz [48] (Sec.IIB). Note, the latter is currently only tested for a box with a fixed elastic cross section.

More details on the stochastic collision criterion can be found here:

  • P. Danielewicz and G. F. Bertsch, Nucl. Phys. A533, 712 (1991).
  • A. Lang, H. Babovsky, W. Cassing, U. Mosel, H. G. Reusch, and K. Weber, J. Comp. Phys. 106, 391 (1993).
  • W. Cassing, Nucl. Phys. A700, 618 (2002).
Parameters
[in]data_aFirst incoming particle
[in]data_bSecond incoming particle
[in]dtMaximum time interval within which a collision can happen
[in]beam_momentum[GeV] List of beam momenta for each particle; only necessary for frozen Fermi motion
[in]cell_vol(optional) volume of grid cell in which the collision is checked
Returns
A null pointer if no collision happens or an action which contains the information of the outgoing particles.

Note: cell_vol is optional, since only find_actions_in_cell has (and needs) this information for the stochastic collision criterion.

Definition at line 288 of file scatteractionsfinder.cc.

290  {
291  /* If the two particles
292  * 1) belong to the two colliding nuclei
293  * 2) are within the same nucleus
294  * 3) both of them have never experienced any collisons,
295  * then the collision between them are banned. */
296  assert(data_a.id() >= 0);
297  assert(data_b.id() >= 0);
298  if (data_a.id() < N_tot_ && data_b.id() < N_tot_ &&
299  ((data_a.id() < N_proj_ && data_b.id() < N_proj_) ||
300  (data_a.id() >= N_proj_ && data_b.id() >= N_proj_)) &&
301  !(nucleon_has_interacted_[data_a.id()] ||
302  nucleon_has_interacted_[data_b.id()])) {
303  return nullptr;
304  }
305 
306  // Determine time of collision.
307  const double time_until_collision =
308  collision_time(data_a, data_b, dt, beam_momentum);
309 
310  // Check that collision happens in this timestep.
311  if (time_until_collision < 0. || time_until_collision >= dt) {
312  return nullptr;
313  }
314 
315  // Create ScatterAction object.
316  ScatterActionPtr act = make_unique<ScatterAction>(
317  data_a, data_b, time_until_collision, isotropic_, string_formation_time_);
318 
319  if (strings_switch_) {
320  act->set_string_interface(string_process_interface_.get());
321  }
322 
324  // No grid or search in cell
325  if (cell_vol < really_small) {
326  return nullptr;
327  }
328 
329  // Add various subprocesses.
330  act->add_all_scatterings(elastic_parameter_, two_to_one_, incl_set_,
333 
334  const double xs = act->cross_section() * fm2_mb;
335 
336  // Relative velocity calculation, see e.g. \iref{Seifert:2017oyb}, eq. (5)
337  const double m1 = act->incoming_particles()[0].effective_mass();
338  const double m1_sqr = m1 * m1;
339  const double m2 = act->incoming_particles()[1].effective_mass();
340  const double m2_sqr = m2 * m2;
341  const double e1 = act->incoming_particles()[0].momentum().x0();
342  const double e2 = act->incoming_particles()[1].momentum().x0();
343  const double m_s = act->mandelstam_s();
344  const double lambda = (m_s - m1_sqr - m2_sqr) * (m_s - m1_sqr - m2_sqr) -
345  4. * m1_sqr * m2_sqr;
346  const double v_rel = std::sqrt(lambda) / (2. * e1 * e2);
347 
348  // Collision probability, see e.g. \iref{Xu:2004mz}, eq. (11)
349  const double p_22 = xs * v_rel * dt / (cell_vol * testparticles_);
350 
351  logg[LFindScatter].debug(
352  "Stochastic collison criterion parameters:\np_22 = ", p_22,
353  ", xs = ", xs, ", v_rel = ", v_rel, ", dt = ", dt,
354  ", cell_vol = ", cell_vol, ", testparticles = ", testparticles_);
355 
356  if (p_22 > 1.) {
357  std::stringstream err;
358  err << "Probability larger than 1 for stochastic rates. ( P = " << p_22
359  << " )\nUse smaller timesteps.";
360  throw std::runtime_error(err.str());
361  }
362 
363  // probability criterion
364  double random_no = random::uniform(0., 1.);
365  if (random_no > p_22) {
366  return nullptr;
367  }
368 
370  // just collided with this particle
371  if (data_a.id_process() > 0 && data_a.id_process() == data_b.id_process()) {
372  logg[LFindScatter].debug("Skipping collided particles at time ",
373  data_a.position().x0(), " due to process ",
374  data_a.id_process(), "\n ", data_a, "\n<-> ",
375  data_b);
376 
377  return nullptr;
378  }
379 
380  const double distance_squared = act->transverse_distance_sqr();
381 
382  // Don't calculate cross section if the particles are very far apart.
383  if (distance_squared >= max_transverse_distance_sqr(testparticles_)) {
384  return nullptr;
385  }
386 
387  // Add various subprocesses.
388  act->add_all_scatterings(elastic_parameter_, two_to_one_, incl_set_,
391 
392  // Cross section for collision criterion
393  double cross_section_criterion = act->cross_section() * fm2_mb * M_1_PI /
394  static_cast<double>(testparticles_);
395 
396  // Take cross section scaling factors into account
397  cross_section_criterion *= data_a.xsec_scaling_factor(time_until_collision);
398  cross_section_criterion *= data_b.xsec_scaling_factor(time_until_collision);
399 
400  // distance criterion according to cross_section
401  if (distance_squared >= cross_section_criterion) {
402  return nullptr;
403  }
404 
405  logg[LFindScatter].debug("particle distance squared: ", distance_squared,
406  "\n ", data_a, "\n<-> ", data_b);
407  }
408 
409  // Using std::move here is redundant with newer compilers, but required for
410  // supporting GCC 4.8. Once we drop this support, std::move should be removed.
411  return std::move(act);
412 }
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ string_process_interface_

std::unique_ptr<StringProcess> smash::ScatterActionsFinder::string_process_interface_
private

Class that deals with strings, interfacing Pythia.

Definition at line 294 of file scatteractionsfinder.h.

◆ coll_crit_

const CollisionCriterion smash::ScatterActionsFinder::coll_crit_
private

Specifies which collision criterion is used.

Definition at line 296 of file scatteractionsfinder.h.

◆ elastic_parameter_

const double smash::ScatterActionsFinder::elastic_parameter_
private

Elastic cross section parameter (in mb).

Definition at line 298 of file scatteractionsfinder.h.

◆ testparticles_

const int smash::ScatterActionsFinder::testparticles_
private

Number of test particles.

Definition at line 300 of file scatteractionsfinder.h.

◆ isotropic_

const bool smash::ScatterActionsFinder::isotropic_
private

Do all collisions isotropically.

Definition at line 302 of file scatteractionsfinder.h.

◆ two_to_one_

const bool smash::ScatterActionsFinder::two_to_one_
private

Enable 2->1 processes.

Definition at line 304 of file scatteractionsfinder.h.

◆ incl_set_

const ReactionsBitSet smash::ScatterActionsFinder::incl_set_
private

List of included 2<->2 reactions.

Definition at line 306 of file scatteractionsfinder.h.

◆ low_snn_cut_

const double smash::ScatterActionsFinder::low_snn_cut_
private

Elastic collsions between two nucleons with sqrt_s below low_snn_cut_ are excluded.

Definition at line 311 of file scatteractionsfinder.h.

◆ strings_switch_

const bool smash::ScatterActionsFinder::strings_switch_
private

Switch to turn off string excitation.

Definition at line 313 of file scatteractionsfinder.h.

◆ use_AQM_

const bool smash::ScatterActionsFinder::use_AQM_
private

Switch to control whether to use AQM or not.

Definition at line 315 of file scatteractionsfinder.h.

◆ strings_with_probability_

const bool smash::ScatterActionsFinder::strings_with_probability_
private

Decide whether to implement string fragmentation based on a probability.

Definition at line 317 of file scatteractionsfinder.h.

◆ nnbar_treatment_

const NNbarTreatment smash::ScatterActionsFinder::nnbar_treatment_
private

Switch for NNbar reactions.

Definition at line 319 of file scatteractionsfinder.h.

◆ nucleon_has_interacted_

const std::vector<bool>& smash::ScatterActionsFinder::nucleon_has_interacted_
private

Parameter to record whether the nucleon has experienced a collision or not.

Definition at line 323 of file scatteractionsfinder.h.

◆ N_tot_

const int smash::ScatterActionsFinder::N_tot_
private

Record the total number of the nucleons in the two colliding nuclei.

Definition at line 325 of file scatteractionsfinder.h.

◆ N_proj_

const int smash::ScatterActionsFinder::N_proj_
private

Record the number of the nucleons in the projectile.

Definition at line 327 of file scatteractionsfinder.h.

◆ string_formation_time_

const double smash::ScatterActionsFinder::string_formation_time_
private

Parameter for formation time.

Definition at line 329 of file scatteractionsfinder.h.


The documentation for this class was generated from the following files:
smash::ScatterActionsFinder::low_snn_cut_
const double low_snn_cut_
Elastic collsions between two nucleons with sqrt_s below low_snn_cut_ are excluded.
Definition: scatteractionsfinder.h:311
smash::ProcessType::StringHard
hard string process involving 2->2 QCD process by PYTHIA.
smash::maximum_cross_section
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
smash::ScatterActionsFinder::string_formation_time_
const double string_formation_time_
Parameter for formation time.
Definition: scatteractionsfinder.h:329
smash::ScatterActionsFinder::elastic_parameter_
const double elastic_parameter_
Elastic cross section parameter (in mb).
Definition: scatteractionsfinder.h:298
smash::ScatterActionsFinder::string_process_interface_
std::unique_ptr< StringProcess > string_process_interface_
Class that deals with strings, interfacing Pythia.
Definition: scatteractionsfinder.h:294
smash::s_from_plab
double s_from_plab(double plab, double m_P, double m_T)
Convert p_lab to Mandelstam-s for a fixed-target setup, with a projectile of mass m_P and momentum pl...
Definition: kinematics.h:224
smash::ScatterActionsFinder::testparticles_
const int testparticles_
Number of test particles.
Definition: scatteractionsfinder.h:300
smash::utf8::fill_left
std::string fill_left(const std::string &s, size_t width, char fill=' ')
Fill string with characters to the left until the given width is reached.
Definition: stringfunctions.cc:47
smash::is_string_soft_process
bool is_string_soft_process(ProcessType p)
Check if a given process type is a soft string excitation.
Definition: processbranch.cc:18
smash::ScatterActionsFinder::incl_set_
const ReactionsBitSet incl_set_
List of included 2<->2 reactions.
Definition: scatteractionsfinder.h:306
smash::ScatterActionsFinder::strings_with_probability_
const bool strings_with_probability_
Decide whether to implement string fragmentation based on a probability.
Definition: scatteractionsfinder.h:317
smash::ScatterActionsFinder::two_to_one_
const bool two_to_one_
Enable 2->1 processes.
Definition: scatteractionsfinder.h:304
smash::LFindScatter
static constexpr int LFindScatter
Definition: scatteractionsfinder.cc:31
smash::ScatterActionsFinder::nucleon_has_interacted_
const std::vector< bool > & nucleon_has_interacted_
Parameter to record whether the nucleon has experienced a collision or not.
Definition: scatteractionsfinder.h:323
smash::ProcessType::TwoToTwo
2->2 inelastic scattering
smash::ScatterActionsFinder::max_transverse_distance_sqr
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...
Definition: scatteractionsfinder.h:216
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::deduplicate
static void deduplicate(std::vector< FinalStateCrossSection > &final_state_xs)
Deduplicate the final-state cross sections by summing.
Definition: scatteractionsfinder.cc:849
smash::really_small
constexpr double really_small
Numerical error tolerance.
Definition: constants.h:37
smash::ScatterActionsFinder::collision_time
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.
Definition: scatteractionsfinder.h:78
smash::isoclean
void isoclean(std::string &s)
Remove ⁺, ⁻, ⁰ from string.
Definition: stringfunctions.cc:92
smash::ScatterActionsFinder::nnbar_treatment_
const NNbarTreatment nnbar_treatment_
Switch for NNbar reactions.
Definition: scatteractionsfinder.h:319
CollisionCriterion::Stochastic
Stochastic Criteiron.
smash::ScatterActionsFinder::strings_switch_
const bool strings_switch_
Switch to turn off string excitation.
Definition: scatteractionsfinder.h:313
smash::decaytree::add_decays
static void add_decays(Node &node, double sqrts)
Add nodes for all decays possible from the given node and all of its children.
Definition: scatteractionsfinder.cc:787
smash::ScatterActionsFinder::is_constant_elastic_isotropic
bool is_constant_elastic_isotropic() const
If there is only one particle sort, no decays (only elastic scatterings are possible),...
Definition: scatteractionsfinder.h:201
smash::ScatterActionsFinder::isotropic_
const bool isotropic_
Do all collisions isotropically.
Definition: scatteractionsfinder.h:302
smash::ScatterActionsFinder::use_AQM_
const bool use_AQM_
Switch to control whether to use AQM or not.
Definition: scatteractionsfinder.h:315
smash::fm2_mb
constexpr double fm2_mb
mb <-> fm^2 conversion factor.
Definition: constants.h:28
smash::ProcessType::Elastic
elastic scattering: particles remain the same, only momenta change
smash::pdg::p
constexpr int p
Proton.
Definition: pdgcode_constants.h:28
smash::random::uniform
T uniform(T min, T max)
Definition: random.h:88
smash::ScatterActionsFinder::N_tot_
const int N_tot_
Record the total number of the nucleons in the two colliding nuclei.
Definition: scatteractionsfinder.h:325
CollisionCriterion::Geometric
(Default) geometric criterion.
smash::ScatterActionsFinder::check_collision
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...
Definition: scatteractionsfinder.cc:288
smash::ScatterActionsFinder::N_proj_
const int N_proj_
Record the number of the nucleons in the projectile.
Definition: scatteractionsfinder.h:327
smash::ScatterActionsFinder::coll_crit_
const CollisionCriterion coll_crit_
Specifies which collision criterion is used.
Definition: scatteractionsfinder.h:296
smash::IsoParticleType::list_all
static const IsoParticleTypeList & list_all()
Returns a list of all IsoParticleTypes.
Definition: isoparticletype.cc:43
smash::ParticleType::list_all
static const ParticleTypeList & list_all()
Definition: particletype.cc:57
smash::pCM_from_s
T pCM_from_s(const T s, const T mass_a, const T mass_b) noexcept
Definition: kinematics.h:66