Version: SMASH-2.0
smash::ColliderModus Class Reference

#include <collidermodus.h>

ColliderModus: Provides a modus for colliding nuclei.

To use this modus, choose

General:
Modus: Collider

in the configuration file.

Options for ColliderModus go in the "Modi"→"Collider" section of the configuration.

The following configuration options are understood: Collider

Definition at line 43 of file collidermodus.h.

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

Classes

struct  ColliderEmpty
 

Public Member Functions

 ColliderModus (Configuration modus_config, const ExperimentParameters &parameters)
 Constructor. More...
 
std::string custom_file_path (const std::string &file_directory, const std::string &file_name)
 Creates full path string consisting of file_directory and file_name Needed to initialize a customnucleus. More...
 
double initial_conditions (Particles *particles, const ExperimentParameters &parameters)
 Generates initial state of the particles in the system. More...
 
int total_N_number () const
 
int proj_N_number () const
 
double nuclei_passing_time () const
 Time until nuclei have passed through each other. More...
 
double velocity_projectile () const
 
double velocity_target () const
 
bool cll_in_nucleus ()
 
FermiMotion fermi_motion ()
 
bool is_collider () const
 
double sqrt_s_NN () const
 
double impact_parameter () const
 
- Public Member Functions inherited from smash::ModusDefault
int impose_boundary_conditions (Particles *, const OutputsList &={})
 Enforces sensible positions for the particles. More...
 
int total_N_number () const
 
int proj_N_number () const
 
bool cll_in_nucleus () const
 
bool is_collider () const
 
bool is_box () const
 
bool is_list () const
 
double sqrt_s_NN () const
 
double impact_parameter () const
 
double velocity_projectile () const
 
double velocity_target () const
 
FermiMotion fermi_motion () const
 
double max_timestep (double) const
 
double equilibration_time () const
 
double nuclei_passing_time () const
 Get the passing time of the two nuclei in a collision. More...
 
Grid< GridOptions::Normalcreate_grid (const Particles &particles, double min_cell_length, double timestep_duration, CellSizeStrategy strategy=CellSizeStrategy::Optimal) const
 Creates the Grid with normal boundary conditions. More...
 

Private Member Functions

bool same_inputfile (Configuration &proj_config, Configuration &targ_config)
 Checks if target and projectile are read from the same external file if they are both initialized as a customnucleus. More...
 
void rotate_reaction_plane (double phi, Particles *particles)
 Rotate the reaction plane about the angle phi. More...
 
void sample_impact ()
 Sample impact parameter. More...
 
std::pair< double, double > get_velocities (double mandelstam_s, double m_a, double m_b)
 Get the frame dependent velocity for each nucleus, using the current reference frame. More...
 

Static Private Member Functions

static std::unique_ptr< DeformedNucleuscreate_deformed_nucleus (Configuration &nucleus_cfg, const int ntest, const std::string &nucleus_type)
 Configure Deformed Nucleus. More...
 

Private Attributes

std::unique_ptr< Nucleusprojectile_
 Projectile. More...
 
std::unique_ptr< Nucleustarget_
 Target. More...
 
double total_s_
 Center-of-mass energy squared of the nucleus-nucleus collision. More...
 
double sqrt_s_NN_
 Center-of-mass energy of a nucleon-nucleon collision. More...
 
double impact_ = 0.
 Impact parameter. More...
 
bool random_reaction_plane_
 Whether the reaction plane should be randomized. More...
 
Sampling sampling_ = Sampling::Quadratic
 Method used for sampling of impact parameter. More...
 
double imp_min_ = 0.0
 Minimum value of impact parameter. More...
 
double imp_max_ = 0.0
 Maximum value of impact parameter. More...
 
double yield_max_ = 0.0
 Maximum value of yield. Needed for custom impact parameter sampling. More...
 
std::unique_ptr< InterpolateDataLinear< double > > impact_interpolation_
 Pointer to the impact parameter interpolation. More...
 
double initial_z_displacement_ = 2.0
 Initial z-displacement of nuclei. More...
 
CalculationFrame frame_ = CalculationFrame::CenterOfVelocity
 Reference frame for the system, as specified from config. More...
 
FermiMotion fermi_motion_ = FermiMotion::Off
 An option to include Fermi motion ("off", "on", "frozen") More...
 
bool cll_in_nucleus_ = false
 An option to accept first collisions within the same nucleus. More...
 
double velocity_projectile_ = 0.0
 Beam velocity of the projectile. More...
 
double velocity_target_ = 0.0
 Beam velocity of the target. More...
 

Friends

std::ostream & operator<< (std::ostream &, const ColliderModus &)
 

Constructor & Destructor Documentation

◆ ColliderModus()

smash::ColliderModus::ColliderModus ( Configuration  modus_config,
const ExperimentParameters parameters 
)
explicit

Constructor.

Takes all there is to take from the (truncated!) configuration object (only contains configuration for this modus).

Parameters
[in]modus_configThe configuration object that sets all initial conditions of the experiment.
[in]parametersUnused, but necessary because of templated initialization
Exceptions
ColliderEmptyif projectile or nucleus are empty (i.e. do not contain particles)
InvalidEnergyif sqrts from config is not large enough to support the colliding masses of the nuclei, or if E_kin or P_lab are negative
domain_errorif more or less than exactly one of the input energy options is specified, or if custom impact parameter Values and Yields are improperly supplied
Todo:
include a check that only one method of specifying impact is used

Definition at line 266 of file collidermodus.cc.

267  {
268  Configuration modus_cfg = modus_config["Collider"];
269  // Get the reference frame for the collision calculation.
270  if (modus_cfg.has_value({"Calculation_Frame"})) {
271  frame_ = modus_cfg.take({"Calculation_Frame"});
272  }
273 
274  // Determine whether to allow the first collisions within the same nucleus
275  if (modus_cfg.has_value({"Collisions_Within_Nucleus"})) {
276  cll_in_nucleus_ = modus_cfg.take({"Collisions_Within_Nucleus"});
277  }
278  Configuration proj_cfg = modus_cfg["Projectile"];
279  Configuration targ_cfg = modus_cfg["Target"];
280  /* Needed to check if projectile and target in customnucleus are read from
281  * the same input file.*/
282  bool same_file = false;
283  // Set up the projectile nucleus
284  if (proj_cfg.has_value({"Deformed"})) {
285  projectile_ =
286  create_deformed_nucleus(proj_cfg, params.testparticles, "projectile");
287  } else if (proj_cfg.has_value({"Custom"})) {
288  same_file = same_inputfile(proj_cfg, targ_cfg);
289  projectile_ =
290  make_unique<CustomNucleus>(proj_cfg, params.testparticles, same_file);
291  } else {
292  projectile_ = make_unique<Nucleus>(proj_cfg, params.testparticles);
293  }
294  if (projectile_->size() < 1) {
295  throw ColliderEmpty("Input Error: Projectile nucleus is empty.");
296  }
297 
298  // Set up the target nucleus
299  if (targ_cfg.has_value({"Deformed"})) {
300  target_ = create_deformed_nucleus(targ_cfg, params.testparticles, "target");
301  } else if (targ_cfg.has_value({"Custom"})) {
302  target_ =
303  make_unique<CustomNucleus>(targ_cfg, params.testparticles, same_file);
304  } else {
305  target_ = make_unique<Nucleus>(targ_cfg, params.testparticles);
306  }
307  if (target_->size() < 1) {
308  throw ColliderEmpty("Input Error: Target nucleus is empty.");
309  }
310 
311  // Get the Fermi-Motion input (off, on, frozen)
312  if (modus_cfg.has_value({"Fermi_Motion"})) {
313  // We only read the value, because it is still required by the experiment
314  // class to make sure we don't use frozen Fermi momenta with potentials.
315  fermi_motion_ = modus_cfg.read({"Fermi_Motion"});
316  }
317 
318  // Get the total nucleus-nucleus collision energy. Since there is
319  // no meaningful choice for a default energy, we require the user to
320  // give one (and only one) energy input from the available options.
321  int energy_input = 0;
322  const double mass_projec = projectile_->mass();
323  const double mass_target = target_->mass();
324  // average mass of a particle in that nucleus
325  const double mass_a =
326  projectile_->mass() / projectile_->number_of_particles();
327  const double mass_b = target_->mass() / target_->number_of_particles();
328  // Option 1: Center of mass energy.
329  if (modus_cfg.has_value({"Sqrtsnn"})) {
330  sqrt_s_NN_ = modus_cfg.take({"Sqrtsnn"});
331  // Check that input satisfies the lower bound (everything at rest).
332  if (sqrt_s_NN_ <= mass_a + mass_b) {
333  throw ModusDefault::InvalidEnergy(
334  "Input Error: sqrt(s_NN) is not larger than masses:\n" +
335  std::to_string(sqrt_s_NN_) + " GeV <= " + std::to_string(mass_a) +
336  " GeV + " + std::to_string(mass_b) + " GeV.");
337  }
338  // Set the total nucleus-nucleus collision energy.
339  total_s_ = (sqrt_s_NN_ * sqrt_s_NN_ - mass_a * mass_a - mass_b * mass_b) *
340  mass_projec * mass_target / (mass_a * mass_b) +
341  mass_projec * mass_projec + mass_target * mass_target;
342  energy_input++;
343  }
344  /* Option 2: Kinetic energy per nucleon of the projectile nucleus
345  * (target at rest). */
346  if (modus_cfg.has_value({"E_Kin"})) {
347  const double e_kin = modus_cfg.take({"E_Kin"});
348  if (e_kin < 0) {
349  throw ModusDefault::InvalidEnergy(
350  "Input Error: "
351  "E_Kin must be nonnegative.");
352  }
353  // Set the total nucleus-nucleus collision energy.
354  total_s_ = s_from_Ekin(e_kin * projectile_->number_of_particles(),
355  mass_projec, mass_target);
356  sqrt_s_NN_ = std::sqrt(s_from_Ekin(e_kin, mass_a, mass_b));
357  energy_input++;
358  }
359  // Option 3: Momentum of the projectile nucleus (target at rest).
360  if (modus_cfg.has_value({"P_Lab"})) {
361  const double p_lab = modus_cfg.take({"P_Lab"});
362  if (p_lab < 0) {
363  throw ModusDefault::InvalidEnergy(
364  "Input Error: "
365  "P_Lab must be nonnegative.");
366  }
367  // Set the total nucleus-nucleus collision energy.
368  total_s_ = s_from_plab(p_lab * projectile_->number_of_particles(),
369  mass_projec, mass_target);
370  sqrt_s_NN_ = std::sqrt(s_from_plab(p_lab, mass_a, mass_b));
371  energy_input++;
372  }
373  if (energy_input == 0) {
374  throw std::domain_error(
375  "Input Error: Non-existent collision energy. "
376  "Please provide one of Sqrtsnn/E_Kin/P_Lab.");
377  }
378  if (energy_input > 1) {
379  throw std::domain_error(
380  "Input Error: Redundant collision energy. "
381  "Please provide only one of Sqrtsnn/E_Kin/P_Lab.");
382  }
383 
384  /* Impact parameter setting: Either "Value", "Range", "Max" or "Sample".
385  * Unspecified means 0 impact parameter.*/
386  if (modus_cfg.has_value({"Impact", "Value"})) {
387  impact_ = modus_cfg.take({"Impact", "Value"});
388  imp_min_ = impact_;
389  imp_max_ = impact_;
390  } else {
391  // If impact is not supplied by value, inspect sampling parameters:
392  if (modus_cfg.has_value({"Impact", "Sample"})) {
393  sampling_ = modus_cfg.take({"Impact", "Sample"});
394  if (sampling_ == Sampling::Custom) {
395  if (!(modus_cfg.has_value({"Impact", "Values"}) ||
396  modus_cfg.has_value({"Impact", "Yields"}))) {
397  throw std::domain_error(
398  "Input Error: Need impact parameter spectrum for custom "
399  "sampling. "
400  "Please provide Values and Yields.");
401  }
402  const std::vector<double> impacts =
403  modus_cfg.take({"Impact", "Values"});
404  const std::vector<double> yields = modus_cfg.take({"Impact", "Yields"});
405  if (impacts.size() != yields.size()) {
406  throw std::domain_error(
407  "Input Error: Need as many impact parameter values as yields. "
408  "Please make sure that Values and Yields have the same length.");
409  }
410  impact_interpolation_ = make_unique<InterpolateDataLinear<double>>(
411  InterpolateDataLinear<double>(impacts, yields));
412 
413  const auto imp_minmax =
414  std::minmax_element(impacts.begin(), impacts.end());
415  imp_min_ = *imp_minmax.first;
416  imp_max_ = *imp_minmax.second;
417  yield_max_ = *std::max_element(yields.begin(), yields.end());
418  }
419  }
420  if (modus_cfg.has_value({"Impact", "Range"})) {
421  const std::array<double, 2> range = modus_cfg.take({"Impact", "Range"});
422  imp_min_ = range[0];
423  imp_max_ = range[1];
424  }
425  if (modus_cfg.has_value({"Impact", "Max"})) {
426  imp_min_ = 0.0;
427  imp_max_ = modus_cfg.take({"Impact", "Max"});
428  }
429  }
431  // whether the direction of separation should be ramdomly smapled
433  modus_cfg.take({"Impact", "Random_Reaction_Plane"}, false);
434  // Look for user-defined initial separation between nuclei.
435  if (modus_cfg.has_value({"Initial_Distance"})) {
436  initial_z_displacement_ = modus_cfg.take({"Initial_Distance"});
437  // the displacement is half the distance (both nuclei are shifted
438  // initial_z_displacement_ away from origin)
440  }
441 }
Here is the call graph for this function:

Member Function Documentation

◆ custom_file_path()

std::string smash::ColliderModus::custom_file_path ( const std::string &  file_directory,
const std::string &  file_name 
)

Creates full path string consisting of file_directory and file_name Needed to initialize a customnucleus.

Parameters
[in]file_directoryis the path to the external file
[in]file_nameis the name of the external file

Definition at line 622 of file collidermodus.cc.

623  {
624  // make sure that path is correct even if the / at the end is missing
625  if (file_directory.back() == '/') {
626  return file_directory + file_name;
627  } else {
628  return file_directory + '/' + file_name;
629  }
630 }
Here is the caller graph for this function:

◆ initial_conditions()

double smash::ColliderModus::initial_conditions ( Particles particles,
const ExperimentParameters parameters 
)

Generates initial state of the particles in the system.

In particular, it initializes the momenta and positions of nucleons withing the colliding nuclei.

Parameters
[out]particlesAn empty list that gets filled up by this function
[in]parametersThe initialization parameters of the system
Returns
The starting time of the simulation (negative, so that nuclei collide exactly at t=0)
Exceptions
domain_errorif the velocities of each nucleus are >= 1, or if input for Fermi motion is invalid

Definition at line 472 of file collidermodus.cc.

473  {
474  sample_impact();
475 
476  logg[LCollider].info() << "Impact parameter = " << format(impact_, "fm");
477  // Populate the nuclei with appropriately distributed nucleons.
478  // If deformed, this includes rotating the nucleus.
479  projectile_->arrange_nucleons();
480  target_->arrange_nucleons();
481 
482  // Use the total mandelstam variable to get the frame-dependent velocity for
483  // each nucleus. Position a is projectile, position b is target.
484  double v_a, v_b;
485  std::tie(v_a, v_b) =
486  get_velocities(total_s_, projectile_->mass(), target_->mass());
487 
488  // If velocities are larger or equal to 1, throw an exception.
489  if (v_a >= 1.0 || v_b >= 1.0) {
490  throw std::domain_error(
491  "Found velocity equal to or larger than 1 in "
492  "ColliderModus::initial_conditions.\nConsider using "
493  "the center of velocity reference frame.");
494  }
495 
496  // Calculate the beam velocity of the projectile and the target, which will be
497  // used to calculate the beam momenta in experiment.cc
499  velocity_projectile_ = v_a;
500  velocity_target_ = v_b;
501  }
502 
503  // Generate Fermi momenta if necessary
506  // Frozen: Fermi momenta will be ignored during the propagation to
507  // avoid that the nuclei will fly apart.
508  projectile_->generate_fermi_momenta();
509  target_->generate_fermi_momenta();
511  logg[LCollider].info() << "Fermi motion is ON.";
512  } else {
513  logg[LCollider].info() << "FROZEN Fermi motion is on.";
514  }
515  } else if (fermi_motion_ == FermiMotion::Off) {
516  // No Fermi-momenta are generated in this case
517  logg[LCollider].info() << "Fermi motion is OFF.";
518  } else {
519  throw std::domain_error("Invalid Fermi_Motion input.");
520  }
521 
522  // Boost the nuclei to the appropriate velocity.
523  projectile_->boost(v_a);
524  target_->boost(v_b);
525 
526  // Shift the nuclei into starting positions. Contracted spheres with
527  // nuclear radii should touch exactly at t=0. Modus starts at negative
528  // time corresponding to additional initial displacement.
529  const double d_a = std::max(0., projectile_->get_diffusiveness());
530  const double d_b = std::max(0., target_->get_diffusiveness());
531  const double r_a = projectile_->get_nuclear_radius();
532  const double r_b = target_->get_nuclear_radius();
533  const double dz = initial_z_displacement_;
534 
535  const double simulation_time = -dz / std::abs(v_a);
536  const double proj_z = -dz - std::sqrt(1.0 - v_a * v_a) * (r_a + d_a);
537  const double targ_z =
538  +dz * std::abs(v_b / v_a) + std::sqrt(1.0 - v_b * v_b) * (r_b + d_b);
539  // rotation angle in the transverse plane
540  const double phi =
541  random_reaction_plane_ ? random::uniform(0.0, 2.0 * M_PI) : 0.0;
542 
543  projectile_->shift(proj_z, +impact_ / 2.0, simulation_time);
544  target_->shift(targ_z, -impact_ / 2.0, simulation_time);
545 
546  // Put the particles in the nuclei into code particles.
547  projectile_->copy_particles(particles);
548  target_->copy_particles(particles);
549  rotate_reaction_plane(phi, particles);
550  return simulation_time;
551 }
Here is the call graph for this function:

◆ total_N_number()

int smash::ColliderModus::total_N_number ( ) const
inline
Returns
The total number of test particles in the initial nuclei

Definition at line 90 of file collidermodus.h.

90 { return target_->size() + projectile_->size(); }

◆ proj_N_number()

int smash::ColliderModus::proj_N_number ( ) const
inline
Returns
The number of test particles in the projectile nucleus

Definition at line 92 of file collidermodus.h.

92 { return projectile_->size(); }

◆ nuclei_passing_time()

double smash::ColliderModus::nuclei_passing_time ( ) const
inline

Time until nuclei have passed through each other.

Definition at line 95 of file collidermodus.h.

95  {
96  const double passing_distance =
97  projectile_->get_nuclear_radius() + target_->get_nuclear_radius();
98  const double passing_time =
99  passing_distance /
100  std::sqrt(sqrt_s_NN_ * sqrt_s_NN_ /
101  ((2 * nucleon_mass) * (2 * nucleon_mass)) -
102  1);
103  return passing_time;
104  }

◆ velocity_projectile()

double smash::ColliderModus::velocity_projectile ( ) const
inline
Returns
the beam velocity of the projectile, which will be used to calculate the beam momenta in experiment.cc if Fermi motion is frozen.

Definition at line 110 of file collidermodus.h.

110 { return velocity_projectile_; }

◆ velocity_target()

double smash::ColliderModus::velocity_target ( ) const
inline
Returns
the beam velocity of the target, which will be used to calculate the beam momenta in experiment.cc if Fermi motion is frozen.

Definition at line 115 of file collidermodus.h.

115 { return velocity_target_; }

◆ cll_in_nucleus()

bool smash::ColliderModus::cll_in_nucleus ( )
inline
Returns
A flag: whether to allow first collisions within the same nucleus.

Definition at line 119 of file collidermodus.h.

119 { return cll_in_nucleus_; }

◆ fermi_motion()

FermiMotion smash::ColliderModus::fermi_motion ( )
inline
Returns
The Fermi motion type

Definition at line 121 of file collidermodus.h.

121 { return fermi_motion_; }

◆ is_collider()

bool smash::ColliderModus::is_collider ( ) const
inline
Returns
whether the modus is collider (which is, yes, trivially true)

Definition at line 123 of file collidermodus.h.

123 { return true; }

◆ sqrt_s_NN()

double smash::ColliderModus::sqrt_s_NN ( ) const
inline
Returns
center of mass energy per nucleon pair

Definition at line 125 of file collidermodus.h.

125 { return sqrt_s_NN_; }

◆ impact_parameter()

double smash::ColliderModus::impact_parameter ( ) const
inline
Returns
impact parameter of the collision

Definition at line 127 of file collidermodus.h.

127 { return impact_; }

◆ create_deformed_nucleus()

std::unique_ptr< DeformedNucleus > smash::ColliderModus::create_deformed_nucleus ( Configuration nucleus_cfg,
const int  ntest,
const std::string &  nucleus_type 
)
staticprivate

Configure Deformed Nucleus.

Sets up a deformed nucleus object based on the input parameters in the configuration file.

Parameters
[in]nucleus_cfgSubset of configuration, projectile or target section.
[in]ntestNumber of test particles
[in]nucleus_typeString 'projectile' or 'target'. To display an appropriate error message.
Returns
Pointer to the created deformed nucleus object.

Definition at line 453 of file collidermodus.cc.

454  {
455  bool auto_deform = nucleus_cfg.take({"Deformed", "Automatic"});
456  bool is_beta2 = nucleus_cfg.has_value({"Deformed", "Beta_2"}) ? true : false;
457  bool is_beta4 = nucleus_cfg.has_value({"Deformed", "Beta_4"}) ? true : false;
458  std::unique_ptr<DeformedNucleus> nucleus;
459 
460  if ((auto_deform && (!is_beta2 && !is_beta4)) ||
461  (!auto_deform && (is_beta2 && is_beta4))) {
462  nucleus = make_unique<DeformedNucleus>(nucleus_cfg, ntest, auto_deform);
463  return nucleus;
464  } else {
465  throw std::domain_error("Deformation of " + nucleus_type +
466  " nucleus not configured "
467  "properly, please check whether all necessary "
468  "parameters are set.");
469  }
470 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ same_inputfile()

bool smash::ColliderModus::same_inputfile ( Configuration proj_config,
Configuration targ_config 
)
private

Checks if target and projectile are read from the same external file if they are both initialized as a customnucleus.

Function is only called if, projectile is customnucleus. /param[in] proj_config Configuration of projectile nucleus /param[in] targ_config Configuration of target nucleus

Definition at line 632 of file collidermodus.cc.

633  {
634  /* Check if both nuclei are custom
635  * Only check target as function is called after if statement for projectile.
636  */
637  if (!targ_config.has_value({"Custom"})) {
638  return false;
639  }
640  std::string projectile_file_directory =
641  proj_config.read({"Custom", "File_Directory"});
642  std::string target_file_directory =
643  targ_config.read({"Custom", "File_Directory"});
644  std::string projectile_file_name = proj_config.read({"Custom", "File_Name"});
645  std::string target_file_name = targ_config.read({"Custom", "File_Name"});
646  // Check if files are the same for projectile and target
647  std::string proj_path =
648  custom_file_path(projectile_file_directory, projectile_file_name);
649  std::string targ_path =
650  custom_file_path(target_file_directory, target_file_name);
651  if (proj_path == targ_path) {
652  return true;
653  } else {
654  return false;
655  }
656 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rotate_reaction_plane()

void smash::ColliderModus::rotate_reaction_plane ( double  phi,
Particles particles 
)
private

Rotate the reaction plane about the angle phi.

Parameters
[in]phiAngle about which to rotate
[in]particlesParticles, whose position is rotated

Definition at line 553 of file collidermodus.cc.

553  {
554  for (ParticleData &p : *particles) {
555  ThreeVector pos = p.position().threevec();
556  ThreeVector mom = p.momentum().threevec();
557  pos.rotate_around_z(phi);
558  mom.rotate_around_z(phi);
559  p.set_3position(pos);
560  p.set_3momentum(mom);
561  }
562 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sample_impact()

void smash::ColliderModus::sample_impact ( )
private

Sample impact parameter.

Samples the impact parameter from values between imp_min_ and imp_max_, if linear or quadratic sampling is used. By specifying impact parameters and corresponding yields, custom sampling can be used. This depends on the value of sampling_.

Note that imp_max_ less than imp_min_ also works fine.

Definition at line 564 of file collidermodus.cc.

564  {
565  switch (sampling_) {
566  case Sampling::Quadratic: {
567  // quadratic sampling: Note that for bmin > bmax, this still yields
568  // the correct distribution (however canonical() = 0 is then the
569  // upper end, not the lower).
570  impact_ = std::sqrt(imp_min_ * imp_min_ +
573  } break;
574  case Sampling::Custom: {
575  // rejection sampling based on given distribution
576  assert(impact_interpolation_ != nullptr);
577  double probability_random = 1;
578  double probability = 0;
579  double b;
580  while (probability_random > probability) {
582  probability = (*impact_interpolation_)(b) / yield_max_;
583  assert(probability < 1.);
584  probability_random = random::uniform(0., 1.);
585  }
586  impact_ = b;
587  } break;
588  case Sampling::Uniform: {
589  // linear sampling. Still, min > max works fine.
591  }
592  }
593 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_velocities()

std::pair< double, double > smash::ColliderModus::get_velocities ( double  mandelstam_s,
double  m_a,
double  m_b 
)
private

Get the frame dependent velocity for each nucleus, using the current reference frame.

See also
frame_
Parameters
[in]mandelstam_sThe total center-of-mass energy of the system.
[in]m_aThe (positive) mass of the projectile.
[in]m_bThe (positive) mass of the target.
Returns
A pair < v_a, v_b > containing the velocities of the nuclei.
Exceptions
domain_errorif the reference frame is not properly specified

Definition at line 595 of file collidermodus.cc.

596  {
597  double v_a = 0.0;
598  double v_b = 0.0;
599  // Frame dependent calculations of velocities. Assume v_a >= 0, v_b <= 0.
600  switch (frame_) {
602  v_a = center_of_velocity_v(s, m_a, m_b);
603  v_b = -v_a;
604  break;
606  // Compute center of mass momentum.
607  double pCM = pCM_from_s(s, m_a, m_b);
608  v_a = pCM / std::sqrt(m_a * m_a + pCM * pCM);
609  v_b = -pCM / std::sqrt(m_b * m_b + pCM * pCM);
610  } break;
612  v_a = fixed_target_projectile_v(s, m_a, m_b);
613  break;
614  default:
615  throw std::domain_error(
616  "Invalid reference frame in "
617  "ColliderModus::get_velocities.");
618  }
619  return std::make_pair(v_a, v_b);
620 }
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ projectile_

std::unique_ptr<Nucleus> smash::ColliderModus::projectile_
private

Projectile.

The object that goes from negative z-values to positive z-values with positive velocity.

Definition at line 143 of file collidermodus.h.

◆ target_

std::unique_ptr<Nucleus> smash::ColliderModus::target_
private

Target.

The object that goes from positive z-values to negative z-values with negative velocity. In fixed target experiments, the target is at rest.

Definition at line 151 of file collidermodus.h.

◆ total_s_

double smash::ColliderModus::total_s_
private

Center-of-mass energy squared of the nucleus-nucleus collision.

Needs to be double to allow for calculations at LHC energies

Definition at line 157 of file collidermodus.h.

◆ sqrt_s_NN_

double smash::ColliderModus::sqrt_s_NN_
private

Center-of-mass energy of a nucleon-nucleon collision.

Needs to be double to allow for calculations at LHC energies

Definition at line 163 of file collidermodus.h.

◆ impact_

double smash::ColliderModus::impact_ = 0.
private

Impact parameter.

The nuclei projectile_ and target_ will be shifted along the x-axis so that their centers move on antiparallel lines that are this distance apart from each other.

Definition at line 193 of file collidermodus.h.

◆ random_reaction_plane_

bool smash::ColliderModus::random_reaction_plane_
private

Whether the reaction plane should be randomized.

Definition at line 195 of file collidermodus.h.

◆ sampling_

Sampling smash::ColliderModus::sampling_ = Sampling::Quadratic
private

Method used for sampling of impact parameter.

Definition at line 197 of file collidermodus.h.

◆ imp_min_

double smash::ColliderModus::imp_min_ = 0.0
private

Minimum value of impact parameter.

Definition at line 199 of file collidermodus.h.

◆ imp_max_

double smash::ColliderModus::imp_max_ = 0.0
private

Maximum value of impact parameter.

Definition at line 201 of file collidermodus.h.

◆ yield_max_

double smash::ColliderModus::yield_max_ = 0.0
private

Maximum value of yield. Needed for custom impact parameter sampling.

Definition at line 203 of file collidermodus.h.

◆ impact_interpolation_

std::unique_ptr<InterpolateDataLinear<double> > smash::ColliderModus::impact_interpolation_
private
Initial value:
=
nullptr

Pointer to the impact parameter interpolation.

Definition at line 205 of file collidermodus.h.

◆ initial_z_displacement_

double smash::ColliderModus::initial_z_displacement_ = 2.0
private

Initial z-displacement of nuclei.

Projectile is shifted on -(this value) in z-direction and target on +(this value)*v_target/v_projectile. In this way projectile and target touch at t=0 in z=0.

Definition at line 233 of file collidermodus.h.

◆ frame_

CalculationFrame smash::ColliderModus::frame_ = CalculationFrame::CenterOfVelocity
private

Reference frame for the system, as specified from config.

Definition at line 237 of file collidermodus.h.

◆ fermi_motion_

FermiMotion smash::ColliderModus::fermi_motion_ = FermiMotion::Off
private

An option to include Fermi motion ("off", "on", "frozen")

Definition at line 241 of file collidermodus.h.

◆ cll_in_nucleus_

bool smash::ColliderModus::cll_in_nucleus_ = false
private

An option to accept first collisions within the same nucleus.

Definition at line 245 of file collidermodus.h.

◆ velocity_projectile_

double smash::ColliderModus::velocity_projectile_ = 0.0
private

Beam velocity of the projectile.

Definition at line 249 of file collidermodus.h.

◆ velocity_target_

double smash::ColliderModus::velocity_target_ = 0.0
private

Beam velocity of the target.

Definition at line 253 of file collidermodus.h.


The documentation for this class was generated from the following files:
smash::ColliderModus::impact_interpolation_
std::unique_ptr< InterpolateDataLinear< double > > impact_interpolation_
Pointer to the impact parameter interpolation.
Definition: collidermodus.h:205
smash::ColliderModus::initial_z_displacement_
double initial_z_displacement_
Initial z-displacement of nuclei.
Definition: collidermodus.h:233
smash::ColliderModus::imp_min_
double imp_min_
Minimum value of impact parameter.
Definition: collidermodus.h:199
smash::ColliderModus::custom_file_path
std::string custom_file_path(const std::string &file_directory, const std::string &file_name)
Creates full path string consisting of file_directory and file_name Needed to initialize a customnucl...
Definition: collidermodus.cc:622
Sampling::Quadratic
Sample from areal / quadratic distribution.
CalculationFrame::CenterOfVelocity
smash::ColliderModus::cll_in_nucleus_
bool cll_in_nucleus_
An option to accept first collisions within the same nucleus.
Definition: collidermodus.h:245
smash::ColliderModus::fermi_motion_
FermiMotion fermi_motion_
An option to include Fermi motion ("off", "on", "frozen")
Definition: collidermodus.h:241
smash::ColliderModus::random_reaction_plane_
bool random_reaction_plane_
Whether the reaction plane should be randomized.
Definition: collidermodus.h:195
smash::ColliderModus::sampling_
Sampling sampling_
Method used for sampling of impact parameter.
Definition: collidermodus.h:197
smash::ColliderModus::sqrt_s_NN_
double sqrt_s_NN_
Center-of-mass energy of a nucleon-nucleon collision.
Definition: collidermodus.h:163
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::ColliderModus::target_
std::unique_ptr< Nucleus > target_
Target.
Definition: collidermodus.h:151
smash::fixed_target_projectile_v
double fixed_target_projectile_v(double s, double ma, double mb)
Definition: kinematics.h:39
FermiMotion::Off
Don't use fermi motion.
smash::ColliderModus::same_inputfile
bool same_inputfile(Configuration &proj_config, Configuration &targ_config)
Checks if target and projectile are read from the same external file if they are both initialized as ...
Definition: collidermodus.cc:632
smash::ColliderModus::sample_impact
void sample_impact()
Sample impact parameter.
Definition: collidermodus.cc:564
smash::s_from_Ekin
double s_from_Ekin(double e_kin, double m_P, double m_T)
Convert E_kin to Mandelstam-s for a fixed-target setup, with a projectile of mass m_P and a kinetic e...
Definition: kinematics.h:211
smash::nucleon_mass
constexpr double nucleon_mass
Nucleon mass in GeV.
Definition: constants.h:55
FermiMotion::Frozen
Use fermi motion without potentials.
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
Sampling::Custom
Sample from custom, user-defined distribution.
smash::ColliderModus::velocity_projectile_
double velocity_projectile_
Beam velocity of the projectile.
Definition: collidermodus.h:249
smash::pCM
T pCM(const T sqrts, const T mass_a, const T mass_b) noexcept
Definition: kinematics.h:79
smash::center_of_velocity_v
double center_of_velocity_v(double s, double ma, double mb)
Definition: kinematics.h:26
smash::ColliderModus::imp_max_
double imp_max_
Maximum value of impact parameter.
Definition: collidermodus.h:201
smash::format
FormattingHelper< T > format(const T &value, const char *unit, int width=-1, int precision=-1)
Acts as a stream modifier for std::ostream to output an object with an optional suffix string and wit...
Definition: logging.h:307
smash::ColliderModus::total_s_
double total_s_
Center-of-mass energy squared of the nucleus-nucleus collision.
Definition: collidermodus.h:157
smash::ColliderModus::frame_
CalculationFrame frame_
Reference frame for the system, as specified from config.
Definition: collidermodus.h:237
smash::LCollider
static constexpr int LCollider
Definition: collidermodus.cc:30
CalculationFrame::FixedTarget
smash::ColliderModus::yield_max_
double yield_max_
Maximum value of yield. Needed for custom impact parameter sampling.
Definition: collidermodus.h:203
smash::ColliderModus::impact_
double impact_
Impact parameter.
Definition: collidermodus.h:193
Sampling::Uniform
Sample from uniform distribution.
FermiMotion::On
Use fermi motion in combination with potentials.
smash::ColliderModus::projectile_
std::unique_ptr< Nucleus > projectile_
Projectile.
Definition: collidermodus.h:143
smash::ColliderModus::velocity_target_
double velocity_target_
Beam velocity of the target.
Definition: collidermodus.h:253
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
CalculationFrame::CenterOfMass
smash::ColliderModus::create_deformed_nucleus
static std::unique_ptr< DeformedNucleus > create_deformed_nucleus(Configuration &nucleus_cfg, const int ntest, const std::string &nucleus_type)
Configure Deformed Nucleus.
Definition: collidermodus.cc:453
smash::ColliderModus::rotate_reaction_plane
void rotate_reaction_plane(double phi, Particles *particles)
Rotate the reaction plane about the angle phi.
Definition: collidermodus.cc:553
smash::ColliderModus::get_velocities
std::pair< double, double > get_velocities(double mandelstam_s, double m_a, double m_b)
Get the frame dependent velocity for each nucleus, using the current reference frame.
Definition: collidermodus.cc:595
smash::random::canonical
T canonical()
Definition: random.h:113
smash::pCM_from_s
T pCM_from_s(const T s, const T mass_a, const T mass_b) noexcept
Definition: kinematics.h:66