Version: SMASH-1.5.1
smash::ScatterActionsFinder Class Reference

#include <scatteractionsfinder.h>

A simple scatter finder: Just loops through all particles and checks each pair for a collision.

Definition at line 30 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...
 
ActionList find_actions_in_cell (const ParticleList &search_list, double dt) 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 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 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) 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
 

Static Public Member Functions

static double collision_time (const ParticleData &p1, const ParticleData &p2)
 Determine the collision time of the two particles. More...
 

Private Member Functions

ActionPtr check_collision (const ParticleData &data_a, const ParticleData &data_b, double dt) 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 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 193 of file scatteractionsfinder.cc.

197  config.take({"Collision_Term", "Elastic_Cross_Section"}, -1.)),
198  testparticles_(parameters.testparticles),
199  isotropic_(config.take({"Collision_Term", "Isotropic"}, false)),
200  two_to_one_(parameters.two_to_one),
201  incl_set_(parameters.included_2to2),
202  low_snn_cut_(parameters.low_snn_cut),
203  strings_switch_(parameters.strings_switch),
204  use_AQM_(parameters.use_AQM),
205  strings_with_probability_(parameters.strings_with_probability),
206  nnbar_treatment_(parameters.nnbar_treatment),
207  nucleon_has_interacted_(nucleon_has_interacted),
208  N_tot_(N_tot),
209  N_proj_(N_proj),
210  string_formation_time_(config.take(
211  {"Collision_Term", "String_Parameters", "Formation_Time"}, 1.)) {
213  const auto& log = logger<LogArea::FindScatter>();
214  log.info("Constant elastic isotropic cross-section mode:", " using ",
215  elastic_parameter_, " mb as maximal cross-section.");
216  }
217  if (strings_switch_) {
218  auto subconfig = config["Collision_Term"]["String_Parameters"];
219  string_process_interface_ = make_unique<StringProcess>(
220  subconfig.take({"String_Tension"}, 1.0), string_formation_time_,
221  subconfig.take({"Gluon_Beta"}, 0.5),
222  subconfig.take({"Gluon_Pmin"}, 0.001),
223  subconfig.take({"Quark_Alpha"}, 2.0),
224  subconfig.take({"Quark_Beta"}, 5.0),
225  subconfig.take({"Strange_Supp"}, 0.12),
226  subconfig.take({"Diquark_Supp"}, 0.03),
227  subconfig.take({"Sigma_Perp"}, 0.42),
228  subconfig.take({"Leading_Frag_Mean"}, 1.0),
229  subconfig.take({"Leading_Frag_Width"}, 0.6),
230  subconfig.take({"StringZ_A"}, 0.68), subconfig.take({"StringZ_B"}, 0.3),
231  subconfig.take({"String_Sigma_T"}, 0.5),
232  subconfig.take({"Form_Time_Factor"}, 1.0),
233  subconfig.take({"Use_Yoyo_Model"}, true),
234  subconfig.take({"Prob_proton_to_d_uu"}, 1. / 3.));
235  }
236 }
const int testparticles_
Number of test particles.
const ReactionsBitSet incl_set_
List of included 2<->2 reactions.
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.
const bool strings_with_probability_
Decide whether to implement string fragmentation based on a probability.
const std::vector< bool > & nucleon_has_interacted_
Parameter to record whether the nucleon has experienced a collision or not.
std::unique_ptr< StringProcess > string_process_interface_
Class that deals with strings, interfacing Pythia.
const bool strings_switch_
Switch to turn off string excitation.
const NNbarTreatment nnbar_treatment_
Switch for NNbar reactions.
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 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.
const double elastic_parameter_
Elastic cross section parameter (in mb).

Member Function Documentation

◆ collision_time()

static double smash::ScatterActionsFinder::collision_time ( const ParticleData p1,
const ParticleData p2 
)
inlinestatic

Determine the collision time of the two particles.

Time of the closest approach is taken as collision time.

Parameters
[in]p1First incoming particle
[in]p2Second incoming particle
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 (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 72 of file scatteractionsfinder.h.

73  {
83  const ThreeVector dv_times_e1e2 =
84  p1.momentum().threevec() * p2.momentum().x0() -
85  p2.momentum().threevec() * p1.momentum().x0();
86  const double dv_times_e1e2_sqr = dv_times_e1e2.sqr();
87  if (dv_times_e1e2_sqr < really_small) {
88  return -1.0;
89  }
90  const ThreeVector dr = p1.position().threevec() - p2.position().threevec();
91  return -(dr * dv_times_e1e2) *
92  (p1.momentum().x0() * p2.momentum().x0() / dv_times_e1e2_sqr);
93  }
constexpr double really_small
Numerical error tolerance.
Definition: constants.h:34
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
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/c]
Returns
A list of possible scatter actions

Implements smash::ActionFinderInterface.

Definition at line 316 of file scatteractionsfinder.cc.

317  {
318  std::vector<ActionPtr> actions;
319  for (const ParticleData& p1 : search_list) {
320  for (const ParticleData& p2 : search_list) {
321  if (p1.id() < p2.id()) {
322  // Check if a collision is possible.
323  ActionPtr act = check_collision(p1, p2, dt);
324  if (act) {
325  actions.push_back(std::move(act));
326  }
327  }
328  }
329  }
330  return actions;
331 }
ActionPtr check_collision(const ParticleData &data_a, const ParticleData &data_b, double dt) const
Check for a single pair of particles (id_a, id_b) if a collision will happen in the next timestep and...
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
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]
Returns
A list of possible scatter actions

Implements smash::ActionFinderInterface.

Definition at line 333 of file scatteractionsfinder.cc.

335  {
336  std::vector<ActionPtr> actions;
337  for (const ParticleData& p1 : search_list) {
338  for (const ParticleData& p2 : neighbors_list) {
339  assert(p1.id() != p2.id());
340  // Check if a collision is possible.
341  ActionPtr act = check_collision(p1, p2, dt);
342  if (act) {
343  actions.push_back(std::move(act));
344  }
345  }
346  }
347  return actions;
348 }
ActionPtr check_collision(const ParticleData &data_a, const ParticleData &data_b, double dt) const
Check for a single pair of particles (id_a, id_b) if a collision will happen in the next timestep and...
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
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]
Returns
A list of possible scatter actions

Implements smash::ActionFinderInterface.

Definition at line 350 of file scatteractionsfinder.cc.

352  {
353  std::vector<ActionPtr> actions;
354  for (const ParticleData& p2 : surrounding_list) {
355  /* don't look for collisions if the particle from the surrounding list is
356  * also in the search list */
357  auto result = std::find_if(
358  search_list.begin(), search_list.end(),
359  [&p2](const ParticleData& p) { return p.id() == p2.id(); });
360  if (result != search_list.end()) {
361  continue;
362  }
363  for (const ParticleData& p1 : search_list) {
364  // Check if a collision is possible.
365  ActionPtr act = check_collision(p1, p2, dt);
366  if (act) {
367  actions.push_back(std::move(act));
368  }
369  }
370  }
371  return actions;
372 }
ActionPtr check_collision(const ParticleData &data_a, const ParticleData &data_b, double dt) const
Check for a single pair of particles (id_a, id_b) if a collision will happen in the next timestep and...
constexpr int p
Proton.
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 140 of file scatteractionsfinder.h.

141  {
142  return ActionList();
143  }

◆ 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 155 of file scatteractionsfinder.h.

155  {
156  return ParticleType::list_all().size() == 1 && !two_to_one_ && isotropic_ &&
157  elastic_parameter_ > 0.;
158  }
const bool two_to_one_
Enable 2->1 processes.
static const ParticleTypeList & list_all()
Definition: particletype.cc:55
const bool isotropic_
Do all collisions isotropically.
const double elastic_parameter_
Elastic cross section parameter (in mb).
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 170 of file scatteractionsfinder.h.

170  {
173  testparticles * fm2_mb * M_1_PI;
174  }
constexpr double fm2_mb
mb <-> fm^2 conversion factor.
Definition: constants.h:28
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:108
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 double elastic_parameter_
Elastic cross section parameter (in mb).
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 374 of file scatteractionsfinder.cc.

374  {
375  constexpr double time = 0.0;
376 
377  const size_t N_isotypes = IsoParticleType::list_all().size();
378  const size_t N_pairs = N_isotypes * (N_isotypes - 1) / 2;
379 
380  std::cout << N_isotypes << " iso-particle types." << std::endl;
381  std::cout << "They can make " << N_pairs << " pairs." << std::endl;
382  std::vector<double> momentum_scan_list = {0.1, 0.3, 0.5, 1.0,
383  2.0, 3.0, 5.0, 10.0};
384  for (const IsoParticleType& A_isotype : IsoParticleType::list_all()) {
385  for (const IsoParticleType& B_isotype : IsoParticleType::list_all()) {
386  if (&A_isotype > &B_isotype) {
387  continue;
388  }
389  bool any_nonzero_cs = false;
390  std::vector<std::string> r_list;
391  for (const ParticleTypePtr A_type : A_isotype.get_states()) {
392  for (const ParticleTypePtr B_type : B_isotype.get_states()) {
393  if (A_type > B_type) {
394  continue;
395  }
396  ParticleData A(*A_type), B(*B_type);
397  for (auto mom : momentum_scan_list) {
398  A.set_4momentum(A.pole_mass(), mom, 0.0, 0.0);
399  B.set_4momentum(B.pole_mass(), -mom, 0.0, 0.0);
400  ScatterActionPtr act = make_unique<ScatterAction>(
401  A, B, time, isotropic_, string_formation_time_);
402  if (strings_switch_) {
403  act->set_string_interface(string_process_interface_.get());
404  }
405  act->add_all_scatterings(elastic_parameter_, two_to_one_, incl_set_,
409  const double total_cs = act->cross_section();
410  if (total_cs <= 0.0) {
411  continue;
412  }
413  any_nonzero_cs = true;
414  for (const auto& channel : act->collision_channels()) {
415  const auto type = channel->get_type();
416  std::string r;
417  if (is_string_soft_process(type) ||
418  type == ProcessType::StringHard) {
419  r = A_type->name() + B_type->name() + std::string(" → strings");
420  } else {
421  std::string r_type =
422  (type == ProcessType::Elastic)
423  ? std::string(" (el)")
424  : (channel->get_type() == ProcessType::TwoToTwo)
425  ? std::string(" (inel)")
426  : std::string(" (?)");
427  r = A_type->name() + B_type->name() + std::string(" → ") +
428  channel->particle_types()[0]->name() +
429  channel->particle_types()[1]->name() + r_type;
430  }
431  isoclean(r);
432  r_list.push_back(r);
433  }
434  }
435  }
436  }
437  std::sort(r_list.begin(), r_list.end());
438  r_list.erase(std::unique(r_list.begin(), r_list.end()), r_list.end());
439  if (any_nonzero_cs) {
440  for (auto r : r_list) {
441  std::cout << r;
442  if (r_list.back() != r) {
443  std::cout << ", ";
444  }
445  }
446  std::cout << std::endl;
447  }
448  }
449  }
450 }
const ReactionsBitSet incl_set_
List of included 2<->2 reactions.
bool is_string_soft_process(ProcessType p)
Check if a given process type is a soft string excitation.
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.
void isoclean(std::string &s)
Remove ⁺, ⁻, ⁰ from string.
const bool strings_with_probability_
Decide whether to implement string fragmentation based on a probability.
2->2 inelastic scattering
std::unique_ptr< StringProcess > string_process_interface_
Class that deals with strings, interfacing Pythia.
const bool strings_switch_
Switch to turn off string excitation.
elastic scattering: particles remain the same, only momenta change
const NNbarTreatment nnbar_treatment_
Switch for NNbar reactions.
hard string process involving 2->2 QCD process by PYTHIA.
const bool use_AQM_
Switch to control whether to use AQM or not.
const bool isotropic_
Do all collisions isotropically.
const double elastic_parameter_
Elastic cross section parameter (in mb).
static const IsoParticleTypeList & list_all()
Returns a list of all IsoParticleTypes.
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 
) 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.

Definition at line 738 of file scatteractionsfinder.cc.

741  {
742  typedef std::vector<std::pair<double, double>> xs_saver;
743  std::map<std::string, xs_saver> xs_dump;
744  std::map<std::string, double> outgoing_total_mass;
745 
746  ParticleData a_data(a), b_data(b);
747  constexpr int n_momentum_points = 200;
748  constexpr double momentum_step = 0.02;
749  for (int i = 1; i < n_momentum_points + 1; i++) {
750  const double momentum = momentum_step * i;
751  a_data.set_4momentum(m_a, momentum, 0.0, 0.0);
752  b_data.set_4momentum(m_b, -momentum, 0.0, 0.0);
753  const double sqrts = (a_data.momentum() + b_data.momentum()).abs();
754  const ParticleList incoming = {a_data, b_data};
755  ScatterActionPtr act = make_unique<ScatterAction>(
756  a_data, b_data, 0., isotropic_, string_formation_time_);
757  if (strings_switch_) {
758  act->set_string_interface(string_process_interface_.get());
759  }
760  act->add_all_scatterings(elastic_parameter_, two_to_one_, incl_set_,
763  decaytree::Node tree(a.name() + b.name(), act->cross_section(), {&a, &b},
764  {&a, &b}, {&a, &b}, {});
765  const CollisionBranchList& processes = act->collision_channels();
766  for (const auto& process : processes) {
767  const double xs = process->weight();
768  if (xs <= 0.0) {
769  continue;
770  }
771  if (!final_state) {
772  std::stringstream process_description_stream;
773  process_description_stream << *process;
774  const std::string& description = process_description_stream.str();
775  double m_tot = 0.0;
776  for (const auto& ptype : process->particle_types()) {
777  m_tot += ptype->mass();
778  }
779  outgoing_total_mass[description] = m_tot;
780  if (!xs_dump[description].empty() &&
781  std::abs(xs_dump[description].back().first - sqrts) <
782  really_small) {
783  xs_dump[description].back().second += xs;
784  } else {
785  xs_dump[description].push_back(std::make_pair(sqrts, xs));
786  }
787  } else {
788  std::stringstream process_description_stream;
789  process_description_stream << *process;
790  const std::string& description = process_description_stream.str();
791  ParticleTypePtrList initial_particles = {&a, &b};
792  ParticleTypePtrList final_particles = process->particle_types();
793  auto& process_node =
794  tree.add_action(description, xs, std::move(initial_particles),
795  std::move(final_particles));
796  decaytree::add_decays(process_node);
797  }
798  }
799  xs_dump["total"].push_back(std::make_pair(sqrts, act->cross_section()));
800  // Total cross-section should be the first in the list -> negative mass
801  outgoing_total_mass["total"] = -1.0;
802  if (final_state) {
803  // tree.print();
804  auto final_state_xs = tree.final_state_cross_sections();
805  deduplicate(final_state_xs);
806  for (const auto& p : final_state_xs) {
807  outgoing_total_mass[p.name_] = p.mass_;
808  xs_dump[p.name_].push_back(std::make_pair(sqrts, p.cross_section_));
809  }
810  }
811  }
812 
813  // Nice ordering of channels by summed pole mass of products
814  std::vector<std::string> all_channels;
815  for (const auto channel : xs_dump) {
816  all_channels.push_back(channel.first);
817  }
818  std::sort(all_channels.begin(), all_channels.end(),
819  [&](const std::string& str_a, const std::string& str_b) {
820  return outgoing_total_mass[str_a] < outgoing_total_mass[str_b];
821  });
822 
823  // Print header
824  std::cout << "# Dumping partial " << a.name() << b.name()
825  << " cross-sections in mb, energies in GeV" << std::endl;
826  std::cout << " sqrt_s";
827  // Align everything to 16 unicode characters.
828  // This should be enough for the longest channel name (7 final-state
829  // particles).
830  for (const auto channel : all_channels) {
831  std::cout << utf8::fill_left(channel, 16, ' ');
832  }
833  std::cout << std::endl;
834 
835  // Print out all partial cross-sections in mb
836  for (int i = 1; i < n_momentum_points; i++) {
837  const double momentum = momentum_step * i;
838  a_data.set_4momentum(m_a, momentum, 0.0, 0.0);
839  b_data.set_4momentum(m_b, -momentum, 0.0, 0.0);
840  const double sqrts = (a_data.momentum() + b_data.momentum()).abs();
841  printf("%9.5f", sqrts);
842  for (const auto channel : all_channels) {
843  const xs_saver energy_and_xs = xs_dump[channel];
844  size_t j = 0;
845  for (; j < energy_and_xs.size() && energy_and_xs[j].first < sqrts; j++) {
846  }
847  double xs = 0.0;
848  if (j < energy_and_xs.size() &&
849  std::abs(energy_and_xs[j].first - sqrts) < really_small) {
850  xs = energy_and_xs[j].second;
851  }
852  printf("%16.6f", xs); // Same alignment as in the header.
853  }
854  printf("\n");
855  }
856 }
static void deduplicate(std::vector< FinalStateCrossSection > &final_state_xs)
Deduplicate the final-state cross sections by summing.
constexpr double really_small
Numerical error tolerance.
Definition: constants.h:34
const ReactionsBitSet incl_set_
List of included 2<->2 reactions.
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.
const bool strings_with_probability_
Decide whether to implement string fragmentation based on a probability.
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.
std::unique_ptr< StringProcess > string_process_interface_
Class that deals with strings, interfacing Pythia.
const bool strings_switch_
Switch to turn off string excitation.
const NNbarTreatment nnbar_treatment_
Switch for NNbar reactions.
constexpr int p
Proton.
const bool use_AQM_
Switch to control whether to use AQM or not.
const bool isotropic_
Do all collisions isotropically.
static void add_decays(Node &node)
Add nodes for all decays possible from the given node and all of its children.
const double elastic_parameter_
Elastic cross section parameter (in mb).
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 200 of file scatteractionsfinder.h.

200  {
201  if (strings_switch_) {
202  return string_process_interface_.get();
203  } else {
204  return NULL;
205  }
206  }
std::unique_ptr< StringProcess > string_process_interface_
Class that deals with strings, interfacing Pythia.
const bool strings_switch_
Switch to turn off string excitation.

◆ check_collision()

ActionPtr smash::ScatterActionsFinder::check_collision ( const ParticleData data_a,
const ParticleData data_b,
double  dt 
) 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.

Parameters
[in]data_aFirst incoming particle
[in]data_bSecond incoming particle
[in]dtMaximum time interval within which a collision can happen
Returns
A null pointer if no collision happens or an action which contains the information of the outgoing particles.

Definition at line 238 of file scatteractionsfinder.cc.

240  {
241 #ifndef NDEBUG
242  const auto& log = logger<LogArea::FindScatter>();
243 #endif
244 
245  // just collided with this particle
246  if (data_a.id_process() > 0 && data_a.id_process() == data_b.id_process()) {
247 #ifndef NDEBUG
248  log.debug("Skipping collided particles at time ", data_a.position().x0(),
249  " due to process ", data_a.id_process(), "\n ", data_a,
250  "\n<-> ", data_b);
251 #endif
252  return nullptr;
253  }
254  /* If the two particles
255  * 1) belong to the two colliding nuclei
256  * 2) are within the same nucleus
257  * 3) both of them have never experienced any collisons,
258  * then the collision between them are banned. */
259  assert(data_a.id() >= 0);
260  assert(data_b.id() >= 0);
261  if (data_a.id() < N_tot_ && data_b.id() < N_tot_ &&
262  ((data_a.id() < N_proj_ && data_b.id() < N_proj_) ||
263  (data_a.id() >= N_proj_ && data_b.id() >= N_proj_)) &&
264  !(nucleon_has_interacted_[data_a.id()] ||
265  nucleon_has_interacted_[data_b.id()])) {
266  return nullptr;
267  }
268 
269  // Determine time of collision.
270  const double time_until_collision = collision_time(data_a, data_b);
271 
272  // Check that collision happens in this timestep.
273  if (time_until_collision < 0. || time_until_collision >= dt) {
274  return nullptr;
275  }
276 
277  // Create ScatterAction object.
278  ScatterActionPtr act = make_unique<ScatterAction>(
279  data_a, data_b, time_until_collision, isotropic_, string_formation_time_);
280  if (strings_switch_) {
281  act->set_string_interface(string_process_interface_.get());
282  }
283 
284  const double distance_squared = act->transverse_distance_sqr();
285 
286  // Don't calculate cross section if the particles are very far apart.
287  if (distance_squared >= max_transverse_distance_sqr(testparticles_)) {
288  return nullptr;
289  }
290 
291  // Add various subprocesses.
292  act->add_all_scatterings(elastic_parameter_, two_to_one_, incl_set_,
295 
296  // Cross section for collision criterion
297  double cross_section_criterion = act->cross_section() * fm2_mb * M_1_PI /
298  static_cast<double>(testparticles_);
299  // Take cross section scaling factors into account
300  cross_section_criterion *= data_a.xsec_scaling_factor(time_until_collision);
301  cross_section_criterion *= data_b.xsec_scaling_factor(time_until_collision);
302 
303  // distance criterion according to cross_section
304  if (distance_squared >= cross_section_criterion) {
305  return nullptr;
306  }
307 
308 #ifndef NDEBUG
309  log.debug("particle distance squared: ", distance_squared, "\n ", data_a,
310  "\n<-> ", data_b);
311 #endif
312 
313  return std::move(act);
314 }
static double collision_time(const ParticleData &p1, const ParticleData &p2)
Determine the collision time of the two particles.
const int testparticles_
Number of test particles.
const ReactionsBitSet incl_set_
List of included 2<->2 reactions.
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.
const bool strings_with_probability_
Decide whether to implement string fragmentation based on a probability.
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...
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.
std::unique_ptr< StringProcess > string_process_interface_
Class that deals with strings, interfacing Pythia.
const bool strings_switch_
Switch to turn off string excitation.
const NNbarTreatment nnbar_treatment_
Switch for NNbar reactions.
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.
const double elastic_parameter_
Elastic cross section parameter (in mb).
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 223 of file scatteractionsfinder.h.

◆ elastic_parameter_

const double smash::ScatterActionsFinder::elastic_parameter_
private

Elastic cross section parameter (in mb).

Definition at line 225 of file scatteractionsfinder.h.

◆ testparticles_

const int smash::ScatterActionsFinder::testparticles_
private

Number of test particles.

Definition at line 227 of file scatteractionsfinder.h.

◆ isotropic_

const bool smash::ScatterActionsFinder::isotropic_
private

Do all collisions isotropically.

Definition at line 229 of file scatteractionsfinder.h.

◆ two_to_one_

const bool smash::ScatterActionsFinder::two_to_one_
private

Enable 2->1 processes.

Definition at line 231 of file scatteractionsfinder.h.

◆ incl_set_

const ReactionsBitSet smash::ScatterActionsFinder::incl_set_
private

List of included 2<->2 reactions.

Definition at line 233 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 238 of file scatteractionsfinder.h.

◆ strings_switch_

const bool smash::ScatterActionsFinder::strings_switch_
private

Switch to turn off string excitation.

Definition at line 240 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 242 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 244 of file scatteractionsfinder.h.

◆ nnbar_treatment_

const NNbarTreatment smash::ScatterActionsFinder::nnbar_treatment_
private

Switch for NNbar reactions.

Definition at line 246 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 251 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 253 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 255 of file scatteractionsfinder.h.

◆ string_formation_time_

const double smash::ScatterActionsFinder::string_formation_time_
private

Parameter for formation time.

Definition at line 257 of file scatteractionsfinder.h.


The documentation for this class was generated from the following files: