Constructor.
Takes all there is to take from the (truncated!) configuration object (only contains configuration for this modus).
321 Configuration modus_cfg = modus_config[
"Collider"];
323 if (modus_cfg.has_value({
"Calculation_Frame"})) {
324 frame_ = modus_cfg.take({
"Calculation_Frame"});
327 Configuration proj_cfg = modus_cfg[
"Projectile"];
328 Configuration targ_cfg = modus_cfg[
"Target"];
331 bool same_file =
false;
333 if (proj_cfg.has_value({
"Deformed"})) {
336 }
else if (proj_cfg.has_value({
"Custom"})) {
339 make_unique<CustomNucleus>(proj_cfg, params.testparticles, same_file);
341 projectile_ = make_unique<Nucleus>(proj_cfg, params.testparticles);
344 throw ColliderEmpty(
"Input Error: Projectile nucleus is empty.");
349 if (targ_cfg.has_value({
"Deformed"})) {
351 }
else if (targ_cfg.has_value({
"Custom"})) {
353 make_unique<CustomNucleus>(targ_cfg, params.testparticles, same_file);
355 target_ = make_unique<Nucleus>(targ_cfg, params.testparticles);
358 throw ColliderEmpty(
"Input Error: Target nucleus is empty.");
363 if (modus_cfg.has_value({
"Fermi_Motion"})) {
372 int energy_input = 0;
374 const double mass_target =
target_->mass();
376 const double mass_a =
378 const double mass_b =
target_->mass() /
target_->number_of_particles();
380 if (modus_cfg.has_value({
"Sqrtsnn"})) {
384 throw ModusDefault::InvalidEnergy(
385 "Input Error: sqrt(s_NN) is not larger than masses:\n" +
386 std::to_string(
sqrt_s_NN_) +
" GeV <= " + std::to_string(mass_a) +
387 " GeV + " + std::to_string(mass_b) +
" GeV.");
391 mass_projec * mass_target / (mass_a * mass_b) +
392 mass_projec * mass_projec + mass_target * mass_target;
397 if (modus_cfg.has_value({
"E_Tot"})) {
398 const double e_tot = modus_cfg.take({
"E_Tot"});
400 throw ModusDefault::InvalidEnergy(
402 "E_Tot must be nonnegative.");
406 mass_projec, mass_target);
412 if (modus_cfg.has_value({
"E_Kin"})) {
413 const double e_kin = modus_cfg.take({
"E_Kin"});
415 throw ModusDefault::InvalidEnergy(
417 "E_Kin must be nonnegative.");
421 mass_projec, mass_target);
426 if (modus_cfg.has_value({
"P_Lab"})) {
427 const double p_lab = modus_cfg.take({
"P_Lab"});
429 throw ModusDefault::InvalidEnergy(
431 "P_Lab must be nonnegative.");
435 mass_projec, mass_target);
440 if (proj_cfg.has_value({
"E_Tot"}) && targ_cfg.has_value({
"E_Tot"})) {
441 const double e_tot_p = proj_cfg.take({
"E_Tot"});
442 const double e_tot_t = targ_cfg.take({
"E_tot"});
443 if (e_tot_p < 0 || e_tot_t < 0) {
444 throw ModusDefault::InvalidEnergy(
446 "E_Tot must be nonnegative.");
449 e_tot_t *
target_->number_of_particles(),
450 mass_projec, mass_target);
455 if (proj_cfg.has_value({
"E_Kin"}) && targ_cfg.has_value({
"E_Kin"})) {
456 const double e_kin_p = proj_cfg.take({
"E_Kin"});
457 const double e_kin_t = targ_cfg.take({
"E_Kin"});
458 if (e_kin_p < 0 || e_kin_t < 0) {
459 throw ModusDefault::InvalidEnergy(
461 "E_Kin must be nonnegative.");
464 e_kin_t *
target_->number_of_particles(),
465 mass_projec, mass_target);
470 if (proj_cfg.has_value({
"P_Lab"}) && targ_cfg.has_value({
"P_Lab"})) {
471 const double p_lab_p = proj_cfg.take({
"P_Lab"});
472 const double p_lab_t = targ_cfg.take({
"P_Lab"});
473 if (p_lab_p < 0 || p_lab_t < 0) {
474 throw ModusDefault::InvalidEnergy(
476 "P_Lab must be nonnegative.");
479 p_lab_t *
target_->number_of_particles(),
480 mass_projec, mass_target);
484 if (energy_input == 0) {
485 throw std::domain_error(
486 "Input Error: Non-existent collision energy. "
487 "Please provide one of Sqrtsnn/E_Kin/P_Lab.");
489 if (energy_input > 1) {
490 throw std::domain_error(
491 "Input Error: Redundant collision energy. "
492 "Please provide only one of Sqrtsnn/E_Kin/P_Lab.");
497 if (modus_cfg.has_value({
"Impact",
"Value"})) {
498 impact_ = modus_cfg.take({
"Impact",
"Value"});
503 if (modus_cfg.has_value({
"Impact",
"Sample"})) {
504 sampling_ = modus_cfg.take({
"Impact",
"Sample"});
506 if (!(modus_cfg.has_value({
"Impact",
"Values"}) ||
507 modus_cfg.has_value({
"Impact",
"Yields"}))) {
508 throw std::domain_error(
509 "Input Error: Need impact parameter spectrum for custom "
511 "Please provide Values and Yields.");
513 const std::vector<double> impacts =
514 modus_cfg.take({
"Impact",
"Values"});
515 const std::vector<double> yields = modus_cfg.take({
"Impact",
"Yields"});
516 if (impacts.size() != yields.size()) {
517 throw std::domain_error(
518 "Input Error: Need as many impact parameter values as yields. "
519 "Please make sure that Values and Yields have the same length.");
522 InterpolateDataLinear<double>(impacts, yields));
524 const auto imp_minmax =
525 std::minmax_element(impacts.begin(), impacts.end());
528 yield_max_ = *std::max_element(yields.begin(), yields.end());
531 if (modus_cfg.has_value({
"Impact",
"Range"})) {
532 const std::array<double, 2> range = modus_cfg.take({
"Impact",
"Range"});
536 if (modus_cfg.has_value({
"Impact",
"Max"})) {
538 imp_max_ = modus_cfg.take({
"Impact",
"Max"});
544 modus_cfg.take({
"Impact",
"Random_Reaction_Plane"},
false);
546 if (modus_cfg.has_value({
"Initial_Distance"})) {
CalculationFrame frame_
Reference frame for the system, as specified from config.
double imp_min_
Minimum value of impact parameter.
double initial_z_displacement_
Initial z-displacement of nuclei.
double yield_max_
Maximum value of yield. Needed for custom impact parameter sampling.
bool random_reaction_plane_
Whether the reaction plane should be randomized.
std::unique_ptr< Nucleus > projectile_
Projectile.
std::unique_ptr< InterpolateDataLinear< double > > impact_interpolation_
Pointer to the impact parameter interpolation.
FermiMotion fermi_motion_
An option to include Fermi motion ("off", "on", "frozen")
Sampling sampling_
Method used for sampling of impact parameter.
double total_s_
Center-of-mass energy squared of the nucleus-nucleus collision.
std::unique_ptr< Nucleus > target_
Target.
double impact_
Impact parameter.
double sqrt_s_NN_
Center-of-mass energy of a nucleon-nucleon collision.
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 ...
static std::unique_ptr< DeformedNucleus > create_deformed_nucleus(Configuration &nucleus_cfg, const int ntest, const std::string &nucleus_type)
Configure Deformed Nucleus.
double imp_max_
Maximum value of impact parameter.
@ On
Use fermi motion in combination with potentials.
@ Frozen
Use fermi motion without potentials.
@ Off
Don't use fermi motion.
@ Custom
Sample from custom, user-defined distribution.
std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > logg
An array that stores all pre-configured Logger objects.
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...
static constexpr int LCollider
double s_from_Etot(double e_tot, double m_P, double m_T)
Convert E_tot to Mandelstam-s for a fixed-target setup, with a projectile of mass m_P and a total ene...
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...