Constructor.
Takes all there is to take from the (truncated!) configuration object (only contains configuration for this modus).
324 Configuration modus_cfg = modus_config[
"Collider"];
326 if (modus_cfg.has_value({
"Calculation_Frame"})) {
327 frame_ = modus_cfg.take({
"Calculation_Frame"});
330 Configuration proj_cfg = modus_cfg[
"Projectile"];
331 Configuration targ_cfg = modus_cfg[
"Target"];
334 bool same_file =
false;
336 if (proj_cfg.has_value({
"Deformed"})) {
339 }
else if (proj_cfg.has_value({
"Custom"})) {
342 make_unique<CustomNucleus>(proj_cfg, params.testparticles, same_file);
344 projectile_ = make_unique<Nucleus>(proj_cfg, params.testparticles);
347 throw ColliderEmpty(
"Input Error: Projectile nucleus is empty.");
352 if (targ_cfg.has_value({
"Deformed"})) {
354 }
else if (targ_cfg.has_value({
"Custom"})) {
356 make_unique<CustomNucleus>(targ_cfg, params.testparticles, same_file);
358 target_ = make_unique<Nucleus>(targ_cfg, params.testparticles);
361 throw ColliderEmpty(
"Input Error: Target nucleus is empty.");
366 if (modus_cfg.has_value({
"Fermi_Motion"})) {
375 int energy_input = 0;
377 const double mass_target =
target_->mass();
379 const double mass_a =
381 const double mass_b =
target_->mass() /
target_->number_of_particles();
383 if (modus_cfg.has_value({
"Sqrtsnn"})) {
387 throw ModusDefault::InvalidEnergy(
388 "Input Error: sqrt(s_NN) is not larger than masses:\n" +
389 std::to_string(
sqrt_s_NN_) +
" GeV <= " + std::to_string(mass_a) +
390 " GeV + " + std::to_string(mass_b) +
" GeV.");
394 mass_projec * mass_target / (mass_a * mass_b) +
395 mass_projec * mass_projec + mass_target * mass_target;
400 if (modus_cfg.has_value({
"E_Tot"})) {
401 const double e_tot = modus_cfg.take({
"E_Tot"});
403 throw ModusDefault::InvalidEnergy(
405 "E_Tot must be nonnegative.");
409 mass_projec, mass_target);
415 if (modus_cfg.has_value({
"E_Kin"})) {
416 const double e_kin = modus_cfg.take({
"E_Kin"});
418 throw ModusDefault::InvalidEnergy(
420 "E_Kin must be nonnegative.");
424 mass_projec, mass_target);
429 if (modus_cfg.has_value({
"P_Lab"})) {
430 const double p_lab = modus_cfg.take({
"P_Lab"});
432 throw ModusDefault::InvalidEnergy(
434 "P_Lab must be nonnegative.");
438 mass_projec, mass_target);
443 if (proj_cfg.has_value({
"E_Tot"}) && targ_cfg.has_value({
"E_Tot"})) {
444 const double e_tot_p = proj_cfg.take({
"E_Tot"});
445 const double e_tot_t = targ_cfg.take({
"E_tot"});
446 if (e_tot_p < 0 || e_tot_t < 0) {
447 throw ModusDefault::InvalidEnergy(
449 "E_Tot must be nonnegative.");
452 e_tot_t *
target_->number_of_particles(),
453 mass_projec, mass_target);
458 if (proj_cfg.has_value({
"E_Kin"}) && targ_cfg.has_value({
"E_Kin"})) {
459 const double e_kin_p = proj_cfg.take({
"E_Kin"});
460 const double e_kin_t = targ_cfg.take({
"E_Kin"});
461 if (e_kin_p < 0 || e_kin_t < 0) {
462 throw ModusDefault::InvalidEnergy(
464 "E_Kin must be nonnegative.");
467 e_kin_t *
target_->number_of_particles(),
468 mass_projec, mass_target);
473 if (proj_cfg.has_value({
"P_Lab"}) && targ_cfg.has_value({
"P_Lab"})) {
474 const double p_lab_p = proj_cfg.take({
"P_Lab"});
475 const double p_lab_t = targ_cfg.take({
"P_Lab"});
476 if (p_lab_p < 0 || p_lab_t < 0) {
477 throw ModusDefault::InvalidEnergy(
479 "P_Lab must be nonnegative.");
482 p_lab_t *
target_->number_of_particles(),
483 mass_projec, mass_target);
487 if (energy_input == 0) {
488 throw std::domain_error(
489 "Input Error: Non-existent collision energy. "
490 "Please provide one of Sqrtsnn/E_Kin/P_Lab.");
492 if (energy_input > 1) {
493 throw std::domain_error(
494 "Input Error: Redundant collision energy. "
495 "Please provide only one of Sqrtsnn/E_Kin/P_Lab.");
500 if (modus_cfg.has_value({
"Impact",
"Value"})) {
501 impact_ = modus_cfg.take({
"Impact",
"Value"});
506 if (modus_cfg.has_value({
"Impact",
"Sample"})) {
507 sampling_ = modus_cfg.take({
"Impact",
"Sample"});
509 if (!(modus_cfg.has_value({
"Impact",
"Values"}) ||
510 modus_cfg.has_value({
"Impact",
"Yields"}))) {
511 throw std::domain_error(
512 "Input Error: Need impact parameter spectrum for custom "
514 "Please provide Values and Yields.");
516 const std::vector<double> impacts =
517 modus_cfg.take({
"Impact",
"Values"});
518 const std::vector<double> yields = modus_cfg.take({
"Impact",
"Yields"});
519 if (impacts.size() != yields.size()) {
520 throw std::domain_error(
521 "Input Error: Need as many impact parameter values as yields. "
522 "Please make sure that Values and Yields have the same length.");
525 InterpolateDataLinear<double>(impacts, yields));
527 const auto imp_minmax =
528 std::minmax_element(impacts.begin(), impacts.end());
531 yield_max_ = *std::max_element(yields.begin(), yields.end());
534 if (modus_cfg.has_value({
"Impact",
"Range"})) {
535 const std::array<double, 2> range = modus_cfg.take({
"Impact",
"Range"});
539 if (modus_cfg.has_value({
"Impact",
"Max"})) {
541 imp_max_ = modus_cfg.take({
"Impact",
"Max"});
547 modus_cfg.take({
"Impact",
"Random_Reaction_Plane"},
false);
549 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...